Review of changes in the XSLT 4.0 draft

This note is to review the status of changes listed in the change appendix of the current XSLT 4.0 draft.

https://qt4cg.org/specifications/xslt-40/Overview.html#changes-since-3.0

J.1.1 Changes in this Specification: draft A (12 April 2021) <https://qt4cg.org/specifications/xslt-40/Overview.html#changes-in-draft-A>
Errata agreed against XSLT 3.0 have been applied.
These were agreed by the old WG before it disbanded and should not need further review
Support for XPath 4.0 and Functions and Operators 4.0 is required. This notably means that support for XDM arrays is now required.
Hopefully uncontroversial.
The xsl:if <https://qt4cg.org/specifications/xslt-40/Overview.html#element-if> instruction acquires attributes then and else.
Accepted 8 Nov 2022 subject to action ACTION QT4CG-010-02
The xsl:when <https://qt4cg.org/specifications/xslt-40/Overview.html#element-when> and xsl:otherwise <https://qt4cg.org/specifications/xslt-40/Overview.html#element-otherwise> elements can be evaluated using a select expression rather than a contained sequence constructor.
Accepted 8 Nov 2022
A new xsl:switch <https://qt4cg.org/specifications/xslt-40/Overview.html#element-switch> instruction is introduced.
Accepted 8 Nov 2022
The xsl:item-type <https://qt4cg.org/specifications/xslt-40/Overview.html#element-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.
Needs WG review; affects XQuery and XPath also
A new xsl:function-library <https://qt4cg.org/specifications/xslt-40/Overview.html#element-function-library> declaration is introduced, allowing functions from multiple different namespaces to be called without using a namespace prefix.
I propose to withdraw this, the complexity probably exceeds the benefit
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").
Needs WG review. The main motivation was to allow more flexibility for unprefixed names in paths, e.g. matching by local name only.
New instructions xsl:array <https://qt4cg.org/specifications/xslt-40/Overview.html#element-array> and xsl:array-member <https://qt4cg.org/specifications/xslt-40/Overview.html#element-array-member> allow the construction of arrays.
Needs WG review (and probably revision).
The instructions xsl:for-each <https://qt4cg.org/specifications/xslt-40/Overview.html#element-for-each>, xsl:iterate <https://qt4cg.org/specifications/xslt-40/Overview.html#element-iterate>, and xsl:for-each-group <https://qt4cg.org/specifications/xslt-40/Overview.html#element-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.
We've already dropped this (see below). But it remains an issue.
New pattern syntax ( type(T), record(N, M, N)) allows matching of items by item type.
Needs WG review.
The xsl:mode <https://qt4cg.org/specifications/xslt-40/Overview.html#element-mode> declaration acquires an attribute as="sequence-type" which declares the return type of all template rules in that mode.
Discussed 8 Nov 2022, no conclusion recorded.
The xsl:for-each <https://qt4cg.org/specifications/xslt-40/Overview.html#element-for-each> and xsl:apply-templates <https://qt4cg.org/specifications/xslt-40/Overview.html#element-apply-templates> instructions acquire a separator attribute to allow separators to be inserted into the output.
Needs WG review
The xsl:map <https://qt4cg.org/specifications/xslt-40/Overview.html#element-map> instruction acquires a new attribute on-duplicates.
Needs WG review (hopefully straightforward)
The xsl:function <https://qt4cg.org/specifications/xslt-40/Overview.html#element-function> declaration allows parameters to be declared as optional, so a single xsl:function <https://qt4cg.org/specifications/xslt-40/Overview.html#element-function>declaration can declare functions with multiple arities.
Accepted as part of cross-spec capability.
Enclosing modes: The xsl:mode <https://qt4cg.org/specifications/xslt-40/Overview.html#element-mode> declaration allows contained xsl:template <https://qt4cg.org/specifications/xslt-40/Overview.html#element-template> declarations.
Discussed 8 Nov 2022, no conclusion reached.
Functions that accept a lexical QName as an argument, such as key <https://www.w3.org/TR/xpath-functions-30/#func-key>FO30, function-available <https://www.w3.org/TR/xpath-functions-30/#func-function-available>FO30, element-available <https://www.w3.org/TR/xpath-functions-30/#func-element-available>FO30, type-available <https://www.w3.org/TR/xpath-functions-30/#func-type-available>FO30, system-property <https://www.w3.org/TR/xpath-functions-30/#func-system-property>FO30, accumulator-before <https://www.w3.org/TR/xpath-functions-30/#func-accumulator-before>FO30, and accumulator-after <https://www.w3.org/TR/xpath-functions-30/#func-accumulator-after>FO30, now have the option of supplying an xs:QName value instead.
Needs WG review (hopefully straightforward)
 <>J.1.2 Changes in this Specification: draft B (date TBA) <https://qt4cg.org/specifications/xslt-40/Overview.html#changes-in-draft-B>
The proposed array and map attributes of xsl:for-each <https://qt4cg.org/specifications/xslt-40/Overview.html#element-for-each>, xsl:iterate <https://qt4cg.org/specifications/xslt-40/Overview.html#element-iterate>, and xsl:for-each-group <https://qt4cg.org/specifications/xslt-40/Overview.html#element-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 replacement functions are not yet agreed.
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.
Editorial.
The rules for enclosing modes <https://qt4cg.org/specifications/xslt-40/Overview.html#dt-enclosing-mode> 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 <https://qt4cg.org/specifications/xslt-40/Overview.html#element-apply-templates> instruction within an enclosing mode defaults its mode attribute to the enclosing mode.
Does not need a separate review, see 16 above.
Support for higher-order functions is now mandatory (in XSLT 3.0 it was an optional feature).
Agreed as a cross-spec decision.

Received on Friday, 17 February 2023 16:23:46 UTC