The following sections list changes in successive drafts of this specification.
Errata agreed against XSLT 3.0 have been applied.
Support for XPath 4.0 and Functions and Operators 4.0 is required. This notably means that support for XDM arrays is now required.
The xsl:if
instruction acquires attributes then
and else
.
The xsl:when
and xsl:otherwise
elements can be evaluated using a
select
expression rather than a contained sequence constructor.
A new xsl:switch
instruction is introduced.
The xsl:item-type
declaration allows names to be given to item types,
which can then be referenced by name. This is particularly useful with record types, introduced
in XPath 4.0.
A new xsl:function-library
declaration is introduced, allowing
functions from multiple different namespaces to be called without using a namespace prefix.
The default namespace for element names and the default namespace for types can now be
different, allowing built-in types to be referenced in unprefixed form (as="integer"
).
New instructions xsl:array
and xsl:array-member
allow
the construction of arrays.
The instructions xsl:for-each
, xsl:iterate
, and
xsl:for-each-group
have attributes array
and map
which can be used in place of the select
attribute to allow iteration over arrays or maps
rather than sequences.
New pattern syntax ( type(T)
, record(N, M, N)
)
allows matching of items by item type.
The xsl:mode
declaration acquires an attribute as="sequence-type"
which
declares the return type of all template rules in that mode.
The xsl:for-each
and xsl:apply-templates
instructions
acquire a separator
attribute to allow separators to be inserted into the output.
The xsl:map
instruction acquires a new attribute on-duplicates
.
The xsl:function
declaration allows parameters to be declared as optional,
so a single xsl:function
declaration can declare functions with multiple arities.
Enclosing modes: The xsl:mode
declaration allows contained
xsl:template
declarations.
Functions that accept a lexical QName as an argument, such as key
FO30,
function-available
FO30, element-available
FO30,
type-available
FO30, system-property
FO30,
accumulator-before
FO30, and accumulator-after
FO30,
now have the option of supplying an xs:QName
value instead.
The proposed array
and map
attributes of
xsl:for-each
, xsl:iterate
, and xsl:for-each-group
have been dropped. Instead, to iterate over the contents of an array or map, use functions
such as array:members
and map:key-value-pairs
.
The descriptions of basic data types for attributes now avoid using the term lexical space, since in XSD the lexical space contains values after whitespace normalization whereas these descriptions relate to the values as written.
The rules for enclosing modes are corrected:
the restriction on referring to the enclosing mode from outside applies to the package, not
just to the stylesheet module. In addition, an xsl:apply-templates
instruction
within an enclosing mode defaults its mode
attribute to the enclosing mode.
A number of changes affecting XSLT 4.0 have been made in other related specifications. Some of the more significant changes are as follows:
A number of new kinds of ItemType are introduced, for example union types, record types, and enumeration types.
The coercion rules (previously "function conversion rules") allow atomic values
of primitive types to be supplied where a restricted type is required: for example
if the required type is xs:positiveInteger
, it is now acceptable to supply the
value 42
.
XPath 4.0 introduces abbreviated syntax for conditional expressions
(condition ?? action1 !! action2
) and for inline functions
(-> $x, $y {$x + $y}
).