View Old View New View Both View Only Previous Next

This draft contains only sections that have differences from the version that it modified.

W3C

XSL Transformations (XSLT) Version 4.0

W3C Editor's Draft 23 February 2026

This version:
https://qt4cg.org/specifications/xslt-40/
Latest version:
https://qt4cg.org/specifications/xslt-40/
Most recent Recommendation of XSL Transformations (XSLT):
https://www.w3.org/TR/xslt-30/
Editor:
Michael Kay, Saxonica <http://www.saxonica.com/>

The following associated resources are available: Specification in XML format, XSD 1.1 Schema for XSLT 4.0 Stylesheets (non-normative), Relax-NG Schema for XSLT 4.0 Stylesheets (non-normative), Stylesheet for XML-to-JSON conversion (non-normative)


Abstract

This specification defines the syntax and semantics of XSLT 4.0, a language designed primarily for transforming XML documents into other XML documents.

XSLT 4.0 is a revised version of the XSLT 3.0 Recommendation [XSLT 3.0] published on 8 June 2017. Changes are presented in 1.2 What’s New in XSLT 4.0?.

XSLT 4.0 is designed to be used in conjunction with XPath 4.0, which is defined in [XPath 4.0]. XSLT shares the same data model as XPath 4.0, which is defined in [XDM 3.0], and it uses the library of functions and operators defined in [Functions and Operators 4.0]. XPath 4.0 and the underlying function library introduce a number of enhancements, for example the availability of union and record types.

This document contains hyperlinks to specific sections or definitions within other documents in this family of specifications. These links are indicated visually by a superscript identifying the target specification: for example XP for XPath 4.0, DM for the XDM data model version 4.0, FO for Functions and Operators version 4.0.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.

This document has no official standing. It is produced by the editor as a proposal for community review. Insofar as it copies large amounts of text from the W3C XSLT 3.0 Recommendation, W3C copyright and similar provisions apply.

Dedication

The publications of this community group are dedicated to our co-chair, Michael Sperberg-McQueen (1954–2024).


3 Stylesheet Structure

This section describes the overall structure of a stylesheet as a collection of XML documents.

3.2 Extension Attributes

[Definition: An element from the XSLT namespace may have any attribute not from the XSLT namespace, provided that the expanded QName (see [XPath 3.0]) of the attribute has a non-null namespace URI. These attributes are referred to as extension attributes.] The presence of an extension attribute must not cause the principal result or any secondary result of the transformation to be different from the results that a conformant XSLT 4.0 processor might produce. They must not cause the processor to fail to raise an error that a conformant processor is required to raise. This means that an extension attribute must not change the effect of any instruction except to the extent that the effect is implementation-defined or implementation-dependent.

Furthermore, if serialization is performed using one of the serialization methods described in [XSLT and XQuery Serialization], the presence of an extension attribute must not cause the serializer to behave in a way that is inconsistent with the mandatory provisions of that specification.

Note:

Extension attributes may be used to modify the behavior of extension functions and extension instructions. They may be used to select processing options in cases where the specification leaves the behavior implementation-defined or implementation-dependent. They may also be used for optimization hints, for diagnostics, or for documentation.

Extension attributes may also be used to influence the behavior of the standard serialization methods xml, xhtml, html, or text, json, and adaptive, to the extent that the behavior of the serialization method is implementation-defined or implementation-dependent. For example, an extension attribute might be used to define the amount of indentation to be used when indent="yes" is specified. If a serialization method other than one of these four is requested (using a prefixednamespaced QName in the method parameter) then extension attributes may influence its behavior in arbitrary ways. Extension attributes must not be used to cause the standard serialization methods to behave in a non-conformant way, for example by failing to report serialization errors that a serializer is required to report. An implementation that wishes to provide such options must create a new serialization method for the purpose.

An implementation that does not recognize the name of an extension attribute, or that does not recognize its value, must perform the transformation as if the extension attribute were not present. As always, it is permissible to produce warning messages.

The namespace used for an extension attribute will be copied to the result tree in the normal way if it is in scope for a literal result element. This can be prevented using the [xsl:]exclude-result-prefixes attribute.

Example: An Extension Attribute for xsl:messageExample: An Extension Attribute for xsl:message

The following code might be used to indicate to a particular implementation that the xsl:message instruction is to ask the user for confirmation before continuing with the transformation:

<xsl:message abc:pause="yes"
    xmlns:abc="http://vendor.example.com/xslt/extensions">
       Phase 1 complete
</xsl:message>

Implementations that do not recognize the namespace http://vendor.example.com/xslt/extensions will simply ignore the extra attribute, and evaluate the xsl:message instruction in the normal way.

[ERR XTSE0090] It is a static error for an element from the XSLT namespace to have an attribute whose namespace is either null (that is, an attribute with an unprefixed name) or the XSLT namespace, other than attributes defined for the element in this document.

25 Transformation Results

The output of a transformation includes a principal result and zero or more secondary results.

The way in which these results are delivered to an application is implementation-defined.

Serialization of results is described further in 26 Serialization

25.1 Creating Secondary Results

Changes in 4.0  

  1. A new serialization parameter escape-solidus is provided to control whether the character / is escaped as \/ by the JSON serialization method.   [Issue 530 PR 534 9 June 2023]

  2. The input to the serializer can be defined using the select attribute of xsl:result-document as an alternative to using a sequence constructor.   [Issue 1534 ]

<!-- Category: instruction -->
<xsl:result-document
  format? = { eqname }
  href? = { uri }
  select? = expression
  validation? = "strict" | "lax" | "preserve" | "strip"
  type? = eqname
  method? = { "xml" | "html" | "xhtml" | "text" | "json" | "adaptive" | eqname }
  allow-duplicate-names? = { boolean }
  build-tree? = { boolean }
  byte-order-mark? = { boolean }
  cdata-section-elements? = { eqnames }
  doctype-public? = { string }
  doctype-system? = { string }
  encoding? = { string }
  escape-solidus? = { boolean }
  escape-uri-attributes? = { boolean }
  html-version? = { decimal }
  include-content-type? = { boolean }
  indent? = { boolean }
  item-separator? = { string }
  json-lines? = { boolean }
  json-node-output-method? = { "xml" | "html" | "xhtml" | "text" | eqname }
  media-type? = { string }
  normalization-form? = { "NFC" | "NFD" | "NFKC" | "NFKD" | "fully-normalized" | "none" | nmtoken }
  omit-xml-declaration? = { boolean }
  parameter-document? = { uri }
  standalone? = { boolean | "omit" }
  suppress-indentation? = { eqnames }
  undeclare-prefixes? = { boolean }
  use-character-maps? = eqnames
  output-version? = { nmtoken } >
  <!-- Content: sequence-constructor -->
</xsl:result-document>

The xsl:result-document instruction is used to create a secondary result.

The select attribute and the contained sequence constructor are mutually exclusive; if the select attribute is present then the sequence constructor must be empty, and if the sequence constructor is non-empty then the select attribute must be absent [see ERR XTSE3185]. The value of the select attribute or the immediate result of the contained sequence constructor is referred to as the raw result.

As with the principal result of the transformation, a secondary result may be delivered to the calling application in three ways (see 2.3.6 Post-processing the Raw Result):

  1. The raw result may be delivered as is.

  2. The raw result may be used to construct a final result tree by invoking the process of sequence normalizationSER30.

  3. The raw result may be serialized to a sequence of octets (which may then, optionally, be saved to a persistent storage location).

The decision whether or not to serialize the raw result depends on the processor and on the way it is invoked. This is implementation-defined, and it is not controlled by anything in the stylesheet.

If the result is not serialized, then the decision whether to return the raw result or to construct a tree depends on the effective value of the build-tree attribute. If the effective value of the build-tree attribute is yes, then a final result tree is created by invoking the process of sequence normalizationSER30. Conversely, if the result is serialized, then the decision whether or not to construct a tree depends on the choice of serialization method, and the build-tree attribute is then ignored. For example, with method="xml" a tree is always constructed, whereas with method="json" a tree is never constructed. [XSLT 3.0 Erratum E14, bug 30208].

The xsl:result-document instruction defines a URI that may be used to identify the secondary result. The instruction may optionally specify the output format to be used for serializing the result.

Technically, the result of evaluating the xsl:result-document instruction is an empty sequence. This means it does not contribute anything to the result of the sequence constructor it is part of.

The effective value of the format attribute, if specified, must be an EQName. The value is expanded using the namespace declarations in scope for the xsl:result-document element. The resulting expanded QNamemust match the expanded QName of a named output definition in the stylesheet. This identifies the xsl:output declaration that will control the serialization of the final result tree (see 26 Serialization), if the result tree is serialized. If the format attribute is omitted, the unnamed output definition is used to control serialization of the result tree.

[ERR XTDE1460] It is a dynamic error if the effective value of the format attribute is not a valid EQName, or if it does not match the expanded QName of an output definition in the containing package. If the processor is able to detect the error statically (for example, when the format attribute contains no curly brackets), then the processor may optionally raise this as a static error.

Note:

The only way to select the unnamed output definition is to omit the format attribute.

The parameter-document attribute allows serialization parameters to be supplied in an external document. The external document must contain an output:serialization-parameters element with the format described in Section 3.1 Setting Serialization Parameters by Means of a Data Model Instance SER30, and the parameters are interpreted as described in that specification.

If present, the effective value of the URI supplied in the parameter-document attribute is dereferenced, after resolution against the base URI of the xsl:result-document element if it is a relative reference. The parameter document should be read during run-time evaluation of the stylesheet. If the location of the stylesheet at development time is different from the deployed location, any relative reference should be resolved against the deployed location. A serialization error occurs if the result of dereferencing the URI is ill-formed or invalid; but if no document can be found at the specified location, the attribute should be ignored.

A serialization parameter specified in the parameter-document takes precedence over a value supplied directly as an attribute of xsl:result-document, which in turn takes precedence over a value supplied in the selected output definition, except that the values of the cdata-section-elements and suppress-indentation attributes are merged in the same way as when multiple xsl:output declarations are merged.

The attributes method, allow-duplicate-names, build-tree, byte-order-markcdata-section-elements, doctype-public, doctype-system, encoding, escape-solidusescape-uri-attributes, html-version, indent, item-separator, json-lines, json-node-output-method, media-type, normalization-form, omit-xml-declaration, standalone, suppress-indentation, undeclare-prefixes, use-character-maps, and output-version may be used to override attributes defined in the selected output definition.

With the exception of use-character-maps, these attributes are all defined as attribute value templates, so their values may be set dynamically. For any of these attributes that is present on the xsl:result-document instruction, the effective value of the attribute overrides or supplements the corresponding value from the output definition. This works in the same way as when one xsl:output declaration overrides another. Some of the attributes have more specific rules:

  • In the case of cdata-section-elements and suppress-indentation, the value of the serialization parameter is the union of the expanded names of the elements named in this instruction and the elements named in the selected output definition.

  • In the case of use-character-maps, the character maps referenced in this instruction supplement and take precedence over those defined in the selected output definition.

  • In the case of doctype-public and doctype-system, setting the effective value of the attribute to a zero-length string has the effect of overriding any value for these attributes obtained from the output definition. The corresponding serialization parameter is not set (is “absent”).

  • In the case of item-separator, setting the effective value of the attribute to the special value "#absent" has the effect of overriding any value for this attribute obtained from the output definition. The corresponding serialization parameter is not set (is “absent”). It is not possible to set the value of the serialization parameter to the literal 7-character string "#absent".

  • In all other cases, the effective value of an attribute actually present on this instruction takes precedence over the value defined in the selected output definition.

Note:

In the case of the attributes method, cdata-section-elements, suppress-indentation, and use-character-maps, the effective value of the attribute contains a space-separated list of EQNames. If any of these is a lexical QName with a prefix, the prefix is expanded using the applicable static namespaces for the xsl:result-document element. In the case of cdata-section-elements and suppress-indentation, an unprefixed element name is expanded using the default namespace. In the case of the method attribute, if the method is not one of the system-defined methods (xml, html, xhtml, text, json, adaptive) then the expanded name must have a non-absent namespace.

In the case of the attributes method, json-node-output-methodcdata-section-elements, suppress-indentation, and use-character-maps, the effective value of the attribute contains an EQName or a space-separated list of EQNames. Where lexical QNames are used in these attributes (whether prefixed or unprefixed), the namespace context is established in the same way as for the corresponding attributes of xsl:output: see 26.2 Serialization parameters.

The output-version attribute on the xsl:result-document instruction overrides the version attribute on xsl:output (it has been renamed because version is available with a different meaning as a standard attribute: see 3.4 Standard Attributes). In all other cases, attributes correspond if they have the same name.

There are some serialization parameters that apply to some output methods but not to others. For example, the indent attribute has no effect on the text output method. If a value is supplied for an attribute that is inapplicable to the output method, its value is not passed to the serializer. The processor may validate the value of such an attribute, but is not required to do so.

The item-separator serialization parameter is used when the raw result is used to construct a result tree by applying sequence normalization, and it is also used when the result tree is serialized. For example, if the sequence constructor delivers a sequence of integers, and the text serialization method is used, then the result of serialization will be a string obtained by converting each integer to a string, and separating the strings using the defined item-separator.

The href attribute is optional. The default value is the zero-length string. The effective value of the attribute must be a URI Reference, which may be absolute or relative. If it is relative, then it is resolved against the base output URI. There may be implementation-defined restrictions on the form of absolute URI that may be used, but the implementation is not required to enforce any restrictions. Any valid relative URI reference must be accepted. Note that the zero-length string is a valid relative URI reference.

If the implementation provides an API to access secondary results, then it must allow a secondary result to be identified by means of the absolutized value of the href attribute. In addition, if a final result tree is constructed (that is, if the effective value of build-tree is yes), then this value is used as the base URI of the document node at the root of the final result tree.

Note:

The base URI of the final result tree is not necessarily the same thing as the URI of its serialized representation on disk, if any. For example, a server (or browser client) might store final result trees only in memory, or in an internal disk cache. As long as the processor satisfies requests for those URIs, it is irrelevant where they are actually written on disk, if at all.

Note:

It will often be the case that one final result tree contains links to another final result tree produced during the same transformation, in the form of a relative URI reference. The mechanism of associating a URI with a final result tree has been chosen to allow the integrity of such links to be preserved when the trees are serialized.

As well as being potentially significant in any API that provides access to final result trees, the base URI of the new document node is relevant if the final result tree, rather than being serialized, is supplied as input to a further transformation.

The optional attributes type and validation may be used on the xsl:result-document instruction to validate the contents of a final result tree, and to determine the type annotation that elements and attributes within the final result tree will carry. The permitted values and their semantics are described in 25.4.2 Validating Document Nodes. Any such validation is applied to the document node produced as the result of sequence normalizationSER30. If sequence normalization does not take place (typically because the raw result is delivered to the application directly, or because the selected serialization method does not involve sequence normalization) then the validation and type attributes are ignored.

Note:

Validation applies after inserting item separators as determined by the item-separator serialization parameter, and an inappropriate choice of item-separator may cause the result to become invalid.

A processormay allow a final result tree to be serialized. Serialization is described in 26 Serialization. However, an implementation (for example, a processor running in an environment with no access to writable filestore) is not required to support the serialization of final result trees. An implementation that does not support the serialization of final result trees may ignore the format attribute and the serialization attributes. Such an implementation must provide the application with some means of access to the (un-serialized) result tree, using its URI to identify it.

Implementations may provide additional mechanisms, outside the scope of this specification, for defining the way in which final result trees are processed. Such mechanisms may make use of the XSLT-defined attributes on the xsl:result-document and/or xsl:output elements, or they may use additional elements or attributes in an implementation-defined namespace.

Example: Multiple Result Documents

The following example takes an XHTML document as input, and breaks it up so that the text following each <h1> element is included in a separate document. A new document toc.html is constructed to act as an index:

<xsl:stylesheet
	version="3.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xhtml="http://www.w3.org/1999/xhtml">
	
<xsl:output name="toc-format" method="xhtml" indent="yes"
     doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
     doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
            
<xsl:output name="section-format" method="xhtml" indent="no"
     doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
     doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>	
	 
<xsl:template match="/">
  <xsl:result-document href="toc.html" 
                       format="toc-format" 
                       validation="strict">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head><title>Table of Contents</title></head>
      <body>
        <h1>Table of Contents</h1>
        <xsl:for-each select="/*/xhtml:body/(*[1] | xhtml:h1)">
          <p>
            <a href="section{position()}.html">
              <xsl:value-of select="."/>
            </a>
          </p>
        </xsl:for-each>
      </body>
    </html>
  </xsl:result-document>
  <xsl:for-each-group select="/*/xhtml:body/*" group-starting-with="xhtml:h1">
    <xsl:result-document href="section{position()}.html" 
                         format="section-format" validation="strip">  	
      <html xmlns="http://www.w3.org/1999/xhtml">
        <head><title><xsl:value-of select="."/></title></head>
        <body>
          <xsl:copy-of select="current-group()"/>
        </body>
      </html>
    </xsl:result-document>
  </xsl:for-each-group>
</xsl:template>

</xsl:stylesheet>

26 Serialization

A processormay output a final result tree as a sequence of octets, although it is not required to be able to do so (see 27 Conformance). This process is described as serialization. Stylesheet authors can use xsl:output declarations to specify how they wish result trees to be serialized. If a processor serializes a final result tree, it must do so as specified by these declarations.

The rules governing the output of the serializer are defined in [XSLT and XQuery Serialization]. The serialization is controlled using a number of serialization parameters. The values of these serialization parameters may be set within the stylesheet, using the xsl:output, xsl:result-document, and xsl:character-map declarations.

26.2 Defaults for serialization parametersSerialization parameters

Changes in 4.0  

  1. The default value for the indent parameter is now defined to be no for all output methods other than html and xhtml.   [Issue 1548  9 November 2024]

If none of the xsl:output declarations within an output definition specifies a value for a particular attribute, then the corresponding serialization parameter takes a default value. The default value depends on the chosen output method.

There are some serialization parameters that apply to some output methods but not to others. For example, the indent attribute has no effect on the text output method. If a value is supplied for an attribute that is inapplicable to the output method, its value is not passed to the serializer. The processor may validate the value of such an attribute, but is not required to do so.

An implementation may allow the attributes of the xsl:output declaration to be overridden, or the default values to be changed, using the API that controls the transformation.

The location to which final result trees are serialized (whether in filestore or elsewhere) is implementation-defined (which in practice may mean that it is controlled using an implementation-defined API). However, these locations must satisfy the constraint that when two final result trees are both created (implicitly or explicitly) using relative URI references in the href attribute of the xsl:result-document instruction, then these relative URI references may be used to construct references from one tree to the other, and such references must remain valid when both result trees are serialized.

The method attribute on the xsl:output element identifies the overall method that is to be used for outputting the final result tree.

[ERR XTSE1570] The value must (if present) be a valid EQName. If it is a lexical QName with no a prefixin no namespace, then it identifies a method specified in [XSLT and XQuery Serialization] and must be one of xml, html, xhtml, ortext, textjson, or adaptive. If it is a lexical QName with a prefix, then the lexical QName is expanded into an expanded QName as described in 5.1.1 Qualified Names; the. An expanded QName identifies thewith a non-absent namespace identifies an implementation-defined output method; whose the behavior in this case is not specified by this document.

The default for the method attribute depends on the contents of the tree being serialized, and is chosen as follows. If the document node of the final result tree has an element child, and any text nodes preceding the first element child of the document node of the result tree contain only whitespace characters, then:

  • If the expanded QName of this first element child has local part html (in lower case), and namespace URI http://www.w3.org/1999/xhtml, then the default output method is normally xhtml. However, if the effective version of the outermost element of the principal stylesheet module in the top-level package has the value 1.0, and if the result tree is generated implicitly (rather than by an explicit xsl:result-document instruction), then the default output method in this situation is xml.

  • If the expanded QName of this first element child has local part html (in any combination of upper and lower case) and a null namespace URI, then the default output method is html.

In all other cases, the default output method is xml.

The default output method is used if the selected output definition does not include a method attribute.

The other attributes on xsl:output provide parameters for the output method. The following attributes are allowed:

  • The value of the encoding attribute provides the value of the encoding parameter to the serialization method. The default value is implementation-defined, but in the case of the xml and xhtml methods it must be either UTF-8 or UTF-16.

  • The byte-order-mark attribute defines whether a byte order mark is written at the start of the file. If the value yes is specified, a byte order mark is written; if no is specified, no byte order mark is written. The default value depends on the encoding used. If the encoding is UTF-16, the default is yes; for UTF-8 it is implementation-defined, and for all other encodings it is no. The value of the byte order mark indicates whether high order bytes are written before or after low order bytes; the actual byte order used is implementation-dependent, unless it is defined by the selected encoding.

  • The cdata-section-elements attribute is a whitespace-separated list of QNames. The default value is an empty list. After expansion of these names using the applicable static namespaces for the xsl:output declaration in which they appear, this list of names provides the value of the cdata-section-elements parameter to the serialization method. In the case of an unprefixed name, the default namespace (that is, the namespace declared using xmlns="uri") is used.

    Note:

    This differs from the rule for most other QNames used in a stylesheet. The reason is that these names refer to elements in the result document, and therefore follow the same convention as the name of a literal result element or the name attribute of xsl:element.

  • The value of the doctype-system attribute provides the value of the doctype-system parameter to the serialization method. If the attribute is absent or has a zero-length string as its value, then the serialization parameter is not set (is “absent”).

  • The value of the doctype-public attribute provides the value of the doctype-public parameter to the serialization method. If the attribute is absent or has a zero-length string as its value, then the serialization parameter is not set (is “absent”).

    The value of doctype-public must conform to the rules for a PubidLiteralXML (see [XML 1.0]).

  • The value of the escape-solidus attribute provides the value of the escape-solidus parameter to the serialization method. The default value is yes.

  • The value of the escape-uri-attributes attribute provides the value of the escape-uri-attributes parameter to the serialization method. The default value is yes.

  • The value of the html-version attribute provides the value of the html-version parameter to the serialization method. The set of permitted values, and the default value, are implementation-defined. A serialization error will be raised if the requested version is not supported by the implementation.

    Note:

    This serialization parameter is new in version 3.0. If it is absent, the html output method uses the value of the version parameter in its place. For XHTML serialization, the html-version parameter indicates the version of XHTML to be used, while the version parameter indicates the version of XML.

  • The value of the include-content-type attribute provides the value of the include-content-type parameter to the serialization method. The default value is yes.

  • The value of the indent attribute provides the value of the indent parameter to the serialization method. The default value is yes in the case of the html and xhtml output methods, no in the case of all other output methods.

  • The value of the item-separator attribute provides the value of the item-separator parameter to the serialization method. The value of the serialization parameter can be any string (including a zero-length string), or absent. To set the parameter to absent, the item-separator attribute can either be omitted, or set to the special value item-separator="#absent"; it is not possible to set the value of the serialization parameter to the literal 7-character string "#absent".

    Note:

    The item-separator attribute has no effect if the sequence being serialized contains only one item. [XSLT 3.0 Erratum E14, bug 30208].

  • The value of the json-lines attribute determines whether the JSON output method should output multiple JSON values in json-lines format (one value per line). The default value is no.

  • The value of the json-node-output-method attribute determines how any nodes appearing within maps or arrays are serialized by the json output method. The default value is xml. The syntax and semantics of the value follow the same rules as the method attribute.

  • The value of the media-type attribute provides the value of the media-type parameter to the serialization method. The default value is text/xml in the case of the xml output method, text/html in the case of the html and xhtml output methods, and text/plain in the case of the text output method. The default for the json output method is application/json; the default for the adaptive output method is implementation-defined. [XSLT 3.0 Erratum E26, bug 30245].

  • The value of the normalization-form attribute provides the value of the normalization-form parameter to the serialization method. A value that is an NMTOKEN other than one of those enumerated for the normalization-form attribute specifies an implementation-defined normalization form; the behavior in this case is not specified by this document. The default value is none.

  • The value of the omit-xml-declaration attribute provides the value of the omit-xml-declaration parameter to the serialization method. The default value is no.

  • The value of the standalone attribute provides the value of the standalone parameter to the serialization method. The default value is omit; this means that no standalone attribute is to be included in the XML declaration.

  • The suppress-indentation attribute is a whitespace-separated list of QNames. The default value is an empty list. After expansion of these names using the applicable static namespaces for the xsl:output declaration in which they appear, this list of names provides the value of the suppress-indentation parameter to the serialization method. In the case of an unprefixed name, the default namespace (that is, the namespace declared using xmlns="uri") is used.

    Note:

    This differs from the rule for most other QNames used in a stylesheet. The reason is that these names refer to elements in the result document, and therefore follow the same convention as the name of a literal result element or the name attribute of xsl:element.

  • The value of the undeclare-prefixes attribute provides the value of the undeclare-prefixes parameter to the serialization method. The default value is no.

  • The use-character-maps attribute provides a list of named character maps that are used in conjunction with this output definition. The way this attribute is used is described in 26.3 Character Maps. The default value is an empty list.

  • The value of the version attribute provides the value of the version parameter to the serialization method. The set of permitted values, and the default value, are implementation-defined. A serialization error will be raised if the requested version is not supported by the implementation.

If the processor performs serialization, then it must raise any serialization errors that occur. These have the same effect as dynamic errors: that is, the processor must raise the error and must not finish as if the transformation had been successful.

D Summary of Error Conditions (Non-Normative)

This appendix provides a summary of error conditions that a processor may raise. This list includes all error codes defined in this specification, but this is not an exhaustive list of all errors that can occur. Implementations must raise errors using these error codes, and applications can test for these codes; however, when more than one rule in the specification is violated, different processors will not necessarily raise the same error code. Implementations are not required to raise errors using the descriptive text used here.

Note:

The appendix is non-normative because the same information is given normatively elsewhere.

Static errors

ERR XTSE0010

It is a static error if an XSLT-defined element is used in a context where it is not permitted, if a required attribute is omitted, or if the content of the element does not correspond to the content that is allowed for the element.

ERR XTSE0020

It is a static error if an attribute (other than an attribute written using curly brackets in a position where an attribute value template is permitted) contains a value that is not one of the permitted values for that attribute.

ERR XTSE0080

It is a static error to use a reserved namespace in the name of a named template, a mode, an attribute set, a key, a decimal-format, a variable or parameter, a stylesheet function, a named output definition, an accumulator, or a character map; except that the name xsl:initial-template is permitted as a template name.

ERR XTSE0085

It is a static error to use a reserved namespace in the name of any extension function or extension instruction, other than a function or instruction defined in this specification or in a normatively referenced specification. It is a static error to use a prefix bound to a reserved namespace in the [xsl:]extension-element-prefixes attribute.

ERR XTSE0090

It is a static error for an element from the XSLT namespace to have an attribute whose namespace is either null (that is, an attribute with an unprefixed name) or the XSLT namespace, other than attributes defined for the element in this document.

ERR XTSE0110

The value of the version attribute must be a number: specifically, it must be a valid instance of the type xs:decimal as defined in [XML Schema Part 2].

ERR XTSE0120

An xsl:stylesheet, xsl:transform, or xsl:package element must not have any text node children.

ERR XTSE0122

It is a static error if a token appearing in the fixed-namespaces attribute takes a form that is not one of the permitted forms, or if it is interpreted as a URI but cannot be dereferenced to locate a namespace well-formed XML document. It is not permitted to bind the prefix xmlns. It is not permitted to bind the prefix xml or the XML namespace URI http://www.w3.org/XML/1998/namespace, other than to each other.

ERR XTSE0125

It is a static error if the value of an [xsl:]default-collation attribute, after resolving against the base URI, contains no URI that the implementation recognizes as a collation URI.

ERR XTSE0130

It is a static error if an xsl:stylesheet, xsl:transform, or xsl:package element has a child element whose name has a null namespace URI.

ERR XTSE0165

It is a static error if the processor is not able to retrieve the resource identified by the URI reference [ in the href attribute of xsl:include or xsl:import ] , or if the resource that is retrieved does not contain a stylesheet module.

ERR XTSE0170

An xsl:include element must be a top-level element.

ERR XTSE0190

An xsl:import element must be a top-level element.

ERR XTSE0210

It is a static error if a stylesheet module directly or indirectly references itself via a chain of xsl:include and xsl:import declarations that contains at least one xsl:import.

ERR XTSE0215

It is a static error if an xsl:import-schema element that contains an xs:schema element has a schema-location attribute, or if it has a namespace attribute that conflicts with the target namespace of the contained schema.

ERR XTSE0220

It is a static error if the synthetic schema document does not satisfy the constraints described in [XML Schema Part 1] (section 5.1, Errors in Schema Construction and Structure). This includes, without loss of generality, conflicts such as multiple definitions of the same name.

ERR XTSE0260

Within an XSLT element that is required to be empty, any content other than comments or processing instructions, including any whitespace text node preserved using the xml:space="preserve" attribute, is a static error.

ERR XTSE0265

It is a static error if there is a stylesheet module in a package that specifies input-type-annotations="strip" and another stylesheet module that specifies input-type-annotations="preserve", or if a stylesheet module specifies the value strip or preserve and the same value is not specified on the xsl:package element of the containing package.

ERR XTSE0270

It is a static error if within any package the same NameTestXP appears in both an xsl:strip-space and an xsl:preserve-space declaration if both have the same import precedence. Two NameTests are considered the same if they match the same set of names (which can be determined by comparing them after expanding namespace prefixes to URIs).

ERR XTSE0280

In the case of a prefixed lexical QName used as the value (or as part of the value) of an attribute in the stylesheet, or appearing within an XPath expression in the stylesheet, it is a static error if the defining element has no namespace node whose name matches the prefix of the lexical QName.

ERR XTSE0340

Where an attribute is defined to contain a pattern, it is a static error if the pattern does not match the production Pattern40.

ERR XTSE0350

It is a static error if an unescaped left curly bracket appears in a fixed part of a value template without a matching right curly bracket.

ERR XTSE0370

It is a static error if an unescaped right curly bracket occurs in a fixed part of a value template.

ERR XTSE0500

An xsl:template element must have either a match attribute or a name attribute, or both. An xsl:template element that has no match attribute must have no mode attribute and no priority attribute. An xsl:template element that has no name attribute must have no visibility attribute.

ERR XTSE0530

The value of the priority attribute [ of the xsl:template element] must conform to the rules for the xs:decimal type defined in [XML Schema Part 2]. Negative values are permitted.

ERR XTSE0545

It is a static error if for any named or unnamed mode, a package explicitly specifies two conflicting values for the same attribute in different xsl:mode declarations having the same import precedence, unless there is another definition of the same attribute with higher import precedence. The attributes in question are the attributes other than name on the xsl:mode element.

ERR XTSE0550

It is a static error if the list of modes [in the mode attribute of xsl:template ] is empty, if the same token is included more than once in the list, if the list contains an invalid token, or if the token #all appears together with any other value.

ERR XTSE0580

It is a static error if the values of the name attribute of two sibling xsl:param elements represent the same expanded QName.

ERR XTSE0620

It is a static error if a variable-binding element has a select attribute and has non-empty content.

ERR XTSE0630

It is a static error if a package contains more than one non-hidden binding of a global variable with the same name and same import precedence, unless it also contains another binding with the same name and higher import precedence.

ERR XTSE0650

It is a static error if a package contains an xsl:call-template instruction whose name attribute does not match the name attribute of any named template visible in the containing package (this includes any template defined in this package, as well as templates accepted from used packages whose visibility in this package is not hidden). For more details of the process of binding the called template, see 3.5.3.5 Binding References to Components.

ERR XTSE0660

It is a static error if a package contains more than one non-hidden template with the same name and the same import precedence, unless it also contains a template with the same name and higher import precedence.

ERR XTSE0670

It is a static error if two or more sibling xsl:with-param elements have name attributes that represent the same expanded QName.

ERR XTSE0680

In the case of xsl:call-template, it is a static error to pass a non-tunnel parameter named x to a template that does not have a non-tunnel template parameter named x, unless the xsl:call-template instruction is processed with XSLT 1.0 behavior.

ERR XTSE0690

It is a static error if a package contains both (a) a named template named T that is not overridden by another named template of higher import precedence and that has an explicitly mandatory non-tunnel parameter named P, and (b) an xsl:call-template instruction whose name attribute equals T and that has no non-tunnel xsl:with-param child element whose name attribute equals P. (All names are compared as QNames.)

ERR XTSE0710

It is a static error if the value of the use-attribute-sets attribute of an xsl:copy, xsl:element, or xsl:attribute-set element, or the xsl:use-attribute-sets attribute of a literal result element, is not a whitespace-separated sequence of EQNames, or if it contains an EQName that does not match the name attribute of any xsl:attribute-set declaration in the containing package.

ERR XTSE0730

If an xsl:attribute set element specifies streamable="yes" then every attribute set referenced in its use-attribute-sets attribute (if present) must also specify streamable="yes".

ERR XTSE0740

It is a static error if a stylesheet function has a name that is in no namespace.

ERR XTSE0760

It is a static error if an xsl:param child of an xsl:function element has either a select attribute or non-empty content, unless it specifies required="no".

ERR XTSE0761

It is a static error if an xsl:param child of an xsl:function element specifies required="no", unless all following-sibling xsl:param elements also specify required="no".

ERR XTSE0769

It is a static error for a package to contain an xsl:function declaration F and an xsl:function declaration G such that F and G have the same expanded QName, F has lower import precedence than G, and the arity range of G includes part but not all of the arity range of F, unless G is itself eclipsed by another xsl:function declaration.

ERR XTSE0770

It is a static error for a package to contain an xsl:function declaration F and an xsl:function declaration G such that F and G have the same expanded QName and the same import precedence, if the arity ranges of F and G overlap in whole or in part, unless F and G are both eclipsed by another xsl:function declaration.

ERR XTSE0805

It is a static error if an attribute on a literal result element is in the XSLT namespace, unless it is one of the attributes explicitly defined in this specification.

ERR XTSE0808

It is a static error if a namespace prefix is used within the [xsl:]exclude-result-prefixes attribute and there is no namespace binding in scope for that prefix.

ERR XTSE0809

It is a static error if the value #default is used within the [xsl:]exclude-result-prefixes attribute and the parent element of the [xsl:]exclude-result-prefixes attribute has no default namespace.

ERR XTSE0810

It is a static error if within a package there is more than one such declaration [more than one xsl:namespace-alias declaration] with the same literal namespace URI and the same import precedence and different values for the target namespace URI, unless there is also an xsl:namespace-alias declaration with the same literal namespace URI and a higher import precedence.

ERR XTSE0812

It is a static error if a value other than #default is specified for either the stylesheet-prefix or the result-prefix attributes of the xsl:namespace-alias element when there is no in-scope binding for that namespace prefix.

ERR XTSE0840

It is a static error if the select attribute of the xsl:attribute element is present unless the element has empty content.

ERR XTSE0870

It is a static error if the select attribute of the xsl:value-of element is present when the content of the element is non-empty.

ERR XTSE0880

It is a static error if the select attribute of the xsl:processing-instruction element is present unless the element has empty content.

ERR XTSE0910

It is a static error if the select attribute of the xsl:namespace element is present when the element has content other than one or more xsl:fallback instructions, or if the select attribute is absent when the element has empty content.

ERR XTSE0940

It is a static error if the select attribute of the xsl:comment element is present unless the element has empty content.

ERR XTSE0975

It is a static error if the value attribute of xsl:number is present unless the select, level, count, and from attributes are all absent.

ERR XTSE1015

It is a static error if an xsl:sort element with a select attribute has non-empty content.

ERR XTSE1017

It is a static error if an xsl:sort element other than the first in a sequence of sibling xsl:sort elements has a stable attribute.

ERR XTSE1040

It is a static error if an xsl:perform-sort instruction with a select attribute has any content other than xsl:sort and xsl:fallback instructions.

ERR XTSE1060

It is a static error if the current-group function is used within a pattern.

ERR XTSE1070

It is a static error if the current-grouping-key function is used within a pattern.

ERR XTSE1080

These five attributes [the group-by, group-adjacent, group-starting-with, group-ending-with, and split-when attributes of xsl:for-each-group ] are mutually exclusive: it is a static error if none of these attributes is present or if more than one of them is present.

ERR XTSE1090

It is a static error to specify the collation attribute or the composite attribute if neither the group-by attribute nor group-adjacent attribute is specified.

ERR XTSE1130

It is a static error if the xsl:analyze-string instruction contains neither an xsl:matching-substring nor an xsl:non-matching-substring element.

ERR XTSE1205

It is a static error if an xsl:key declaration has a use attribute and has non-empty content, or if it has empty content and no use attribute.

ERR XTSE1210

It is a static error if the xsl:key declaration has a collation attribute whose value (after resolving against the base URI) is not a URI recognized by the implementation as referring to a collation.

ERR XTSE1220

It is a static error if there are several xsl:key declarations in the same package with the same key name and different effective collations. Two collations are the same if their URIs are equal under the rules for comparing xs:anyURI values, or if the implementation can determine that they are different URIs referring to the same collation.

ERR XTSE1222

It is a static error if there are several xsl:key declarations in a package with the same key name and different effective values for the composite attribute.

ERR XTSE1290

It is a static error if a named or unnamed decimal format contains two conflicting values for the same attribute in different xsl:decimal-format declarations having the same import precedence, unless there is another definition of the same attribute with higher import precedence.

ERR XTSE1295

It is a static error if the character specified in the zero-digit attribute is not a digit or is a digit that does not have the numeric value zero.

ERR XTSE1300

It is a static error if, for any named or unnamed decimal format, the properties identifying marker characters to be used in a picture string do not identify distinct values. These properties are decimal-separator, grouping-separator, exponent-separator, percent, per-mille, zero-digit, digit, and pattern-separator.

ERR XTSE1430

It is a static error if there is no namespace bound to the prefix on the element bearing the [xsl:]extension-element-prefixes attribute or, when #default is specified, if there is no default namespace.

ERR XTSE1505

It is a static error if both the [xsl:]type and [xsl:]validation attributes are present on the xsl:element, xsl:attribute, xsl:copy, xsl:copy-of, xsl:document, xsl:result-document, xsl:source-document, or xsl:merge-source elements, or on a literal result element.

ERR XTSE1520

It is a static error if the value of the type attribute of an xsl:element, xsl:attribute, xsl:copy, xsl:copy-of, xsl:document, xsl:result-document, xsl:source-document, or xsl:merge-source instruction, or the xsl:type attribute of a literal result element, is not a valid QName, or if it uses a prefix that is not defined in the applicable static namespaces of the containing instruction, or if the QName is not the name of a type definition included in the in-scope schema components for the package. [XSLT 3.0 Erratum E20, bug 30234]

ERR XTSE1530

It is a static error if the value of the type attribute of an xsl:attribute instruction refers to a complex type definition

ERR XTSE1560

It is a static error if two xsl:output declarations within an output definition specify explicit values for the same attribute (other than cdata-section-elements, suppress-indentation, and use-character-maps), with the values of the attributes being not equal, unless there is another xsl:output declaration within the same output definition that has higher import precedence and that specifies an explicit value for the same attribute.

ERR XTSE1570

The value [of the method attribute on xsl:output ] must (if present) be a valid EQName. If it is a lexical QName with no a prefixin no namespace, then it identifies a method specified in [XSLT and XQuery Serialization] and must be one of xml, html, xhtml, ortext, textjson, or adaptive.

ERR XTSE1580

It is a static error if a package contains two or more character maps with the same name and the same import precedence, unless it also contains another character map with the same name and higher import precedence.

ERR XTSE1590

It is a static error if a name in the use-character-maps attribute of the xsl:output or xsl:character-map elements does not match the name attribute of any xsl:character-map in the containing package.

ERR XTSE1600

It is a static error if a character map references itself, directly or indirectly, via a name in the use-character-maps attribute.

ERR XTSE1650

A non-schema-aware processormust raise a static error if a package includes an xsl:import-schema declaration.

ERR XTSE1660

A non-schema-aware processormust raise a static error if a package includes an [xsl:]type attribute; or an [xsl:]validation or [xsl:]default-validation attribute with a value other than strip, preserve, or lax; or an xsl:mode element whose typed attribute is equal to yes or strict; or an as attribute whose value is a SequenceType that can only match nodes with a type annotation other than xs:untyped or xs:untypedAtomic (for example, as="element(*, xs:integer)").

ERR XTSE2200

It is a static error if the number of xsl:merge-key children of a xsl:merge-source element is not equal to the number of xsl:merge-key children of another xsl:merge-source child of the same xsl:merge instruction.

ERR XTSE3000

It is a static error if no package matching the package name and version specified in an xsl:use-package declaration can be located.

ERR XTSE3005

It is a static error if a package is dependent on itself, where package A is defined as being dependent on package B if A contains an xsl:use-package declaration that references B, or if A contains an xsl:use-package declaration that references a package C that is itself dependent on B.

ERR XTSE3008

It is a static error if an xsl:use-package declaration appears in a stylesheet module that is not in the same stylesheet level as the principal stylesheet module of the package.

ERR XTSE3010

It is a static error if the explicit exposed visibility of a component is inconsistent with its declared visibility, as defined in the above table. (This error occurs only when the component declaration has an explicit visibility attribute, and the component is also listed explicitly by name in an xsl:expose declaration.)

ERR XTSE3020

It is a static error if a token in the names attribute of xsl:expose, other than a wildcard, matches no component in the containing package.

ERR XTSE3022

It is a static error if the component attribute of xsl:expose specifies * (meaning all component kinds) and the names attribute is not a wildcard.

ERR XTSE3025

It is a static error if the effect of an xsl:expose declaration would be to make a component abstract, unless the component is already abstract in the absence of the xsl:expose declaration.

ERR XTSE3030

It is a static error if a token in the names attribute of xsl:accept, other than a wildcard, matches no component in the used package.

ERR XTSE3032

It is a static error if the component attribute of xsl:accept specifies * (meaning all component kinds) and the names attribute is not a wildcard.

ERR XTSE3040

It is a static error if the visibility assigned to a component by an xsl:accept element is incompatible with the visibility of the corresponding component in the used package, as defined by the above table, unless the token that matches the component name is a wildcard, in which case the xsl:accept element is treated as not matching that component.

ERR XTSE3050

It is a static error if the xsl:use-package elements in a package manifest cause two or more homonymous components to be accepted with a visibility other than hidden.

ERR XTSE3051

It is a static error if a token in the names attribute of xsl:accept, other than a wildcard, matches the symbolic name of a component declared within an xsl:override child of the same xsl:use-package element.

ERR XTSE3055

It is a static error if a component declaration appearing as a child of xsl:override is homonymous with any other declaration in the using package, regardless of import precedence, including any other overriding declaration in the package manifest of the using package.

ERR XTSE3058

It is a static error if a component declaration appearing as a child of xsl:override does not match (is not homonymous with) some component in the used package.

ERR XTSE3060

It is a static error if the component referenced by an xsl:override declaration has visibility other than public or abstract

ERR XTSE3070

It is a static error if the signature of an overriding component is not compatible with the signature of the component that it is overriding.

ERR XTSE3075

It is a static error to use the component reference xsl:original when the overridden component has visibility="abstract".

ERR XTSE3080

It is a static error if a top-level package (as distinct from a library package) contains components whose visibility is abstract.

ERR XTSE3085

It is a static error, when the effective value of the declared-modes attribute of an xsl:package element is yes, if the package contains an explicit reference to an undeclared mode, or if it implicitly uses the unnamed mode and the unnamed mode is undeclared.

ERR XTSE3087

It is a static error if more than one xsl:global-context-item declaration appears within a stylesheet module, or if several modules within a single package contain inconsistent xsl:global-context-item declarations

ERR XTSE3088

It is a static error if the as attribute is present [on the xsl:context-item element] when use="absent" is specified.

ERR XTSE3089

It is a static error if the as attribute is present [on the xsl:global-context-item element] when use="absent" is specified.

ERR XTSE3105

It is a static error if a template rule applicable to a mode that is defined with typed="strict" uses a match pattern that contains a RelativePathExprP whose first StepExprP is an AxisStepP whose ForwardStepP uses an axis whose principal node kind is Element and whose NodeTest is an EQName that does not correspond to the name of any global element declaration in the in-scope schema components.

ERR XTSE3120

It is a static error if an xsl:break or xsl:next-iteration element appears other than in a tail position within the sequence constructor forming the body of an xsl:iterate instruction.

ERR XTSE3125

It is a static error if the select attribute of xsl:break or xsl:on-completion is present and the instruction has children.

ERR XTSE3130

It is a static error if the name attribute of an xsl:with-param child of an xsl:next-iteration element does not match the name attribute of an xsl:param child of the innermost containing xsl:iterate instruction.

ERR XTSE3140

It is a static error if the select attribute of the xsl:try element is present and the element has children other than xsl:catch and xsl:fallback elements.

ERR XTSE3150

It is a static error if the select attribute of the xsl:catch element is present unless the element has empty content.

ERR XTSE3185

For the elements xsl:sequence, xsl:on-empty, xsl:on-non-empty, xsl:when, xsl:otherwise, xsl:matching-substring, xsl:non-matching-substring, xsl:map, xsl:map-entry, xsl:array, xsl:array-member, and xsl:result-document, it is a static error if the select attribute is present and the instruction has children other than xsl:fallback.

ERR XTSE3190

It is a static error if two sibling xsl:merge-source elements have the same name.

ERR XTSE3195

If the for-each-item attribute is present then the for-each-source, use-accumulators, and streamable attributes must all be absent. If either or both of the use-accumulators or streamable attributes is present then the for-each-source attribute must be present. If the for-each-source attribute is present then the for-each-item attribute must be absent. [XSLT 3.0 Erratum E40, bugs 30265 and 30378].

ERR XTSE3200

It is a static error if an xsl:merge-key element with a select attribute has non-empty content.

ERR XTSE3300

It is a static error if the list of accumulator names [in the use-accumulators attribute] contains an invalid token, contains the same token more than once, or contains the token #all along with any other value; or if any token (other than #all) is not the name of a declared-streamable accumulator visible in the containing package.

ERR XTSE3350

It is a static error for a package to contain two or more accumulators with the same expanded QName and the same import precedence, unless there is another accumulator with the same expanded QName, and a higher import precedence.

ERR XTSE3355

It is a static error for a an xsl:accumulator-rule element to specify capture="yes" unless it also specifies phase="end".

ERR XTSE3430

It is a static error if a package contains a construct that is declared to be streamable but which is not guaranteed-streamable, unless the user has indicated that the processor is to handle this situation by processing the stylesheet without streaming or by making use of processor extensions to the streamability rules where available.

ERR XTSE3440

In the case of a template rule (that is, an xsl:template element having a match attribute) appearing as a child of xsl:override, it is a static error if the list of modes in the mode attribute contains #all or #unnamed, or if it contains #default and the default mode is the unnamed mode, or if the mode attribute is omitted when the default mode is the unnamed mode.

ERR XTSE3450

It is a static error if a variable declared with static="yes" is inconsistent with another static variable of the same name that is declared earlier in stylesheet tree order and that has lower import precedence.

ERR XTSE3460

It is a static error if an xsl:apply-imports element appears in a template rule declared within an xsl:override element. (To invoke the template rule that is being overridden, xsl:next-match should therefore be used.)

ERR XTSE3470

It is a static error if the current-merge-group function is used within a pattern.

ERR XTSE3500

It is a static error if the current-merge-key-array or current-merge-key function is used within a pattern.

ERR XTSE3520

It is a static error if a parameter to xsl:iterate is implicitly mandatory.

ERR XTSE4005

It is a static error if an xsl:mode declaration with one or more xsl:template children has no name attribute.

ERR XTSE4010

It is a static error if an xsl:mode declaration has a child xsl:template element with a name attribute, with a mode attribute, or with no match attribute.

ERR XTSE4015

It is a static error if an xsl:mode declaration having one or more child xsl:template elements has a default-mode attribute whose value differs from its name attribute, or if any of those child xsl:template elements has a default-mode attribute that differs from the name attribute of the xsl:mode declaration.

ERR XTSE4020

It is a static error if a package contains both (a) an xsl:mode declaration having one or more child xsl:template elements, and (b) an xsl:template declaration that is not one of those children but that references that xsl:mode declaration in its mode attribute.

ERR XTSE4025

It is a static error if a package contains (a) an xsl:mode declaration having one or more child xsl:template elements, and (b) a second xsl:mode declaration having the same name and the same import precedence.

ERR XTSE4030

It is a static error if a package contains two xsl:item-type or xsl:record-type declarations having the same name and the same import precedence, unless there is another definition with the same name and higher import precedence. It is also a static error if the name of the item type uses a reserved namespace, or if it has the same name as a type in the in-scope schema typesXP of the static context.

ERR XTSE4035

It is a static error for an item type named N to contain in its as attribute a reference to N, or to an item type that references N directly or indirectly.

ERR XTSE4040

It is a static error if a template ruleR has an as attribute S, and the template rule is applicable to a modeM that is declared with an as attribute T, and the sequence type S is not a subtype of the sequence type T as defined by the relationship subtype(S, T) in Section 3.3.1 Subtypes of Sequence TypesXP.

ERR XTSE4045

It is a static error if the value of any [xsl:]schema-role in a stylesheet package does not match the value of the role attribute on some xsl:import-schema element in the same package.

ERR XTSE4050

It is a static error if the names of the fields in an xsl:record-type declaration are not distinct.

ERR XTSE4051

It is a static error if an xsl:field element has a default attribute unless it specifies required="no".

Type errors

ERR XTDE0450

It is a type error if the result sequence contains a function item.

ERR XTTE0505

It is a type error if the result of evaluating the sequence constructor cannot be coerced to the required type.

ERR XTTE0510

It is a type error if an xsl:apply-templates instruction with no select attribute is evaluated when the context item is not a node.

ERR XTTE0570

It is a type error if the supplied value of a variable cannot be converted to the required type.

ERR XTTE0590

It is a type error if the conversion of the supplied value of a parameter, or of the context item, does not match the required type, after applying any permitted conversions. [XSLT 3.0 Erratum E22, bug 30238].

ERR XTTE0780

If the as attribute [of xsl:function ] is specified, then the result evaluated by the sequence constructor (see 5.8 Sequence Constructors) is converted to the required type, using the coercion rules. It is a type error if this conversion fails.

ERR XTTE0945

It is a type error to use the xsl:copy instruction with no select attribute when the context item is absent.

ERR XTTE0950

It is a type error to use the xsl:copy or xsl:copy-of instruction to copy a node that has namespace-sensitive content if the copy-namespaces attribute has the value no and its explicit or implicit validation attribute has the value preserve. It is also a type error if either of these instructions (with validation="preserve") is used to copy an attribute having namespace-sensitive content, unless the parent element is also copied. A node has namespace-sensitive content if its typed value contains an item of type xs:QName or xs:NOTATION or a type derived therefrom. The reason this is an error is because the validity of the content depends on the namespace context being preserved.

ERR XTTE0990

It is a type error if the xsl:number instruction is evaluated, with no value or select attribute, when the context item is not a node.

ERR XTTE1000

It is a type error if the result of evaluating the select attribute of the xsl:number instruction is anything other than a single node.

ERR XTTE1100

It is a type error if the result of evaluating the group-adjacent expression is an empty sequence or a sequence containing more than one item, unless composite="yes" is specified.

ERR XTTE1510

If the validation attribute of an xsl:element, xsl:attribute, xsl:copy, xsl:copy-of, or xsl:result-document instruction, or the xsl:validation attribute of a literal result element, has the effective valuestrict, and schema validity assessment concludes that the validity of the element or attribute is invalid or unknown, a type error occurs. As with other type errors, the error may be raised statically if it can be detected statically.

ERR XTTE1512

If the validation attribute of an xsl:element, xsl:attribute, xsl:copy, xsl:copy-of, or xsl:result-document instruction, or the xsl:validation attribute of a literal result element, has the effective valuestrict, and there is no matching top-level declaration in the schema, then a type error occurs. As with other type errors, the error may be raised statically if it can be detected statically.

ERR XTTE1515

If the validation attribute of an xsl:element, xsl:attribute, xsl:copy, xsl:copy-of, or xsl:result-document instruction, or the xsl:validation attribute of a literal result element, has the effective valuelax, and schema validity assessment concludes that the element or attribute is invalid, a type error occurs. As with other type errors, the error may be raised statically if it can be detected statically.

ERR XTTE1535

It is a type error if the value of the type attribute of an xsl:copy or xsl:copy-of instruction refers to a complex type definition and one or more of the items being copied is an attribute node.

ERR XTTE1540

It is a type error if an [xsl:]type attribute is defined for a constructed element or attribute, and the outcome of schema validity assessment against that type is that the validity property of that element or attribute information item is other than valid.

ERR XTTE1545

A type error occurs if a type or validation attribute is defined (explicitly or implicitly) for an instruction that constructs a new attribute node, if the effect of this is to cause the attribute value to be validated against a type that is derived from, or constructed by list or union from, the primitive types xs:QName or xs:NOTATION.

ERR XTTE1550

A type error occurs [when a document node is validated] unless the children of the document node comprise exactly one element node, no text nodes, and zero or more comment and processing instruction nodes, in any order.

ERR XTTE1555

It is a type error if, when validating a document node, document-level constraints (such as ID/IDREF constraints) are not satisfied.

ERR XTTE2230

It is a type error if some item selected by a particular merge key in one input sequence is not comparable using the XPath le operator with the corresponding item selected by the corresponding sort key in another input sequence.

ERR XTTE3090

It is a type error if the xsl:context-item child of xsl:template specifies that a context item is required and none is supplied by the caller, that is, if the context item is absent at the point where xsl:call-template is evaluated.

ERR XTTE3100

It is a type error if an xsl:apply-templates instruction in a particular mode selects an element or attribute whose type is xs:untyped or xs:untypedAtomic when the typed attribute of that mode specifies the value yes, strict, or lax.

ERR XTTE3110

It is a type error if an xsl:apply-templates instruction in a particular mode selects an element or attribute whose type is anything other than xs:untyped or xs:untypedAtomic when the typed attribute of that mode specifies the value no.

ERR XTTE3165

It is a type error if the result of evaluating the expression in the with-params attribute of the xsl:evaluate instruction is anything other than a single map of type map(xs:QName, item()*).

ERR XTTE3170

It is a type error if the result of evaluating the namespace-context attribute of the xsl:evaluate instruction is anything other than a single node.

ERR XTTE3180

It is a type error if the result of evaluating the select expression [of the xsl:copy element] is a sequence of more than one item.

ERR XTTE3375

A type error occurs if the result of the input sequence [of an xsl:map instruction] is not an instance of the required type map(*)*.

ERR XTTE4045

A type error is raised if the result of evaluating the select expression or contained sequence constructor of an xsl:array instruction is not an instance of one of the following sequence types: empty-sequence(), xs:anyAtomicType+, node()+, or record(value as item()*, *)+. As with other type errors, the error may be raised statically if it can be detected statically.

Dynamic errors

ERR XTDE0030

It is a dynamic error if the effective value of an attribute written using curly brackets, in a position where an attribute value template is permitted, is a value that is not one of the permitted values for that attribute. If the processor is able to detect the error statically (for example, when any XPath expressions within the curly brackets can be evaluated statically), then the processor may optionally raise this as a static error.

ERR XTDE0040

It is a dynamic error if the invocation of the stylesheet specifies a template name that does not match the expanded QName of a named template defined in the stylesheet, whose visibility is public or final.

ERR XTDE0041

It is a dynamic error if the invocation of the stylesheet specifies a function name and arity that does not match the expanded QName and arity of a named stylesheet function defined in the stylesheet, whose visibility is public or final.

ERR XTDE0044

It is a dynamic error if the invocation of the stylesheet specifies an initial mode when no initial match selection is supplied (either explicitly, or defaulted to the global context item).

ERR XTDE0045

It is a dynamic error if the invocation of the stylesheet specifies an initial mode and the specified mode is not eligible as an initial mode (as defined above).

ERR XTDE0050

It is a dynamic error if a stylesheet declares a visible stylesheet parameter that is explicitly or implicitly mandatory, and no value for this parameter is supplied when the stylesheet is primed. A stylesheet parameter is visible if it is not masked by another global variable or parameter with the same name and higher import precedence. If the parameter is a static parameter then the value must be supplied prior to the static analysis phase.

ERR XTDE0160

It is a dynamic error if an element has an effective version of V (with V < 4.0) when the implementation does not support backwards compatible behavior for XSLT version V.

ERR XTDE0290

Where the result of evaluating an XPath expression (or an attribute value template) is required to be a lexical QName, or if it is permitted to be a lexical QName and the actual value takes the form of a lexical QName, then unless otherwise specified it is a dynamic error if the value has a prefix and the defining element has no namespace node whose name matches that prefix. This error may be raised as a static error if the value of the expression can be determined statically.

ERR XTDE0410

It is a dynamic error if the sequence used to construct the content of an element node contains a namespace node or attribute node that is preceded in the sequence by a node that is neither a namespace node nor an attribute node.

ERR XTDE0420

It is a dynamic error if the sequence used to construct the content of a document node contains a namespace node or attribute node.

ERR XTDE0430

It is a dynamic error if the sequence contains two or more namespace nodes having the same name but different string values (that is, namespace nodes that map the same prefix to different namespace URIs).

ERR XTDE0440

It is a dynamic error if the sequence contains a namespace node with no name and the element node being constructed has a null namespace URI (that is, it is an error to define a default namespace when the element is in no namespace).

ERR XTDE0540

It is a dynamic error if the conflict resolution algorithm for template rules leaves more than one matching template rule when the declaration of the relevant mode has an on-multiple-match attribute with the value fail.

ERR XTDE0555

It is a dynamic error if xsl:apply-templates, xsl:apply-imports or xsl:next-match is used to process an item using a mode whose declaration specifies on-no-match="fail" when there is no template rule in the stylesheet whose match pattern matches that item.

ERR XTDE0560

It is a dynamic error if xsl:apply-imports or xsl:next-match is evaluated when the current template rule is absent.

ERR XTDE0640

In general, a circularity in a stylesheet is a dynamic error.

ERR XTDE0700

It is a dynamic error if a template that has an explicitly mandatory or implicitly mandatory parameter is invoked without supplying a value for that parameter.

ERR XTDE0820

It is a dynamic error if the effective value of the name attribute [of the xsl:element instruction] is not a lexical QName.

ERR XTDE0830

In the case of an xsl:element instruction with no 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 applicable static namespaces for the xsl:element instruction.

ERR XTDE0835

It is a dynamic error if the effective value of the namespace attribute [of the xsl:element instruction] is not in the lexical space of the xs:anyURI datatype or if it is the string http://www.w3.org/2000/xmlns/.

ERR XTDE0850

It is a dynamic error if the effective value of the name attribute [of an xsl:attribute instruction] is not a lexical QName.

ERR XTDE0855

In the case of an xsl:attribute instruction with no namespace attribute, it is a dynamic error if the effective value of the name attribute is the string xmlns.

ERR XTDE0860

In the case of an xsl:attribute instruction with no 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 applicable static namespaces for the xsl:attribute instruction.

ERR XTDE0865

It is a dynamic error if the effective value of the namespace attribute [of the xsl:attribute instruction] is not in the lexical space of the xs:anyURI datatype or if it is the string http://www.w3.org/2000/xmlns/.

ERR XTDE0890

It is a dynamic error if the effective value of the name attribute [of the xsl:processing-instruction instruction] is not both an NCNameNames and a PITargetXML.

ERR XTDE0905

It is a dynamic error if the string value of the new namespace node is not valid in the lexical space of the datatype xs:anyURI, or if it is the string http://www.w3.org/2000/xmlns/.

ERR XTDE0920

It is a dynamic error if the effective value of the name attribute [of the xsl:namespace instruction] is neither a zero-length string nor an NCNameNames, or if it is xmlns.

ERR XTDE0925

It is a dynamic error if the xsl:namespace instruction generates a namespace node whose name is xml and whose string value is not http://www.w3.org/XML/1998/namespace, or a namespace node whose string value is http://www.w3.org/XML/1998/namespace and whose name is not xml.

ERR XTDE0930

It is a dynamic error if evaluating the select attribute or the contained sequence constructor of an xsl:namespace instruction results in a zero-length string.

ERR XTDE0980

It is a dynamic error if any undiscarded item in the atomized sequence supplied as the value of the value attribute of xsl:number cannot be converted to an integer, or if the resulting integer is less than 0 (zero).

ERR XTDE1030

It is a dynamic error if, for any sort key component, the set of sort key values evaluated for all the items in the initial sequence, after any type conversion requested, contains a pair of atomic items for which the result of the XPath lt operator is an error. If the processor is able to detect the error statically, it may optionally raise it as a static error.

ERR XTDE1035

It is a dynamic error if the collation attribute of xsl:sort (after resolving against the base URI) is not a URI that is recognized by the implementation as referring to a collation.

ERR XTDE1061

It is a dynamic error if the current-group function is used when the current group is absent , or when it is invoked in the course of evaluating a pattern. The error may be reported statically if it can be detected statically.

ERR XTDE1071

It is a dynamic error if the current-grouping-key function is used when the current grouping key is absent, or when it is invoked in the course of evaluating a pattern. The error may be reported statically if it can be detected statically.

ERR XTDE1110

It is a dynamic error if the collation URI specified to xsl:for-each-group (after resolving against the base URI) is a collation that is not recognized by the implementation. (For notes, [see ERR XTDE1035].)

ERR XTDE1140

It is a dynamic error if the effective value of the regex attribute [of the xsl:analyze-string instruction] does not conform to the required syntax for regular expressions, as specified in [Functions and Operators 4.0]. If the regular expression is known statically (for example, if the attribute does not contain any expressions enclosed in curly brackets) then the processor may raise the error as a static error.

ERR XTDE1145

It is a dynamic error if the effective value of the flags attribute [of the xsl:analyze-string instruction] has a value other than the values defined in [Functions and Operators 4.0]. If the value of the attribute is known statically (for example, if the attribute does not contain any expressions enclosed in curly brackets) then the processor may raise the error as a static error.

ERR XTDE1160

When a URI reference [supplied to the document function] contains a fragment identifier, it is a dynamic error if the media type is not one that is recognized by the processor, or if the fragment identifier does not conform to the rules for fragment identifiers for that media type, or if the fragment identifier selects something other than a sequence of nodes (for example, if it selects a range of characters within a text node).

ERR XTDE1162

When a URI reference [supplied to the document function] is a relative reference, it is a dynamic error if no base URI is available to resolve the relative reference. This can arise for example when the URI is contained in a node that has no base URI (for example a parentless text node), or when the second argument to the function is a node that has no base URI, or when the base URI from the static context is undefined.

ERR XTDE1260

It is a dynamic error if the value of $key-name is not a valid QName, or if there is no namespace declaration in scope for the prefix of the QName, or if the name obtained by expanding the QName is not the same as the expanded name of any xsl:key declaration in the containing package. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally raise this as a static error.

ERR XTDE1262

It is a dynamic error if the key identified in a call to the function map-for-key is unsuitable because it uses a collation other than the Unicode Codepoint Collation, or because it is defined with composite=yes.

ERR XTDE1270

It is a dynamic error to call the key function with two arguments if there is no context node, or if the root of the tree containing the context node is not a document node; or to call the function with three arguments if the root of the tree containing the node supplied in the third argument is not a document node.

ERR XTDE1360

If the current function is evaluated within an expression that is evaluated when the context item is absent, a dynamic error occurs.

ERR XTDE1370

It is a dynamic error if $node, or the context item if the second argument is omitted, is a node in a tree whose root is not a document node.

ERR XTDE1380

It is a dynamic error if $node, or the context item if the second argument is omitted, is a node in a tree whose root is not a document node.

ERR XTDE1390

It is a dynamic error if the value supplied as the $property-name argument [to the system-property function] is not a valid QName, or if there is no namespace declaration in scope for the prefix of the QName. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally raise this as a static error.

ERR XTDE1400

It is a dynamic error if the $name argument [passed to the function-available function] evaluates to a string that is not a valid EQName, or if the value is a lexical QName with a prefix for which no namespace declaration is present in the static context. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally raise this as a static error.

ERR XTDE1420

It is a dynamic error if the arguments supplied to a call on an extension function do not satisfy the rules defined for that particular extension function, or if the extension function raises an error, or if the result of the extension function cannot be converted to an XPath value.

ERR XTDE1425

When the containing element is processed with XSLT 1.0 behavior, it is a dynamic error to evaluate an extension function call if no implementation of the extension function is available.

ERR XTDE1428

It is a dynamic error if the argument [passed to the type-available function] evaluates to a string that is not a valid EQName, or if the value is a lexical QName with a prefix for which no namespace declaration is present in the static context. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally raise this as a static error.

ERR XTDE1440

It is a dynamic error if the argument [passed to the element-available function] evaluates to a string that is not a valid EQName, or if the value is a lexical QName with a prefix for which no namespace declaration is present in the static context. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally raise this as a static error.

ERR XTDE1450

When a processor performs fallback for an extension instruction that is not recognized, if the instruction element has one or more xsl:fallback children, then the content of each of the xsl:fallback children must be evaluated; it is a dynamic error if it has no xsl:fallback children.

ERR XTDE1460

It is a dynamic error if the effective value of the format attribute [of an xsl:result-document element] is not a valid EQName, or if it does not match the expanded QName of an output definition in the containing package. If the processor is able to detect the error statically (for example, when the format attribute contains no curly brackets), then the processor may optionally raise this as a static error.

ERR XTDE1480

It is a dynamic error to evaluate the xsl:result-document instruction in temporary output state.

ERR XTDE1490

It is a dynamic error for a transformation to generate two or more final result trees with the same URI.

ERR XTDE1500

It is a dynamic error for a stylesheet to write to an external resource and read from the same resource during a single transformation, if the same absolute URI is used to access the resource in both cases.

ERR XTDE1665

A dynamic errormay be raised if the input to the processor includes an item that requires availability of an optional feature that the processor does not provide.

ERR XTDE2210

It is a dynamic error if there are two xsl:merge-key elements that occupy corresponding positions among the xsl:merge-key children of two different xsl:merge-source elements and that have differing effective values for any of the attributes lang, order, collation, case-order, or data-type. Values are considered to differ if they have different effective values. In the case of the collation attribute, the values are compared as absolute URIs after resolving against the base URI. The error may be raised statically if it is detected statically.

ERR XTDE2220

It is a dynamic error if any input sequence to an xsl:merge instruction contains two items that are not correctly sorted according to the merge key values defined on the xsl:merge-key children of the corresponding xsl:merge-source element, when compared using the collation rules defined by the attributes of the corresponding xsl:merge-key children of the xsl:merge instruction, unless the attribute sort-before-merge is present with the value yes.

ERR XTDE3052

It is a dynamic error if an invocation of an abstract component is evaluated.

ERR XTDE3086

It is a dynamic error if an xsl:global-context-item declaration specifies use="required", and no global context item is supplied. [XSLT 3.0 Erratum E6, bug 30173].

ERR XTSE3155

It is a static error if an xsl:function element with no xsl:param children has a streamability attribute with any value other than unclassified.

ERR XTDE3160

It is a dynamic error if the target expression [of an xsl:evaluate instruction] is not a valid expression (that is, if a static error occurs when analyzing the string according to the rules of the XPath specification).

ERR XTDE3175

It is a dynamic error if an xsl:evaluate instruction is evaluated when use of xsl:evaluate has been statically or dynamically disabled.

ERR XTDE3340

It is a dynamic error if the value of the first argument to the accumulator-before or accumulator-after function is a string that is not a valid EQName, or if there is no namespace declaration in scope for the prefix of the QName, or if the name obtained by expanding the QName is not the same as the expanded name of any xsl:accumulator declaration appearing in the package in which the function call appears. If the processor is able to detect the error statically (for example, when the argument is supplied as a string literal), then the processor may optionally raise this as a static error.

ERR XTDE3350

It is a dynamic error to call the accumulator-before or accumulator-after function when there is no context item.

ERR XTTE3360

It is a type error to call the accumulator-before or accumulator-after function when the context item is not a node, or when it is an attribute or namespace node.

ERR XTDE3362

It is a dynamic error to call the accumulator-before or accumulator-after function when the context item is a node in a tree to which the selected accumulator is not applicable (including the case where it is not applicable because the document is streamed and the accumulator is not declared with streamable="yes"). Implementations may raise this error but are not required to do so, if they are capable of streaming documents without imposing this restriction.

ERR XTDE3365

In the absence of the [xsl:]duplicates attribute, a dynamic error occurs if the set of keys in the maps making up the input sequence [of an xsl:map or xsl:record instruction] contains duplicates.

ERR XTDE3400

It is an error if there is a cyclic set of dependencies among accumulators such that the (pre- or post-descent) value of an accumulator depends directly or indirectly on itself. A processor may report this as a static error if it can be detected statically. Alternatively a processor may report this as a dynamic error. As a further option, a processor may fail catastrophically when this error occurs.

ERR XTDE3480

It is a dynamic error if the current-merge-group function is used when the current merge group is absent. The error may be reported statically if it can be detected statically.

ERR XTDE3490

It is a dynamic error if the $source argument of the current-merge-group function (when supplied) does not match the name attribute of any xsl:merge-source element for the current merge operation. The error may be reported statically if it can be detected statically.

ERR XTDE3510

It is a dynamic error if the current-merge-key-array or current-merge-key function is used when the current merge key is absent, or when it is invoked in the course of evaluating a pattern. The error may be reported statically if it can be detected statically.

ERR XTDE3530

It is a dynamic error if an xsl:try instruction is unable to recover the state of a final result tree because recovery has been disabled by use of the attribute rollback-output="no".

ERR XTMM9000

When a transformation is terminated by use of <xsl:message terminate="yes"/>, the effect is the same as when a dynamic error occurs during the transformation. The default error code is XTMM9000; this may be overridden using the error-code attribute of the xsl:message instruction.

ERR XTMM9001

When a transformation is terminated by use of xsl:assert, the effect is the same as when a dynamic error occurs during the transformation. The default error code is XTMM9001; this may be overridden using the error-code attribute of the xsl:assert instruction.

F Checklist of Implementation-Defined Features (Non-Normative)

This appendix provides a summary of XSLT language features whose effect is explicitly implementation-defined. The conformance rules (see 27 Conformance) require vendors to provide documentation that explains how these choices have been exercised.

The implementation-defined features are grouped into categories for convenience.

F.1 Application Programming Interfaces

This category covers interfaces for initiating a transformation, setting its parameters, initializing the static and dynamic context, and collecting the results. In general terms, it is implementation defined how input is passed to the processor and how it returns its output. This includes the interpretation of URIs used to refer to stylesheet packages and modules, source documents and collections, collations, and result documents.

More specifically:

  1. If the initialization of any global variables or parameter depends on the context item, a dynamic error can occur if the context item is absent. It is implementation-defined whether this error occurs during priming of the stylesheet or subsequently when the variable is referenced; and it is implementation-defined whether the error occurs at all if the variable or parameter is never referenced. (See 2.3.2 Priming a Stylesheet)

  2. The way in which an XSLT processor is invoked, and the way in which values are supplied for the source document, starting node, stylesheet parameters, and base output URI, are implementation-defined. (See 2.3.2 Priming a Stylesheet)

  3. The way in which a base output URI is established is implementation-defined (See 2.3.6.2 Serializing the Result)

  4. It is implementation-defined how a package is located given its name and version, and which version of a package is chosen if several are available. (See 3.5.2 Dependencies between Packages)

  5. In the absence of an [xsl:]default-collation attribute, the default collation may be set by the calling application in an implementation-defined way. (See 3.7.2 The default-collation Attribute)

  6. It is implementation-defined what forms of URI reference are acceptable in the href attribute of the xsl:include and xsl:import elements, for example, the URI schemes that may be used, the forms of fragment identifier that may be used, and the media types that are supported. The way in which the URI reference is used to locate a representation of a stylesheet module, and the way in which the stylesheet module is constructed from that representation, are also implementation-defined. (See 3.11.1 Locating Stylesheet Modules)

  7. Implementations may provide user options that relax the requirement for the doc and collection functions (and therefore, by implication, the document function) to return stable results. The manner in which such user options are provided, if at all, is implementation-defined. (See 5.3.3 Initializing the Dynamic Context)

  8. Streamed processing may be initiated by invoking the transformation with an initial mode declared as streamable, while supplying the initial match selection (in an implementation-defined way) as a streamed document. (See 6.7.6 Streamable Templates)

  9. The mechanism by which the caller supplies a value for a stylesheet parameter is implementation-defined. (See 9.5 Global Variables and Parameters)

  10. The detail of any external mechanism allowing a processor to enable or disable checking of assertions is implementation-defined. (See 23.2 Assertions)

  11. The way in which the results of the transformation are delivered to an application is implementation-defined. (See 25 Transformation Results)

  12. It is implementation-defined how the URI appearing in the href attribute of xsl:result-document affects the way in which the result tree is delivered to the application. There may be restrictions on the form of this URI. (See 25.1 Creating Secondary Results)

  13. If serialization is supported, then the location to which a final result tree is serialized is implementation-defined, subject to the constraint that relative URI references used to reference one tree from another remain valid. (See 26.2 Defaults for serializationSerialization parameters)

F.5 Dependencies

When this specification refers normatively to other specifications, it generally gives implementations freedom to decide (within constraints) which version of the referenced specification should be used. Specifically:

  1. It is implementation-defined which versions and editions of XML and XML Namespaces (1.0 and/or 1.1) are supported. (See 4.1 XML Versions)

  2. It is implementation-defined which versions of XML, HTML, and XHTML are supported in the version attribute of the xsl:output declaration. (See 26.2 Defaults for serializationSerialization parameters)

  3. It is implementation-defined whether (and if so how) an XSLT 3.0 processor is able to work with versions of [XSLT and XQuery Serialization] later than 3.1. (See 27.3 Serialization Feature)

F.6 Defaults and Limits

To accommodate variations in the way that the XSLT language is deployed, and the constraints of different processing environments, defaults for some options are implementation-defined. In addition, limits on the sizes of ranges of values permitted are in general implementation-defined:

  1. Limits on the value space of primitive datatypes, where not fixed by [XML Schema Part 2], are implementation-defined. (See 4.6 Limits)

  2. The default value of the encoding attribute of the xsl:output element is implementation-defined. Where the encoding is UTF-8, the default for the byte-order-mark attribute is implementation-defined. (See 26.2 Defaults for serializationSerialization parameters)

H Schemas for XSLT 4.0 Stylesheets (Non-Normative)

For convenience, schemas are provided for validation of XSLT 4.0 stylesheets using the XSD 1.1 and Relax NG schema languages. These are non-normative. Neither will detect every static error that might arise in an XSLT 4.0 stylesheet (for example, there is no attempt to check the syntax of XPath expressions); in addition, these schemas may reject some stylesheets that are valid, for example because they rely on xsl:use-when to eliminate sections of code that would otherwise be invalid.

H.1 XSD 1.1 Schema for XSLT Stylesheets

The following XSD 1.1 schema describes the structure of an XSLT stylesheet module. There are some limitations:

  • It does not define all the constraints that apply to a stylesheet (for example, it does not attempt to define a datatype that precisely represents attributes containing XPath expressions).

  • Stylesheets that use forwards compatible behavior (an [xsl:]version attribute greater than 4.0), or that have sections excluded using [xsl:]use-when attributes, are not required to conform to the schema.

  • The specification allows xsl:note elements to appear anywhere, but this schema is more restrictive.

A copy of this schema is available at schema-for-xslt40.xsd

Note:

The schema as written uses a lax wildcard to permit literal result elements to appear in a sequence constructor. This assumes that the schema used for validation will not contain any global element declaration that matches the element name of a literal result element. The content model for an element such as invoice appearing within a stylesheet is not the same as the content model for the same element appearing within a source document (it is likely to contain XSLT instructions rather than other elements from the target vocabulary): therefore, including such declarations in the schema used for validating a stylesheet is inappropriate.

The reason that lax validation rather than skip validation is used is so that XSLT instructions appearing as children of the literal result element will themselves be validated, using the appropriate global element declaration.

Note:

The schema uses XSD 1.1 assertions to represent some of the non-grammatical constraints appearing in the specification, for example the rule that some elements can have either a select attribute or a contained sequence constructor, but not both. At this stage, no attempt has been made to represent every such constraint, even where it is not difficult to express the rule. There will always be some constraints that cannot be expressed at all, for example those that require access to multiple stylesheet modules, those that require access to the in-scope schema components, and those that involve parsing a non-regular grammar, such as the grammar for patterns.

Apart from assertions, the only other significant use of XSD 1.1 features is that the elements xsl:param and xsl:variable are in two substitution groups: one containing all instructions, and one containing all declarations. If the schema needs to be converted to an XSD 1.0 schema, removing all assertions is straightforward; the other change needed is to remove xsl:param and xsl:variable from the substitution group for declarations, and instead permit them explicitly as children of xsl:transform.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
           xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
           targetNamespace="http://www.w3.org/1999/XSL/Transform"
           elementFormDefault="qualified"
           vc:minVersion="1.1">

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <xs:annotation>
    <xs:documentation>
      <p>
         This is an XSD 1.1 schema for XSLT 4.0 stylesheets. It defines all the
         elements that appear in the XSLT namespace; it also provides hooks that
         allow the inclusion of user-defined literal result elements, extension
         instructions, and top-level data elements.
      </p>
      <p>
         This schema is available for use under the conditions of the W3C Software
         License published at
         http://www.w3.org/Consortium/Legal/copyright-software-19980720
      </p>
      <p>
         The schema is organized as follows:
      </p>
      <ul>
        <li>
           PART A: definitions of complex types and model groups used as the basis
           for element definitions
        </li>
        <li>
           PART B: definitions of individual XSLT elements
        </li>
        <li>
           PART C: definitions for literal result elements
        </li>
        <li>
           PART D: definitions of simple types used in attribute definitions
        </li>
      </ul>
      <p>
         The schema has a number of limitations:
      </p>
      <ul>
        <li>
           The XSLT specification allows additional elements and attributes to be
           present where forwards compatibility is invoked. This schema does not.
        </li>
        <li>
           The XSLT specification allows arbitrary content in a part of the
           stylesheet that is excluded by virtue of a use-when attribute. This
           schema does not.
        </li>
        <li>
           The handling of literal result elements in this schema is imperfect;
           although various options are allowed, none matches the specification
           exactly. For example, the content of a literal result element uses lax
           validation, which permits child elements in the XSLT namespace that have
           no declaration in this schema.
        </li>
        <li>
           The schema makes no attempt to check XPath expressions for syntactic or
           semantic correctness, nor to check that component references are
           resolved (for example that a template named in <code>xsl:call-template</code> has a
           declaration). Doing this in general requires cross-document validation,
           which is beyond the scope of XSD.
        </li>
        <li>
           The XSLT specification allows <code>xsl:note</code> elements to appear
           anywhere, with arbitrary content. This schema does not: for example, it does
           not allow <code>xsl:note</code> as a child of an element such as <code>xsl:text</code>
           or <code>xsl:strip-space</code>.
        </li>
        <li>
           The schema imports the schema for XSD 1.0 schema documents. In
           stylesheets that contain an inline XSD 1.1 schema, this import should be
           replaced with one for the schema for XSD 1.1 schema documents.
        </li>
      </ul>
    </xs:documentation>
  </xs:annotation>
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

  <!--
The declaration of xml:space and xml:lang may need to be commented out because
of problems processing the schema using various tools
-->

  <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
  <!--schemaLocation="http://www.w3.org/2001/xml.xsd"-->

  <!-- 
    An XSLT stylesheet may contain an in-line schema within an xsl:import-schema element,
    so the Schema for schemas needs to be imported. We use the XSD 1.1 version.
-->

  <xs:import namespace="http://www.w3.org/2001/XMLSchema"
             schemaLocation="http://www.w3.org/TR/xmlschema11-1/XMLSchema.xsd"/>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <xs:annotation>
    <xs:documentation>
      <p>
         PART A: definitions of complex types and model groups used as the basis
         for element definitions
      </p>
    </xs:documentation>
  </xs:annotation>
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  
  <xs:defaultOpenContent>
    <!-- Allow xsl:note anywhere -->
    <xs:any processContents="strict" 
            namespace="##targetNamespace"
            notQName="xsl:accept 
                      xsl:accumulator 
                      xsl:accumulator-rule 
                      xsl:analyze-string 
                      xsl:apply-imports 
                      xsl:apply-templates 
                      xsl:array 
                      xsl:assert 
                      xsl:attribute 
                      xsl:attribute-set 
                      xsl:break 
                      xsl:call-template 
                      xsl:catch 
                      xsl:character-map 
                      xsl:choose 
                      xsl:comment 
                      xsl:context-item 
                      xsl:copy 
                      xsl:copy-of 
                      xsl:document 
                      xsl:decimal-format 
                      xsl:element 
                      xsl:evaluate 
                      xsl:expose 
                      xsl:fallback 
                      xsl:for-each 
                      xsl:for-each-group 
                      xsl:fork 
                      xsl:function 
                      xsl:global-context-item 
                      xsl:if 
                      xsl:import 
                      xsl:import-schema 
                      xsl:include 
                      xsl:iterate 
                      xsl:key 
                      xsl:map 
                      xsl:map-entry 
                      xsl:matching-substring 
                      xsl:merge 
                      xsl:merge-action 
                      xsl:merge-key 
                      xsl:merge-source 
                      xsl:message 
                      xsl:mode 
                      xsl:namespace 
                      xsl:namespace-alias 
                      xsl:next-iteration 
                      xsl:next-match 
                      xsl:non-matching-substring 
                      xsl:number 
                      xsl:on-completion 
                      xsl:on-empty 
                      xsl:on-non-empty 
                      xsl:otherwise 
                      xsl:output 
                      xsl:output-character 
                      xsl:override 
                      xsl:package 
                      xsl:param 
                      xsl:perform-sort 
                      xsl:preserve-space 
                      xsl:processing-instruction 
                      xsl:result-document 
                      xsl:sequence 
                      xsl:sort 
                      xsl:source-document 
                      xsl:strip-space 
                      xsl:stylesheet 
                      xsl:switch 
                      xsl:template 
                      xsl:text 
                      xsl:transform 
                      xsl:try 
                      xsl:use-package 
                      xsl:value-of 
                      xsl:variable 
                      xsl:when 
                      xsl:where-populated 
                      xsl:with-param
            "/>
  </xs:defaultOpenContent>
  
  <xs:complexType name="generic-element-type" mixed="true">
    <xs:annotation>
      <xs:documentation>
        <p>
           This complex type provides a generic supertype for all XSLT elements; it
           contains the definitions of the standard attributes that may appear on
           any element.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="default-collation" type="xsl:uri-list"/>
    <xs:attribute name="default-mode" type="xsl:default-mode-type"/>
    <xs:attribute name="default-validation"
                  type="xsl:validation-strip-or-preserve"
                  default="strip"/>
    <xs:attribute name="exclude-result-prefixes" type="xsl:prefix-list-or-all"/>
    <xs:attribute name="expand-text" type="xsl:yes-or-no"/>
    <xs:attribute name="extension-element-prefixes" type="xsl:prefix-list"/>
    <xs:attribute name="use-when" type="xsl:expression"/>
    <xs:attribute name="xpath-default-namespace" type="xs:anyURI"/>
    <xs:attribute name="_default-collation" type="xs:string"/>
    <xs:attribute name="_default-mode" type="xs:string"/>
    <xs:attribute name="_default-validation" type="xs:string"/>
    <xs:attribute name="_exclude-result-prefixes" type="xs:string"/>
    <xs:attribute name="_expand-text" type="xs:string"/>
    <xs:attribute name="_extension-element-prefixes" type="xs:string"/>
    <xs:attribute name="_use-when" type="xs:string"/>
    <xs:attribute name="_xpath-default-namespace" type="xs:string"/>
    <xs:anyAttribute namespace="##other" processContents="lax"/>
  </xs:complexType>

  <xs:complexType name="versioned-element-type" mixed="true">
    <xs:annotation>
      <xs:documentation>
        <p>This complex type provides a generic supertype for all XSLT elements with
                the exception of <code>xsl:output</code>; it contains the
                definitions of the <code>version</code> attribute that may appear on any element.
                </p>
        <p>The <code>xsl:output</code> element does not use this definition because, although it
             has a <code>version</code> attribute, the syntax and semantics of this attribute are
             unrelated to the standard <code>version</code> attribute allowed on other elements.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="xsl:generic-element-type">
        <xs:attribute name="version" type="xs:decimal" use="optional"/>
        <xs:attribute name="_version" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="element-only-versioned-element-type" mixed="false">
    <xs:complexContent>
      <xs:restriction base="xsl:versioned-element-type">
        <xs:anyAttribute namespace="##other" processContents="lax"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="sequence-constructor">
    <xs:annotation>
      <xs:documentation>
        <p>
           This complex type provides a generic supertype for all XSLT elements
           that allow a sequence constructor as their content.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent mixed="true">
      <xs:extension base="xsl:versioned-element-type">
        <xs:group ref="xsl:sequence-constructor-group"
                  minOccurs="0"
                  maxOccurs="unbounded"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  
  <xs:complexType name="sequence-constructor-and-select">
    <xs:annotation>
      <xs:documentation>
        <p>
           This complex type allows a sequence constructor and a select attribute.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent mixed="true">
      <xs:extension base="xsl:sequence-constructor">
        <xs:attribute name="select" type="xsl:expression"/>
        <xs:attribute name="_select" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  
  <xs:complexType name="sequence-constructor-or-select">
    <xs:annotation>
      <xs:documentation>
        <p>
           This complex type allows a sequence constructor or a select attribute,
           but not both.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent mixed="true">
      <xs:restriction base="xsl:sequence-constructor-and-select">
        <xs:group ref="xsl:sequence-constructor-group"
                  minOccurs="0"
                  maxOccurs="unbounded"/>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
        <xs:assert test="not(exists(@select | @_select) and 
          (exists(* except xsl:fallback) or exists(text()[normalize-space()])))"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <xs:group name="sequence-constructor-group">
    <xs:annotation>
      <xs:documentation>
        <p>
           This complex type provides a generic supertype for all XSLT elements
           that allow a sequence constructor as their content.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:element ref="xsl:instruction"/>
      <xs:group ref="xsl:result-elements"/>
    </xs:choice>
  </xs:group>

  <xs:element name="declaration" type="xsl:generic-element-type" abstract="true"/>

  <xs:element name="instruction" type="xsl:versioned-element-type" abstract="true"/>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <xs:annotation>
    <xs:documentation>
      <p>
         PART B: definitions of individual XSLT elements Elements are listed in
         alphabetical order.
      </p>
    </xs:documentation>
  </xs:annotation>
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  
  <xs:element name="accept">
    <xs:annotation>
      <xs:documentation>
        <p>This element appears as a child of <code>xsl:use-package</code> and defines 
            any variations that the containing package wishes to make to the visibility of
            components made available from a library package. For example, it may indicate that
            some of the public components in the library package are not to be made available
            to the containing package.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="component" type="xsl:component-kind-type"/>
          <xs:attribute name="names" type="xsl:component-tests"/>
          <xs:attribute name="visibility" type="xsl:visibility-type"/>
          <xs:attribute name="_component" type="xs:string"/>
          <xs:attribute name="_names" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
          <xs:assert test="exists(@component | @_component)"/>
          <xs:assert test="exists(@names | @_names)"/>
          <xs:assert test="exists(@visibility | @_visibility)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="accumulator" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:accumulator-rule" minOccurs="1" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="initial-value" type="xsl:expression"/>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="streamable" type="xsl:yes-or-no"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_initial-value" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_streamable" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="accumulator-rule">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:sequence/>
          <xs:attribute name="match" type="xsl:pattern"/>
          <xs:attribute name="phase">
            <xs:simpleType>
              <xs:restriction base="xs:token">
                <xs:enumeration value="start"/>
                <xs:enumeration value="end"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="capture" type="xsl:yes-or-no" default="no"/>
          <xs:attribute name="_match" type="xs:string"/>
          <xs:attribute name="_phase" type="xs:string"/>
          <xs:attribute name="_capture" type="xs:string"/>
          <xs:assert test="exists(@match | @_match)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="analyze-string" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:matching-substring" minOccurs="0"/>
            <xs:element ref="xsl:non-matching-substring" minOccurs="0"/>
            <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="regex" type="xsl:avt"/>
          <xs:attribute name="flags" type="xsl:avt" default=""/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_regex" type="xs:string"/>
          <xs:attribute name="_flags" type="xs:string"/>
          <xs:assert test="exists(@select | @_select)"/>
          <xs:assert test="exists(@regex | @_regex)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="apply-imports" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:with-param" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="apply-templates" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:sort"/>
            <xs:element ref="xsl:with-param"/>
          </xs:choice>
          <xs:attribute name="select" type="xsl:expression" default="child::node()"/>
          <xs:attribute name="separator" type="xsl:avt"/>
          <xs:attribute name="mode" type="xsl:mode"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_separator" type="xs:string"/>
          <xs:attribute name="_mode" type="xs:string"/>
          <xs:assert test="every $e in subsequence(xsl:sort, 2) 
                           satisfies empty($e/(@stable | @_stable))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is a static error if an <code>xsl:sort</code> element other than the first
                   in a sequence of sibling <code>xsl:sort</code> elements has a <code>stable</code>
                   attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="array"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="array-member"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="assert" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="test" type="xsl:expression"/>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="error-code" type="xsl:avt"/>
          <xs:attribute name="_test" type="xs:string"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_error-code" type="xs:string"/>
          <xs:assert test="exists(@test | @_test)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="attribute" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:avt"/>
          <xs:attribute name="namespace" type="xsl:avt"/>
          <xs:attribute name="separator" type="xsl:avt"/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_namespace" type="xs:string"/>
          <xs:attribute name="_separator" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="attribute-set" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:attribute"/>
          </xs:sequence>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="streamable" type="xsl:yes-or-no"/>
          <xs:attribute name="use-attribute-sets" type="xsl:EQNames" default=""/>
          <xs:attribute name="visibility" type="xsl:visibility-type"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_streamable" type="xs:string"/>
          <xs:attribute name="_use-attribute-sets" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="break"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>

  <xs:element name="call-template" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:with-param" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="catch">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="errors" type="xs:token" use="optional"/>
          <xs:attribute name="_errors" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="character-map" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:output-character" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="use-character-maps" type="xsl:EQNames" default=""/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_use-character-maps" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="choose" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:when" maxOccurs="unbounded"/>
            <xs:element ref="xsl:otherwise" minOccurs="0"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="comment"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="context-item">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="as" type="xsl:item-type"/>
          <xs:attribute name="use">
            <xs:simpleType>
              <xs:restriction base="xs:token">
                <xs:enumeration value="required"/>
                <xs:enumeration value="optional"/>
                <xs:enumeration value="absent"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_use" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="copy" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="copy-namespaces" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="inherit-namespaces" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="use-attribute-sets" type="xsl:EQNames" default=""/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_copy-namespaces" type="xs:string"/>
          <xs:attribute name="_inherit-namespaces" type="xs:string"/>
          <xs:attribute name="_use-attribute-sets" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="copy-of" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="copy-accumulators" type="xsl:yes-or-no" default="no"/>
          <xs:attribute name="copy-namespaces" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_copy-accumulators" type="xs:string"/>
          <xs:attribute name="_copy-namespaces" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="exists(@select | @_select)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="document" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="decimal-format" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="decimal-separator" type="xsl:char-optionally-expanded" default="."/>
          <xs:attribute name="grouping-separator" type="xsl:char-optionally-expanded" default=","/>
          <xs:attribute name="infinity" type="xs:string" default="Infinity"/>
          <xs:attribute name="minus-sign" type="xs:string" default="-"/>
          <xs:attribute name="exponent-separator" type="xsl:char-optionally-expanded" default="e"/>
          <xs:attribute name="NaN" type="xs:string" default="NaN"/>
          <xs:attribute name="percent" type="xsl:char-optionally-expanded" default="%"/>
          <xs:attribute name="per-mille" type="xsl:char-optionally-expanded" default="~"/>
          <xs:attribute name="zero-digit" type="xsl:zero-digit" default="0"/>
          <xs:attribute name="digit" type="xsl:char" default="#"/>
          <xs:attribute name="pattern-separator" type="xsl:char" default=";"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_decimal-separator" type="xs:string"/>
          <xs:attribute name="_grouping-separator" type="xs:string"/>
          <xs:attribute name="_infinity" type="xs:string"/>
          <xs:attribute name="_minus-sign" type="xs:string"/>
          <xs:attribute name="_exponent-separator" type="xs:string"/>
          <xs:attribute name="_NaN" type="xs:string"/>
          <xs:attribute name="_percent" type="xs:string"/>
          <xs:attribute name="_per-mille" type="xs:string"/>
          <xs:attribute name="_zero-digit" type="xs:string"/>
          <xs:attribute name="_digit" type="xs:string"/>
          <xs:attribute name="_pattern-separator" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="element" substitutionGroup="xsl:instruction">
    <xs:complexType mixed="true">
      <xs:complexContent>
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="name" type="xsl:avt"/>
          <xs:attribute name="namespace" type="xsl:avt"/>
          <xs:attribute name="inherit-namespaces" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="use-attribute-sets" type="xsl:EQNames" default=""/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_namespace" type="xs:string"/>
          <xs:attribute name="_inherit-namespaces" type="xs:string"/>
          <xs:attribute name="_use-attribute-sets" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="evaluate" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:with-param"/>
            <xs:element ref="xsl:fallback"/>
          </xs:choice>
          <xs:attribute name="xpath" type="xsl:expression"/>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="base-uri" type="xsl:avt"/>
          <xs:attribute name="context-item" type="xsl:expression"/>
          <xs:attribute name="namespace-context" type="xsl:expression"/>
          <xs:attribute name="schema-aware" type="xsl:avt"/>
          <xs:attribute name="with-params" type="xsl:expression"/>
          <xs:attribute name="_xpath" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_base-uri" type="xs:string"/>
          <xs:attribute name="_context-item" type="xs:string"/>
          <xs:attribute name="_namespace-context" type="xs:string"/>
          <xs:attribute name="_schema-aware" type="xs:string"/>
          <xs:attribute name="_with-params" type="xs:string"/>
          <xs:assert test="exists(@xpath | @_xpath)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="expose">
    <xs:annotation>
      <xs:documentation>
        <p>This element appears as a child of <code>xsl:use-package</code> and defines 
            the visibility of components that are made available (or not) by this package
            to other using packages.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="component" type="xsl:component-kind-type"/>
          <xs:attribute name="names" type="xsl:component-tests"/>
          <xs:attribute name="visibility" type="xsl:visibility-not-hidden-type"/>
          <xs:attribute name="_component" type="xs:string"/>
          <xs:attribute name="_names" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="fallback"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor"/>

  <xs:element name="for-each" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:sort" minOccurs="0" maxOccurs="unbounded"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="separator" type="xsl:avt"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_separator" type="xs:string"/>
          <xs:assert test="every $e in subsequence(xsl:sort, 2) 
                           satisfies empty($e/(@stable | @_stable))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is a static error if an <code>xsl:sort</code> element other than the first
                   in a sequence of sibling <code>xsl:sort</code> elements has a <code>stable</code>
                   attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="exists(@select | @_select)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="for-each-group" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:sort" minOccurs="0" maxOccurs="unbounded"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="group-by" type="xsl:expression"/>
          <xs:attribute name="group-adjacent" type="xsl:expression"/>
          <xs:attribute name="group-starting-with" type="xsl:pattern"/>
          <xs:attribute name="group-ending-with" type="xsl:pattern"/>
          <xs:attribute name="split-when" type="xsl:expression"/>
          <xs:attribute name="composite" type="xsl:yes-or-no"/>
          <xs:attribute name="collation" type="xsl:avt"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_group-by" type="xs:string"/>
          <xs:attribute name="_group-adjacent" type="xs:string"/>
          <xs:attribute name="_group-starting-with" type="xs:string"/>
          <xs:attribute name="_group-ending-with" type="xs:string"/>
          <xs:attribute name="_split_when" type="xs:string"/>
          <xs:attribute name="_composite" type="xs:string"/>
          <xs:attribute name="_collation" type="xs:string"/>
          <xs:assert test="exists(@select | @_select)"/>
          <xs:assert test="every $e in subsequence(xsl:sort, 2) 
                           satisfies empty($e/(@stable | @_stable))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is a static error if an <code>xsl:sort</code> element other than the first
                   in a sequence of sibling <code>xsl:sort</code> elements has a <code>stable</code>
                   attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="count(((@group-by|@_group-by)[1], 
                                  (@group-adjacent|@_group-adjacent)[1], 
                                  (@group-starting-with|@_group-starting-with)[1], 
                                  (@group-ending-with|@_group-ending-with)[1],
                                  (@split-when|@_split-when)[1])) = 1">
            <xs:annotation>
              <xs:documentation>
                <p>
                   These four attributes are mutually exclusive: it is a static
                   error if none of these four attributes is present or if more
                   than one of them is present.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="if (exists(@collation|@_collation) or exists(@composite|@_composite)) 
                           then (exists(@group-by|@_group-by) or exists(@group-adjacent|@_group-adjacent)) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is an error to specify the collation attribute or the
                   composite attribute if neither the group-by attribute nor
                   group-adjacent attribute is specified.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="fork" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
            <xs:choice>
              <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="xsl:sequence"/>
                <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
              </xs:sequence>
              <xs:sequence>
                <xs:element ref="xsl:for-each-group"/>
                <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
              </xs:sequence>
            </xs:choice>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="function" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:param" minOccurs="0" maxOccurs="unbounded"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="name" type="xsl:EQName-in-namespace"/>
          <xs:attribute name="override" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="as" type="xsl:sequence-type" default="item()*"/>
          <xs:attribute name="visibility" type="xsl:visibility-type"/>
          <xs:attribute name="streamability" type="xsl:streamability-type"/>
          <xs:attribute name="override-extension-function" type="xsl:yes-or-no"/>
          <xs:attribute name="new-each-time" type="xsl:yes-or-no-or-maybe"/>
          <xs:attribute name="cache" type="xsl:yes-or-no"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_override" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
          <xs:attribute name="_streamability" type="xs:string"/>
          <xs:attribute name="_override-extension-function" type="xs:string"/>
          <xs:attribute name="_new-each-time" type="xs:string"/>
          <xs:attribute name="_cache" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
          <xs:assert test="every $e in xsl:param satisfies empty($e/(@visibility | @_visibility))">
            <xs:annotation>
              <xs:documentation>
                <p>A parameter for a function must have no <code>visibility</code> attribute.</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="global-context-item" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="as" type="xsl:item-type"/>
          <xs:attribute name="use">
            <xs:simpleType>
              <xs:restriction base="xs:token">
                <xs:enumeration value="required"/>
                <xs:enumeration value="optional"/>
                <xs:enumeration value="absent"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_use" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  

  <xs:element name="if" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="test" type="xsl:expression"/>
          <xs:attribute name="then" type="xsl:expression"/>
          <xs:attribute name="else" type="xsl:expression"/>
          <xs:attribute name="_test" type="xs:string"/>
          <xs:attribute name="_then" type="xs:string"/>
          <xs:attribute name="_else" type="xs:string"/>
          <xs:assert test="exists(@test | @_test)"/>
          <xs:assert test="not(exists(@then | @_then) and 
            (exists(* except xsl:fallback) or exists(text()[normalize-space()])))"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="import" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="href" type="xs:anyURI"/>
          <xs:attribute name="_href" type="xs:string"/>
          <xs:assert test="exists(@href | @_href)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="import-schema" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xs:schema" minOccurs="0" maxOccurs="1"/>
          </xs:sequence>
          <xs:attribute name="namespace" type="xs:anyURI"/>
          <xs:attribute name="schema-location" type="xs:anyURI"/>
          <xs:attribute name="_namespace" type="xs:string"/>
          <xs:attribute name="_schema-location" type="xs:string"/>
          <xs:assert test="not(exists(@schema-location | @_schema-location) and exists(xs:schema))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   XTSE0215: It is a static error if an <code>xsl:import-schema</code> element
                   that contains an xs:schema element has a <code>schema-location</code>
                   attribute
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="include" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="href" type="xs:anyURI"/>
          <xs:attribute name="_href" type="xs:string"/>
          <xs:assert test="exists(@href | @_href)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="iterate" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:param" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="xsl:on-completion" minOccurs="0" maxOccurs="1"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:assert test="exists(@select | @_select)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="key" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="match" type="xsl:pattern"/>
          <xs:attribute name="use" type="xsl:expression"/>
          <xs:attribute name="composite" type="xsl:yes-or-no"/>
          <xs:attribute name="collation" type="xs:anyURI"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_match" type="xs:string"/>
          <xs:attribute name="_use" type="xs:string"/>
          <xs:attribute name="_composite" type="xs:string"/>
          <xs:attribute name="_collation" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
          <xs:assert test="exists(@match | @_match)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="map"
              substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-and-select">
          <xs:attribute name="duplicates" type="xsl:expression"/>
          <xs:attribute name="_duplicates" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="map-entry" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-and-select">
          <xs:attribute name="key" type="xsl:expression"/>
          <xs:attribute name="_key" type="xs:string"/>
          <xs:assert test="exists(@key | @_key)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="matching-substring" type="xsl:sequence-constructor-or-select"/>

  <xs:element name="merge" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:merge-source" minOccurs="1" maxOccurs="unbounded"/>
            <xs:element ref="xsl:merge-action" minOccurs="1" maxOccurs="1"/>
            <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="merge-action" type="xsl:sequence-constructor"/>

  <xs:element name="merge-key" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="lang" type="xsl:avt"/>
          <xs:attribute name="order" type="xsl:avt"/>
          <xs:attribute name="collation" type="xs:anyURI"/>
          <xs:attribute name="case-order" type="xsl:avt"/>
          <xs:attribute name="data-type" type="xsl:avt"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_lang" type="xs:string"/>
          <xs:attribute name="_order" type="xs:string"/>
          <xs:attribute name="_collation" type="xs:string"/>
          <xs:attribute name="_case-order" type="xs:string"/>
          <xs:attribute name="_data-type" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="merge-source">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:merge-key" minOccurs="1" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="name" type="xs:NCName"/>
          <xs:attribute name="for-each-item" type="xsl:expression"/>
          <xs:attribute name="for-each-source" type="xsl:expression"/>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="streamable" type="xsl:yes-or-no"/>
          <xs:attribute name="use-accumulators" type="xsl:accumulator-names"/>
          <xs:attribute name="sort-before-merge" type="xsl:yes-or-no"/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_for-each-item" type="xs:string"/>
          <xs:attribute name="_for-each-source" type="xs:string"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_streamable" type="xs:string"/>
          <xs:attribute name="_use-accumulators" type="xs:string"/>
          <xs:attribute name="_sort-before-merge" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="exists(@select | @_select)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="message" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="terminate" type="xsl:avt" default="no"/>
          <xs:attribute name="error-code" type="xsl:avt"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_terminate" type="xs:string"/>
          <xs:attribute name="_error-code" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="mode" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent mixed="false">
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:template"/> 
            <xs:element ref="xsl:fallback"/> 
          </xs:choice>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="streamable" type="xsl:yes-or-no" default="no"/>
          <xs:attribute name="use-accumulators" type="xsl:accumulator-names"/>
          <xs:attribute name="on-no-match" type="xsl:on-no-match-type" default="shallow-skip"/>
          <xs:attribute name="on-multiple-match"
                        type="xsl:on-multiple-match-type"
                        default="use-last"/>
          <xs:attribute name="warning-on-no-match" type="xsl:yes-or-no"/>
          <xs:attribute name="warning-on-multiple-match" type="xsl:yes-or-no"/>
          <xs:attribute name="typed" type="xsl:typed-type"/>
          <xs:attribute name="visibility">
            <xs:simpleType>
              <xs:restriction base="xsl:visibility-type">
                <xs:enumeration value="public"/>
                <xs:enumeration value="private"/>
                <xs:enumeration value="final"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_streamable" type="xs:string"/>
          <xs:attribute name="_use-accumulators" type="xs:string"/>
          <xs:attribute name="_on-no-match" type="xs:string"/>
          <xs:attribute name="_on-multiple-match" type="xs:string"/>
          <xs:attribute name="_warning-on-no-match" type="xs:string"/>
          <xs:attribute name="_warning-on-multiple-match" type="xs:string"/>
          <xs:attribute name="_typed" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>


  <xs:element name="namespace" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:avt"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="namespace-alias" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="stylesheet-prefix" type="xsl:prefix-or-default"/>
          <xs:attribute name="result-prefix" type="xsl:prefix-or-default"/>
          <xs:attribute name="_stylesheet-prefix" type="xs:string"/>
          <xs:attribute name="_result-prefix" type="xs:string"/>
          <xs:assert test="exists(@stylesheet-prefix | @_stylesheet-prefix)"/>
          <xs:assert test="exists(@result-prefix | @_result-prefix)"/>
          <xs:assert test="every $prefix in (@stylesheet-prefix, @result-prefix)/normalize-space(.)[. ne '#default']
                           satisfies $prefix = in-scope-prefixes(.)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>


  <xs:element name="next-iteration" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:with-param" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>


  <xs:element name="next-match" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:with-param"/>
            <xs:element ref="xsl:fallback"/>
          </xs:choice>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="non-matching-substring" type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="note" type="xs:anyType"/>

  <xs:element name="number" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:attribute name="value" type="xsl:expression"/>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="level" type="xsl:level" default="single"/>
          <xs:attribute name="count" type="xsl:pattern"/>
          <xs:attribute name="from" type="xsl:pattern"/>
          <xs:attribute name="format" type="xsl:avt" default="1"/>
          <xs:attribute name="lang" type="xsl:avt"/>
          <xs:attribute name="letter-value" type="xsl:avt"/>
          <xs:attribute name="ordinal" type="xsl:avt"/>
          <xs:attribute name="start-at" type="xsl:avt"/>
          <xs:attribute name="grouping-separator" type="xsl:avt"/>
          <xs:attribute name="grouping-size" type="xsl:avt"/>
          <xs:attribute name="_value" type="xs:string"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_level" type="xs:string"/>
          <xs:attribute name="_count" type="xs:string"/>
          <xs:attribute name="_from" type="xs:string"/>
          <xs:attribute name="_format" type="xs:string"/>
          <xs:attribute name="_lang" type="xs:string"/>
          <xs:attribute name="_letter-value" type="xs:string"/>
          <xs:attribute name="_ordinal" type="xs:string"/>
          <xs:attribute name="_start-at" type="xs:string"/>
          <xs:attribute name="_grouping-separator" type="xs:string"/>
          <xs:attribute name="_grouping-size" type="xs:string"/>
          <xs:assert test="if (exists(@value | @_value)) 
                           then empty((@select | @_select, @count | @_count, @from | @_from)) 
                            and (exists(@_level) or normalize-space(@level)='single') 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is a static error if the value attribute of <code>xsl:number</code> is
                   present unless the <code>select</code>, <code>level</code>, <code>count</code>, 
                   and <code>from</code> attributes are all absent.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="on-completion" type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="on-empty"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="on-non-empty"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>

  <xs:element name="otherwise" 
              type="xsl:sequence-constructor-or-select"/>

  <xs:element name="output" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:generic-element-type">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="method" type="xsl:method"/>
          <xs:attribute name="allow-duplicate-names" type="xsl:yes-or-no"/>
          <xs:attribute name="build-tree" type="xsl:yes-or-no"/>
          <xs:attribute name="byte-order-mark" type="xsl:yes-or-no"/>
          <xs:attribute name="cdata-section-elements" type="xsl:EQNames"/>
          <xs:attribute name="doctype-public" type="xs:string"/>
          <xs:attribute name="doctype-system" type="xs:string"/>
          <xs:attribute name="encoding" type="xs:string"/>
          <xs:attribute name="escape-solidus" type="xsl:yes-or-no"/>
          <xs:attribute name="escape-uri-attributes" type="xsl:yes-or-no"/>
          <xs:attribute name="html-version" type="xs:decimal"/>
          <xs:attribute name="include-content-type" type="xsl:yes-or-no"/>
          <xs:attribute name="indent" type="xsl:yes-or-no"/>
          <xs:attribute name="item-separator" type="xs:string"/>
          <xs:attribute name="json-lines" type="xsl:yes-or-no"/>
          <xs:attribute name="json-node-output-method" type="xsl:method"/>
          <xs:attribute name="media-type" type="xs:string"/>
          <xs:attribute name="normalization-form" type="xs:NMTOKEN"/>
          <xs:attribute name="omit-xml-declaration" type="xsl:yes-or-no"/>
          <xs:attribute name="parameter-document" type="xs:anyURI"/>
          <xs:attribute name="standalone" type="xsl:yes-or-no-or-omit"/>
          <xs:attribute name="suppress-indentation" type="xsl:EQNames"/>
          <xs:attribute name="undeclare-prefixes" type="xsl:yes-or-no"/>
          <xs:attribute name="use-character-maps" type="xsl:EQNames"/>
          <xs:attribute name="version" type="xs:NMTOKEN"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_method" type="xs:string"/>
          <xs:attribute name="_byte-order-mark" type="xs:string"/>
          <xs:attribute name="_cdata-section-elements" type="xs:string"/>
          <xs:attribute name="_doctype-public" type="xs:string"/>
          <xs:attribute name="_doctype-system" type="xs:string"/>
          <xs:attribute name="_encoding" type="xs:string"/>
          <xs:attribute name="_escape-solidus" type="xs:string"/>
          <xs:attribute name="_escape-uri-attributes" type="xs:string"/>
          <xs:attribute name="_html-version" type="xs:string"/>
          <xs:attribute name="_include-content-type" type="xs:string"/>
          <xs:attribute name="_indent" type="xs:string"/>
          <xs:attribute name="_item-separator" type="xs:string"/>
          <xs:attribute name="_media-type" type="xs:string"/>
          <xs:attribute name="_normalization-form" type="xs:string"/>
          <xs:attribute name="_omit-xml-declaration" type="xs:string"/>
          <xs:attribute name="_parameter-document" type="xs:string"/>
          <xs:attribute name="_standalone" type="xs:string"/>
          <xs:attribute name="_suppress-indentation" type="xs:string"/>
          <xs:attribute name="_undeclare-prefixes" type="xs:string"/>
          <xs:attribute name="_use-character-maps" type="xs:string"/>
          <xs:attribute name="_version" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="output-character">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="character" type="xsl:char"/>
          <xs:attribute name="string" type="xs:string"/>
          <xs:attribute name="_character" type="xs:string"/>
          <xs:attribute name="_string" type="xs:string"/>
          <xs:assert test="exists(@character | @_character)"/>
          <xs:assert test="exists(@string | @_string)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="override">
    <xs:annotation>
      <xs:documentation>
        <p>This element appears as a child of <code>xsl:use-package</code> and defines 
            any overriding definitions of components that the containing package wishes to make 
            to the components made available from a library package.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:template"/>
            <xs:element ref="xsl:function"/>
            <xs:element ref="xsl:variable"/>
            <xs:element ref="xsl:param"/>
            <xs:element ref="xsl:attribute-set"/>
          </xs:choice>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
    
  <xs:element name="package">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element ref="xsl:expose"/>
              <xs:element ref="xsl:declaration"/>
              <xs:any namespace="##other" processContents="lax"/>
            </xs:choice>
          </xs:sequence>
          <xs:attribute name="declared-modes" type="xsl:yes-or-no"/>
          <xs:attribute name="id" type="xs:ID"/>
          <xs:attribute name="name" type="xs:anyURI"/>
          <xs:attribute name="package-version" type="xs:string"/>
          <xs:attribute name="input-type-annotations" type="xsl:input-type-annotations-type"/>
          <xs:attribute name="fixed-namespaces" type="xsl:fixed-namespaces-type"/>
          <xs:attribute name="_declared-modes" type="xs:string"/>
          <xs:attribute name="_id" type="xs:string"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_package-version" type="xs:string"/>
          <xs:attribute name="_input-type-annotations" type="xs:string"/>
          <xs:attribute name="_fixed-namespaces" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="param" substitutionGroup="xsl:declaration">
    <xs:annotation>
      <xs:documentation>
        <p>Declaration of the <code>xsl:param</code> element, used both defining function
            parameters, template parameters, parameters to <code>xsl:iterate</code>,
            and global stylesheet parameters.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="required" type="xsl:yes-or-no"/>
          <xs:attribute name="tunnel" type="xsl:yes-or-no"/>
          <xs:attribute name="static" type="xsl:yes-or-no"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_required" type="xs:string"/>
          <xs:attribute name="_tunnel" type="xs:string"/>
          <xs:attribute name="_static" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
          <xs:assert test="if (normalize-space(@static) = ('yes', 'true', '1')) 
                           then empty((*,text())) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   When the attribute <code>static="yes"</code> is specified, the <code>xsl:param</code>
                   element must have empty content.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  

  <xs:element name="perform-sort" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:sort" minOccurs="1" maxOccurs="unbounded"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:assert test="every $e in subsequence(xsl:sort, 2) 
                           satisfies empty($e/(@stable | @_stable))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is a static error if an <code>xsl:sort</code> element other than the first
                   in a sequence of sibling <code>xsl:sort</code> elements has a <code>stable</code>
                   attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="preserve-space" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="elements" type="xsl:nametests"/>
          <xs:attribute name="_elements" type="xs:string"/>
          <xs:assert test="exists(@elements | @_elements)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="processing-instruction" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:avt"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="result-document" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="format" type="xsl:avt"/>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="href" type="xsl:avt"/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="method" type="xsl:avt"/>
          <xs:attribute name="allow-duplicate-names" type="xsl:avt"/>
          <xs:attribute name="build-tree" type="xsl:avt"/>
          <xs:attribute name="byte-order-mark" type="xsl:avt"/>
          <xs:attribute name="cdata-section-elements" type="xsl:avt"/>
          <xs:attribute name="doctype-public" type="xsl:avt"/>
          <xs:attribute name="doctype-system" type="xsl:avt"/>
          <xs:attribute name="encoding" type="xsl:avt"/>
          <xs:attribute name="escape-solidus" type="xsl:avt"/>
          <xs:attribute name="escape-uri-attributes" type="xsl:avt"/>
          <xs:attribute name="html-version" type="xsl:avt"/>
          <xs:attribute name="include-content-type" type="xsl:avt"/>
          <xs:attribute name="indent" type="xsl:avt"/>
          <xs:attribute name="item-separator" type="xsl:avt"/>
          <xs:attribute name="json-lines" type="xsl:avt"/>
          <xs:attribute name="json-node-output-method" type="xsl:avt"/>
          <xs:attribute name="media-type" type="xsl:avt"/>
          <xs:attribute name="normalization-form" type="xsl:avt"/>
          <xs:attribute name="omit-xml-declaration" type="xsl:avt"/>
          <xs:attribute name="parameter-document" type="xsl:avt"/>
          <xs:attribute name="standalone" type="xsl:avt"/>
          <xs:attribute name="suppress-indentation" type="xsl:avt"/>
          <xs:attribute name="undeclare-prefixes" type="xsl:avt"/>
          <xs:attribute name="use-character-maps" type="xsl:EQNames"/>
          <xs:attribute name="output-version" type="xsl:avt"/>
          <xs:attribute name="_format" type="xs:string"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_href" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:attribute name="_method" type="xs:string"/>
          <xs:attribute name="_byte-order-mark" type="xs:string"/>
          <xs:attribute name="_cdata-section-elements" type="xs:string"/>
          <xs:attribute name="_doctype-public" type="xs:string"/>
          <xs:attribute name="_doctype-system" type="xs:string"/>
          <xs:attribute name="_encoding" type="xs:string"/>
          <xs:attribute name="_escape-solidus" type="xs:string"/>
          <xs:attribute name="_escape-uri-attributes" type="xs:string"/>
          <xs:attribute name="_html-version" type="xs:string"/>
          <xs:attribute name="_include-content-type" type="xs:string"/>
          <xs:attribute name="_indent" type="xs:string"/>
          <xs:attribute name="_item-separator" type="xs:string"/>
          <xs:attribute name="_media-type" type="xs:string"/>
          <xs:attribute name="_normalization-form" type="xs:string"/>
          <xs:attribute name="_omit-xml-declaration" type="xs:string"/>
          <xs:attribute name="_parameter-document" type="xs:string"/>
          <xs:attribute name="_standalone" type="xs:string"/>
          <xs:attribute name="_suppress-indentation" type="xs:string"/>
          <xs:attribute name="_undeclare-prefixes" type="xs:string"/>
          <xs:attribute name="_use-character-maps" type="xs:string"/>
          <xs:attribute name="_output-version" type="xs:string"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="sequence"
              substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="_as" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="sort">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="lang" type="xsl:avt"/>
          <xs:attribute name="data-type" type="xsl:avt"/>
          <xs:attribute name="order" type="xsl:avt" default="ascending"/>
          <xs:attribute name="case-order" type="xsl:avt"/>
          <xs:attribute name="collation" type="xsl:avt"/>
          <xs:attribute name="stable" type="xsl:avt"/>
          <xs:attribute name="_lang" type="xs:string"/>
          <xs:attribute name="_data-type" type="xs:string"/>
          <xs:attribute name="_order" type="xs:string"/>
          <xs:attribute name="_case-order" type="xs:string"/>
          <xs:attribute name="_collation" type="xs:string"/>
          <xs:attribute name="_stable" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="source-document" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="href" type="xsl:avt"/>
          <xs:attribute name="streamable" type="xsl:yes-or-no" default="no"/>
          <xs:attribute name="use-accumulators" type="xsl:accumulator-names"/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_href" type="xs:string"/>
          <xs:attribute name="_streamable" type="xs:string"/>
          <xs:attribute name="_use-accumulators" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="exists(@href | @_href)"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="strip-space" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="elements" type="xsl:nametests"/>
          <xs:attribute name="_elements" type="xs:string"/>
          <xs:assert test="exists(@elements | @_elements)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="stylesheet" substitutionGroup="xsl:transform"/>

  <xs:element name="switch" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:when" maxOccurs="unbounded"/>
            <xs:element ref="xsl:otherwise" minOccurs="0"/>
            <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="_select" type="xsl:avt"/>
          <xs:assert test="exists(@select | @_select)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="template" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:context-item" minOccurs="0" maxOccurs="1"/>
            <xs:element ref="xsl:param" minOccurs="0" maxOccurs="unbounded"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="match" type="xsl:pattern"/>
          <xs:attribute name="priority" type="xs:decimal"/>
          <xs:attribute name="mode" type="xsl:modes"/>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="as" type="xsl:sequence-type" default="item()*"/>
          <xs:attribute name="visibility" type="xsl:visibility-type"/>
          <xs:attribute name="_match" type="xs:string"/>
          <xs:attribute name="_priority" type="xs:string"/>
          <xs:attribute name="_mode" type="xs:string"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
          <xs:assert test="exists(@match | @_match) or exists(@name | @_name)">
            <xs:annotation>
              <xs:documentation>
                <p>
                   An <code>xsl:template</code> element must have either a <code>match</code> attribute or a
                   <code>name</code> attribute, or both.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="if (empty(@match | @_match)) 
                           then (empty(@mode | @_mode) and empty(@priority | @_priority)) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   An <code>xsl:template</code> element that has no <code>match</code> attribute must have no
                   <code>mode</code> attribute and no <code>priority</code> attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="not(exists(@visibility | @_visibility) and empty(@name | @_name))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   An <code>xsl:template</code> element that has no <code>name</code> attribute must have no
                   <code>visibility</code> attribute
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="if (normalize-space(@visibility) = 'abstract') 
                           then empty(* except (xsl:context-item, xsl:param)) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   If the <code>visibility</code> attribute is present with the value <code>abstract</code>
                   then (a) the sequence constructor defining the template body
                   must be empty: that is, the only permitted children are
                   <code>xsl:context-item</code> and <code>xsl:param</code>
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="not(normalize-space(@visibility) = 'abstract' and exists(@match))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   If the <code>visibility</code> attribute is present with the value <code>abstract</code>
                   then there must be no <code>match</code> attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="every $e in xsl:param satisfies empty($e/(@visibility | @_visibility))">
            <xs:annotation>
              <xs:documentation>
                <p>A parameter for a template must have no <code>visibility</code> attribute.</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="text-element-base-type">
    <xs:simpleContent>
      <xs:restriction base="xsl:versioned-element-type">
        <xs:simpleType>
          <xs:restriction base="xs:string"/>
        </xs:simpleType>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="text-element-type">
    <xs:simpleContent>
      <xs:extension base="xsl:text-element-base-type">
        <xs:attribute name="disable-output-escaping" type="xsl:yes-or-no" default="no"/>
        <xs:attribute name="_disable-output-escaping" type="xs:string"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:element name="text"
              substitutionGroup="xsl:instruction"
              type="xsl:text-element-type"/>


  <xs:complexType name="transform-element-base-type">
    <xs:complexContent>
      <xs:restriction base="xsl:element-only-versioned-element-type">
        <xs:attribute name="version" type="xs:decimal" use="optional"/>
        <xs:attribute name="_version" type="xs:string">
          <xs:annotation>
            <xs:documentation>
              <p>
                 The version attribute indicates the version of XSLT that the
                 stylesheet module requires. The attribute is required, unless the
                 <code>xsl:stylesheet</code> element is a child of an <code>xsl:package</code> element, in
                 which case it is optional: the default is then taken from the
                 parent <code>xsl:package</code> element.
              </p>
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="transform">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:transform-element-base-type">
          <xs:sequence>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element ref="xsl:declaration"/>
              <xs:any namespace="##other" processContents="lax"/>
              <!-- weaker than XSLT 1.0 -->
            </xs:choice>
          </xs:sequence>
          <xs:attribute name="id" type="xs:ID"/>
          <xs:attribute name="input-type-annotations"
                        type="xsl:input-type-annotations-type"
                        default="unspecified"/>
          <xs:attribute name="fixed-namespaces"
                        type="xsl:fixed-namespaces-type"/>
          <xs:attribute name="_id" type="xs:string"/>
          <xs:attribute name="_input-type-annotations" type="xs:string"/>
          <xs:attribute name="_fixed-namespaces" type="xs:string"/>
          <!--* The 'static' attribute may be used on 'param' and 'variable'
              * only when they are top-level elements. *-->
          <xs:assert test="every $v in (.//xsl:param, .//xsl:variable)[exists(@static | @_static)] 
                           satisfies $v[parent::xsl:stylesheet or parent::xsl:transform or parent::xsl:override]">
            <xs:annotation>
              <xs:documentation>
                <p>
                   The static attribute must not be present on an <code>xsl:variable</code> or
                   <code>xsl:param</code> element unless it is a top-level element.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="every $prefix in (@exclude-result-prefixes[not(. = '#all')], 
                                             @extension-element-prefixes) 
                           satisfies ((if ($prefix = '#default') then '' else $prefix) = in-scope-prefixes(.))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   XTSE0808: It is a static error if a namespace prefix is used
                   within the <code>[xsl:]exclude-result-prefixes</code> attribute and there is
                   no namespace binding in scope for that prefix.
                </p>
                <p>
                   XTSE0809: It is a static error if the value #default is used
                   within the <code>[xsl:]exclude-result-prefixes</code> attribute and the
                   parent element of the <code>[xsl:]exclude-result-prefixes</code> attribute
                   has no default namespace.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="try" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
            <xs:element ref="xsl:catch" minOccurs="1" maxOccurs="1"/>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element ref="xsl:catch"/>
              <xs:element ref="xsl:fallback"/>
            </xs:choice>
          </xs:sequence>
          <xs:attribute name="rollback-output" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="select" type="xsl:expression" use="optional"/>
          <xs:attribute name="_rollback-output" type="xs:string"/>
          <xs:attribute name="_select" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="use-package" substitutionGroup="xsl:declaration">
    <xs:annotation>
      <xs:documentation>
        <p>This element appears as a child of <code>xsl:package</code> and defines a dependency
            of the containing package on another package, identified by URI in the <code>name</code>
            attribute. The <code>package-version</code> attribute indicates which version of the
            library package is required, or may indicate a range of versions.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent mixed="false">
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:accept"/>
            <xs:element ref="xsl:override"/>
          </xs:choice>
          <xs:attribute name="name" type="xs:anyURI"/>
          <xs:attribute name="package-version" type="xs:string"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_package-version" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="value-of" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="separator" type="xsl:avt"/>
          <xs:attribute name="disable-output-escaping" type="xsl:yes-or-no" default="no"/>
          <xs:attribute name="_separator" type="xs:string"/>
          <xs:attribute name="_disable-output-escaping" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="variable" substitutionGroup="xsl:declaration xsl:instruction">
    <xs:annotation>
      <xs:documentation>
        <p>Declaration of the <code>xsl:variable</code> element, used both for local
            and global variable bindings.</p>
        <p>
           This definition takes advantage of the ability in XSD 1.1 for an element
           to belong to more than one substitution group. A global variable is a
           declaration, while a local variable can appear as an instruction in a
           sequence constructor.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="visibility" type="xsl:visibility-type"/>
          <xs:attribute name="static" type="xsl:yes-or-no"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
          <xs:attribute name="_static" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
          <xs:assert test="if (normalize-space(@static) = ('yes', 'true', '1')) 
                           then (exists(@_visibility) or normalize-space(@visibility) 
                                       = ('', 'private', 'final')) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   When the static attribute is present with the value yes, the
                   visibility attribute must not have a value other than private or
                   final.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="if (normalize-space(@static) = ('yes', 'true', '1')) 
                           then (empty((*, text())) and exists(@select | @_select)) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   When the attribute <code>static="yes"</code> is specified, the <code>xsl:variable</code>
                   element must have empty content, and the <code>select</code> attribute must
                   be present to define the value of the variable.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="when">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="test" type="xsl:expression"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_test" type="xs:string"/>
          <xs:assert test="exists(@test | @_test)"/>
          <xs:assert test="not(exists(@select | @_select) and 
            (exists(* except xsl:fallback) or exists(text()[normalize-space()])))"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="where-populated"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor"/>

  <xs:element name="with-param">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="tunnel" type="xsl:yes-or-no"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_tunnel" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <xs:annotation>
    <xs:documentation> PART C: definition of literal result elements There are three ways to define
      the literal result elements permissible in a stylesheet. (a) do nothing. This allows any
      element to be used as a literal result element, provided it is not in the XSLT namespace (b)
      declare all permitted literal result elements as members of the <code>xsl:literal-result-element</code>
      substitution group (c) redefine the model group xsl:result-elements to accommodate all
      permitted literal result elements. Literal result elements are allowed to take certain
      attributes in the XSLT namespace. These are defined in the attribute group
      <code>literal-result-element-attributes</code>, which can be included in the definition of any literal
      result element. </xs:documentation>
  </xs:annotation>
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

  <xs:element name="literal-result-element" abstract="true" type="xs:anyType"/>

  <xs:attributeGroup name="literal-result-element-attributes">
    <xs:attribute name="default-collation" 
                  form="qualified" 
                  type="xsl:uri-list"/>
    <xs:attribute name="default-mode" 
                  form="qualified"  
                  type="xsl:default-mode-type"/>
    <xs:attribute name="default-validation" 
                  form="qualified" 
                  type="xsl:validation-strip-or-preserve"
                  default="strip"/>
    <xs:attribute name="expand-text" 
                  form="qualified"  
                  type="xsl:yes-or-no"/>
    <xs:attribute name="extension-element-prefixes" 
                  form="qualified" 
                  type="xsl:prefixes"/>
    <xs:attribute name="exclude-result-prefixes" 
                  form="qualified" 
                  type="xsl:prefixes"/>
    <xs:attribute name="xpath-default-namespace" 
                  form="qualified" 
                  type="xs:anyURI"/>
    <xs:attribute name="inherit-namespaces"
                  form="qualified"
                  type="xsl:yes-or-no"
                  default="yes"/>
    <xs:attribute name="use-attribute-sets"
                  form="qualified"
                  type="xsl:EQNames"
                  default=""/>
    <xs:attribute name="use-when" 
                  form="qualified" 
                  type="xsl:expression"/>
    <xs:attribute name="version" 
                  form="qualified" 
                  type="xs:decimal"/>
    <xs:attribute name="type" 
                  form="qualified" 
                  type="xsl:EQName"/>
    <xs:attribute name="validation" 
                  form="qualified" 
                  type="xsl:validation-type"/>
  </xs:attributeGroup>

  <xs:group name="result-elements">
    <xs:choice>
      <xs:element ref="xsl:literal-result-element"/>
      <xs:any namespace="##other" processContents="lax"/>
      <xs:any namespace="##local" processContents="lax"/>
    </xs:choice>
  </xs:group>


  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <xs:annotation>
    <xs:documentation>
      <p>
         PART D: definitions of simple types used in stylesheet attributes
      </p>
    </xs:documentation>
  </xs:annotation>
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

  <xs:simpleType name="accumulator-names">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>use-accumulators</code> attribute of <code>xsl:source-document</code>, 
           <code>xsl:merge-source</code>, or <code>xsl:global-context-item</code>: 
           either a list, each member being a QName; or the value <code>#all</code>
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union>
      <xs:simpleType>
        <xs:list itemType="xsl:EQName"/>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#all"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType> 
  
  <xs:simpleType name="avt">
    <xs:annotation>
      <xs:documentation>
        <p>
           This type is used for all attributes that allow an attribute value
           template. The general rules for the syntax of attribute value templates,
           and the specific rules for each such attribute, are described in the
           XSLT 4.0 Recommendation.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string"/>
  </xs:simpleType>
  
  <xs:simpleType name="char">
    <xs:annotation>
      <xs:documentation>
        <p>
           A string containing exactly one character.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:length value="1"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="char-optionally-expanded">
    <xs:annotation>
      <xs:documentation>
        <p>
           A string containing either a single character, or a single character
           followed by a colon followed by an arbitrary string
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:pattern value=".(:.*)?"/>
    </xs:restriction>
  </xs:simpleType>
  
   <xs:simpleType name="component-kind-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes a kind of component within a package.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="template"/>
      <xs:enumeration value="function"/>
      <xs:enumeration value="variable"/>
      <xs:enumeration value="attribute-set"/>
      <xs:enumeration value="mode"/>
      <xs:enumeration value="*"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="default-mode-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>default-mode</code> attribute of <code>xsl:stylesheet</code>, 
           <code>xsl:transform</code>, <code>xsl:package</code>
           (or any other xsl:* element): either a QName or #unnamed.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xsl:EQName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#unnamed"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  
  <xs:simpleType name="component-test">
    <xs:annotation>
      <xs:documentation>
        <p> A NameTest or a named function reference. </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xsl:nametest xsl:named-function-reference"/>
  </xs:simpleType>

  <xs:simpleType name="component-tests">
    <xs:annotation>
      <xs:documentation>
        <p> A list of NameTests or named function references</p>
      </xs:documentation>
    </xs:annotation>
    <xs:list itemType="xsl:component-test"/>
  </xs:simpleType>

  <xs:simpleType name="expression">
    <xs:annotation>
      <xs:documentation>
        <p>
           An XPath 4.0 expression.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:pattern value=".+"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="fixed-namespaces-type">
    <xs:annotation>
      <xs:documentation>
        <p>
          A sequence of tokens, each of which may be one of #default, an NCName, a prefix=namespace binding, or a URI
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:list>
      <xs:simpleType>
        <xs:union memberTypes="xsl:fixed-namespaces-type-default xs:NCName xsl:fixed-namespaces-type-prefix-binding xs:anyURI"/>
      </xs:simpleType>
    </xs:list>
 
  </xs:simpleType>
  
  <xs:simpleType name="fixed-namespaces-type-default">
    <xs:restriction base="xs:string">
       <xs:enumeration value="#default"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="fixed-namespaces-type-prefix-binding">
    <xs:restriction base="xs:string">
       <xs:pattern value="([\i-[:]][\c-[:]]*:)=.+"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="item-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           An XPath 4.0 ItemType
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:pattern value=".+"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="input-type-annotations-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes how type annotations in source documents are handled.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="preserve"/>
      <xs:enumeration value="strip"/>
      <xs:enumeration value="unspecified"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="level">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>level</code> attribute of <code>xsl:number</code>: 
           one of <code>single</code>, <code>multiple</code>, or <code>any</code>.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="single"/>
      <xs:enumeration value="multiple"/>
      <xs:enumeration value="any"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="mode">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>mode</code> attribute of <code>xsl:apply-templates</code>: 
           either a QName, or <code>#current</code>,
           or <code>#unnamed</code>, or <code>#default</code>.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xsl:EQName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#default"/>
          <xs:enumeration value="#unnamed"/>
          <xs:enumeration value="#current"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="modes">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>mode</code> attribute of <code>xsl:template</code>: either a list, each member being
           either a QName or <code>#default</code> or <code>#unnamed</code>; or the value <code>#all</code>
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union>
      <xs:simpleType>
        <xs:restriction>
          <xs:simpleType>
            <xs:list>
              <xs:simpleType>
                <xs:union memberTypes="xsl:EQName">
                  <xs:simpleType>
                    <xs:restriction base="xs:token">
                      <xs:enumeration value="#default"/>
                      <xs:enumeration value="#unnamed"/>
                    </xs:restriction>
                  </xs:simpleType>
                </xs:union>
              </xs:simpleType>
            </xs:list>
          </xs:simpleType>
          <xs:assertion test="count($value) = count(distinct-values($value))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   XTSE0550: It is a static error if the same token is included
                   more than once in the list.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assertion>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#all"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

   <xs:simpleType name="named-function-reference">
    <xs:annotation>
      <xs:documentation>
        <p> In simple terms, this is an EQName followed by "#arity" where "arity" is a non-negative integer. However,
          XSD doesn't allow us to reuse the definition of EQName in this way, so it has to be defined from scratch. The simplest
          way to do this is with an assertion. However, the assertion cannot exploit types such as <code>xsl:EQName</code> defined in this
        schema</p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:pattern value="((Q\{.*\})|([\i-[:]][\c-[:]]*:))?[\i-[:]][\c-[:]]*#[0-9]+"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="nametest">
    <xs:annotation>
      <xs:documentation>
        <p> A list of NameTests, as defined in the XPath 31 Recommendation. Each NameTest is either
          an EQName, or "*", or "prefix:*", or "*:localname", or the wildcard Q{uri}*. </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xsl:EQName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="*"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="[\i-[:]][\c-[:]]*:\*"/>
          <xs:pattern value="\*:[\i-[:]][\c-[:]]*"/>
          <xs:pattern value="Q\{[^}]*\}\*"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="nametests">
    <xs:annotation>
      <xs:documentation>
        <p> A list of NameTests, as defined in the XPath 4.0 Recommendation. Each NameTest is either
          a QName, or "*", or "prefix:*", or "*:localname" </p>
      </xs:documentation>
    </xs:annotation>
    <xs:list itemType="xsl:nametest"/>
  </xs:simpleType>
  
  <xs:simpleType name="on-multiple-match-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes the action to be taken when there are several template rules
           to match an item in a given mode.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="use-last"/>
      <xs:enumeration value="fail"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="on-no-match-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes the action to be taken when there is no template rule to match
           an item in a given mode.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="deep-copy"/>
      <xs:enumeration value="shallow-copy"/>
      <xs:enumeration value="shallow-copy-all"/>
      <xs:enumeration value="deep-skip"/>
      <xs:enumeration value="shallow-skip"/>
      <xs:enumeration value="text-only-copy"/>
      <xs:enumeration value="fail"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="prefixes">
    <xs:list itemType="xs:NCName"/>
  </xs:simpleType>

  <xs:simpleType name="prefix-list-or-all">
    <xs:union memberTypes="xsl:prefix-list">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#all"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="prefix-list">
    <xs:list itemType="xsl:prefix-or-default"/>
  </xs:simpleType>

  <xs:simpleType name="method">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>method</code> attribute of <code>xsl:output</code>: Either one of the recognized names
           "xml", "xhtml", "html", "text", "json", or "adaptive",
            or a QName that must include a prefix.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="xml"/>
          <xs:enumeration value="xhtml"/>
          <xs:enumeration value="html"/>
          <xs:enumeration value="text"/>
          <xs:enumeration value="json"/>
          <xs:enumeration value="adaptive"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xsl:EQName">
          <xs:pattern value="\c*:\c*"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="pattern">
    <xs:annotation>
      <xs:documentation>
        <p>
           A match pattern as defined in the XSLT 4.0 Recommendation. The syntax
           for patterns is a restricted form of the syntax for XPath 4.0
           expressions. 
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xsl:expression"/>
  </xs:simpleType>

  <xs:simpleType name="prefix-or-default">
    <xs:annotation>
      <xs:documentation>
        <p>
           Either a namespace prefix, or <code>#default</code>. Used in the <code>xsl:namespace-alias</code>
           element.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xs:NCName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#default"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="EQNames">
    <xs:annotation>
      <xs:documentation>
        <p>
           A list of QNames. Used in the <code>[xsl:]use-attribute-sets</code> attribute of
           various elements, and in the <code>cdata-section-elements</code> attribute of
           <code>xsl:output</code>.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:list itemType="xsl:EQName"/>
  </xs:simpleType>

  <xs:simpleType name="EQName">
    <xs:annotation>
      <xs:documentation>
        <p>
           An extended QName. This schema does not use the built-in type <code>xs:QName</code>,
           but rather defines its own QName type. This may be either a local name,
           or a prefixed QName, or a name written using the extended QName notation
           <code>Q{uri}local</code>
        </p>
        <p>In XSLT 4.0, where a QName is used in the <code>name</code> attribute
        of (say) <code>xsl:template</code> or <code>xsl:call-template</code>, the prefix
        does not have to be bound in an XML namespace declaration; rather it can be bound
        in a <code>fixed-namespaces</code> attribute on the <code>xsl:stylesheet</code>
        element. Therefore, the built-in <code>xs:QName</code> type cannot be used.
        This schema does not attempt to verify that namespace prefixes have been
        properly declared.</p>
        
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xs:NCName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="[\i-[:]][\c-[:]]*:[\i-[:]][\c-[:]]*"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="Q\{[^{}]*\}[\i-[:]][\c-[:]]*"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  
  <xs:simpleType name="EQName-in-namespace">
    <xs:annotation>
      <xs:documentation>
        <p>
           A subtype of EQNames that excludes no-namespace names
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xsl:EQName">
      <xs:pattern value="Q\{.+\}.+|\i\c*:.+"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="sequence-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           The description of a datatype, conforming to the SequenceType production
           defined in the XPath 4.0 Recommendation
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:pattern value=".+"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="streamability-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes the category to which a function belongs, with regards to its
           streaming behavior.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xsl:EQName-in-namespace">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="unclassified"/>
          <xs:enumeration value="absorbing"/>
          <xs:enumeration value="inspection"/>
          <xs:enumeration value="filter"/>
          <xs:enumeration value="shallow-descent"/>
          <xs:enumeration value="deep-descent"/>
          <xs:enumeration value="ascent"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  
  <xs:simpleType name="typed-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes whether a mode is designed to match typed or untyped nodes.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="yes"/>
      <xs:enumeration value="no"/>
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="1"/>
      <xs:enumeration value="0"/>
      <xs:enumeration value="strict"/>
      <xs:enumeration value="lax"/>
      <xs:enumeration value="unspecified"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="uri-list">
    <xs:list itemType="xs:anyURI"/>
  </xs:simpleType>

  <xs:simpleType name="validation-strip-or-preserve">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes different ways of type-annotating an element or attribute.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xsl:validation-type">
      <xs:enumeration value="preserve"/>
      <xs:enumeration value="strip"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="validation-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes different ways of type-annotating an element or attribute.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="strict"/>
      <xs:enumeration value="lax"/>
      <xs:enumeration value="preserve"/>
      <xs:enumeration value="strip"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="visibility-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes the visibility of a component within a package.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="public"/>
      <xs:enumeration value="private"/>
      <xs:enumeration value="final"/>
      <xs:enumeration value="abstract"/>
      <xs:enumeration value="hidden"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="visibility-not-hidden-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes the visibility of a component within a package.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xsl:visibility-type">
      <xs:enumeration value="public"/>
      <xs:enumeration value="private"/>
      <xs:enumeration value="final"/>
      <xs:enumeration value="abstract"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="yes-or-no">
    <xs:annotation>
      <xs:documentation>
        <p>
           One of the values "yes" or "no": the values "true" or "false", or "1" or
           "0" are accepted as synonyms.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="yes"/>
      <xs:enumeration value="no"/>
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="1"/>
      <xs:enumeration value="0"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="yes-or-no-or-maybe">
    <xs:annotation>
      <xs:documentation>
        <p>
           One of the values "yes" or "no" or "omit". The values "true" or "false",
           or "1" or "0" are accepted as synonyms of "yes" and "no" respectively.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="yes"/>
      <xs:enumeration value="no"/>
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="1"/>
      <xs:enumeration value="0"/>
      <xs:enumeration value="maybe"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="yes-or-no-or-omit">
    <xs:annotation>
      <xs:documentation>
        <p>
           One of the values "yes" or "no" or "omit". The values "true" or "false",
           or "1" or "0" are accepted as synonyms of "yes" and "no" respectively.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="yes"/>
      <xs:enumeration value="no"/>
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="1"/>
      <xs:enumeration value="0"/>
      <xs:enumeration value="omit"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="zero-digit">
    <xs:annotation>
      <xs:documentation>
        <p>
           A digit that has the numerical value zero.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xsl:char">
      <xs:pattern value="\p{Nd}"/>
      <xs:assertion test="matches(string-join(codepoints-to-string(
           for $i in 0 to 9 return string-to-codepoints($value) + $i), ''), '\p{Nd}{10}')"/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
           xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
           targetNamespace="http://www.w3.org/1999/XSL/Transform"
           elementFormDefault="qualified"
           vc:minVersion="1.1">

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <xs:annotation>
    <xs:documentation>
      <p>
         This is an XSD 1.1 schema for XSLT 4.0 stylesheets. It defines all the
         elements that appear in the XSLT namespace; it also provides hooks that
         allow the inclusion of user-defined literal result elements, extension
         instructions, and top-level data elements.
      </p>
      <p>
         This schema is available for use under the conditions of the W3C Software
         License published at
         http://www.w3.org/Consortium/Legal/copyright-software-19980720
      </p>
      <p>
         The schema is organized as follows:
      </p>
      <ul>
        <li>
           PART A: definitions of complex types and model groups used as the basis
           for element definitions
        </li>
        <li>
           PART B: definitions of individual XSLT elements
        </li>
        <li>
           PART C: definitions for literal result elements
        </li>
        <li>
           PART D: definitions of simple types used in attribute definitions
        </li>
      </ul>
      <p>
         The schema has a number of limitations:
      </p>
      <ul>
        <li>
           The XSLT specification allows additional elements and attributes to be
           present where forwards compatibility is invoked. This schema does not.
        </li>
        <li>
           The XSLT specification allows arbitrary content in a part of the
           stylesheet that is excluded by virtue of a use-when attribute. This
           schema does not.
        </li>
        <li>
           The handling of literal result elements in this schema is imperfect;
           although various options are allowed, none matches the specification
           exactly. For example, the content of a literal result element uses lax
           validation, which permits child elements in the XSLT namespace that have
           no declaration in this schema.
        </li>
        <li>
           The schema makes no attempt to check XPath expressions for syntactic or
           semantic correctness, nor to check that component references are
           resolved (for example that a template named in <code>xsl:call-template</code> has a
           declaration). Doing this in general requires cross-document validation,
           which is beyond the scope of XSD.
        </li>
        <li>
           The XSLT specification allows <code>xsl:note</code> elements to appear
           anywhere, with arbitrary content. This schema does not: for example, it does
           not allow <code>xsl:note</code> as a child of an element such as <code>xsl:text</code>
           or <code>xsl:strip-space</code>.
        </li>
        <li>
           The schema imports the schema for XSD 1.0 schema documents. In
           stylesheets that contain an inline XSD 1.1 schema, this import should be
           replaced with one for the schema for XSD 1.1 schema documents.
        </li>
      </ul>
    </xs:documentation>
  </xs:annotation>
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

  <!--
The declaration of xml:space and xml:lang may need to be commented out because
of problems processing the schema using various tools
-->

  <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
  <!--schemaLocation="http://www.w3.org/2001/xml.xsd"-->

  <!-- 
    An XSLT stylesheet may contain an in-line schema within an xsl:import-schema element,
    so the Schema for schemas needs to be imported. We use the XSD 1.1 version.
-->

  <xs:import namespace="http://www.w3.org/2001/XMLSchema"
             schemaLocation="http://www.w3.org/TR/xmlschema11-1/XMLSchema.xsd"/>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <xs:annotation>
    <xs:documentation>
      <p>
         PART A: definitions of complex types and model groups used as the basis
         for element definitions
      </p>
    </xs:documentation>
  </xs:annotation>
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  
  <xs:defaultOpenContent>
    <!-- Allow xsl:note anywhere -->
    <xs:any processContents="strict" 
            namespace="##targetNamespace"
            notQName="xsl:accept 
                      xsl:accumulator 
                      xsl:accumulator-rule 
                      xsl:analyze-string 
                      xsl:apply-imports 
                      xsl:apply-templates 
                      xsl:array 
                      xsl:assert 
                      xsl:attribute 
                      xsl:attribute-set 
                      xsl:break 
                      xsl:call-template 
                      xsl:catch 
                      xsl:character-map 
                      xsl:choose 
                      xsl:comment 
                      xsl:context-item 
                      xsl:copy 
                      xsl:copy-of 
                      xsl:document 
                      xsl:decimal-format 
                      xsl:element 
                      xsl:evaluate 
                      xsl:expose 
                      xsl:fallback 
                      xsl:for-each 
                      xsl:for-each-group 
                      xsl:fork 
                      xsl:function 
                      xsl:global-context-item 
                      xsl:if 
                      xsl:import 
                      xsl:import-schema 
                      xsl:include 
                      xsl:iterate 
                      xsl:key 
                      xsl:map 
                      xsl:map-entry 
                      xsl:matching-substring 
                      xsl:merge 
                      xsl:merge-action 
                      xsl:merge-key 
                      xsl:merge-source 
                      xsl:message 
                      xsl:mode 
                      xsl:namespace 
                      xsl:namespace-alias 
                      xsl:next-iteration 
                      xsl:next-match 
                      xsl:non-matching-substring 
                      xsl:number 
                      xsl:on-completion 
                      xsl:on-empty 
                      xsl:on-non-empty 
                      xsl:otherwise 
                      xsl:output 
                      xsl:output-character 
                      xsl:override 
                      xsl:package 
                      xsl:param 
                      xsl:perform-sort 
                      xsl:preserve-space 
                      xsl:processing-instruction 
                      xsl:result-document 
                      xsl:sequence 
                      xsl:sort 
                      xsl:source-document 
                      xsl:strip-space 
                      xsl:stylesheet 
                      xsl:switch 
                      xsl:template 
                      xsl:text 
                      xsl:transform 
                      xsl:try 
                      xsl:use-package 
                      xsl:value-of 
                      xsl:variable 
                      xsl:when 
                      xsl:where-populated 
                      xsl:with-param
            "/>
  </xs:defaultOpenContent>
  
  <xs:complexType name="generic-element-type" mixed="true">
    <xs:annotation>
      <xs:documentation>
        <p>
           This complex type provides a generic supertype for all XSLT elements; it
           contains the definitions of the standard attributes that may appear on
           any element.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:attribute name="default-collation" type="xsl:uri-list"/>
    <xs:attribute name="default-mode" type="xsl:default-mode-type"/>
    <xs:attribute name="default-validation"
                  type="xsl:validation-strip-or-preserve"
                  default="strip"/>
    <xs:attribute name="exclude-result-prefixes" type="xsl:prefix-list-or-all"/>
    <xs:attribute name="expand-text" type="xsl:yes-or-no"/>
    <xs:attribute name="extension-element-prefixes" type="xsl:prefix-list"/>
    <xs:attribute name="use-when" type="xsl:expression"/>
    <xs:attribute name="xpath-default-namespace" type="xs:anyURI"/>
    <xs:attribute name="_default-collation" type="xs:string"/>
    <xs:attribute name="_default-mode" type="xs:string"/>
    <xs:attribute name="_default-validation" type="xs:string"/>
    <xs:attribute name="_exclude-result-prefixes" type="xs:string"/>
    <xs:attribute name="_expand-text" type="xs:string"/>
    <xs:attribute name="_extension-element-prefixes" type="xs:string"/>
    <xs:attribute name="_use-when" type="xs:string"/>
    <xs:attribute name="_xpath-default-namespace" type="xs:string"/>
    <xs:anyAttribute namespace="##other" processContents="lax"/>
  </xs:complexType>

  <xs:complexType name="versioned-element-type" mixed="true">
    <xs:annotation>
      <xs:documentation>
        <p>This complex type provides a generic supertype for all XSLT elements with
                the exception of <code>xsl:output</code>; it contains the
                definitions of the <code>version</code> attribute that may appear on any element.
                </p>
        <p>The <code>xsl:output</code> element does not use this definition because, although it
             has a <code>version</code> attribute, the syntax and semantics of this attribute are
             unrelated to the standard <code>version</code> attribute allowed on other elements.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="xsl:generic-element-type">
        <xs:attribute name="version" type="xs:decimal" use="optional"/>
        <xs:attribute name="_version" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="element-only-versioned-element-type" mixed="false">
    <xs:complexContent>
      <xs:restriction base="xsl:versioned-element-type">
        <xs:anyAttribute namespace="##other" processContents="lax"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="sequence-constructor">
    <xs:annotation>
      <xs:documentation>
        <p>
           This complex type provides a generic supertype for all XSLT elements
           that allow a sequence constructor as their content.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent mixed="true">
      <xs:extension base="xsl:versioned-element-type">
        <xs:group ref="xsl:sequence-constructor-group"
                  minOccurs="0"
                  maxOccurs="unbounded"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  
  <xs:complexType name="sequence-constructor-and-select">
    <xs:annotation>
      <xs:documentation>
        <p>
           This complex type allows a sequence constructor and a select attribute.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent mixed="true">
      <xs:extension base="xsl:sequence-constructor">
        <xs:attribute name="select" type="xsl:expression"/>
        <xs:attribute name="_select" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  
  <xs:complexType name="sequence-constructor-or-select">
    <xs:annotation>
      <xs:documentation>
        <p>
           This complex type allows a sequence constructor or a select attribute,
           but not both.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexContent mixed="true">
      <xs:restriction base="xsl:sequence-constructor-and-select">
        <xs:group ref="xsl:sequence-constructor-group"
                  minOccurs="0"
                  maxOccurs="unbounded"/>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
        <xs:assert test="not(exists(@select | @_select) and 
          (exists(* except xsl:fallback) or exists(text()[normalize-space()])))"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <xs:group name="sequence-constructor-group">
    <xs:annotation>
      <xs:documentation>
        <p>
           This complex type provides a generic supertype for all XSLT elements
           that allow a sequence constructor as their content.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:choice>
      <xs:element ref="xsl:instruction"/>
      <xs:group ref="xsl:result-elements"/>
    </xs:choice>
  </xs:group>

  <xs:element name="declaration" type="xsl:generic-element-type" abstract="true"/>

  <xs:element name="instruction" type="xsl:versioned-element-type" abstract="true"/>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <xs:annotation>
    <xs:documentation>
      <p>
         PART B: definitions of individual XSLT elements Elements are listed in
         alphabetical order.
      </p>
    </xs:documentation>
  </xs:annotation>
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  
  <xs:element name="accept">
    <xs:annotation>
      <xs:documentation>
        <p>This element appears as a child of <code>xsl:use-package</code> and defines 
            any variations that the containing package wishes to make to the visibility of
            components made available from a library package. For example, it may indicate that
            some of the public components in the library package are not to be made available
            to the containing package.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="component" type="xsl:component-kind-type"/>
          <xs:attribute name="names" type="xsl:component-tests"/>
          <xs:attribute name="visibility" type="xsl:visibility-type"/>
          <xs:attribute name="_component" type="xs:string"/>
          <xs:attribute name="_names" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
          <xs:assert test="exists(@component | @_component)"/>
          <xs:assert test="exists(@names | @_names)"/>
          <xs:assert test="exists(@visibility | @_visibility)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="accumulator" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:accumulator-rule" minOccurs="1" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="initial-value" type="xsl:expression"/>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="streamable" type="xsl:yes-or-no"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_initial-value" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_streamable" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="accumulator-rule">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:sequence/>
          <xs:attribute name="match" type="xsl:pattern"/>
          <xs:attribute name="phase">
            <xs:simpleType>
              <xs:restriction base="xs:token">
                <xs:enumeration value="start"/>
                <xs:enumeration value="end"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="capture" type="xsl:yes-or-no" default="no"/>
          <xs:attribute name="_match" type="xs:string"/>
          <xs:attribute name="_phase" type="xs:string"/>
          <xs:attribute name="_capture" type="xs:string"/>
          <xs:assert test="exists(@match | @_match)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="analyze-string" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:matching-substring" minOccurs="0"/>
            <xs:element ref="xsl:non-matching-substring" minOccurs="0"/>
            <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="regex" type="xsl:avt"/>
          <xs:attribute name="flags" type="xsl:avt" default=""/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_regex" type="xs:string"/>
          <xs:attribute name="_flags" type="xs:string"/>
          <xs:assert test="exists(@select | @_select)"/>
          <xs:assert test="exists(@regex | @_regex)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="apply-imports" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:with-param" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="apply-templates" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:sort"/>
            <xs:element ref="xsl:with-param"/>
          </xs:choice>
          <xs:attribute name="select" type="xsl:expression" default="child::node()"/>
          <xs:attribute name="separator" type="xsl:avt"/>
          <xs:attribute name="mode" type="xsl:mode"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_separator" type="xs:string"/>
          <xs:attribute name="_mode" type="xs:string"/>
          <xs:assert test="every $e in subsequence(xsl:sort, 2) 
                           satisfies empty($e/(@stable | @_stable))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is a static error if an <code>xsl:sort</code> element other than the first
                   in a sequence of sibling <code>xsl:sort</code> elements has a <code>stable</code>
                   attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="array"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="array-member"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="assert" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="test" type="xsl:expression"/>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="error-code" type="xsl:avt"/>
          <xs:attribute name="_test" type="xs:string"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_error-code" type="xs:string"/>
          <xs:assert test="exists(@test | @_test)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="attribute" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:avt"/>
          <xs:attribute name="namespace" type="xsl:avt"/>
          <xs:attribute name="separator" type="xsl:avt"/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_namespace" type="xs:string"/>
          <xs:attribute name="_separator" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="attribute-set" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:attribute"/>
          </xs:sequence>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="streamable" type="xsl:yes-or-no"/>
          <xs:attribute name="use-attribute-sets" type="xsl:EQNames" default=""/>
          <xs:attribute name="visibility" type="xsl:visibility-type"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_streamable" type="xs:string"/>
          <xs:attribute name="_use-attribute-sets" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="break"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>

  <xs:element name="call-template" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:with-param" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="catch">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="errors" type="xs:token" use="optional"/>
          <xs:attribute name="_errors" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="character-map" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:output-character" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="use-character-maps" type="xsl:EQNames" default=""/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_use-character-maps" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="choose" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:when" maxOccurs="unbounded"/>
            <xs:element ref="xsl:otherwise" minOccurs="0"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="comment"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="context-item">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="as" type="xsl:item-type"/>
          <xs:attribute name="use">
            <xs:simpleType>
              <xs:restriction base="xs:token">
                <xs:enumeration value="required"/>
                <xs:enumeration value="optional"/>
                <xs:enumeration value="absent"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_use" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="copy" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="copy-namespaces" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="inherit-namespaces" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="use-attribute-sets" type="xsl:EQNames" default=""/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_copy-namespaces" type="xs:string"/>
          <xs:attribute name="_inherit-namespaces" type="xs:string"/>
          <xs:attribute name="_use-attribute-sets" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="copy-of" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="copy-accumulators" type="xsl:yes-or-no" default="no"/>
          <xs:attribute name="copy-namespaces" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_copy-accumulators" type="xs:string"/>
          <xs:attribute name="_copy-namespaces" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="exists(@select | @_select)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="document" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="decimal-format" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="decimal-separator" type="xsl:char-optionally-expanded" default="."/>
          <xs:attribute name="grouping-separator" type="xsl:char-optionally-expanded" default=","/>
          <xs:attribute name="infinity" type="xs:string" default="Infinity"/>
          <xs:attribute name="minus-sign" type="xs:string" default="-"/>
          <xs:attribute name="exponent-separator" type="xsl:char-optionally-expanded" default="e"/>
          <xs:attribute name="NaN" type="xs:string" default="NaN"/>
          <xs:attribute name="percent" type="xsl:char-optionally-expanded" default="%"/>
          <xs:attribute name="per-mille" type="xsl:char-optionally-expanded" default="~"/>
          <xs:attribute name="zero-digit" type="xsl:zero-digit" default="0"/>
          <xs:attribute name="digit" type="xsl:char" default="#"/>
          <xs:attribute name="pattern-separator" type="xsl:char" default=";"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_decimal-separator" type="xs:string"/>
          <xs:attribute name="_grouping-separator" type="xs:string"/>
          <xs:attribute name="_infinity" type="xs:string"/>
          <xs:attribute name="_minus-sign" type="xs:string"/>
          <xs:attribute name="_exponent-separator" type="xs:string"/>
          <xs:attribute name="_NaN" type="xs:string"/>
          <xs:attribute name="_percent" type="xs:string"/>
          <xs:attribute name="_per-mille" type="xs:string"/>
          <xs:attribute name="_zero-digit" type="xs:string"/>
          <xs:attribute name="_digit" type="xs:string"/>
          <xs:attribute name="_pattern-separator" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="element" substitutionGroup="xsl:instruction">
    <xs:complexType mixed="true">
      <xs:complexContent>
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="name" type="xsl:avt"/>
          <xs:attribute name="namespace" type="xsl:avt"/>
          <xs:attribute name="inherit-namespaces" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="use-attribute-sets" type="xsl:EQNames" default=""/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_namespace" type="xs:string"/>
          <xs:attribute name="_inherit-namespaces" type="xs:string"/>
          <xs:attribute name="_use-attribute-sets" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="evaluate" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:with-param"/>
            <xs:element ref="xsl:fallback"/>
          </xs:choice>
          <xs:attribute name="xpath" type="xsl:expression"/>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="base-uri" type="xsl:avt"/>
          <xs:attribute name="context-item" type="xsl:expression"/>
          <xs:attribute name="namespace-context" type="xsl:expression"/>
          <xs:attribute name="schema-aware" type="xsl:avt"/>
          <xs:attribute name="with-params" type="xsl:expression"/>
          <xs:attribute name="_xpath" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_base-uri" type="xs:string"/>
          <xs:attribute name="_context-item" type="xs:string"/>
          <xs:attribute name="_namespace-context" type="xs:string"/>
          <xs:attribute name="_schema-aware" type="xs:string"/>
          <xs:attribute name="_with-params" type="xs:string"/>
          <xs:assert test="exists(@xpath | @_xpath)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="expose">
    <xs:annotation>
      <xs:documentation>
        <p>This element appears as a child of <code>xsl:use-package</code> and defines 
            the visibility of components that are made available (or not) by this package
            to other using packages.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="component" type="xsl:component-kind-type"/>
          <xs:attribute name="names" type="xsl:component-tests"/>
          <xs:attribute name="visibility" type="xsl:visibility-not-hidden-type"/>
          <xs:attribute name="_component" type="xs:string"/>
          <xs:attribute name="_names" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="fallback"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor"/>

  <xs:element name="for-each" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:sort" minOccurs="0" maxOccurs="unbounded"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="separator" type="xsl:avt"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_separator" type="xs:string"/>
          <xs:assert test="every $e in subsequence(xsl:sort, 2) 
                           satisfies empty($e/(@stable | @_stable))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is a static error if an <code>xsl:sort</code> element other than the first
                   in a sequence of sibling <code>xsl:sort</code> elements has a <code>stable</code>
                   attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="exists(@select | @_select)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="for-each-group" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:sort" minOccurs="0" maxOccurs="unbounded"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="group-by" type="xsl:expression"/>
          <xs:attribute name="group-adjacent" type="xsl:expression"/>
          <xs:attribute name="group-starting-with" type="xsl:pattern"/>
          <xs:attribute name="group-ending-with" type="xsl:pattern"/>
          <xs:attribute name="split-when" type="xsl:expression"/>
          <xs:attribute name="composite" type="xsl:yes-or-no"/>
          <xs:attribute name="collation" type="xsl:avt"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_group-by" type="xs:string"/>
          <xs:attribute name="_group-adjacent" type="xs:string"/>
          <xs:attribute name="_group-starting-with" type="xs:string"/>
          <xs:attribute name="_group-ending-with" type="xs:string"/>
          <xs:attribute name="_split_when" type="xs:string"/>
          <xs:attribute name="_composite" type="xs:string"/>
          <xs:attribute name="_collation" type="xs:string"/>
          <xs:assert test="exists(@select | @_select)"/>
          <xs:assert test="every $e in subsequence(xsl:sort, 2) 
                           satisfies empty($e/(@stable | @_stable))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is a static error if an <code>xsl:sort</code> element other than the first
                   in a sequence of sibling <code>xsl:sort</code> elements has a <code>stable</code>
                   attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="count(((@group-by|@_group-by)[1], 
                                  (@group-adjacent|@_group-adjacent)[1], 
                                  (@group-starting-with|@_group-starting-with)[1], 
                                  (@group-ending-with|@_group-ending-with)[1],
                                  (@split-when|@_split-when)[1])) = 1">
            <xs:annotation>
              <xs:documentation>
                <p>
                   These four attributes are mutually exclusive: it is a static
                   error if none of these four attributes is present or if more
                   than one of them is present.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="if (exists(@collation|@_collation) or exists(@composite|@_composite)) 
                           then (exists(@group-by|@_group-by) or exists(@group-adjacent|@_group-adjacent)) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is an error to specify the collation attribute or the
                   composite attribute if neither the group-by attribute nor
                   group-adjacent attribute is specified.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="fork" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
            <xs:choice>
              <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element ref="xsl:sequence"/>
                <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
              </xs:sequence>
              <xs:sequence>
                <xs:element ref="xsl:for-each-group"/>
                <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
              </xs:sequence>
            </xs:choice>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="function" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:param" minOccurs="0" maxOccurs="unbounded"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="name" type="xsl:EQName-in-namespace"/>
          <xs:attribute name="override" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="as" type="xsl:sequence-type" default="item()*"/>
          <xs:attribute name="visibility" type="xsl:visibility-type"/>
          <xs:attribute name="streamability" type="xsl:streamability-type"/>
          <xs:attribute name="override-extension-function" type="xsl:yes-or-no"/>
          <xs:attribute name="new-each-time" type="xsl:yes-or-no-or-maybe"/>
          <xs:attribute name="cache" type="xsl:yes-or-no"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_override" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
          <xs:attribute name="_streamability" type="xs:string"/>
          <xs:attribute name="_override-extension-function" type="xs:string"/>
          <xs:attribute name="_new-each-time" type="xs:string"/>
          <xs:attribute name="_cache" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
          <xs:assert test="every $e in xsl:param satisfies empty($e/(@visibility | @_visibility))">
            <xs:annotation>
              <xs:documentation>
                <p>A parameter for a function must have no <code>visibility</code> attribute.</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="global-context-item" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="as" type="xsl:item-type"/>
          <xs:attribute name="use">
            <xs:simpleType>
              <xs:restriction base="xs:token">
                <xs:enumeration value="required"/>
                <xs:enumeration value="optional"/>
                <xs:enumeration value="absent"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_use" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  

  <xs:element name="if" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="test" type="xsl:expression"/>
          <xs:attribute name="then" type="xsl:expression"/>
          <xs:attribute name="else" type="xsl:expression"/>
          <xs:attribute name="_test" type="xs:string"/>
          <xs:attribute name="_then" type="xs:string"/>
          <xs:attribute name="_else" type="xs:string"/>
          <xs:assert test="exists(@test | @_test)"/>
          <xs:assert test="not(exists(@then | @_then) and 
            (exists(* except xsl:fallback) or exists(text()[normalize-space()])))"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="import" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="href" type="xs:anyURI"/>
          <xs:attribute name="_href" type="xs:string"/>
          <xs:assert test="exists(@href | @_href)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="import-schema" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xs:schema" minOccurs="0" maxOccurs="1"/>
          </xs:sequence>
          <xs:attribute name="namespace" type="xs:anyURI"/>
          <xs:attribute name="schema-location" type="xs:anyURI"/>
          <xs:attribute name="_namespace" type="xs:string"/>
          <xs:attribute name="_schema-location" type="xs:string"/>
          <xs:assert test="not(exists(@schema-location | @_schema-location) and exists(xs:schema))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   XTSE0215: It is a static error if an <code>xsl:import-schema</code> element
                   that contains an xs:schema element has a <code>schema-location</code>
                   attribute
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="include" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="href" type="xs:anyURI"/>
          <xs:attribute name="_href" type="xs:string"/>
          <xs:assert test="exists(@href | @_href)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="iterate" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:param" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="xsl:on-completion" minOccurs="0" maxOccurs="1"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:assert test="exists(@select | @_select)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="key" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="match" type="xsl:pattern"/>
          <xs:attribute name="use" type="xsl:expression"/>
          <xs:attribute name="composite" type="xsl:yes-or-no"/>
          <xs:attribute name="collation" type="xs:anyURI"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_match" type="xs:string"/>
          <xs:attribute name="_use" type="xs:string"/>
          <xs:attribute name="_composite" type="xs:string"/>
          <xs:attribute name="_collation" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
          <xs:assert test="exists(@match | @_match)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="map"
              substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-and-select">
          <xs:attribute name="duplicates" type="xsl:expression"/>
          <xs:attribute name="_duplicates" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="map-entry" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-and-select">
          <xs:attribute name="key" type="xsl:expression"/>
          <xs:attribute name="_key" type="xs:string"/>
          <xs:assert test="exists(@key | @_key)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="matching-substring" type="xsl:sequence-constructor-or-select"/>

  <xs:element name="merge" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:merge-source" minOccurs="1" maxOccurs="unbounded"/>
            <xs:element ref="xsl:merge-action" minOccurs="1" maxOccurs="1"/>
            <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="merge-action" type="xsl:sequence-constructor"/>

  <xs:element name="merge-key" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="lang" type="xsl:avt"/>
          <xs:attribute name="order" type="xsl:avt"/>
          <xs:attribute name="collation" type="xs:anyURI"/>
          <xs:attribute name="case-order" type="xsl:avt"/>
          <xs:attribute name="data-type" type="xsl:avt"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_lang" type="xs:string"/>
          <xs:attribute name="_order" type="xs:string"/>
          <xs:attribute name="_collation" type="xs:string"/>
          <xs:attribute name="_case-order" type="xs:string"/>
          <xs:attribute name="_data-type" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="merge-source">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:merge-key" minOccurs="1" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="name" type="xs:NCName"/>
          <xs:attribute name="for-each-item" type="xsl:expression"/>
          <xs:attribute name="for-each-source" type="xsl:expression"/>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="streamable" type="xsl:yes-or-no"/>
          <xs:attribute name="use-accumulators" type="xsl:accumulator-names"/>
          <xs:attribute name="sort-before-merge" type="xsl:yes-or-no"/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_for-each-item" type="xs:string"/>
          <xs:attribute name="_for-each-source" type="xs:string"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_streamable" type="xs:string"/>
          <xs:attribute name="_use-accumulators" type="xs:string"/>
          <xs:attribute name="_sort-before-merge" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="exists(@select | @_select)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="message" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="terminate" type="xsl:avt" default="no"/>
          <xs:attribute name="error-code" type="xsl:avt"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_terminate" type="xs:string"/>
          <xs:attribute name="_error-code" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="mode" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent mixed="false">
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:template"/> 
            <xs:element ref="xsl:fallback"/> 
          </xs:choice>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="streamable" type="xsl:yes-or-no" default="no"/>
          <xs:attribute name="use-accumulators" type="xsl:accumulator-names"/>
          <xs:attribute name="on-no-match" type="xsl:on-no-match-type" default="shallow-skip"/>
          <xs:attribute name="on-multiple-match"
                        type="xsl:on-multiple-match-type"
                        default="use-last"/>
          <xs:attribute name="warning-on-no-match" type="xsl:yes-or-no"/>
          <xs:attribute name="warning-on-multiple-match" type="xsl:yes-or-no"/>
          <xs:attribute name="typed" type="xsl:typed-type"/>
          <xs:attribute name="visibility">
            <xs:simpleType>
              <xs:restriction base="xsl:visibility-type">
                <xs:enumeration value="public"/>
                <xs:enumeration value="private"/>
                <xs:enumeration value="final"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_streamable" type="xs:string"/>
          <xs:attribute name="_use-accumulators" type="xs:string"/>
          <xs:attribute name="_on-no-match" type="xs:string"/>
          <xs:attribute name="_on-multiple-match" type="xs:string"/>
          <xs:attribute name="_warning-on-no-match" type="xs:string"/>
          <xs:attribute name="_warning-on-multiple-match" type="xs:string"/>
          <xs:attribute name="_typed" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>


  <xs:element name="namespace" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:avt"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="namespace-alias" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="stylesheet-prefix" type="xsl:prefix-or-default"/>
          <xs:attribute name="result-prefix" type="xsl:prefix-or-default"/>
          <xs:attribute name="_stylesheet-prefix" type="xs:string"/>
          <xs:attribute name="_result-prefix" type="xs:string"/>
          <xs:assert test="exists(@stylesheet-prefix | @_stylesheet-prefix)"/>
          <xs:assert test="exists(@result-prefix | @_result-prefix)"/>
          <xs:assert test="every $prefix in (@stylesheet-prefix, @result-prefix)/normalize-space(.)[. ne '#default']
                           satisfies $prefix = in-scope-prefixes(.)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>


  <xs:element name="next-iteration" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:with-param" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>


  <xs:element name="next-match" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:with-param"/>
            <xs:element ref="xsl:fallback"/>
          </xs:choice>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="non-matching-substring" type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="note" type="xs:anyType"/>

  <xs:element name="number" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:attribute name="value" type="xsl:expression"/>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="level" type="xsl:level" default="single"/>
          <xs:attribute name="count" type="xsl:pattern"/>
          <xs:attribute name="from" type="xsl:pattern"/>
          <xs:attribute name="format" type="xsl:avt" default="1"/>
          <xs:attribute name="lang" type="xsl:avt"/>
          <xs:attribute name="letter-value" type="xsl:avt"/>
          <xs:attribute name="ordinal" type="xsl:avt"/>
          <xs:attribute name="start-at" type="xsl:avt"/>
          <xs:attribute name="grouping-separator" type="xsl:avt"/>
          <xs:attribute name="grouping-size" type="xsl:avt"/>
          <xs:attribute name="_value" type="xs:string"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_level" type="xs:string"/>
          <xs:attribute name="_count" type="xs:string"/>
          <xs:attribute name="_from" type="xs:string"/>
          <xs:attribute name="_format" type="xs:string"/>
          <xs:attribute name="_lang" type="xs:string"/>
          <xs:attribute name="_letter-value" type="xs:string"/>
          <xs:attribute name="_ordinal" type="xs:string"/>
          <xs:attribute name="_start-at" type="xs:string"/>
          <xs:attribute name="_grouping-separator" type="xs:string"/>
          <xs:attribute name="_grouping-size" type="xs:string"/>
          <xs:assert test="if (exists(@value | @_value)) 
                           then empty((@select | @_select, @count | @_count, @from | @_from)) 
                            and (exists(@_level) or normalize-space(@level)='single') 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is a static error if the value attribute of <code>xsl:number</code> is
                   present unless the <code>select</code>, <code>level</code>, <code>count</code>, 
                   and <code>from</code> attributes are all absent.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="on-completion" type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="on-empty"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>
  
  <xs:element name="on-non-empty"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor-or-select"/>

  <xs:element name="otherwise" 
              type="xsl:sequence-constructor-or-select"/>

  <xs:element name="output" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:generic-element-type">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="method" type="xsl:method"/>
          <xs:attribute name="allow-duplicate-names" type="xsl:yes-or-no"/>
          <xs:attribute name="build-tree" type="xsl:yes-or-no"/>
          <xs:attribute name="byte-order-mark" type="xsl:yes-or-no"/>
          <xs:attribute name="cdata-section-elements" type="xsl:EQNames"/>
          <xs:attribute name="doctype-public" type="xs:string"/>
          <xs:attribute name="doctype-system" type="xs:string"/>
          <xs:attribute name="encoding" type="xs:string"/>
          <xs:attribute name="escape-solidus" type="xsl:yes-or-no"/>
          <xs:attribute name="escape-uri-attributes" type="xsl:yes-or-no"/>
          <xs:attribute name="html-version" type="xs:decimal"/>
          <xs:attribute name="include-content-type" type="xsl:yes-or-no"/>
          <xs:attribute name="indent" type="xsl:yes-or-no"/>
          <xs:attribute name="item-separator" type="xs:string"/>
          <xs:attribute name="json-lines" type="xsl:yes-or-no"/>
          <xs:attribute name="json-node-output-method" type="xsl:method"/>
          <xs:attribute name="media-type" type="xs:string"/>
          <xs:attribute name="normalization-form" type="xs:NMTOKEN"/>
          <xs:attribute name="omit-xml-declaration" type="xsl:yes-or-no"/>
          <xs:attribute name="parameter-document" type="xs:anyURI"/>
          <xs:attribute name="standalone" type="xsl:yes-or-no-or-omit"/>
          <xs:attribute name="suppress-indentation" type="xsl:EQNames"/>
          <xs:attribute name="undeclare-prefixes" type="xsl:yes-or-no"/>
          <xs:attribute name="use-character-maps" type="xsl:EQNames"/>
          <xs:attribute name="version" type="xs:NMTOKEN"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_method" type="xs:string"/>
          <xs:attribute name="_byte-order-mark" type="xs:string"/>
          <xs:attribute name="_cdata-section-elements" type="xs:string"/>
          <xs:attribute name="_doctype-public" type="xs:string"/>
          <xs:attribute name="_doctype-system" type="xs:string"/>
          <xs:attribute name="_encoding" type="xs:string"/>
          <xs:attribute name="_escape-solidus" type="xs:string"/>
          <xs:attribute name="_escape-uri-attributes" type="xs:string"/>
          <xs:attribute name="_html-version" type="xs:string"/>
          <xs:attribute name="_include-content-type" type="xs:string"/>
          <xs:attribute name="_indent" type="xs:string"/>
          <xs:attribute name="_item-separator" type="xs:string"/>
          <xs:attribute name="_media-type" type="xs:string"/>
          <xs:attribute name="_normalization-form" type="xs:string"/>
          <xs:attribute name="_omit-xml-declaration" type="xs:string"/>
          <xs:attribute name="_parameter-document" type="xs:string"/>
          <xs:attribute name="_standalone" type="xs:string"/>
          <xs:attribute name="_suppress-indentation" type="xs:string"/>
          <xs:attribute name="_undeclare-prefixes" type="xs:string"/>
          <xs:attribute name="_use-character-maps" type="xs:string"/>
          <xs:attribute name="_version" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="output-character">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="character" type="xsl:char"/>
          <xs:attribute name="string" type="xs:string"/>
          <xs:attribute name="_character" type="xs:string"/>
          <xs:attribute name="_string" type="xs:string"/>
          <xs:assert test="exists(@character | @_character)"/>
          <xs:assert test="exists(@string | @_string)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="override">
    <xs:annotation>
      <xs:documentation>
        <p>This element appears as a child of <code>xsl:use-package</code> and defines 
            any overriding definitions of components that the containing package wishes to make 
            to the components made available from a library package.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:template"/>
            <xs:element ref="xsl:function"/>
            <xs:element ref="xsl:variable"/>
            <xs:element ref="xsl:param"/>
            <xs:element ref="xsl:attribute-set"/>
          </xs:choice>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
    
  <xs:element name="package">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element ref="xsl:expose"/>
              <xs:element ref="xsl:declaration"/>
              <xs:any namespace="##other" processContents="lax"/>
            </xs:choice>
          </xs:sequence>
          <xs:attribute name="declared-modes" type="xsl:yes-or-no"/>
          <xs:attribute name="id" type="xs:ID"/>
          <xs:attribute name="name" type="xs:anyURI"/>
          <xs:attribute name="package-version" type="xs:string"/>
          <xs:attribute name="input-type-annotations" type="xsl:input-type-annotations-type"/>
          <xs:attribute name="fixed-namespaces" type="xsl:fixed-namespaces-type"/>
          <xs:attribute name="_declared-modes" type="xs:string"/>
          <xs:attribute name="_id" type="xs:string"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_package-version" type="xs:string"/>
          <xs:attribute name="_input-type-annotations" type="xs:string"/>
          <xs:attribute name="_fixed-namespaces" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="param" substitutionGroup="xsl:declaration">
    <xs:annotation>
      <xs:documentation>
        <p>Declaration of the <code>xsl:param</code> element, used both defining function
            parameters, template parameters, parameters to <code>xsl:iterate</code>,
            and global stylesheet parameters.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="required" type="xsl:yes-or-no"/>
          <xs:attribute name="tunnel" type="xsl:yes-or-no"/>
          <xs:attribute name="static" type="xsl:yes-or-no"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_required" type="xs:string"/>
          <xs:attribute name="_tunnel" type="xs:string"/>
          <xs:attribute name="_static" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
          <xs:assert test="if (normalize-space(@static) = ('yes', 'true', '1')) 
                           then empty((*,text())) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   When the attribute <code>static="yes"</code> is specified, the <code>xsl:param</code>
                   element must have empty content.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  

  <xs:element name="perform-sort" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:sort" minOccurs="1" maxOccurs="unbounded"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:assert test="every $e in subsequence(xsl:sort, 2) 
                           satisfies empty($e/(@stable | @_stable))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   It is a static error if an <code>xsl:sort</code> element other than the first
                   in a sequence of sibling <code>xsl:sort</code> elements has a <code>stable</code>
                   attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="preserve-space" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="elements" type="xsl:nametests"/>
          <xs:attribute name="_elements" type="xs:string"/>
          <xs:assert test="exists(@elements | @_elements)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="processing-instruction" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:avt"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="result-document" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="format" type="xsl:avt"/>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="href" type="xsl:avt"/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="method" type="xsl:avt"/>
          <xs:attribute name="allow-duplicate-names" type="xsl:avt"/>
          <xs:attribute name="build-tree" type="xsl:avt"/>
          <xs:attribute name="byte-order-mark" type="xsl:avt"/>
          <xs:attribute name="cdata-section-elements" type="xsl:avt"/>
          <xs:attribute name="doctype-public" type="xsl:avt"/>
          <xs:attribute name="doctype-system" type="xsl:avt"/>
          <xs:attribute name="encoding" type="xsl:avt"/>
          <xs:attribute name="escape-solidus" type="xsl:avt"/>
          <xs:attribute name="escape-uri-attributes" type="xsl:avt"/>
          <xs:attribute name="html-version" type="xsl:avt"/>
          <xs:attribute name="include-content-type" type="xsl:avt"/>
          <xs:attribute name="indent" type="xsl:avt"/>
          <xs:attribute name="item-separator" type="xsl:avt"/>
          <xs:attribute name="json-lines" type="xsl:avt"/>
          <xs:attribute name="json-node-output-method" type="xsl:avt"/>
          <xs:attribute name="media-type" type="xsl:avt"/>
          <xs:attribute name="normalization-form" type="xsl:avt"/>
          <xs:attribute name="omit-xml-declaration" type="xsl:avt"/>
          <xs:attribute name="parameter-document" type="xsl:avt"/>
          <xs:attribute name="standalone" type="xsl:avt"/>
          <xs:attribute name="suppress-indentation" type="xsl:avt"/>
          <xs:attribute name="undeclare-prefixes" type="xsl:avt"/>
          <xs:attribute name="use-character-maps" type="xsl:EQNames"/>
          <xs:attribute name="output-version" type="xsl:avt"/>
          <xs:attribute name="_format" type="xs:string"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_href" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:attribute name="_method" type="xs:string"/>
          <xs:attribute name="_byte-order-mark" type="xs:string"/>
          <xs:attribute name="_cdata-section-elements" type="xs:string"/>
          <xs:attribute name="_doctype-public" type="xs:string"/>
          <xs:attribute name="_doctype-system" type="xs:string"/>
          <xs:attribute name="_encoding" type="xs:string"/>
          <xs:attribute name="_escape-solidus" type="xs:string"/>
          <xs:attribute name="_escape-uri-attributes" type="xs:string"/>
          <xs:attribute name="_html-version" type="xs:string"/>
          <xs:attribute name="_include-content-type" type="xs:string"/>
          <xs:attribute name="_indent" type="xs:string"/>
          <xs:attribute name="_item-separator" type="xs:string"/>
          <xs:attribute name="_media-type" type="xs:string"/>
          <xs:attribute name="_normalization-form" type="xs:string"/>
          <xs:attribute name="_omit-xml-declaration" type="xs:string"/>
          <xs:attribute name="_parameter-document" type="xs:string"/>
          <xs:attribute name="_standalone" type="xs:string"/>
          <xs:attribute name="_suppress-indentation" type="xs:string"/>
          <xs:attribute name="_undeclare-prefixes" type="xs:string"/>
          <xs:attribute name="_use-character-maps" type="xs:string"/>
          <xs:attribute name="_output-version" type="xs:string"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="sequence"
              substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="_as" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="sort">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="lang" type="xsl:avt"/>
          <xs:attribute name="data-type" type="xsl:avt"/>
          <xs:attribute name="order" type="xsl:avt" default="ascending"/>
          <xs:attribute name="case-order" type="xsl:avt"/>
          <xs:attribute name="collation" type="xsl:avt"/>
          <xs:attribute name="stable" type="xsl:avt"/>
          <xs:attribute name="_lang" type="xs:string"/>
          <xs:attribute name="_data-type" type="xs:string"/>
          <xs:attribute name="_order" type="xs:string"/>
          <xs:attribute name="_case-order" type="xs:string"/>
          <xs:attribute name="_collation" type="xs:string"/>
          <xs:attribute name="_stable" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="source-document" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="href" type="xsl:avt"/>
          <xs:attribute name="streamable" type="xsl:yes-or-no" default="no"/>
          <xs:attribute name="use-accumulators" type="xsl:accumulator-names"/>
          <xs:attribute name="type" type="xsl:EQName"/>
          <xs:attribute name="validation" type="xsl:validation-type"/>
          <xs:attribute name="_href" type="xs:string"/>
          <xs:attribute name="_streamable" type="xs:string"/>
          <xs:attribute name="_use-accumulators" type="xs:string"/>
          <xs:attribute name="_type" type="xs:string"/>
          <xs:attribute name="_validation" type="xs:string"/>
          <xs:assert test="exists(@href | @_href)"/>
          <xs:assert test="not(exists(@type | @_type) and exists(@validation | @_validation))">
            <xs:annotation>
              <xs:documentation>
                <p>The <code>type</code> and <code>validation</code> attributes are mutually exclusive
                  (if one is present, the other must be absent).</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="strip-space" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:attribute name="elements" type="xsl:nametests"/>
          <xs:attribute name="_elements" type="xs:string"/>
          <xs:assert test="exists(@elements | @_elements)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="stylesheet" substitutionGroup="xsl:transform"/>

  <xs:element name="switch" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:when" maxOccurs="unbounded"/>
            <xs:element ref="xsl:otherwise" minOccurs="0"/>
            <xs:element ref="xsl:fallback" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="_select" type="xsl:avt"/>
          <xs:assert test="exists(@select | @_select)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="template" substitutionGroup="xsl:declaration">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:element ref="xsl:context-item" minOccurs="0" maxOccurs="1"/>
            <xs:element ref="xsl:param" minOccurs="0" maxOccurs="unbounded"/>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:attribute name="match" type="xsl:pattern"/>
          <xs:attribute name="priority" type="xs:decimal"/>
          <xs:attribute name="mode" type="xsl:modes"/>
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="as" type="xsl:sequence-type" default="item()*"/>
          <xs:attribute name="visibility" type="xsl:visibility-type"/>
          <xs:attribute name="_match" type="xs:string"/>
          <xs:attribute name="_priority" type="xs:string"/>
          <xs:attribute name="_mode" type="xs:string"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
          <xs:assert test="exists(@match | @_match) or exists(@name | @_name)">
            <xs:annotation>
              <xs:documentation>
                <p>
                   An <code>xsl:template</code> element must have either a <code>match</code> attribute or a
                   <code>name</code> attribute, or both.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="if (empty(@match | @_match)) 
                           then (empty(@mode | @_mode) and empty(@priority | @_priority)) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   An <code>xsl:template</code> element that has no <code>match</code> attribute must have no
                   <code>mode</code> attribute and no <code>priority</code> attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="not(exists(@visibility | @_visibility) and empty(@name | @_name))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   An <code>xsl:template</code> element that has no <code>name</code> attribute must have no
                   <code>visibility</code> attribute
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="if (normalize-space(@visibility) = 'abstract') 
                           then empty(* except (xsl:context-item, xsl:param)) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   If the <code>visibility</code> attribute is present with the value <code>abstract</code>
                   then (a) the sequence constructor defining the template body
                   must be empty: that is, the only permitted children are
                   <code>xsl:context-item</code> and <code>xsl:param</code>
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="not(normalize-space(@visibility) = 'abstract' and exists(@match))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   If the <code>visibility</code> attribute is present with the value <code>abstract</code>
                   then there must be no <code>match</code> attribute.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="every $e in xsl:param satisfies empty($e/(@visibility | @_visibility))">
            <xs:annotation>
              <xs:documentation>
                <p>A parameter for a template must have no <code>visibility</code> attribute.</p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="text-element-base-type">
    <xs:simpleContent>
      <xs:restriction base="xsl:versioned-element-type">
        <xs:simpleType>
          <xs:restriction base="xs:string"/>
        </xs:simpleType>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="text-element-type">
    <xs:simpleContent>
      <xs:extension base="xsl:text-element-base-type">
        <xs:attribute name="disable-output-escaping" type="xsl:yes-or-no" default="no"/>
        <xs:attribute name="_disable-output-escaping" type="xs:string"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:element name="text"
              substitutionGroup="xsl:instruction"
              type="xsl:text-element-type"/>


  <xs:complexType name="transform-element-base-type">
    <xs:complexContent>
      <xs:restriction base="xsl:element-only-versioned-element-type">
        <xs:attribute name="version" type="xs:decimal" use="optional"/>
        <xs:attribute name="_version" type="xs:string">
          <xs:annotation>
            <xs:documentation>
              <p>
                 The version attribute indicates the version of XSLT that the
                 stylesheet module requires. The attribute is required, unless the
                 <code>xsl:stylesheet</code> element is a child of an <code>xsl:package</code> element, in
                 which case it is optional: the default is then taken from the
                 parent <code>xsl:package</code> element.
              </p>
            </xs:documentation>
          </xs:annotation>
        </xs:attribute>
        <xs:anyAttribute namespace="##other" processContents="lax"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="transform">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="xsl:transform-element-base-type">
          <xs:sequence>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element ref="xsl:declaration"/>
              <xs:any namespace="##other" processContents="lax"/>
              <!-- weaker than XSLT 1.0 -->
            </xs:choice>
          </xs:sequence>
          <xs:attribute name="id" type="xs:ID"/>
          <xs:attribute name="input-type-annotations"
                        type="xsl:input-type-annotations-type"
                        default="unspecified"/>
          <xs:attribute name="fixed-namespaces"
                        type="xsl:fixed-namespaces-type"/>
          <xs:attribute name="_id" type="xs:string"/>
          <xs:attribute name="_input-type-annotations" type="xs:string"/>
          <xs:attribute name="_fixed-namespaces" type="xs:string"/>
          <!--* The 'static' attribute may be used on 'param' and 'variable'
              * only when they are top-level elements. *-->
          <xs:assert test="every $v in (.//xsl:param, .//xsl:variable)[exists(@static | @_static)] 
                           satisfies $v[parent::xsl:stylesheet or parent::xsl:transform or parent::xsl:override]">
            <xs:annotation>
              <xs:documentation>
                <p>
                   The static attribute must not be present on an <code>xsl:variable</code> or
                   <code>xsl:param</code> element unless it is a top-level element.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="every $prefix in (@exclude-result-prefixes[not(. = '#all')], 
                                             @extension-element-prefixes) 
                           satisfies ((if ($prefix = '#default') then '' else $prefix) = in-scope-prefixes(.))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   XTSE0808: It is a static error if a namespace prefix is used
                   within the <code>[xsl:]exclude-result-prefixes</code> attribute and there is
                   no namespace binding in scope for that prefix.
                </p>
                <p>
                   XTSE0809: It is a static error if the value #default is used
                   within the <code>[xsl:]exclude-result-prefixes</code> attribute and the
                   parent element of the <code>[xsl:]exclude-result-prefixes</code> attribute
                   has no default namespace.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="try" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:versioned-element-type">
          <xs:sequence>
            <xs:group ref="xsl:sequence-constructor-group"
                      minOccurs="0"
                      maxOccurs="unbounded"/>
            <xs:element ref="xsl:catch" minOccurs="1" maxOccurs="1"/>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
              <xs:element ref="xsl:catch"/>
              <xs:element ref="xsl:fallback"/>
            </xs:choice>
          </xs:sequence>
          <xs:attribute name="rollback-output" type="xsl:yes-or-no" default="yes"/>
          <xs:attribute name="select" type="xsl:expression" use="optional"/>
          <xs:attribute name="_rollback-output" type="xs:string"/>
          <xs:attribute name="_select" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="use-package" substitutionGroup="xsl:declaration">
    <xs:annotation>
      <xs:documentation>
        <p>This element appears as a child of <code>xsl:package</code> and defines a dependency
            of the containing package on another package, identified by URI in the <code>name</code>
            attribute. The <code>package-version</code> attribute indicates which version of the
            library package is required, or may indicate a range of versions.</p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent mixed="false">
        <xs:extension base="xsl:element-only-versioned-element-type">
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="xsl:accept"/>
            <xs:element ref="xsl:override"/>
          </xs:choice>
          <xs:attribute name="name" type="xs:anyURI"/>
          <xs:attribute name="package-version" type="xs:string"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_package-version" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="value-of" substitutionGroup="xsl:instruction">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="separator" type="xsl:avt"/>
          <xs:attribute name="disable-output-escaping" type="xsl:yes-or-no" default="no"/>
          <xs:attribute name="_separator" type="xs:string"/>
          <xs:attribute name="_disable-output-escaping" type="xs:string"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="variable" substitutionGroup="xsl:declaration xsl:instruction">
    <xs:annotation>
      <xs:documentation>
        <p>Declaration of the <code>xsl:variable</code> element, used both for local
            and global variable bindings.</p>
        <p>
           This definition takes advantage of the ability in XSD 1.1 for an element
           to belong to more than one substitution group. A global variable is a
           declaration, while a local variable can appear as an instruction in a
           sequence constructor.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="visibility" type="xsl:visibility-type"/>
          <xs:attribute name="static" type="xsl:yes-or-no"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_visibility" type="xs:string"/>
          <xs:attribute name="_static" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
          <xs:assert test="if (normalize-space(@static) = ('yes', 'true', '1')) 
                           then (exists(@_visibility) or normalize-space(@visibility) 
                                       = ('', 'private', 'final')) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   When the static attribute is present with the value yes, the
                   visibility attribute must not have a value other than private or
                   final.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
          <xs:assert test="if (normalize-space(@static) = ('yes', 'true', '1')) 
                           then (empty((*, text())) and exists(@select | @_select)) 
                           else true()">
            <xs:annotation>
              <xs:documentation>
                <p>
                   When the attribute <code>static="yes"</code> is specified, the <code>xsl:variable</code>
                   element must have empty content, and the <code>select</code> attribute must
                   be present to define the value of the variable.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assert>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="when">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor">
          <xs:attribute name="select" type="xsl:expression"/>
          <xs:attribute name="test" type="xsl:expression"/>
          <xs:attribute name="_select" type="xs:string"/>
          <xs:attribute name="_test" type="xs:string"/>
          <xs:assert test="exists(@test | @_test)"/>
          <xs:assert test="not(exists(@select | @_select) and 
            (exists(* except xsl:fallback) or exists(text()[normalize-space()])))"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="where-populated"
              substitutionGroup="xsl:instruction"
              type="xsl:sequence-constructor"/>

  <xs:element name="with-param">
    <xs:complexType>
      <xs:complexContent mixed="true">
        <xs:extension base="xsl:sequence-constructor-or-select">
          <xs:attribute name="name" type="xsl:EQName"/>
          <xs:attribute name="as" type="xsl:sequence-type"/>
          <xs:attribute name="tunnel" type="xsl:yes-or-no"/>
          <xs:attribute name="_name" type="xs:string"/>
          <xs:attribute name="_as" type="xs:string"/>
          <xs:attribute name="_tunnel" type="xs:string"/>
          <xs:assert test="exists(@name | @_name)"/>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <xs:annotation>
    <xs:documentation> PART C: definition of literal result elements There are three ways to define
      the literal result elements permissible in a stylesheet. (a) do nothing. This allows any
      element to be used as a literal result element, provided it is not in the XSLT namespace (b)
      declare all permitted literal result elements as members of the <code>xsl:literal-result-element</code>
      substitution group (c) redefine the model group xsl:result-elements to accommodate all
      permitted literal result elements. Literal result elements are allowed to take certain
      attributes in the XSLT namespace. These are defined in the attribute group
      <code>literal-result-element-attributes</code>, which can be included in the definition of any literal
      result element. </xs:documentation>
  </xs:annotation>
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

  <xs:element name="literal-result-element" abstract="true" type="xs:anyType"/>

  <xs:attributeGroup name="literal-result-element-attributes">
    <xs:attribute name="default-collation" 
                  form="qualified" 
                  type="xsl:uri-list"/>
    <xs:attribute name="default-mode" 
                  form="qualified"  
                  type="xsl:default-mode-type"/>
    <xs:attribute name="default-validation" 
                  form="qualified" 
                  type="xsl:validation-strip-or-preserve"
                  default="strip"/>
    <xs:attribute name="expand-text" 
                  form="qualified"  
                  type="xsl:yes-or-no"/>
    <xs:attribute name="extension-element-prefixes" 
                  form="qualified" 
                  type="xsl:prefixes"/>
    <xs:attribute name="exclude-result-prefixes" 
                  form="qualified" 
                  type="xsl:prefixes"/>
    <xs:attribute name="xpath-default-namespace" 
                  form="qualified" 
                  type="xs:anyURI"/>
    <xs:attribute name="inherit-namespaces"
                  form="qualified"
                  type="xsl:yes-or-no"
                  default="yes"/>
    <xs:attribute name="use-attribute-sets"
                  form="qualified"
                  type="xsl:EQNames"
                  default=""/>
    <xs:attribute name="use-when" 
                  form="qualified" 
                  type="xsl:expression"/>
    <xs:attribute name="version" 
                  form="qualified" 
                  type="xs:decimal"/>
    <xs:attribute name="type" 
                  form="qualified" 
                  type="xsl:EQName"/>
    <xs:attribute name="validation" 
                  form="qualified" 
                  type="xsl:validation-type"/>
  </xs:attributeGroup>

  <xs:group name="result-elements">
    <xs:choice>
      <xs:element ref="xsl:literal-result-element"/>
      <xs:any namespace="##other" processContents="lax"/>
      <xs:any namespace="##local" processContents="lax"/>
    </xs:choice>
  </xs:group>


  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <xs:annotation>
    <xs:documentation>
      <p>
         PART D: definitions of simple types used in stylesheet attributes
      </p>
    </xs:documentation>
  </xs:annotation>
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

  <xs:simpleType name="accumulator-names">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>use-accumulators</code> attribute of <code>xsl:source-document</code>, 
           <code>xsl:merge-source</code>, or <code>xsl:global-context-item</code>: 
           either a list, each member being a QName; or the value <code>#all</code>
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union>
      <xs:simpleType>
        <xs:list itemType="xsl:EQName"/>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#all"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType> 
  
  <xs:simpleType name="avt">
    <xs:annotation>
      <xs:documentation>
        <p>
           This type is used for all attributes that allow an attribute value
           template. The general rules for the syntax of attribute value templates,
           and the specific rules for each such attribute, are described in the
           XSLT 4.0 Recommendation.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string"/>
  </xs:simpleType>
  
  <xs:simpleType name="char">
    <xs:annotation>
      <xs:documentation>
        <p>
           A string containing exactly one character.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:length value="1"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="char-optionally-expanded">
    <xs:annotation>
      <xs:documentation>
        <p>
           A string containing either a single character, or a single character
           followed by a colon followed by an arbitrary string
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:pattern value=".(:.*)?"/>
    </xs:restriction>
  </xs:simpleType>
  
   <xs:simpleType name="component-kind-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes a kind of component within a package.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="template"/>
      <xs:enumeration value="function"/>
      <xs:enumeration value="variable"/>
      <xs:enumeration value="attribute-set"/>
      <xs:enumeration value="mode"/>
      <xs:enumeration value="*"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="default-mode-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>default-mode</code> attribute of <code>xsl:stylesheet</code>, 
           <code>xsl:transform</code>, <code>xsl:package</code>
           (or any other xsl:* element): either a QName or #unnamed.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xsl:EQName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#unnamed"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  
  <xs:simpleType name="component-test">
    <xs:annotation>
      <xs:documentation>
        <p> A NameTest or a named function reference. </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xsl:nametest xsl:named-function-reference"/>
  </xs:simpleType>

  <xs:simpleType name="component-tests">
    <xs:annotation>
      <xs:documentation>
        <p> A list of NameTests or named function references</p>
      </xs:documentation>
    </xs:annotation>
    <xs:list itemType="xsl:component-test"/>
  </xs:simpleType>

  <xs:simpleType name="expression">
    <xs:annotation>
      <xs:documentation>
        <p>
           An XPath 4.0 expression.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:pattern value=".+"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="fixed-namespaces-type">
    <xs:annotation>
      <xs:documentation>
        <p>
          A sequence of tokens, each of which may be one of #default, an NCName, a prefix=namespace binding, or a URI
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:list>
      <xs:simpleType>
        <xs:union memberTypes="xsl:fixed-namespaces-type-default xs:NCName xsl:fixed-namespaces-type-prefix-binding xs:anyURI"/>
      </xs:simpleType>
    </xs:list>
 
  </xs:simpleType>
  
  <xs:simpleType name="fixed-namespaces-type-default">
    <xs:restriction base="xs:string">
       <xs:enumeration value="#default"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="fixed-namespaces-type-prefix-binding">
    <xs:restriction base="xs:string">
       <xs:pattern value="([\i-[:]][\c-[:]]*:)=.+"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="item-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           An XPath 4.0 ItemType
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:pattern value=".+"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="input-type-annotations-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes how type annotations in source documents are handled.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="preserve"/>
      <xs:enumeration value="strip"/>
      <xs:enumeration value="unspecified"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="level">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>level</code> attribute of <code>xsl:number</code>: 
           one of <code>single</code>, <code>multiple</code>, or <code>any</code>.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="single"/>
      <xs:enumeration value="multiple"/>
      <xs:enumeration value="any"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="mode">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>mode</code> attribute of <code>xsl:apply-templates</code>: 
           either a QName, or <code>#current</code>,
           or <code>#unnamed</code>, or <code>#default</code>.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xsl:EQName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#default"/>
          <xs:enumeration value="#unnamed"/>
          <xs:enumeration value="#current"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="modes">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>mode</code> attribute of <code>xsl:template</code>: either a list, each member being
           either a QName or <code>#default</code> or <code>#unnamed</code>; or the value <code>#all</code>
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union>
      <xs:simpleType>
        <xs:restriction>
          <xs:simpleType>
            <xs:list>
              <xs:simpleType>
                <xs:union memberTypes="xsl:EQName">
                  <xs:simpleType>
                    <xs:restriction base="xs:token">
                      <xs:enumeration value="#default"/>
                      <xs:enumeration value="#unnamed"/>
                    </xs:restriction>
                  </xs:simpleType>
                </xs:union>
              </xs:simpleType>
            </xs:list>
          </xs:simpleType>
          <xs:assertion test="count($value) = count(distinct-values($value))">
            <xs:annotation>
              <xs:documentation>
                <p>
                   XTSE0550: It is a static error if the same token is included
                   more than once in the list.
                </p>
              </xs:documentation>
            </xs:annotation>
          </xs:assertion>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#all"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

   <xs:simpleType name="named-function-reference">
    <xs:annotation>
      <xs:documentation>
        <p> In simple terms, this is an EQName followed by "#arity" where "arity" is a non-negative integer. However,
          XSD doesn't allow us to reuse the definition of EQName in this way, so it has to be defined from scratch. The simplest
          way to do this is with an assertion. However, the assertion cannot exploit types such as <code>xsl:EQName</code> defined in this
        schema</p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:pattern value="((Q\{.*\})|([\i-[:]][\c-[:]]*:))?[\i-[:]][\c-[:]]*#[0-9]+"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="nametest">
    <xs:annotation>
      <xs:documentation>
        <p> A list of NameTests, as defined in the XPath 31 Recommendation. Each NameTest is either
          an EQName, or "*", or "prefix:*", or "*:localname", or the wildcard Q{uri}*. </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xsl:EQName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="*"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="[\i-[:]][\c-[:]]*:\*"/>
          <xs:pattern value="\*:[\i-[:]][\c-[:]]*"/>
          <xs:pattern value="Q\{[^}]*\}\*"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="nametests">
    <xs:annotation>
      <xs:documentation>
        <p> A list of NameTests, as defined in the XPath 4.0 Recommendation. Each NameTest is either
          a QName, or "*", or "prefix:*", or "*:localname" </p>
      </xs:documentation>
    </xs:annotation>
    <xs:list itemType="xsl:nametest"/>
  </xs:simpleType>
  
  <xs:simpleType name="on-multiple-match-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes the action to be taken when there are several template rules
           to match an item in a given mode.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="use-last"/>
      <xs:enumeration value="fail"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="on-no-match-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes the action to be taken when there is no template rule to match
           an item in a given mode.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="deep-copy"/>
      <xs:enumeration value="shallow-copy"/>
      <xs:enumeration value="shallow-copy-all"/>
      <xs:enumeration value="deep-skip"/>
      <xs:enumeration value="shallow-skip"/>
      <xs:enumeration value="text-only-copy"/>
      <xs:enumeration value="fail"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="prefixes">
    <xs:list itemType="xs:NCName"/>
  </xs:simpleType>

  <xs:simpleType name="prefix-list-or-all">
    <xs:union memberTypes="xsl:prefix-list">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#all"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="prefix-list">
    <xs:list itemType="xsl:prefix-or-default"/>
  </xs:simpleType>

  <xs:simpleType name="method">
    <xs:annotation>
      <xs:documentation>
        <p>
           The <code>method</code> attribute of <code>xsl:output</code>: Either one of the recognized names
           "xml", "xhtml", "html", "text", "json", or "adaptive",
            or an EQName that must include a prefix or namespace URI.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="xml"/>
          <xs:enumeration value="xhtml"/>
          <xs:enumeration value="html"/>
          <xs:enumeration value="text"/>
          <xs:enumeration value="json"/>
          <xs:enumeration value="adaptive"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType ref="EQName-in-namespace"/>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="pattern">
    <xs:annotation>
      <xs:documentation>
        <p>
           A match pattern as defined in the XSLT 4.0 Recommendation. The syntax
           for patterns is a restricted form of the syntax for XPath 4.0
           expressions. 
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xsl:expression"/>
  </xs:simpleType>

  <xs:simpleType name="prefix-or-default">
    <xs:annotation>
      <xs:documentation>
        <p>
           Either a namespace prefix, or <code>#default</code>. Used in the <code>xsl:namespace-alias</code>
           element.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xs:NCName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="#default"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>

  <xs:simpleType name="EQNames">
    <xs:annotation>
      <xs:documentation>
        <p>
           A list of QNames. Used in the <code>[xsl:]use-attribute-sets</code> attribute of
           various elements, and in the <code>cdata-section-elements</code> attribute of
           <code>xsl:output</code>.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:list itemType="xsl:EQName"/>
  </xs:simpleType>

  <xs:simpleType name="EQName">
    <xs:annotation>
      <xs:documentation>
        <p>
           An extended QName. This schema does not use the built-in type <code>xs:QName</code>,
           but rather defines its own QName type. This may be either a local name,
           or a prefixed QName, or a name written using the extended QName notation
           <code>Q{uri}local</code>
        </p>
        <p>In XSLT 4.0, where a QName is used in the <code>name</code> attribute
        of (say) <code>xsl:template</code> or <code>xsl:call-template</code>, the prefix
        does not have to be bound in an XML namespace declaration; rather it can be bound
        in a <code>fixed-namespaces</code> attribute on the <code>xsl:stylesheet</code>
        element. Therefore, the built-in <code>xs:QName</code> type cannot be used.
        This schema does not attempt to verify that namespace prefixes have been
        properly declared.</p>
        
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xs:NCName">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="[\i-[:]][\c-[:]]*:[\i-[:]][\c-[:]]*"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="Q\{[^{}]*\}[\i-[:]][\c-[:]]*"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  
  <xs:simpleType name="EQName-in-namespace">
    <xs:annotation>
      <xs:documentation>
        <p>
           A subtype of EQNames that excludes no-namespace names
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xsl:EQName">
      <xs:pattern value="Q\{.+\}.+|\i\c*:.+"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="sequence-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           The description of a datatype, conforming to the SequenceType production
           defined in the XPath 4.0 Recommendation
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:pattern value=".+"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="streamability-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes the category to which a function belongs, with regards to its
           streaming behavior.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:union memberTypes="xsl:EQName-in-namespace">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="unclassified"/>
          <xs:enumeration value="absorbing"/>
          <xs:enumeration value="inspection"/>
          <xs:enumeration value="filter"/>
          <xs:enumeration value="shallow-descent"/>
          <xs:enumeration value="deep-descent"/>
          <xs:enumeration value="ascent"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  
  <xs:simpleType name="typed-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes whether a mode is designed to match typed or untyped nodes.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="yes"/>
      <xs:enumeration value="no"/>
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="1"/>
      <xs:enumeration value="0"/>
      <xs:enumeration value="strict"/>
      <xs:enumeration value="lax"/>
      <xs:enumeration value="unspecified"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="uri-list">
    <xs:list itemType="xs:anyURI"/>
  </xs:simpleType>

  <xs:simpleType name="validation-strip-or-preserve">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes different ways of type-annotating an element or attribute.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xsl:validation-type">
      <xs:enumeration value="preserve"/>
      <xs:enumeration value="strip"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="validation-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes different ways of type-annotating an element or attribute.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="strict"/>
      <xs:enumeration value="lax"/>
      <xs:enumeration value="preserve"/>
      <xs:enumeration value="strip"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="visibility-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes the visibility of a component within a package.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="public"/>
      <xs:enumeration value="private"/>
      <xs:enumeration value="final"/>
      <xs:enumeration value="abstract"/>
      <xs:enumeration value="hidden"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="visibility-not-hidden-type">
    <xs:annotation>
      <xs:documentation>
        <p>
           Describes the visibility of a component within a package.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xsl:visibility-type">
      <xs:enumeration value="public"/>
      <xs:enumeration value="private"/>
      <xs:enumeration value="final"/>
      <xs:enumeration value="abstract"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="yes-or-no">
    <xs:annotation>
      <xs:documentation>
        <p>
           One of the values "yes" or "no": the values "true" or "false", or "1" or
           "0" are accepted as synonyms.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="yes"/>
      <xs:enumeration value="no"/>
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="1"/>
      <xs:enumeration value="0"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="yes-or-no-or-maybe">
    <xs:annotation>
      <xs:documentation>
        <p>
           One of the values "yes" or "no" or "omit". The values "true" or "false",
           or "1" or "0" are accepted as synonyms of "yes" and "no" respectively.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="yes"/>
      <xs:enumeration value="no"/>
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="1"/>
      <xs:enumeration value="0"/>
      <xs:enumeration value="maybe"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="yes-or-no-or-omit">
    <xs:annotation>
      <xs:documentation>
        <p>
           One of the values "yes" or "no" or "omit". The values "true" or "false",
           or "1" or "0" are accepted as synonyms of "yes" and "no" respectively.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:token">
      <xs:enumeration value="yes"/>
      <xs:enumeration value="no"/>
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
      <xs:enumeration value="1"/>
      <xs:enumeration value="0"/>
      <xs:enumeration value="omit"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:simpleType name="zero-digit">
    <xs:annotation>
      <xs:documentation>
        <p>
           A digit that has the numerical value zero.
        </p>
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xsl:char">
      <xs:pattern value="\p{Nd}"/>
      <xs:assertion test="matches(string-join(codepoints-to-string(
           for $i in 0 to 9 return string-to-codepoints($value) + $i), ''), '\p{Nd}{10}')"/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>

I Changes since XSLT 3.0 (Non-Normative)

I.1 Changes in this specification

  1. Use the arrows to browse significant changes since the 3.0 version of this specification.

    See 1.2 What’s New in XSLT 4.0?

  2. Sections with significant changes are marked Δ in the table of contents.

    See 1.2 What’s New in XSLT 4.0?

  3. 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) every time they are used. [This feature was present in the editor's draft presented to the WG when it started work.]

    See 5.5.1 Named Item Types

  4. 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.]

    See 6.3 Applying Template Rules

  5. PR 751 1386 

    The result type of a mode can be declared using an as attribute. The result type of all template rules in this mode must be consistent with this, as must the values returned by any built-in template rules for the mode.

    See 6.7.4 Declaring the Result Type of a Mode

  6. 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.]

    See 7.1 The xsl:for-each instruction

  7. Numeric values of type xs:decimal are compared as decimals, without first converting to xs:double.

    See 13.1.2 Comparing Sort Key Values

  8. 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.]

    See 20 Additional Functions

  9. 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.]

    See 24 Extensibility and Fallback

  10. It is possible to invoke a named template using an extension instruction, specifically, an element whose name matches the name of the named template.

    See 10.1.3 Invoking Named Templates using Extension Instructions

    See 24.2 Extension Instructions

  11. A new attribute xsl:map/@duplicates is available, allowing control over how duplicate keys are handled by the xsl:map instruction.

    See 21.1.2 Handling of duplicate keys

  12. The semantics of patterns using the intersect and except operators have been changed to reflect the intuitive meaning: for example a node now matches A except B if it matches A and does not match B.

    See 5.4.2.3 Node Patterns

  13. A new attribute xsl:for-each-group/@split-when is available to give applications more complete control over how a sequence is partitioned

    See 14 Grouping

  14. Duplicate xsl:include declarations within a stylesheet level are now ignored, preventing spurious errors caused by the presence of duplicate named components.

    See 3.11.2 Stylesheet Inclusion

  15. Named record types are introduced.

    See 5.5.2 Named Record Types

  16. The contents of a character map declared using xsl:character-map are now available dynamically via a new character-map function.

    See 26.4 The character-map function

  17. New variables err:stack-trace, err:additional, and err:map are available within an xsl:catch clause.

    See 8.4 Try/Catch

  18. The input to the serializer can be defined using the select attribute of xsl:result-document as an alternative to using a sequence constructor.

    See 25.1 Creating Secondary Results

  19. It is no longer an intrinsic error for a global variable to refer to itself; this is now permitted, for example in cases where the value of the global variable is a recursive inline function. Cases where self-reference would not make sense are covered by the existing rules on circularities: see 9.11 Circular Definitions.

    See 9.5 Global Variables and Parameters

  20. The default value for the indent parameter is now defined to be no for all output methods other than html and xhtml.

    See 26.2 Defaults for serializationSerialization parameters

  21. The xsl:map instruction allows a select attribute as an alternative to the contained sequence constructor.

    See 21.1 Map Instructions

    The xsl:map-entry instruction, in common with other instructions, now raises error XTSE3185 (rather than XTSE3280) if both a select attribute and a sequence constructor are present.

    See 21.1 Map Instructions

  22. Composite sort keys are allowed in xsl:sort.

    See 13.1.2 Comparing Sort Key Values

  23. The xsl:mode declaration acquires an attribute copy-namespaces which determines whether or not the built-in template rule copies unused namespace bindings.

    See 6.7.1 Declaring Modes

  24. The default priority for a template rule using a union pattern has changed. This change may cause incompatible behavior.

    See 6.6 Default Priority for Template Rules

  25. The xsl:apply-imports and xsl:next-match instructions automatically pass supplied parameters to the overridden template rule.

    See 6.9 Overriding Template Rules

  26. PR 159 

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

    See 9.2.2 Default Values of Parameters

    See 10.3 Stylesheet Functions

  27. PR 237 

    The xsl:if instruction now allows then and else attributes.

    See 8.1 Conditional Processing with xsl:if

    In xsl:choose, the xsl:when and xsl:otherwise elements can take a select attribute in place of a sequence constructor.

    See 8.2 Conditional Processing with xsl:choose

    A new xsl:switch instruction is introduced.

    See 8.3 Conditional Processing with xsl:switch

  28. PR 326 

    The higher-order-function feature no longer exists; higher-order functions are now a core part of XSLT, no longer an optional extra.

    See 27 Conformance

  29. PR 353 

    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.

    See 3.7 Stylesheet 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.

    See 3.13.2 The xsl:note element

  30. PR 401 

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

    See 5.4.2.2 Type Patterns

  31. PR 406 

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

    See 22.1 Array Construction

  32. PR 470 

    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.

    See 3.7.1 The fixed-namespaces Attribute

  33. PR 489 

    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.

    See 17.1 The xsl:analyze-string Instruction

  34. PR 534 

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

    See 25.1 Creating Secondary Results

    See 26.1 The xsl:output declaration

  35. PR 542 

    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.

    See 6.7.5 Enclosing Modes

  36. PR 599 

    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.

    See 3.8 Simplified Stylesheet Modules

  37. PR 635 

    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.

    See 3.15 Importing Schema Components

    See 25.4 Validation

  38. PR 717 

    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.

    See 18.2.9 Capturing Accumulators

  39. PR 718 

    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.

    See 6.8 Built-in Template Rules

  40. PR 751 

    The xsl:mode declaration acquires an attribute as="sequence-type" which declares the return type of all template rules in that mode.

    See 6.7.1 Declaring Modes

  41. PR 1181 

    The [xsl:]xpath-default-namespace attribute can be set to the value ##any, which causes unprefixed element names to match in any namespace or none.

    See 5.1.2 Unprefixed Lexical QNames in Expressions and Patterns

  42. PR 1250 

    The strings used in the formatted number to represent a decimal separator, grouping separator, exponent separator, percent sign, per mille sign, or minus sign, are no longer constrained to be single characters.

    See 5.6 Defining a Decimal Format

  43. PR 1254 

    The rules concerning the interpretation of xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes have been tightened up.

    See 25.4 Validation

  44. PR 1306 

    An as attribute is available on the xsl:sequence instruction.

    See 11.10 Constructing Sequences

  45. PR 1361 

    The term atomic value has been replaced by atomic item.

    See 2.1 Terminology

  46. PR 1378 

    A function call at the outermost level can now be named using any valid EQName (for example fn:doc) provided it binds to one of the permitted functions fn:doc, fn:id, fn:element-with-id, fn:key, or fn:root. If two functions are called, for example doc('a.xml')/id('abc'), it is no longer necessary to put the second call in parentheses.

    See 5.4.2.3 Node Patterns

  47. PR 1442 

    Default priorities are added for new forms of ElementTest and AttributeTest, for example element(p:*) and element(a|b).

    See 6.6 Default Priority for Template Rules

  48. PR 1622 

    The rules for equality comparison have changed to bring keys into line with maps.

    See 20.2.2 fn:key

    New in 4.0.

    See 20.2.3 fn:map-for-key

  49. PR 1689 

    Composite merge keys are now allowed.

    See 15 Merging

  50. PR 1703 

    Ordered maps are introduced.

    See 21.1 Map Instructions

  51. PR 1819 

    Different parts of a stylesheet may now use different imported schemas.

    See 2.10 Stylesheets and XML Schemas

    The standard attribute [xsl:]schema-role is introduced, to allow different parts of a stylesheet to use different schemas.

    See 3.4 Standard Attributes

    Different parts of a stylesheet may now use different imported schemas.

    See 3.15 Importing Schema Components

    A stylesheet can import multiple schemas with different schema role names.

    See 3.15.1 Multiple Schemas

  52. PR 1856 

    The rules have been adjusted to allow for new capabilities in regular expressions, such as zero-width assertions.

    See 17.1 The xsl:analyze-string Instruction

  53. PR 1858 

    The xsl:record instruction is introduced to make construction of record maps simpler.

    See 21.1.1 Record Instruction

    Attribute xsl:record/@xsl:duplicates is added to control duplicate keys handling in the xsl:record instruction.

    See 21.1.2 Handling of duplicate keys