jd.xslt - Extensions

This page describes the non-standard extensions of jd.xslt:

Output Methods

Beyond the standard output methods xml, html and text jd.xslt recognizes two additional output methods.
These methods have to be specified as a qname with a non-null namespace URI. The value of the URI is not significant:

The output method canonical-xml produces a XML document in canonical form.

    <xsl:output method="jd:canonical-xml" xmlns:jd="http://www.aztecrider.com/xslt"/>
The output method empty does not produce any output. It can be used with the command-line option -verbose to measure the transformation time without the output time:
    <xsl:output method="jd:empty" xmlns:jd="http://www.aztecrider.com/xslt"/>

EXSLT Implementation

EXSLT is an open community initiative to standardize and document extensions to XSLT.
jd.xslt implements the following EXSLT modules:

Extension Functions

If a function name in a XPath-Function call expression is not an NCName (i.e. if it contains a colon), then it is treated as a call to an extension function.
In case of an unknown uri (i.e. not equal to any uri defined by jd.xslt or EXSLT) jd.xslt tries to derive a Java class from the uri and map the function name to a method of this class:
  1. If the uri contains a '/' then all character upto the last '/' are removed
  2. If the uri contains a ':' then all characters upto the last ':' are removed
  3. The remaining string is interpreted as the qualified name of a Java class.
Therefore the following examples will all define a Java extension function which is mapped to java.lang.Math#sin:
<xsl:value-of select="math1:sin(3.14)" xmlns:math1="java.lang.Math">
<xsl:value-of select="math2:sin(3.14)" xmlns:math2="java:java.lang.Math">
<xsl:value-of select="math3:sin(3.14)" xmlns:math3="http://mysite.com/xslt/java.lang.Math">
<xsl:value-of select="math4:sin(3.14)" xmlns:math4="urn:java:java.lang.Math">


main page