XSLT 3.0 implementation
Saxon 9.7 implements the XSLT 3.0 Candidate Recommendation (published 19 November 2015) almost in its entirety. This has involved many detailed changes. The most significant is the implementation of the full semantics of packages, including the ability to override components from used packages.
New features connected with XSLT 3.0 packages include:
-
Attribute sets can now be defined within packages, overridden, etc, in the same way as other named components.
-
Keys and decimal formats are now local to a package.
-
Accumulators are now local to a package.
-
The
xsl:output
andxsl:strip-space
declartions are local to a package. -
The name
xsl:original
can be used within an overriding declaration of a named template, function, variable, or attribute set, to refer to the component that it is overriding.
Saxon allows XSLT 3.0 packages to be separately compiled. The compiled version of a package can be exported (as an XML file whose detailed format is unpublished), saved on disk, and distributed, in the same way as object code produced by conventional compilers. The compiled package is in fact a representation of the abstract syntax tree of the original stylesheet, as amended by all the various processes carried out during static analysis (type checking, optimization, allocation of slots to variables, etc). Loading a compiled package is considerably faster than loading of original source code.
In this release (9.7), the compiled version of the package does not include generated bytecode. When a compiled package is loaded, the relevant code will always be interpreted.
The new facilities supporting XSLT 3.0 packages supersede the old mechanism for saving a
stylesheet (the net.sf.saxon.ptree.StylesheetPackager
command), which is
dropped in Saxon 9.7.
Other XSLT 3.0 changes implemented in Saxon 9.7 include:
-
The
use-accumulators
attribute of xsl:stream is implemented. This means that an accumulator is not available with a particular streamed input unless it was nominated on thexsl:stream
instruction. -
The xsl:context-item declaration is implemented. (This can appear as a child of xsl:template to define whether or not a template uses the context item, which is especially useful as it affects streamability of xsl:call-template instructions.)
-
The xsl:global-context-item declaration is implemented.
-
The
start-at
attribute of xsl:number can now be a sequence of integers. -
A call to root() may appear at the start of a pattern.
-
Composite keys (xsl:key with attribute
composite="yes"
) are implemented. -
The xsl:evaluate instruction no longer allows the dynamic XPath expression to call XSLT-defined functions such as current().
-
The template name
xsl:initial-template
is now permitted, though it has no special significance in any API; if you want execution to start at this template, you must nominate it as the initial template in the usual way. -
The
on-empty
attribute is removed from instructions such as xsl:element and xsl:copy. In its place, the three new instructions xsl:on-empty, xsl:on-non-empty, and xsl:where-populated are implemented, in both streaming and non-streaming situations. -
The
[xsl:]default-mode
standard attribute is implemented.
See also Streamed Processing.