Embedded Stylesheets

The XSLT recommendation also supports embedded stylesheets (following the use of embedded stylesheets and style elements in HTML), but like simplified stylesheets, they’re not in widespread use.

Not all XSLT processors can handle embedded stylesheets, but some, such as Saxon, do. Here’s an example. In this case, I’ll include the entire stylesheet element from planets.xsl in planets.xml to create a new document, embedded.xml. This new document will have all the data and the entire stylesheet in it. Note that to be well-formed XML, embedded.xml must have only one root element, so I’ll make the stylesheet (that is, the <xsl:stylesheet> element) a child element of the <PLANETS> root element.

To indicate which element is to be ...

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.