{ Frameless }


The script element can also be used for executing XSLT instead of JavaScript -- that's what the type attribute is for:

<script src="xslt2.js" defer></script>
<script src="docbook.xsl" type="text/xsl" data-source="article.xml"></script>

For this to work you need to include xslt2.js once too. It is considered a best practice to include that <script> element for xslt2.js as on of the last elements in your HTML page.

You can also specify what mode to use for the initial template:

<script src="docbook.xsl" type="text/xsl" data-source="article.xml" data-mode="svg-clock">

Or your template doens't require any particular input, just call a named template:

<script src="article.xsl" type="text/xsl" data-template="svg-clock"></script>

The above example is essentially an <xsl:call-template name="svg-clock"/> for use in HTML.

Note: for compatibility with Saxon-CE you can also use data-source instead of data-input, data-initial-template instead of data-template and data-initial-mode instead of data-mode.


src="…"Where your stylesheet.xsl file is.
type="…"Must be either application/xslt+xml (the official media type for XSLT stylesheets) or text/xsl which is shorter to type.
language="…"Don't use the language attribute. Ever!