XML technologies / XSLT / XSLT Kochbuch / Extending and embedding XSLT / Saxon extension elements

(Excerpt from "XSLT Kochbuch" by Sal Mangano)

XSLT 1.0 (Saxon version 6.5.4)

Extension elements in Saxon can only be implemented in Java. To do this, you must define a namespace that binds the extension to its implementation. The rules are somewhat more precise here than for extension functions. The namespace URI must end with a /, and part of it is the fully qualified class name of a Java class implementing 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 attribute extension-element-prefixes.

Details of ExtensionElementFactory are covered in the recipe Adding extension elements with Java.

XSLT 2.0 (Saxon version 8.x)

The mechanism is essentially the same, but the fully qualified class names in the Saxon library have changed (e.g. net.sf.saxon.style.ExtensionElementFactory).

  

 

 

 

back to top