XSLT 2.0 implementation
The href
attribute of xsl:result-document
is now interpreted as a relative
URI, relative to the system ID of the principal result document. This works only where the system ID of the
principal output is known, and uses the "file://" protocol. The result document is no longer created
relative to the current working directory, for security reasons (it causes problems when executing
an untrusted stylesheet in a servlet environment).
Note that when Saxon is invoked from the command line, the -o option should be used to specify the
principal output destination. This will ensure that a suitable system ID is available. If the result document
is sent to the standard output stream (even if this is redirected to a file), Saxon will not know the
system identifier and will therefore be unable to create a secondary output destination using a relative
URI. It is still possible, of course, to specify an absolute URI as the value of the href
attribute - note that this must be a URL, not a filename, so it will typically start with file://
.
It is now possible to specify an OutputURIResolver to be used to resolve the URI specified in the href
attribute of the xsl:result-document
element. This will be used in place of the standard output URI
resolver. The OutputURIResolver is called when writing of the output document starts, at which point it must
return a JAXP Result object to act as the output destination. It is called again when writing of an output document
is complete. You can nominate an OutputURIResolver by calling
((Controller)transformer).setOutputURIResolver(new UserOutputResolver())
,
or by calling factory.setAttribute("http://saxon.sf.net/feature/outputURIResolver",
new UserOutputResolver())
.
If the -t option is used, a message is written to the standard error output identifying the
files written using using xsl:result-document
.
It is now an error to use xsl:result-document
when the current output destination
is a temporary tree.
The meaning of the ALLOW_EXTENSION_FUNCTIONS attribute in the TransformerFactory has been
extended so that setting the value to false
also disables extension elements and
the creation of multiple output files. This is because all these operations carry similar risks
when a servlet is allowed to execute untrusted stylesheets.
Added support for the separator
attribute of <xsl:copy-of>
.
The current()
function may now be used in a pattern (specifically, within a predicate).
Its value is the node being tested against the pattern. For example, match="*[*[name()=name(current())]"
matches any element that contains another element with the same name.
A global variable or parameter may now be used in the match pattern of xsl:template
, provided that it does
not cause a circularity (that is, it must be possible to evaluate the variable without calling
xsl:apply-templates
)
A global variable or parameter may now be used in the match pattern or the use expression
of xsl:key
, provided that it does
not cause a circularity (that is, it must be possible to evaluate the variable without using the key()
function against the key being defined)
The key()
function may now be used in the use
or match
attributes of
xsl:key
, provided the key definitions are not circular. (For example, key k1 can be defined
in terms of key k2, provided that k2 is not defined in terms of k1.)
The group-ending-with
attribute of xsl:for-each-group
is implemented. It is especially
useful where the last node in each group carries some kind of marker, for example continued="no"
.
Added attribute default="yes"|"no"
to saxon:collation
, to specify whether this collation
should be used as the default collation. If more than one collation is specified as the default, the last one wins.
If no default collation is specified, Unicode codepoint collation is used. The default collation is used by
the compare() function if no third argument is supplied, by xsl:sort if no collation is specified (for data type text
or string), and also by the comparison operators =, !=, <, >, etc.
The collation name is now a URI, not a QName.
Sorting and comparison according to Unicode codepoints can be achieved by setting up a collator as
<saxon:collation name="unicode" class="net.sf.saxon.sort.CodepointCollator"/>