Previous Page Next Page

Recipe 14.2. Saxon Extension Elements

XSLT 1.0 (Saxon Version 6.5.4)

Extension elements in Saxon can be implemented only in Java. You must define a namespace that binds the extension to its implementation. However, the rules are more explicit here than with extension functions. The namespace URI must end with a /, part of which is the fully qualified class name of a Java class that implements the interface com.icl.saxon.ExtensionElementFactory:

<xsl:stylesheet 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:acmeX="http://www.acmeX.com/com.acemX.SuperExtensionFactory"
extension-element-prefixes="acmeX">
   
<!-- ... -->

</xsl:stylesheet>

The prefix must also be listed in the stylesheet's extension-element-prefixes attribute.

Details of the ExtensionElementFactory are covered in Recipe 14.15.

XSLT 2.0 (Saxon Version 8.x)

The mechanism is basically the same but the fully qualified class names of the Saxon library have changed (for example, net.sf.saxon.style.ExtensionElementFactory).


Previous Page Next Page