There are three categories of elements that can be in an XSLT stylesheet:
- Elements from the XSLT namespace that tell the processor how to transform the source tree into the result tree.
- Literal result elements of any namespace you like that get added to the result tree just as they are shown in the stylesheet.
- Extension elements: customized instruction elements that can be used along with the instructions from the XSLT namespace.
Elements from the XSLT namespace fall into two categories:
- top-level elements, which are children of the xsl:stylesheet element with general instructions about handling the source document,
- and the children of the xsl:template elements known as instructions, which give specific instructions about nodes to add to the result tree.
Extension elements cannot be top-level elements; they are always new instructions.
It's an important part of an XSLT processor's job to recognize all the elements in a stylesheet from the XSLT namespace and to carry out their instructions. If literal result elements can be from any namespace, letting you add elements from the HTML, XLink, or any other namespace to the result tree, how does a processor know which elements are extension elements? Because the stylesheet must explicitly list which namespaces are to be treated as extension element namespaces in the extension-element-prefixes attribute.
For example, In the following stylesheet, the http://icl.com/saxon namespace is declared as a namespace with a prefix of "saxon", and this "saxon" namespace prefix is included in the value of the xsl:stylesheet element's extension-element-prefixes attribute, wich means all the elements in the http://icl.com/saxon namespace are to be treated as extension elements.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon"
extension-element-prefixes="saxon"
version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes"/>
....
</xsl:stylesheet>