XSLT changes

See also XPath 3.0 changes.

XSLT 2.0 implementation

The call system-property('xsl:vendor') now returns the string "Saxonica". Previously it returned a more complex string that also identified the product version; this information should now be obtained using the XSLT 2.0 system properties such as system-property('xsl:product-version'). Information on the values returned for each system property is at XSLT 2.0 Conformance.

The handling of type errors in an <xsl:if>, or an <xsl:choose> with no <xsl:otherwise> branch, has been made less draconian. If the construct appears in a context where it is not allowed to return an empty sequence, the type error is no longer reported statically, but is only reported if the implicit else/otherwise branch is actually taken at run-time. The immediate motivation for this change is that it enables stylesheets generated using Altova's products to be executed; it also appears to be a more reasonable interpretation of the intent of the specification.

Command line

The implementation of the -TP option on the command line, which produces a timing profile, has been rewritten. Rather than producing a trace file containing all the events with timings, which could become very voluminous, it now aggregates the timing data in memory, and outputs the results directly in HTML rather than requiring a separate post-processing step.

On the net.sf.saxon.Transform command line, there is a new option -threads:N controlling how many threads are to be used. This only has effect when the -s option specifies a directory. It does not cause individual transformations to be multi-threaded, it only causes the transformations of different files to run in parallel with each other.

The new -catalog:filename option requests use of OASIS catalogs for resolving DTD references, external entity references, URIs appearing in xsl:include and xsl:import declarations, and calls to the doc() and document() functions.

In Saxon-EE, Java bytecode is generated automatically unless suppressed using the option --generateByteCode:off

XSLT 3.0 Features

Maps, as defined in the draft XSLT 3.0 specification, are implemented as an extension to XPath 3.0. For details see Maps in XPath 3.0.

The xsl:merge instruction is implemented.

Pattern syntax in the form ~ItemType is supported, for example match="~xs:integer" matches an integer. Predicates are allowed on such patterns, for example ~xs:integer[. gt 0].

Associated with this change, xsl:apply-templates (as well as xsl:next-match and xsl:apply-imports can be used to process any kind of item, not only nodes (for example, atomic values or maps)

Similarly, xsl:for-each-group with the group-starting-with or group-ending-with patterns can now process a sequence of atomic values.

In the xsl:mode declaration, the values supported for the on-no-match attribute have changed, in line with changes in the XSLT 3.0 working draft. The option copy is renamed shallow-copy, stringify is renamed text-only-copy, and discard is renamed deep-skip. Two new options are added: deep-copy and shallow-skip.

When xsl:copy is used with a select attribute (new feature in XSLT 3.0), the context item for evaluation of the contained sequence constructor is now the item selected by the select attribute.

The intersect and except operators can now be used in match patterns; multiple operators and parentheses are allowed. Parentheses are also allowed around an expression that is then filtered by a predicate, for example match="(foo|bar)[*]" or (//para)[1].