Next / Previous / Contents / TCC Help System / NM Tech homepage

14. Extension elements

You may need functions that are not part of standard XSLT. A number of organizations have defined so-called extension elements that provide these additional functions.

To use an extension, you must add two attributes to the <xslt:stylesheet> element of your stylesheet:

  1. Declare a namespace for the extension elements by adding an attribute of the form xmlns:n="u", where n is the namespace you are declaring, and u is the URI of the extension element's definition.

  2. Tell XSLT to process this namespace, instead of writing it to the output, by using an attribute of the form extension-element-prefixes="n", where n is the same namespace name used in the previous step.

We'll just give one example; more extensions will arise as XSLT evolves.

14.1. The exsl:document extension

With stock XSLT, all output goes to one place: the output document. However, an organization called EXSLT has published an extension element that allows you to sent output to other files. See the EXSLT homepage for more information.

Here is an example of an <xsl:stylesheet> element that includes the attributes necessary to use the exsl:document extension:

    <xsl:stylesheet version="1.0"

Once you have done this, in order to write some content to a file named F, embed that content in an element that looks like this:

    <exsl:document href="F">