XML
Transformation
- An XML transformation language is a programming language designed specially to transform an input XML document into an out put XML document.
Cases of XML Transformation
There
are two cases of transformation
- XML to XML: The output document is an XML document
- XML to XML transformation outputs an XML document, XML to XML transformation chains form XML pipelines
- XML to Data: the output document is a byte stream
- The XML to Data transformation contains some important cases. The most notable one is XML to HTML, as an HTML document
XML Transformation Languages
- XSLT is the best known XML transformation language
- The XSLT 1.0 W3C recommendation was published in 1999 together with xpathl.0, and it has been widely implemented since then
- XSLT 2.0 has become a new W3C recommendation since January 2007
- XProc is an XML Pipeline language. The XProc 1.0 is the W3C Recommendation published in May 2010
- XML document transform Is a Microsoft standard for performing simple transforms on XML documents
Example
Now,
let's actually use an XSLT stylesheet to transform XML data into XML data.
Example 1:XML Document(listl.xml)
<?xml
version="1.0" ?>
<?xml-stylesheet
type="text/xsl" href="list2
<SalesReport>
<Header>
<InputDate>2010/08/08</InputDate>
<PropertyName>ABC
Services Co., Ltd..</PropertyName>
<SalesPerson>Ramana</SalesPerson>
</Header>
<Body>
<Results>
<ProductName>XML
Database</ProductName>
<UnitPrice
Units="US$">1250</UnitPrice>
<Volume>1</Volume>
</Results>
<Results>
<ProductName>XML
Editor</ProductName>
<UnitPrice
Units="US$">25</UnitPrice>
<volume>10</Volume>
</Results>
</Body>
</SalesReport>