diff --git a/schema/xmlspec.dtd b/schema/xmlspec.dtd index 982179976..76174248f 100644 --- a/schema/xmlspec.dtd +++ b/schema/xmlspec.dtd @@ -398,6 +398,18 @@ ]]> + + + + + + + @@ -407,6 +419,7 @@ #1999-07-02: maler: Added doctype atts and status att. #2000-03-07: maler: Added cr, issues, and dispcmts to w3c-doctype. #2011-01-20: Jim Melton: Added per and wgnote to w3c-doctype. +#2024-04-13: Michael Kay: Added optional changes element after head. --> @@ -481,7 +494,7 @@ + ]]> + ]]> + ]]> + ]]> + ]]> + ]]> Change Log -

The following changes have been made to this document since the +

The following substantive changes have been made to this document since the XPath and XQuery Data Model 3.1 Recommendation of 21 March 2017.

- + + + diff --git a/specifications/xpath-datamodel-40/src/xpath-datamodel.xml b/specifications/xpath-datamodel-40/src/xpath-datamodel.xml index 6398a8ef0..ffcc86b98 100644 --- a/specifications/xpath-datamodel-40/src/xpath-datamodel.xml +++ b/specifications/xpath-datamodel-40/src/xpath-datamodel.xml @@ -221,6 +221,10 @@ work by the and the .

Introduction + + Use the arrows to browse significant changes since the 3.1 version of this specification. + Sections with significant changes are marked Δ in the table of contents. +

This document defines the &language;, which is the data model of , , and @@ -353,6 +357,11 @@ examples as instances of the data model. Basic Concepts + + + Clarified the terminology concerning atomic types and type annotations. + +

Every instance of the data model is a @@ -955,6 +964,7 @@ size and scope of the processing context.

Predefined Types +

The three atomic types xs:anyAtomicType, xs:dayTimeDuration, and @@ -1006,6 +1016,12 @@ size and scope of the processing context.

XML and XSD Versions + + + + Relaxed the rules regarding use of non-XML characters in instances of xs:string. + +

Some of the types defined in XML Schema have differing definitions in XSD 1.0 and XSD 1.1; furthermore, some types are defined by @@ -1245,6 +1261,11 @@ negative zero or to positive zero in the value space. Function Items + + + Introduced the concept of function identity. + +

@@ -1492,6 +1513,11 @@ For all positions greater than 0 and less than or equal to the array size, Labeled Items + + + Introduced the concept of labeled items. + +

A labeled item is a pair (S, L) where S (called the subject) is any item, and L (called the label) is a map containing supplementary diff --git a/specifications/xslt-40/schema/xsltspec.dtd b/specifications/xslt-40/schema/xsltspec.dtd index 96b2e0d5f..1e998804c 100644 --- a/specifications/xslt-40/schema/xsltspec.dtd +++ b/specifications/xslt-40/schema/xsltspec.dtd @@ -49,8 +49,8 @@ - - + diff --git a/specifications/xslt-40/src/xslt.xml b/specifications/xslt-40/src/xslt.xml index c12ba10c4..fa9875a36 100644 --- a/specifications/xslt-40/src/xslt.xml +++ b/specifications/xslt-40/src/xslt.xml @@ -176,7 +176,7 @@ - Introduction + Introduction What is XSLT?

This specification defines the syntax and semantics of the XSLT 4.0 language.

@@ -241,111 +241,14 @@
What’s New in XSLT 4.0? - + + Use the arrows to browse significant changes since the 3.0 version of this specification. + Sections with significant changes are marked Δ in the table of contents. + + +

XSLT 4.0 requires support for XPath 4.0.

+

A full list of changes is at .

@@ -6448,6 +6351,15 @@ there is no need to make it needlessly implausible.

--> Stylesheet Element + + + + A new attribute, main-module, is added to the xsl:stylesheet + element. The attribute is provided for the benefit of development tools such as syntax-directed + editors to provide information about all the components (variables, functions, etc) visible + within a stylesheet module. + + @@ -6650,6 +6562,15 @@ and version="1.0" otherwise.

The fixed-namespaces Attribute + + + + The xsl:stylesheet, xsl:transform, or xsl:package + element may have a fixed-namespaces attribute making it easier to have the same + namespace declarations in force throughout a stylesheet. + + +

The fixed-namespaces attribute, if present, defines the for a . The attribute may appear only on the @@ -6967,6 +6888,14 @@ and version="1.0" otherwise.

Simplified Stylesheet Modules + + + + Simplified stylesheets no longer require an xsl:version attribute + (which means they might not need a declaration of the XSLT namespace). Unless otherwise + specified, a 4.0 simplified stylesheet defaults expand-text to true. + +

A simplified syntax is allowed for a stylesheet module that defines only a single template rule for the document node. The stylesheet module may consist of just a literal result element (see ) @@ -7943,6 +7872,14 @@ and version="1.0" otherwise.

The xsl:note element + + + + A new element xsl:note is available for documentation and similar purposes: + it can appear anywhere in the stylesheet and is ignored by the XSLT processor. + + +

An xsl:note element may appear anywhere in the stylesheet, except as the outermost element.

The element may have any attributes and any children, subject only to rules imposed by @@ -8253,6 +8190,16 @@ and version="1.0" otherwise.

Importing Schema Components + + + The rules concerning the compatibility of schemas imported by different packages have + been clarified. It is now explicitly stated that instructions that trigger validation + must use the imported schema of the package in which validation is invoked. + This differs from the current practice of some XSLT 3.0 processors, which may + use (for example) a schema formed from the union of the imported schemas in all + packages. + +

The facilities described in this section are not available with a basic XSLT processor. They require a schema-aware XSLT @@ -10748,6 +10695,16 @@ and version="1.0" otherwise.

Type Patterns + + + Patterns (especially those used in template rules) can now be defined + by reference to item types, so any item type can be used as a match + pattern. For example match="record(longitude, latitude, *)" + matches any map that includes the key values "longitude" + and "latitude". + + + @@ -11088,6 +11045,15 @@ and version="1.0" otherwise.

Defining Named Item Types + + + Named item types can be declared using the new xsl:item-type + element. This is designed to avoid repeating lengthy type definitions (for example + function types and record types) every time they are used. [This feature was + present in the editor's draft presented to the WG when it started work.] + + +

An xsl:item-type declaration associates a name with an item type, and allows the type @@ -12414,6 +12380,16 @@ and version="1.0" otherwise.

Applying Template Rules + + + + The xsl:for-each and xsl:apply-templates + instructions acquire an attribute separator that can be + used to insert content between adjacent items. [This change was in the + editor's draft adopted as a baseline when the WG commenced work.] + + +

The xsl:apply-templates instruction takes as input a sequence of items (typically nodes in a source tree), and produces as output a sequence of @@ -13134,6 +13110,14 @@ and version="1.0" otherwise.

properties.

Declaring Modes + + + + The xsl:mode declaration acquires an attribute + as="sequence-type" which declares the return type of + all template rules in that mode. + + @@ -13672,6 +13656,16 @@ and version="1.0" otherwise.

Enclosing Modes + + + + A mode (called an enclosing mode) can be defined in which all the relevant + template rules are children of the xsl:mode element. + This is intended to allow a stylesheet design in which it is easier to + determine which rules might apply to a given xsl:apply-templates + call. + +

A mode declared by an xsl:mode declaration that has one or more contained xsl:template declarations is referred to as an enclosing mode.

@@ -13852,6 +13846,14 @@ and version="1.0" otherwise.

Built-in Template Rules + + + + To allow recursive-descent transformation on a tree of maps and arrays, a new + set of built-in templates rules shallow-copy-all is introduced. + + +

When an item is selected by xsl:apply-templates and there is no user-specified template rule in the stylesheet that can be used to process that item, then a built-in template rule is @@ -14529,6 +14531,16 @@ and version="1.0" otherwise.

sorting of the input sequence, while xsl:iterate does not.

The xsl:for-each instruction + + + + The xsl:for-each and xsl:apply-templates + instructions acquire an attribute separator that can be + used to insert content between adjacent items. [This change was in the + editor's draft adopted as a baseline when the WG commenced work.] + + +

The attributes select, array, and map are mutually exclusive: exactly one of these three attributes must be present.

@@ -15160,6 +15172,7 @@ and version="1.0" otherwise.

Conditional Processing +

There are several instructions in XSLT that support conditional processing: xsl:if, xsl:choose, and xsl:switch. The xsl:if @@ -15194,8 +15207,15 @@ and version="1.0" otherwise.

Further conditional constructs are also under development for XPath 4.0. [TODO: elaborate on this when complete.]

- Conditional Processing with xsl:if - + Conditional Processing with xsl:if + + + + The xsl:if instruction now allows then and else + attributes. + + +

The xsl:if element has a mandatory test attribute, whose value is an expression. The content is @@ -15279,8 +15299,16 @@ and version="1.0" otherwise.

- Conditional Processing with xsl:choose - + Conditional Processing with xsl:choose + + + + In xsl:choose, the xsl:when and + xsl:otherwise elements can take a select attribute + in place of a sequence constructor. + + + @@ -15385,11 +15413,18 @@ and version="1.0" otherwise.

- Conditional Processing with xsl:switch - + Conditional Processing with xsl:switch + + + + A new xsl:switch instruction is introduced. + + + +

The xsl:switch element selects one among a number of possible alternatives. The select attribute of the xsl:switch element is evaluated to obtain an atomic value, which is compared with the values given by the @@ -16729,6 +16764,12 @@ and version="1.0" otherwise.

Default Values of Parameters + + + Parameters on functions + declared using xsl:function can now be defined as optional, + with a default value supplied. +

The optional required attribute of xsl:param may be used to indicate whether a , @@ -18104,6 +18145,12 @@ and version="1.0" otherwise.

Invoking Named Templates using Extension Instructions + + + It is possible to invoke a named template using an extension instruction, specifically, + an element whose name matches the name of the named template. + +

As an alternative to the use of xsl:call-template, it is possible to invoke a named template using an instruction. For example, given the named template:

@@ -18834,6 +18881,14 @@ and version="1.0" otherwise.

Stylesheet Functions + + + Parameters on functions + declared using xsl:function can now be defined as optional, + with a default value supplied. + + +

An xsl:function declaration declares the name, parameters, and @@ -20782,7 +20837,7 @@ and version="1.0" otherwise.

namespace attribute, it is a dynamic error if the effective value of the name attribute is a lexical QName whose prefix is not declared - in the the + in the for the xsl:attribute instruction.

@@ -23086,6 +23141,14 @@ return if ($i le count($S)) Grouping + + + + A new attribute xsl:for-each-group/@split-when is available to + give applications more complete control over how a sequence is partitioned + + +

The facilities described in this section are designed to allow items in a sequence to be grouped based on common values; for example it allows grouping of elements having the same value for a particular attribute, or elements with the same name, or elements with @@ -25331,6 +25394,15 @@ the same group, and the--> The xsl:analyze-string Instruction + + + + The xsl:matching-substring and xsl:non-matching-substring + elements within xsl:analyze-string may now take a select attribute + in place of a contained sequence constructor. + + + @@ -26676,6 +26748,14 @@ the same group, and the--> Capturing Accumulators + + + Capturing accumulators have been added; when streaming with a capturing accumulator, + the accumulator-after has full access to a snapshot of the matched + element node. + + +

The capture attribute is intended primarily for use with streamable accumulators, but in the interests of consistency, it has the same effect both for streamable and non-streamable accumulators. If an accumulator rule with phase="end" specifies capture="yes", @@ -34841,6 +34921,18 @@ the same group, and the--> Additional Functions + + + + Functions that accept a lexical QName as an argument, such as key, + function-available, element-available, + type-available, system-property, + accumulator-before, and accumulator-after, + now have the option of supplying an xs:QName value instead. + [This change was in the editor's draft accepted by the WG as its baseline when + it started work.] + +

This section describes XSLT-specific additions to the XPath function library. Some of these additional functions also make use of information specified by declarations in the @@ -35211,6 +35303,14 @@ the same group, and the--> Handling of duplicate keys + + + A new attribute xsl:map/@on-duplicates is available, + allowing control over how duplicate keys are handled by the xsl:map + instruction. + + +

This section describes what happens when two or more maps returned by the sequence constructor within an xsl:map instruction contain duplicate keys: that is, when one of these maps contains an entry with key K, and another contains an entry with key L, @@ -35647,6 +35747,14 @@ return ($m?price - $m?discount)

Arrays are defined in the XDM Data Model.

Array Construction + + + + The new instruction xsl:array is introduced + to allow construction of arrays. + + +

The instruction xsl:array constructs and returns a new array.

If the use attribute is omitted, the resulting @@ -36418,6 +36526,19 @@ return ($m?price - $m?discount) Extensibility and Fallback + + + + Functions that accept a lexical QName as an argument, such as key, + function-available, element-available, + type-available, system-property, + accumulator-before, and accumulator-after, + now have the option of supplying an xs:QName value instead. + [This change was in the editor's draft accepted by the WG as its baseline when + it started work.] + + +

XSLT allows two kinds of extension, extension instructions and extension functions.

An extension @@ -36568,6 +36689,14 @@ return ($m?price - $m?discount) Extension Instructions + + + + It is possible to invoke a named template using an extension instruction, specifically, + an element whose name matches the name of the named template. + + +

The extension instruction mechanism allows namespaces to be designated as extension namespaces. When a namespace @@ -36583,6 +36712,10 @@ return ($m?price - $m?discount) ) are not extension elements as defined here, and nothing in this section applies to them.

+ +

In XSLT 4.0 it is possible to use extension instructions to invoke named templates: see + . +

Designating an Extension Namespace

A namespace is designated as an extension namespace by using an @@ -36672,6 +36805,15 @@ return ($m?price - $m?discount)

Creating Secondary Results + + + + A new serialization parameter escape-solidus is provided to control + whether the character / is escaped as \/ by the + JSON serialization method. + + +

The xsl:result-document instruction is used to create a . The content of the @@ -37082,6 +37224,18 @@ return ($m?price - $m?discount) Validation + + + + The rules concerning the compatibility of schemas imported by different packages have + been clarified. It is now explicitly stated that instructions that trigger validation + must use the imported schema of the package in which validation is invoked. + This differs from the current practice of some XSLT 3.0 processors, which may + use (for example) a schema formed from the union of the imported schemas in all + packages. + + +

It is possible to control the applied to individual element and attribute nodes as they are constructed. This is done using the type and validation attributes of the @@ -37750,6 +37904,15 @@ return ($m?price - $m?discount) Serialization + + + + A new serialization parameter escape-solidus is provided to control + whether the character / is escaped as \/ by the + JSON serialization method. + + +

A processor may output a final result tree as a sequence of octets, although it is not @@ -38390,6 +38553,14 @@ return ($m?price - $m?discount) Conformance + + + + The higher-order-function feature no longer exists; higher-order functions + are now a core part of XSLT, no longer an optional extra. + + +

A processor that claims conformance with this specification must satisfy the conformance requirements for a basic XSLT processor @@ -39365,105 +39536,11 @@ See Changes since XSLT 3.0 - Changes in successive Drafts -

The following sections list changes in successive drafts of this specification.

- - Changes in this Specification: draft A (12 April 2021) - -

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.

- -

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").

-

The new instruction xsl:array allows - the construction of arrays.

- - -

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, - function-available, element-available, - type-available, system-property, - accumulator-before, and accumulator-after, - now have the option of supplying an xs:QName value instead.

-

A serialization parameter escape-solidus has been added, for use - in JSON serialization.

-
-
- - Changes in this Specification: draft B (date TBA) - -

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.

-

Support for higher-order functions is now mandatory (in XSLT 3.0 it was an optional feature).

-

An xsl:note element is defined to enable structured documentation. It - may appear anywhere.

-

A new attribute, main-module, is defined on xsl:stylesheet - and xsl:transform, enabling an XSLT editing tool to identify the top-level module - of a stylesheet, and hence the declarations of functions, templates, and global variables available - to a module that is being edited.

-

The xsl:matching-substring and xsl:non-matching-substring - elements within xsl:analyze-string may take a select attribute - in place of a contained sequence constructor.

- -

Simplified stylesheets no longer require an xsl:version attribute - (which means they might not need a declaration of the XSLT namespace). Unless otherwise - specified, a 4.0 simplified stylesheet defaults expand-text to true.

- -

A new set of built-in template rules is introduced, invoked using - <xsl:mode on-no-match="shallow-copy-all">. This is designed to allow rule-based recursive - transformation of JSON data structures (trees of maps and arrays) to work in the same way as with - XML-derived data structures.

- - -

The streamability rules for accumulators have been relaxed, so that the phase="end" - processing has access to the full subtree of the matched node.

- - -

The of an xsl:fallback - instruction with no version attribute is the version of XSLT supported - by the processor, so that the xsl:fallback is not itself processed - using .

- - - -

The rules concerning the compatibility of schemas imported by different packages - have been clarified. It is now explicitly stated that instructions that trigger validation - must use the imported schema of the package in which validation is invoked. This differs - from the current practice of some XSLT 3.0 processors, which may use (for example) a schema - formed from the union of the imported schemas in all packages.

- + Changes in this specification + + + -
-
Changes in Other Related Specifications @@ -39472,7 +39549,7 @@ See specifications. Some of the more significant changes are as follows:

-

A number of new kinds of ItemType are introduced, for example union types, +

A number of new kinds of ItemType are introduced, for example choice item types, record types, and enumeration types.

@@ -39496,19 +39573,7 @@ See
- - Changes Pending -

Further work is needed in the following areas:

- -

Streamability implications of new constructs

-

Details of error codes

-

Default priorites for new kinds of pattern

-

Add built-in template rules suitable for JSON processing

-

Default namespace for elements: allow matching on local-name only, - or on “XHTML or nothing”.

-

Completing the XSD and RNG schemas for stylesheet modules.

-
-
+ Incompatibilities with XSLT 3.0 @@ -39527,21 +39592,7 @@ See is confined to this edge case.

- -

The functions key, - accumulator-before, - accumulator-after, - element-available, - function-available, - type-available, and - system-property have an argument whose type has changed - from xs:string to (xs:string | xs:QName). - This change means that certain non-string values are no longer accepted: - for example xs:anyURI values or - (with enabled) - xs:boolean or xs:duration values. This is highly - unlikely to arise in practical code.

-
+ @@ -39555,6 +39606,11 @@ See template rule invoked xsl:next-match, it was not specified whether the current template rule should be the calling template or the called template. This omission has been corrected.

+ +

Where different packages import different schemas, the specification is now more + prescriptive about which schema is used for validation. The rules may differ from + the conventions adopted by implementations of XSLT 3.0.

+

See also , , and diff --git a/specifications/xslt-40/style/xslt.xsl b/specifications/xslt-40/style/xslt.xsl index cfbb830cf..bfd722d6f 100644 --- a/specifications/xslt-40/style/xslt.xsl +++ b/specifications/xslt-40/style/xslt.xsl @@ -199,9 +199,9 @@ - + diff --git a/specifications/xslt-xquery-serialization-40/src/xslt-xquery-serialization.xml b/specifications/xslt-xquery-serialization-40/src/xslt-xquery-serialization.xml index 3df717322..fdf413d74 100644 --- a/specifications/xslt-xquery-serialization-40/src/xslt-xquery-serialization.xml +++ b/specifications/xslt-xquery-serialization-40/src/xslt-xquery-serialization.xml @@ -188,6 +188,11 @@ for transition to Proposed Recommendation.

'> Introduction + + + Use the arrows to browse significant changes since the 3.1 version of this specification. + Sections with significant changes are marked Δ in the table of contents. +

This document defines serialization of the W3C XQuery and XPath Data Model 4.0 (XDM), @@ -628,6 +633,11 @@ nodes.

Serialization Parameters + + + Added the escape-solidus parameter for JSON serialization. + +

There are a number of parameters that influence how serialization is performed. Host languages MAY allow users to specify any or all of these parameters, but they are not REQUIRED to be able to do so. However, the host language @@ -2051,42 +2061,15 @@ is not applicable to the XML output method.

-XHTML Output Method - - - + + XHTML Output Method + + In the HTML and XHTML output methods, the rules for adding and replacing + meta elements have been revised to take account of the new HTML5 syntax, + for example <meta charset="utf-8">. + + +

The XHTML output method serializes the as XML, using the HTML compatibility guidelines defined in the XHTML specification @@ -2610,7 +2593,14 @@ is not applicable to the XHTML output method.

-HTML Output Method

The HTML output method serializes + + HTML Output Method + + In the HTML and XHTML output methods, the rules for adding and replacing + meta elements have been revised to take account of the new HTML5 syntax, + for example <meta charset="utf-8">. + +

The HTML output method serializes the as HTML.

For example, the following XSL stylesheet generates html output,

<xsl:stylesheet version="2.0" @@ -3419,6 +3409,12 @@ is not applicable to the Text output method.

JSON Output Method + + + + Added the escape-solidus parameter for JSON serialization. + +

The JSON output method serializes the as a JSON value using the JSON syntax defined in . @@ -3960,6 +3956,11 @@ used and how they convey the information. The Influence of Serialization Parameters upon the Adaptive Output Method + + + Added the escape-solidus parameter for JSON serialization. + +

For some item types the Adaptive output method will delegate serialization to other output methods. @@ -4350,1023 +4351,10 @@ the mechanism described in .

Change Log

This appendix lists changes made in version 4.0 of this specification.

- -

In the HTML and XHTML output methods, the rules for adding and replacing - meta elements have been revised to take account of the new HTML5 syntax, - for example <meta charset="utf-8">.

-
- - -
- + + - - diff --git a/style/xmlspec-2016.xsl b/style/xmlspec-2016.xsl index 3b4d3e58f..526c24759 100644 --- a/style/xmlspec-2016.xsl +++ b/style/xmlspec-2016.xsl @@ -2854,6 +2854,9 @@ + + Δ + diff --git a/style/xsl-query-2016.xsl b/style/xsl-query-2016.xsl index c5dd828d6..543534d35 100644 --- a/style/xsl-query-2016.xsl +++ b/style/xsl-query-2016.xsl @@ -1953,6 +1953,69 @@ + + +
+

+ Changes in 4.0 + + +   + + + + +   + + +

+
    + +
+
+
+ + +
  • +

    + + + + + Issue {@issue}  + PR {@PR}  + Applied {format-date(@date, '[D] [MNn] [Y]')} +  ] + + +

    +
  • +
    + + +
      + + + +
    1. + + +

      PR {@PR} 

      +
      +
      + +

      + +

      + +

      See

      +
      +
      +
    2. +
      +
    +
    +