The <xsl:stylesheet> Element

XSL stylesheets begin with the XML declaration because they are well-formed XML documents, so planets.xsl starts with this same declaration:

<?xml version="1.0"?> 
    . 
    . 
    . 

The XML declaration is stripped off by the XSLT processor immediately, however, and won’t figure in our XSLT discussion. The first element of an XSL stylesheet that is pure XSL is the <xsl:stylesheet> element (not to be confused with the <?xml-stylesheet?> processing instruction, which goes in the XML document). Some people have objected to the name of this element, because it’s usually used in XSLT transformations, so W3C also allows you to refer to this element as <xsl:transform>.

Here’s how you use this element:

 <?xml version="1.0"?> <xsl:stylesheet ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.