XSLT Susanne Sherba October 12, 2000
Overview What is XSLT?What is XSLT? Related RecommendationsRelated Recommendations XSLT ElementsXSLT Elements Associating Stylesheets with DocumentsAssociating Stylesheets with Documents Additional InformationAdditional Information
What is XSLT? A language for transforming XML documents into other XML documentsA language for transforming XML documents into other XML documents Designed for use both as part of XSL and independently of XSLDesigned for use both as part of XSL and independently of XSL Not intended as a completely general- purpose XML transformation language.Not intended as a completely general- purpose XML transformation language. [W3C XSLT Recommendation]
XSLT Process
XSLT Status W3C Recommendation - November 16, 1999W3C Recommendation - November 16, 1999 Version 1.0Version 1.0
Related Recommendations XPathXPath XSLXSL XML Stylesheet RecommendationXML Stylesheet Recommendation
XSLT Stylesheet Element allowed as synonym
XSLT Template Element
Applying Templates
Root Items Item: <?xml-stylesheet href="style1.xsl” type="text/xsl"?> Porsche 1 Ferrari 2 Example 1
Root Items Item: <?xml-stylesheet href="style2.xsl” type="text/xsl"?> Porsche 1 Ferrari 2 Example 2
Repetition Do something here...
Root Items Item: <xsl:value-of select="productName"/> <?xml-stylesheet href="style3.xsl” type="text/xsl"?> Porsche 1 Ferrari 2 Example 3
Conditional Processing <if test = “position()=last()”> Do something …
Conditional Processing Do something for last element Do something for first element Do something for other elements
Creating the result tree
XSL output: Root Items Item: Porsche Item: Ferrari Set the background to red <xsl:attribute name="bgcolor"> red Root... Example 4
Numbering
Combining Stylesheets
Some Other Elements
Associating Stylesheets with Documents W3C Stylesheets Recommendation Version 1.0 In the xml document:
Additional Information XSLT Recommendation Version Recommendation Version XSLT.com XSLT Reference - Output/index.htmlXSLT Reference - Output/index.html Output/index.html Output/index.html