WIP updating reports, adding pass counts (old change, needs my review) reports
authorabraaksm
Sat, 22 Dec 2018 23:40:19 +0100
branchreports
changeset 1939 ef24edf20619
parent 1938 4ec5c316870a
WIP updating reports, adding pass counts (old change, needs my review)
admin/copy-of-spec-3.0.xml
admin/report-overview.html
admin/report-overview.xml
admin/report-overview.xsl
admin/reports.xslt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/admin/copy-of-spec-3.0.xml	Sat Dec 22 23:40:19 2018 +0100
@@ -0,0 +1,57990 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root lang="EN"><head>
+      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
+      <title>XSL Transformations (XSLT) Version 3.0</title>
+      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"></meta>
+          <link rel="stylesheet" type="text/css" href="https://www.w3.org/StyleSheets/TR/2016/W3C-REC.css"></link>
+   </head>
+   <body class="toc-sidebar"><p id="toc-nav"><a id="toc-jump" href="#toc"><span aria-hidden="true">↑</span> <span>Jump to Table of Contents</span></a><a id="toc-toggle" href="#toc"><span aria-hidden="true">←</span> <span>Collapse Sidebar</span></a></p>
+      <div class="head">
+         <p><a href="https://www.w3.org/"><img src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" alt="W3C" height="48" width="72"></img></a></p>
+         
+         <h1><a id="title"></a>XSL Transformations (XSLT) Version 3.0
+         </h1>
+         
+         <h2><a id="w3c-doctype"></a>W3C Recommendation 8 June 2017
+         </h2>
+         <dl>
+            <dt>This version:</dt>
+            <dd><a href="https://www.w3.org/TR/2017/REC-xslt-30-20170608/">https://www.w3.org/TR/2017/REC-xslt-30-20170608/</a></dd>
+            <dt>Latest version:</dt>
+            <dd>
+               <a href="https://www.w3.org/TR/xslt-30/">https://www.w3.org/TR/xslt-30/</a>
+               
+            </dd>
+            <dt>Previous versions:</dt>
+            <dd><a href="https://www.w3.org/TR/2017/PR-xslt-30-20170418/">https://www.w3.org/TR/2017/PR-xslt-30-20170418/</a><br /><a href="https://www.w3.org/TR/2017/CR-xslt-30-20170207/">https://www.w3.org/TR/2017/CR-xslt-30-20170207/</a><br /><a href="https://www.w3.org/TR/2015/CR-xslt-30-20151119/">https://www.w3.org/TR/2015/CR-xslt-30-20151119/</a><br /><a href="https://www.w3.org/TR/2014/WD-xslt-30-20141002/">https://www.w3.org/TR/2014/WD-xslt-30-20141002/</a><br /><a href="https://www.w3.org/TR/2013/WD-xslt-30-20131212/">https://www.w3.org/TR/2012/WD-xslt-30-20131212/</a><br /><a href="https://www.w3.org/TR/2012/WD-xslt-30-20120710/">https://www.w3.org/TR/2012/WD-xslt-30-20120710/</a></dd>
+            <dt>Editor:</dt>
+            <dd>Michael Kay, Saxonica <a href="http://www.saxonica.com/">&lt;http://www.saxonica.com/&gt;</a></dd>
+         </dl>
+         <p>Please check the <a href="http://www.w3.org/XML/2017/qt-errata/xslt-30-errata.html"><strong>errata</strong></a> for any errors or issues reported since publication.
+         </p>
+         <p>See also <a href="https://www.w3.org/2003/03/Translations/byTechnology?technology=xslt-30"><strong>translations</strong></a>.
+         </p>
+         <p>The following associated resources are available:</p>
+         <ul>
+            <li><a href="Overview.html">Normative specification in HTML format</a></li>
+            <li><a href="Overview-diff.html">HTML with revision markings (non-normative)</a></li>
+            <li><a href="schema-for-xslt30.xsd">XSD 1.1 Schema for XSLT 3.0 Stylesheets (non-normative)</a></li>
+            <li><a href="schema-for-xslt30.rnc">Relax-NG Schema for XSLT 3.0 Stylesheets (non-normative)</a></li>
+            <li><a href="schema-for-json.xsd">XSD 1.0 Schema for the XML representation of JSON used by
+                  fn:json-to-xml (non-normative)</a></li>
+            <li><a href="xml-to-json.xsl">Stylesheet for XML-to-JSON conversion (non-normative)</a></li>
+         </ul>
+         <p class="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2017 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+         </p>
+         <hr />
+      </div>
+      <div>
+         
+         <h2><a id="abstract"></a>Abstract
+         </h2>
+         <p>This specification defines the syntax and semantics of XSLT <span>3.0</span>, a language <span>designed
+               primarily</span> for transforming XML documents into other XML documents.
+         </p>
+         <p>XSLT 3.0 is a revised version of the XSLT 2.0 Recommendation <a href="#xslt20">[XSLT 2.0]</a>
+            published on 23 January 2007.
+         </p>
+         <p>The primary purpose of the changes in this version of the language is to enable
+            transformations to be performed in streaming mode, where neither the source document
+            nor
+            the result document is ever held in memory in its entirety. Another important aim
+            is to
+            improve the modularity of large stylesheets, allowing stylesheets to be developed
+            from
+            independently-developed components with a high level of software engineering robustness.
+            
+         </p>
+         <p>XSLT 3.0 is designed to be used in conjunction with XPath 3.0, which is defined in
+            <a href="#xpath-30">[XPath 3.0]</a>. XSLT shares the same data model as XPath 3.0, which is
+            defined in <a href="#xpath-datamodel-30">[XDM 3.0]</a>, and it uses the library of functions and
+            operators defined in <a href="#xpath-functions-30">[Functions and Operators 3.0]</a>. XPath 3.0 and the underlying
+            function library introduce a number of enhancements, for example the availability
+            of
+            higher-order functions. 
+         </p>
+         <p>As an implementer option, XSLT 3.0 can also be used with XPath 3.1. All XSLT 3.0 processors
+            provide maps, an addition to the data model which is specified (identically) in both
+            XSLT 3.0
+            and XPath 3.1. Other features from XPath 3.1, such as arrays, and new functions such
+            as <a href="https://www.w3.org/TR/xpath-functions-31/#func-random-number-generator"><code>random-number-generator</code></a><sup><small>FO31</small></sup> and <a href="https://www.w3.org/TR/xpath-functions-31/#func-sort"><code>sort</code></a><sup><small>FO31</small></sup>, are available in XSLT 3.0
+            stylesheets only if the implementer chooses to support XPath 3.1.
+         </p>
+         <p>Some of the functions that were previously defined in <span>the XSLT 2.0</span> specification, such as the
+            <a href="https://www.w3.org/TR/xpath-functions-30/#func-format-date"><code>format-date</code></a><sup><small>FO30</small></sup> and <a href="https://www.w3.org/TR/xpath-functions-30/#func-format-number"><code>format-number</code></a><sup><small>FO30</small></sup>
+            functions, are now defined in the standard function library to make them available
+            to
+            other host languages.
+         </p>
+         <p>XSLT 3.0 also includes optional facilities to serialize the results of a transformation,
+            by means of an interface to the serialization component described in <a href="#xslt-xquery-serialization-30">[XSLT and XQuery Serialization]</a>. <span>Again, the new serialization capabilities of
+               <a href="#xslt-xquery-serialization-31">[XSLT and XQuery Serialization 3.1]</a> are available at the implementer’s option.</span>
+            
+         </p>
+         <p>
+            <em>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 XP30 for XPath 3.0,
+               DM30 for the XDM data model version 3.0, FO30 for Functions and Operators version
+               3.0.</em>
+            
+         </p>
+      </div>
+      <div>
+         
+         <h2><a id="status"></a>Status of this Document
+         </h2>
+         <p><em>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 <a href="https://www.w3.org/TR/">W3C technical reports index at
+                  https://www.w3.org/TR/.</a></em></p>
+         <p>This document is governed by the <a id="w3c_process_revision" href="https://www.w3.org/2017/Process-20170301/">1 March 2017 W3C Process Document</a>.
+         </p>
+         <p>This is a <a href="https://www.w3.org/2017/Process-20170301/#rec-publication">Recommendation</a> of the W3C. It was developed by the W3C <a href="https://www.w3.org/Style/XSL/">XSLT Working
+               Group</a>.
+         </p>
+         <p>This Recommendation specifies XSLT version 3.0. Changes since <a href="https://www.w3.org/TR/xslt20">XSLT 2.0</a> 
+            are listed in <a href="#changes-since-2.0"><i>J Changes since XSLT 2.0</i></a>. The only incompatibilities with XSLT 2.0 relate to the way in which certain error
+            conditions are handled: the details are given in <a href="#incompatibilities"><i>N Incompatibilities with XSLT 2.0</i></a>.
+         </p>
+         <p>No substantive changes have been made to this specification since its publication
+            as a Proposed Recommendation. A few corrections
+            and clarifications have been made to non-normative text: these are listed in <a href="#changes-since-apr-2017"><i>M Changes since the Proposed Recommendation of 18 April 2017</i></a>.
+         </p>
+         <p>This document has been reviewed by W3C Members, by software developers, and by other
+            W3C groups and interested parties, 
+            and is endorsed by the Director as a W3C Recommendation. It is a stable document and
+            may be used as reference material 
+            or cited from another document. W3C's role in making the Recommendation is to draw
+            attention to the specification and 
+            to promote its widespread deployment. This enhances the functionality and interoperability
+            of the Web.
+         </p>
+         <p>A test suite for XSLT 3.0, containing over 11,000 test cases, is available at <a href="https://dvcs.w3.org/hg/xslt30-test/">https://dvcs.w3.org/hg/xslt30-test/</a>. The metadata
+            for each test case describes any dependencies on optional or implementation-defined
+            features of the specification, and provides
+            expected results for each test. Documentation on how to run tests is available within
+            the test suite. New tests may be added from time to
+            time, and contributions are welcome.
+         </p>
+         <p>An <a href="https://dvcs.w3.org/hg/xslt30-test/raw-file/tip/report/simpleReportOut.html">implementation report</a>  
+            is available detailing test results for various implementations. This link points
+            to the latest
+            version of the report; older versions are available within the repository. New submissions
+            of test results
+            are welcome. Submitted test results and a stylesheet for generating the reports can
+            be found within the
+            repository.
+         </p>
+         <p>This specification has been developed in conjunction with
+            <a href="#xpath-30">[XPath 3.0]</a> and other documents that underpin both XSLT and XQuery. XSLT
+            3.0 <span class="verb">requires</span> support for XPath 3.0 augmented by a selection of
+            features from XPath 3.1 which are described in <a href="#map"><i>21 Maps</i></a> and <a href="#json"><i>22 Processing JSON Data</i></a>. XSLT 3.0 in addition allows a processor to support the whole of XPath
+            3.1, in which case it must do so as described in <a href="#xpath31-feature"><i>27.7 XPath 3.1 Feature</i></a>. In
+            the event that future versions of XPath are defined beyond XPath 3.1, this specification
+            allows XSLT 3.0 processors to provide support for such versions, but leaves it <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a> how this is done. References in this document to
+            XPath and related specifications are by default to the 3.0 versions, but such references
+            should be treated as version-agnostic unless the relevant prose indicates otherwise.
+         </p>
+         <p><em>XSLT 3.0 specifies extensions to the XDM 3.0 data
+               model, to the XPath 3.0 language syntax, and to the XPath 3.0 function library to
+               underpin the introduction of maps, which were found necessary to support some
+               XSLT streaming use cases, to enable XSLT to process JSON data, and to make many other
+               processing tasks easier. These
+               extensions have been incorporated into XDM 3.1 and XPath 3.1. Although XDM 3.1 and
+               XPath 3.1 
+               have reached Recommendation status, XSLT 3.0 
+               has not been made dependent on XPath 3.1, other than those features needed to meet
+               the XSLT 3.0 requirements.
+               </em></p>
+         <p>Please report errors in this document using W3C’s <a href="https://www.w3.org/Bugs/Public/">public Bugzilla system</a> (instructions can
+            be found at <a href="https://www.w3.org/XML/2005/04/qt-bugzilla">https://www.w3.org/XML/2005/04/qt-bugzilla</a>). If access to that
+            system is not feasible, you may send your comments to the W3C XSLT/XPath/XQuery public
+            comments mailing list, <a href="mailto:public-qt-comments@w3.org">public-qt-comments@w3.org</a>. It will be very helpful if you include the string
+            “[XSLT30]” in the subject line of your report, whether made in Bugzilla or in email.
+            Please use multiple Bugzilla entries (or, if necessary, multiple email messages) if
+            you
+            have more than one comment to make. Archives of the comments and responses are available
+            at <a href="https://lists.w3.org/Archives/Public/public-qt-comments/">https://lists.w3.org/Archives/Public/public-qt-comments/</a>.
+         </p>
+         <p>The same mechanism may be used for reporting errors in the test suite.</p>
+         <p>This document was produced by a group operating under the <a href="https://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C
+               Patent Policy</a>. W3C maintains a <a href="https://www.w3.org/2004/01/pp-impl/19552/status#disclosures" rel="disclosure">public list of any
+               patent disclosures</a> made in connection with the deliverables of the group; that
+            page also includes instructions for disclosing a patent. An individual who has actual
+            knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
+               Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6
+               of the W3C Patent Policy</a>.
+         </p>
+      </div>
+      <nav id="toc">
+         
+         <h2><a id="contents"></a>Table of Contents
+         </h2>
+         <ol class="toc">
+            <li><a href="#introduction"><span class="secno">1 </span><span class="content">Introduction</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#what-is-xslt"><span class="secno">1.1 </span><span class="content">What is XSLT?</span></a></li>
+                  <li><a href="#whats-new-in-xslt3"><span class="secno">1.2 </span><span class="content">What’s New in XSLT 3.0?</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#concepts"><span class="secno">2 </span><span class="content">Concepts</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#terminology"><span class="secno">2.1 </span><span class="content">Terminology</span></a></li>
+                  <li><a href="#notation"><span class="secno">2.2 </span><span class="content">Notation</span></a></li>
+                  <li><a href="#initiating"><span class="secno">2.3 </span><span class="content">Initiating a Transformation</span></a><ol class="toc">
+                        <li><a href="#info-for-static-analysis"><span class="secno">2.3.1 </span><span class="content">Information needed for Static Analysis</span></a></li>
+                        <li><a href="#priming-stylesheet"><span class="secno">2.3.2 </span><span class="content">Priming a Stylesheet</span></a></li>
+                        <li><a href="#invoking-initial-mode"><span class="secno">2.3.3 </span><span class="content">Apply-Templates Invocation</span></a></li>
+                        <li><a href="#invoking-initial-template"><span class="secno">2.3.4 </span><span class="content">Call-Template Invocation</span></a></li>
+                        <li><a href="#invoking-initial-function"><span class="secno">2.3.5 </span><span class="content">Function Call Invocation</span></a></li>
+                        <li><a href="#post-processing"><span class="secno">2.3.6 </span><span class="content">Post-processing the Raw Result</span></a><a href="#result-tree-construction"><span class="secno">2.3.6.1 </span><span class="content">Result Tree Construction</span></a>
+                           <a href="#result-serialization"><span class="secno">2.3.6.2 </span><span class="content">Serializing the Result</span></a>
+                           
+                        </li>
+                     </ol>
+                  </li>
+                  <li><a href="#executing-a-transformation"><span class="secno">2.4 </span><span class="content">Instructions</span></a></li>
+                  <li><a href="#rule-based-processing"><span class="secno">2.5 </span><span class="content">Rule-Based Processing</span></a></li>
+                  <li><a href="#context"><span class="secno">2.6 </span><span class="content">The Evaluation Context</span></a></li>
+                  <li><a href="#parsing-and-serialization"><span class="secno">2.7 </span><span class="content">Parsing and Serialization</span></a></li>
+                  <li><a href="#packages-and-modules"><span class="secno">2.8 </span><span class="content">Packages and Modules</span></a></li>
+                  <li><a href="#extensibility"><span class="secno">2.9 </span><span class="content">Extensibility</span></a></li>
+                  <li><a href="#stylesheets-and-schemas"><span class="secno">2.10 </span><span class="content">Stylesheets and XML Schemas</span></a></li>
+                  <li><a href="#streaming-concepts"><span class="secno">2.11 </span><span class="content">Streaming</span></a></li>
+                  <li><a href="#streamed-validation"><span class="secno">2.12 </span><span class="content">Streamed Validation</span></a></li>
+                  <li><a href="#streaming-non-xml"><span class="secno">2.13 </span><span class="content">Streaming of non-XML data</span></a></li>
+                  <li><a href="#errors"><span class="secno">2.14 </span><span class="content">Error Handling</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#stylesheet-structure"><span class="secno">3 </span><span class="content">Stylesheet Structure</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#xslt-namespace"><span class="secno">3.1 </span><span class="content">XSLT Namespace</span></a></li>
+                  <li><a href="#extension-attributes"><span class="secno">3.2 </span><span class="content">Extension Attributes</span></a></li>
+                  <li><a href="#xslt-media-type"><span class="secno">3.3 </span><span class="content">XSLT Media Type</span></a></li>
+                  <li><a href="#standard-attributes"><span class="secno">3.4 </span><span class="content">Standard Attributes</span></a></li>
+                  <li><a href="#packages"><span class="secno">3.5 </span><span class="content">Packages</span></a><ol class="toc">
+                        <li><a href="#package-versions"><span class="secno">3.5.1 </span><span class="content">Versions of a Package</span></a></li>
+                        <li><a href="#package-dependencies"><span class="secno">3.5.2 </span><span class="content">Dependencies between Packages</span></a></li>
+                        <li><a href="#named-components"><span class="secno">3.5.3 </span><span class="content">Named Components in Packages</span></a><a href="#visibility"><span class="secno">3.5.3.1 </span><span class="content">Visibility of Components</span></a>
+                           <a href="#accepting-components"><span class="secno">3.5.3.2 </span><span class="content">Accepting Components</span></a>
+                           <a href="#package-overriding-components"><span class="secno">3.5.3.3 </span><span class="content">Overriding Components from a Used Package</span></a>
+                           <a href="#refer-to-overridden"><span class="secno">3.5.3.4 </span><span class="content">Referring to Overridden Components</span></a>
+                           <a href="#component-references"><span class="secno">3.5.3.5 </span><span class="content">Binding References to Components</span></a>
+                           <a href="#dynamic-component-references"><span class="secno">3.5.3.6 </span><span class="content">Dynamic References to Components</span></a>
+                           
+                        </li>
+                        <li><a href="#modes-and-packages"><span class="secno">3.5.4 </span><span class="content">Overriding Template Rules from a Used Package</span></a><a href="#requiring-explicit-modes"><span class="secno">3.5.4.1 </span><span class="content">Requiring Explicit Mode Declarations</span></a>
+                           
+                        </li>
+                        <li><a href="#package-local-declarations"><span class="secno">3.5.5 </span><span class="content">Declarations Local to a Package</span></a></li>
+                        <li><a href="#declaring-global-context-item"><span class="secno">3.5.6 </span><span class="content">Declaring the Global Context Item</span></a></li>
+                        <li><a href="#packages-csv-library-example"><span class="secno">3.5.7 </span><span class="content">Worked Example of a Library Package</span></a><a href="#csv-example-default-functionality"><span class="secno">3.5.7.1 </span><span class="content">Default Functionality of the CSV Package</span></a>
+                           <a href="#csv-example-package-structure"><span class="secno">3.5.7.2 </span><span class="content">Package Structure</span></a>
+                           <a href="#csv-example-customizing-parse"><span class="secno">3.5.7.3 </span><span class="content">The csv:parse Function and its User-customization Hooks</span></a>
+                           <a href="#csv-example-line-breaking"><span class="secno">3.5.7.4 </span><span class="content">Breaking the Input into Lines</span></a>
+                           <a href="#csv-example-preprocessing-lines"><span class="secno">3.5.7.5 </span><span class="content">Pre-processing the Lines</span></a>
+                           <a href="#example-csv-mode-parse-line"><span class="secno">3.5.7.6 </span><span class="content">The Mode csv:parse-line</span></a>
+                           <a href="#csv-example-mode"><span class="secno">3.5.7.7 </span><span class="content">Mode csv:parse-field</span></a>
+                           <a href="#csv-example-variable"><span class="secno">3.5.7.8 </span><span class="content">The csv:quote Variable</span></a>
+                           <a href="#csv-example-preprocess-field"><span class="secno">3.5.7.9 </span><span class="content">The csv:preprocess-field Function</span></a>
+                           <a href="#csv-example-postprocess"><span class="secno">3.5.7.10 </span><span class="content">The Mode csv:post-process</span></a>
+                           <a href="#csv-example-overriding"><span class="secno">3.5.7.11 </span><span class="content">Overriding the Default Behavior</span></a>
+                           
+                        </li>
+                     </ol>
+                  </li>
+                  <li><a href="#stylesheet-modules"><span class="secno">3.6 </span><span class="content">Stylesheet Modules</span></a></li>
+                  <li><a href="#stylesheet-element"><span class="secno">3.7 </span><span class="content">Stylesheet Element</span></a><ol class="toc">
+                        <li><a href="#default-collation-attribute"><span class="secno">3.7.1 </span><span class="content">The default-collation Attribute</span></a></li>
+                        <li><a href="#default-mode"><span class="secno">3.7.2 </span><span class="content">The default-mode Attribute</span></a></li>
+                        <li><a href="#user-defined-top-level"><span class="secno">3.7.3 </span><span class="content">User-defined Data Elements</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#simplified-stylesheet"><span class="secno">3.8 </span><span class="content">Simplified Stylesheet Modules</span></a></li>
+                  <li><a href="#backwards"><span class="secno">3.9 </span><span class="content">Backwards Compatible Processing</span></a><ol class="toc">
+                        <li><a href="#backwards-1.0"><span class="secno">3.9.1 </span><span class="content">XSLT 1.0 Compatibility Mode</span></a></li>
+                        <li><a href="#backwards-2.0"><span class="secno">3.9.2 </span><span class="content">XSLT 2.0 Compatibility Mode</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#forwards"><span class="secno">3.10 </span><span class="content">Forwards Compatible Processing</span></a></li>
+                  <li><a href="#combining-modules"><span class="secno">3.11 </span><span class="content">Combining Stylesheet Modules</span></a><ol class="toc">
+                        <li><a href="#locating-modules"><span class="secno">3.11.1 </span><span class="content">Locating Stylesheet Modules</span></a></li>
+                        <li><a href="#include"><span class="secno">3.11.2 </span><span class="content">Stylesheet Inclusion</span></a></li>
+                        <li><a href="#import"><span class="secno">3.11.3 </span><span class="content">Stylesheet Import</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#embedded"><span class="secno">3.12 </span><span class="content">Embedded Stylesheet Modules</span></a></li>
+                  <li><a href="#preprocessing"><span class="secno">3.13 </span><span class="content">Stylesheet Preprocessing</span></a><ol class="toc">
+                        <li><a href="#conditional-inclusion"><span class="secno">3.13.1 </span><span class="content">Conditional Element Inclusion</span></a></li>
+                        <li><a href="#shadow-attributes"><span class="secno">3.13.2 </span><span class="content">Shadow Attributes</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#built-in-types"><span class="secno">3.14 </span><span class="content">Built-in Types</span></a></li>
+                  <li><a href="#import-schema"><span class="secno">3.15 </span><span class="content">Importing Schema Components</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#data-model"><span class="secno">4 </span><span class="content">Data Model</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#xml-versions"><span class="secno">4.1 </span><span class="content">XML Versions</span></a></li>
+                  <li><a href="#xdm-versions"><span class="secno">4.2 </span><span class="content">XDM versions</span></a></li>
+                  <li><a href="#stylesheet-stripping"><span class="secno">4.3 </span><span class="content">Stripping Whitespace from the Stylesheet</span></a></li>
+                  <li><a href="#preprocessing-source-docs"><span class="secno">4.4 </span><span class="content">Preprocessing Source Documents</span></a><ol class="toc">
+                        <li><a href="#stripping-annotations"><span class="secno">4.4.1 </span><span class="content">Stripping Type Annotations from a Source Tree</span></a></li>
+                        <li><a href="#strip"><span class="secno">4.4.2 </span><span class="content">Stripping Whitespace from a Source Tree</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#id-in-data-model"><span class="secno">4.5 </span><span class="content">Attribute Types and DTD Validation</span></a></li>
+                  <li><a href="#model-for-streaming"><span class="secno">4.6 </span><span class="content">Data Model for Streaming</span></a><ol class="toc">
+                        <li><a href="#streamed-documents"><span class="secno">4.6.1 </span><span class="content">Streamed Documents</span></a></li>
+                        <li><a href="#streaming-other-types"><span class="secno">4.6.2 </span><span class="content">Other Data Structures</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#limits"><span class="secno">4.7 </span><span class="content">Limits</span></a></li>
+                  <li><a href="#d-o-e-in-data-model"><span class="secno">4.8 </span><span class="content">Disable Output Escaping</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#constructs"><span class="secno">5 </span><span class="content">Features of the XSLT Language</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#names"><span class="secno">5.1 </span><span class="content">Names</span></a><ol class="toc">
+                        <li><a href="#qname"><span class="secno">5.1.1 </span><span class="content">Qualified Names</span></a></li>
+                        <li><a href="#unprefixed-qnames"><span class="secno">5.1.2 </span><span class="content">Unprefixed Lexical QNames in Expressions and Patterns</span></a></li>
+                        <li><a href="#reserved-namespaces"><span class="secno">5.1.3 </span><span class="content">Reserved Namespaces</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#expressions"><span class="secno">5.2 </span><span class="content">Expressions</span></a></li>
+                  <li><a href="#static-and-dynamic-context"><span class="secno">5.3 </span><span class="content">The Static and Dynamic Context</span></a><ol class="toc">
+                        <li><a href="#static-context"><span class="secno">5.3.1 </span><span class="content">Initializing the Static Context</span></a></li>
+                        <li><a href="#additional-static-context"><span class="secno">5.3.2 </span><span class="content">Additional Static Context Components used by XSLT</span></a></li>
+                        <li><a href="#xpath-dynamic-context"><span class="secno">5.3.3 </span><span class="content">Initializing the Dynamic Context</span></a><a href="#focus"><span class="secno">5.3.3.1 </span><span class="content">Maintaining Position: the Focus</span></a>
+                           <a href="#evaluation-context"><span class="secno">5.3.3.2 </span><span class="content">Other Components of the XPath Dynamic Context</span></a>
+                           
+                        </li>
+                        <li><a href="#additional-dynamic-context"><span class="secno">5.3.4 </span><span class="content">Additional Dynamic Context Components used by XSLT</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#defining-decimal-format"><span class="secno">5.4 </span><span class="content">Defining a Decimal Format</span></a></li>
+                  <li><a href="#patterns"><span class="secno">5.5 </span><span class="content">Patterns</span></a><ol class="toc">
+                        <li><a href="#pattern-examples"><span class="secno">5.5.1 </span><span class="content">Examples of Patterns</span></a></li>
+                        <li><a href="#pattern-syntax"><span class="secno">5.5.2 </span><span class="content">Syntax of Patterns</span></a></li>
+                        <li><a href="#pattern-semantics"><span class="secno">5.5.3 </span><span class="content">The Meaning of a Pattern</span></a></li>
+                        <li><a href="#pattern-errors"><span class="secno">5.5.4 </span><span class="content">Errors in Patterns</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#value-templates"><span class="secno">5.6 </span><span class="content">Value Templates</span></a><ol class="toc">
+                        <li><a href="#attribute-value-templates"><span class="secno">5.6.1 </span><span class="content">Attribute Value Templates</span></a></li>
+                        <li><a href="#text-value-templates"><span class="secno">5.6.2 </span><span class="content">Text Value Templates</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#sequence-constructors"><span class="secno">5.7 </span><span class="content">Sequence Constructors</span></a><ol class="toc">
+                        <li><a href="#constructing-complex-content"><span class="secno">5.7.1 </span><span class="content">Constructing Complex Content</span></a></li>
+                        <li><a href="#constructing-simple-content"><span class="secno">5.7.2 </span><span class="content">Constructing Simple Content</span></a></li>
+                        <li><a href="#namespace-fixup"><span class="secno">5.7.3 </span><span class="content">Namespace Fixup</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#uri-references"><span class="secno">5.8 </span><span class="content">URI References</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#rules"><span class="secno">6 </span><span class="content">Template Rules</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#defining-templates"><span class="secno">6.1 </span><span class="content">Defining Templates</span></a></li>
+                  <li><a href="#defining-template-rules"><span class="secno">6.2 </span><span class="content">Defining Template Rules</span></a></li>
+                  <li><a href="#applying-templates"><span class="secno">6.3 </span><span class="content">Applying Template Rules</span></a></li>
+                  <li><a href="#conflict"><span class="secno">6.4 </span><span class="content">Conflict Resolution for Template Rules</span></a></li>
+                  <li><a href="#default-priority"><span class="secno">6.5 </span><span class="content">Default Priority for Template Rules</span></a></li>
+                  <li><a href="#modes"><span class="secno">6.6 </span><span class="content">Modes</span></a><ol class="toc">
+                        <li><a href="#declaring-modes"><span class="secno">6.6.1 </span><span class="content">Declaring Modes</span></a></li>
+                        <li><a href="#using-modes"><span class="secno">6.6.2 </span><span class="content">Using Modes</span></a></li>
+                        <li><a href="#xsl-mode-typed"><span class="secno">6.6.3 </span><span class="content">Declaring the Type of Nodes Processed by a Mode</span></a></li>
+                        <li><a href="#streamable-templates"><span class="secno">6.6.4 </span><span class="content">Streamable Templates</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#built-in-rule"><span class="secno">6.7 </span><span class="content">Built-in Template Rules</span></a><ol class="toc">
+                        <li><a href="#built-in-templates-text-only-copy"><span class="secno">6.7.1 </span><span class="content">Built-in Templates: Text-only Copy</span></a></li>
+                        <li><a href="#built-in-templates-deep-copy"><span class="secno">6.7.2 </span><span class="content">Built-in Templates: Deep Copy</span></a></li>
+                        <li><a href="#built-in-templates-shallow-copy"><span class="secno">6.7.3 </span><span class="content">Built-in Templates: Shallow Copy</span></a></li>
+                        <li><a href="#built-in-templates-deep-skip"><span class="secno">6.7.4 </span><span class="content">Built-in Templates: Deep Skip</span></a></li>
+                        <li><a href="#built-in-templates-shallow-skip"><span class="secno">6.7.5 </span><span class="content">Built-in Templates: Shallow Skip</span></a></li>
+                        <li><a href="#built-in-templates-fail"><span class="secno">6.7.6 </span><span class="content">Built-in Templates: Fail</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#apply-imports"><span class="secno">6.8 </span><span class="content">Overriding Template Rules</span></a></li>
+                  <li><a href="#parameters-to-template-rules"><span class="secno">6.9 </span><span class="content">Passing Parameters to Template Rules</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#repetition"><span class="secno">7 </span><span class="content">Repetition</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#for-each"><span class="secno">7.1 </span><span class="content">The xsl:for-each instruction</span></a></li>
+                  <li><a href="#iterate"><span class="secno">7.2 </span><span class="content">The xsl:iterate Instruction</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#conditionals"><span class="secno">8 </span><span class="content">Conditional Processing</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#xsl-if"><span class="secno">8.1 </span><span class="content">Conditional Processing with xsl:if
+                           </span></a></li>
+                  <li><a href="#xsl-choose"><span class="secno">8.2 </span><span class="content">Conditional Processing with xsl:choose
+                           </span></a></li>
+                  <li><a href="#try-catch"><span class="secno">8.3 </span><span class="content">Try/Catch</span></a><ol class="toc">
+                        <li><a href="#recovery"><span class="secno">8.3.1 </span><span class="content">Recovery of Result Trees</span></a></li>
+                        <li><a href="#try-catch-examples"><span class="secno">8.3.2 </span><span class="content">Try/Catch Examples</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#conditional-content-construction"><span class="secno">8.4 </span><span class="content">Conditional Content Construction</span></a><ol class="toc">
+                        <li><a href="#where-populated"><span class="secno">8.4.1 </span><span class="content">The xsl:where-populated instruction</span></a></li>
+                        <li><a href="#on-empty"><span class="secno">8.4.2 </span><span class="content">The xsl:on-empty instruction</span></a></li>
+                        <li><a href="#on-non-empty"><span class="secno">8.4.3 </span><span class="content">The xsl:on-non-empty instruction</span></a></li>
+                        <li><a href="#evaluating-on-empty"><span class="secno">8.4.4 </span><span class="content">Evaluating xsl:on-empty and xsl:on-non-empty
+                                 Instructions</span></a></li>
+                        <li><a href="#where-populated-example"><span class="secno">8.4.5 </span><span class="content">A More Complex Example</span></a></li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+            <li><a href="#variables-and-parameters"><span class="secno">9 </span><span class="content">Variables and Parameters</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#variables"><span class="secno">9.1 </span><span class="content">Variables</span></a></li>
+                  <li><a href="#parameters"><span class="secno">9.2 </span><span class="content">Parameters</span></a><ol class="toc">
+                        <li><a href="#parameter-type"><span class="secno">9.2.1 </span><span class="content">The Required Type of a Parameter</span></a></li>
+                        <li><a href="#default-values-of-parameters"><span class="secno">9.2.2 </span><span class="content">Default Values of Parameters</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#variable-values"><span class="secno">9.3 </span><span class="content">Values of Variables and Parameters</span></a></li>
+                  <li><a href="#temporary-trees"><span class="secno">9.4 </span><span class="content">Creating Implicit Document Nodes</span></a></li>
+                  <li><a href="#global-variables"><span class="secno">9.5 </span><span class="content">Global Variables and Parameters</span></a></li>
+                  <li><a href="#static-params"><span class="secno">9.6 </span><span class="content">Static Variables and Parameters</span></a></li>
+                  <li><a href="#static-expression"><span class="secno">9.7 </span><span class="content">Static Expressions</span></a></li>
+                  <li><a href="#local-variables"><span class="secno">9.8 </span><span class="content">Local Variables and Parameters</span></a></li>
+                  <li><a href="#scope-of-variables"><span class="secno">9.9 </span><span class="content">Scope of Variables</span></a></li>
+                  <li><a href="#with-param"><span class="secno">9.10 </span><span class="content">Setting Parameter Values</span></a></li>
+                  <li><a href="#circularity"><span class="secno">9.11 </span><span class="content">Circular Definitions</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#callable-components"><span class="secno">10 </span><span class="content">Callable Components</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#named-templates"><span class="secno">10.1 </span><span class="content">Named Templates</span></a><ol class="toc">
+                        <li><a href="#declaring-context-item"><span class="secno">10.1.1 </span><span class="content">Declaring the Context Item for a Template</span></a></li>
+                        <li><a href="#call-template-params"><span class="secno">10.1.2 </span><span class="content">Passing Parameters to Named Templates</span></a></li>
+                        <li><a href="#tunnel-params"><span class="secno">10.1.3 </span><span class="content">Tunnel Parameters</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#attribute-sets"><span class="secno">10.2 </span><span class="content">Named Attribute Sets</span></a><ol class="toc">
+                        <li><a href="#using-attribute-sets"><span class="secno">10.2.1 </span><span class="content">Using Attribute Sets</span></a></li>
+                        <li><a href="#visibility-of-attribute-sets"><span class="secno">10.2.2 </span><span class="content">Visibility of Attribute Sets</span></a></li>
+                        <li><a href="#streamability-of-attribute-sets"><span class="secno">10.2.3 </span><span class="content">Streamability of Attribute Sets</span></a></li>
+                        <li><a href="#evaluating-attribute-sets"><span class="secno">10.2.4 </span><span class="content">Evaluating Attribute Sets</span></a></li>
+                        <li><a href="#attribute-sets-examples"><span class="secno">10.2.5 </span><span class="content">Attribute Sets: Examples</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#stylesheet-functions"><span class="secno">10.3 </span><span class="content">Stylesheet Functions</span></a><ol class="toc">
+                        <li><a href="#xsl-function-name"><span class="secno">10.3.1 </span><span class="content">Function Name and Arity</span></a></li>
+                        <li><a href="#function-arguments"><span class="secno">10.3.2 </span><span class="content">Arguments</span></a></li>
+                        <li><a href="#function-result"><span class="secno">10.3.3 </span><span class="content">Function Result</span></a></li>
+                        <li><a href="#function-visibility-and-overriding"><span class="secno">10.3.4 </span><span class="content">Visibility and Overriding of Functions</span></a></li>
+                        <li><a href="#streamability-of-stylesheet-functions"><span class="secno">10.3.5 </span><span class="content">Streamability of Stylesheet Functions</span></a></li>
+                        <li><a href="#function-lookup"><span class="secno">10.3.6 </span><span class="content">Dynamic Access to Functions</span></a></li>
+                        <li><a href="#function-determinism"><span class="secno">10.3.7 </span><span class="content">Determinism of Functions</span></a></li>
+                        <li><a href="#memoization"><span class="secno">10.3.8 </span><span class="content">Memoization</span></a></li>
+                        <li><a href="#function-examples"><span class="secno">10.3.9 </span><span class="content">Examples of Stylesheet Functions</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#dynamic-xpath"><span class="secno">10.4 </span><span class="content">Dynamic XPath Evaluation</span></a><ol class="toc">
+                        <li><a href="#evaluate-static-context"><span class="secno">10.4.1 </span><span class="content">Static context for the target expression</span></a></li>
+                        <li><a href="#evaluate-dynamic-context"><span class="secno">10.4.2 </span><span class="content">Dynamic context for the target expression</span></a></li>
+                        <li><a href="#evaluate-effect"><span class="secno">10.4.3 </span><span class="content">The effect of the xsl:evaluate instruction</span></a></li>
+                        <li><a href="#evaluation-as-optional-feature"><span class="secno">10.4.4 </span><span class="content">xsl:evaluate as an optional feature</span></a></li>
+                        <li><a href="#evaluate-examples"><span class="secno">10.4.5 </span><span class="content">Examples of xsl:evaluate</span></a></li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+            <li><a href="#creating-new-nodes"><span class="secno">11 </span><span class="content">Creating Nodes and Sequences</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#literal-result-element"><span class="secno">11.1 </span><span class="content">Literal Result Elements</span></a><ol class="toc">
+                        <li><a href="#setting-annotation-for-lre"><span class="secno">11.1.1 </span><span class="content">Setting the Type Annotation for Literal Result Elements</span></a></li>
+                        <li><a href="#attributes-for-lres"><span class="secno">11.1.2 </span><span class="content">Attribute Nodes for Literal Result Elements</span></a></li>
+                        <li><a href="#lre-namespaces"><span class="secno">11.1.3 </span><span class="content">Namespace Nodes for Literal Result Elements</span></a></li>
+                        <li><a href="#namespace-aliasing"><span class="secno">11.1.4 </span><span class="content">Namespace Aliasing</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#xsl-element"><span class="secno">11.2 </span><span class="content">Creating Element Nodes Using xsl:element
+                           </span></a><ol class="toc">
+                        <li><a href="#xsl-element-content"><span class="secno">11.2.1 </span><span class="content">The Content of the Constructed Element Node</span></a></li>
+                        <li><a href="#xsl-element-name"><span class="secno">11.2.2 </span><span class="content">The Name of the Constructed Element Node</span></a></li>
+                        <li><a href="#xsl-element-properties"><span class="secno">11.2.3 </span><span class="content">Other Properties of the Constructed Element Node</span></a></li>
+                        <li><a href="#annotation-for-constructed-element"><span class="secno">11.2.4 </span><span class="content">The Type Annotation of the Constructed Element Node</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#creating-attributes"><span class="secno">11.3 </span><span class="content">Creating Attribute Nodes Using xsl:attribute
+                           </span></a><ol class="toc">
+                        <li><a href="#annotation-for-constructed-attribute"><span class="secno">11.3.1 </span><span class="content">Setting the Type Annotation for a Constructed Attribute Node</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#creating-text-nodes"><span class="secno">11.4 </span><span class="content">Creating Text Nodes</span></a><ol class="toc">
+                        <li><a href="#literal-text-nodes"><span class="secno">11.4.1 </span><span class="content">Literal Text Nodes</span></a></li>
+                        <li><a href="#xsl-text"><span class="secno">11.4.2 </span><span class="content">Creating Text Nodes Using xsl:text
+                                 </span></a></li>
+                        <li><a href="#value-of"><span class="secno">11.4.3 </span><span class="content">Generating Text with xsl:value-of
+                                 </span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#creating-document-nodes"><span class="secno">11.5 </span><span class="content">Creating Document Nodes</span></a></li>
+                  <li><a href="#creating-processing-instructions"><span class="secno">11.6 </span><span class="content">Creating Processing Instructions</span></a></li>
+                  <li><a href="#creating-namespace-nodes"><span class="secno">11.7 </span><span class="content">Creating Namespace Nodes</span></a></li>
+                  <li><a href="#creating-comments"><span class="secno">11.8 </span><span class="content">Creating Comments</span></a></li>
+                  <li><a href="#copying"><span class="secno">11.9 </span><span class="content">Copying Nodes</span></a><ol class="toc">
+                        <li><a href="#shallow-copy"><span class="secno">11.9.1 </span><span class="content">Shallow Copy</span></a></li>
+                        <li><a href="#copy-of"><span class="secno">11.9.2 </span><span class="content">Deep Copy</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#constructing-sequences"><span class="secno">11.10 </span><span class="content">Constructing Sequences</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#number"><span class="secno">12 </span><span class="content">Numbering</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#start-at"><span class="secno">12.1 </span><span class="content">The start-at Attribute</span></a></li>
+                  <li><a href="#formatting-supplied-number"><span class="secno">12.2 </span><span class="content">Formatting a Supplied Number</span></a></li>
+                  <li><a href="#numbering-based-on-position"><span class="secno">12.3 </span><span class="content">Numbering based on Position in a Document </span></a></li>
+                  <li><a href="#convert"><span class="secno">12.4 </span><span class="content">Number to String Conversion Attributes</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#sorting"><span class="secno">13 </span><span class="content">Sorting</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#xsl-sort"><span class="secno">13.1 </span><span class="content">The xsl:sort Element</span></a><ol class="toc">
+                        <li><a href="#sorting-process"><span class="secno">13.1.1 </span><span class="content">The Sorting Process</span></a></li>
+                        <li><a href="#comparing-sort-keys"><span class="secno">13.1.2 </span><span class="content">Comparing Sort Key Values</span></a></li>
+                        <li><a href="#collating-sequences"><span class="secno">13.1.3 </span><span class="content">Sorting Using Collations</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#creating-sorted-sequence"><span class="secno">13.2 </span><span class="content">Creating a Sorted Sequence</span></a></li>
+                  <li><a href="#sorted-iteration"><span class="secno">13.3 </span><span class="content">Processing a Sequence in Sorted Order</span></a></li>
+                  <li><a href="#uca-collations"><span class="secno">13.4 </span><span class="content">The Unicode Collation Algorithm</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#grouping"><span class="secno">14 </span><span class="content">Grouping</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#xsl-for-each-group"><span class="secno">14.1 </span><span class="content">The xsl:for-each-group Element</span></a></li>
+                  <li><a href="#information-about-group"><span class="secno">14.2 </span><span class="content">Accessing Information about the Current Group Value</span></a><ol class="toc">
+                        <li><a href="#func-current-group"><span class="secno">14.2.1 </span><span class="content">fn:current-group</span></a></li>
+                        <li><a href="#func-current-grouping-key"><span class="secno">14.2.2 </span><span class="content">fn:current-grouping-key</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#order-of-groups"><span class="secno">14.3 </span><span class="content">Ordering among Groups</span></a></li>
+                  <li><a href="#grouping-examples"><span class="secno">14.4 </span><span class="content">Examples of Grouping</span></a></li>
+                  <li><a href="#non-transitivity"><span class="secno">14.5 </span><span class="content">Non-Transitivity</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#merging"><span class="secno">15 </span><span class="content">Merging</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#merge-terminology"><span class="secno">15.1 </span><span class="content">Terminology for Merging</span></a></li>
+                  <li><a href="#merge-instruction"><span class="secno">15.2 </span><span class="content">The xsl:merge Instruction</span></a></li>
+                  <li><a href="#merge-input-sequences"><span class="secno">15.3 </span><span class="content">Selecting the Sequences to be Merged</span></a></li>
+                  <li><a href="#streamable-merging"><span class="secno">15.4 </span><span class="content">Streamable Merging</span></a></li>
+                  <li><a href="#merge-keys"><span class="secno">15.5 </span><span class="content">Defining the Merge Keys</span></a></li>
+                  <li><a href="#current-merge-group-and-key"><span class="secno">15.6 </span><span class="content">The Current Merge Group and Key</span></a><ol class="toc">
+                        <li><a href="#func-current-merge-group"><span class="secno">15.6.1 </span><span class="content">fn:current-merge-group</span></a></li>
+                        <li><a href="#func-current-merge-key"><span class="secno">15.6.2 </span><span class="content">fn:current-merge-key</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#merge-action"><span class="secno">15.7 </span><span class="content">The xsl:merge-action Element</span></a></li>
+                  <li><a href="#merge-examples"><span class="secno">15.8 </span><span class="content">Examples of xsl:merge</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#splitting"><span class="secno">16 </span><span class="content">Splitting</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#fork-instruction"><span class="secno">16.1 </span><span class="content">The xsl:fork Instruction</span></a></li>
+                  <li><a href="#splitting-examples"><span class="secno">16.2 </span><span class="content">Examples of Splitting with Streamed Data</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#regular-expressions"><span class="secno">17 </span><span class="content">Regular Expressions</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#analyze-string"><span class="secno">17.1 </span><span class="content">The xsl:analyze-string Instruction</span></a></li>
+                  <li><a href="#func-regex-group"><span class="secno">17.2 </span><span class="content">fn:regex-group</span></a></li>
+                  <li><a href="#regex-examples"><span class="secno">17.3 </span><span class="content">Examples of Regular Expression Matching</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#streaming"><span class="secno">18 </span><span class="content">Streaming</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#source-document-instruction"><span class="secno">18.1 </span><span class="content">The xsl:source-document Instruction</span></a><ol class="toc">
+                        <li><a href="#source-document-validation"><span class="secno">18.1.1 </span><span class="content">Validation of Source Documents</span></a></li>
+                        <li><a href="#stream-examples"><span class="secno">18.1.2 </span><span class="content">Examples of xsl:source-document</span></a></li>
+                        <li><a href="#func-stream-available"><span class="secno">18.1.3 </span><span class="content">fn:stream-available</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#accumulators"><span class="secno">18.2 </span><span class="content">Accumulators</span></a><ol class="toc">
+                        <li><a href="#accumulator-declaration"><span class="secno">18.2.1 </span><span class="content">Declaring an Accumulator</span></a></li>
+                        <li><a href="#applicability-of-accumulators"><span class="secno">18.2.2 </span><span class="content">Applicability of Accumulators</span></a></li>
+                        <li><a href="#accumulator-informal-rules"><span class="secno">18.2.3 </span><span class="content">Informal Model for Accumulators</span></a></li>
+                        <li><a href="#accumulator-formal-rules"><span class="secno">18.2.4 </span><span class="content">Formal Model for Accumulators</span></a></li>
+                        <li><a href="#errors-in-accumulators"><span class="secno">18.2.5 </span><span class="content">Dynamic Errors in Accumulators</span></a></li>
+                        <li><a href="#func-accumulator-before"><span class="secno">18.2.6 </span><span class="content">fn:accumulator-before</span></a></li>
+                        <li><a href="#func-accumulator-after"><span class="secno">18.2.7 </span><span class="content">fn:accumulator-after</span></a></li>
+                        <li><a href="#accumulators-visibility-and-overriding"><span class="secno">18.2.8 </span><span class="content">Importing of Accumulators</span></a></li>
+                        <li><a href="#streamability-of-accumulators"><span class="secno">18.2.9 </span><span class="content">Streamability of Accumulators</span></a></li>
+                        <li><a href="#copying-accumulators"><span class="secno">18.2.10 </span><span class="content">Copying Accumulator Values</span></a></li>
+                        <li><a href="#accumulator-examples"><span class="secno">18.2.11 </span><span class="content">Examples of Accumulators</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#func-copy-of"><span class="secno">18.3 </span><span class="content">fn:copy-of</span></a></li>
+                  <li><a href="#func-snapshot"><span class="secno">18.4 </span><span class="content">fn:snapshot</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#streamability"><span class="secno">19 </span><span class="content">Streamability</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#determining-static-type"><span class="secno">19.1 </span><span class="content">Determining the Static Type of a Construct</span></a><ol class="toc">
+                        <li><a href="#static-type-of-steps"><span class="secno">19.1.1 </span><span class="content">Static Type of an Axis Step</span></a></li>
+                        <li><a href="#static-type-of-current-function"><span class="secno">19.1.2 </span><span class="content">Static Type of a Call to current</span></a></li>
+                        <li><a href="#notes-on-schema-aware-analysis"><span class="secno">19.1.3 </span><span class="content">Schema-Aware Streamability Analysis</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#determining-context-item-type"><span class="secno">19.2 </span><span class="content">Determining the Context Item Type</span></a></li>
+                  <li><a href="#operand-roles"><span class="secno">19.3 </span><span class="content">Operand Roles</span></a><ol class="toc">
+                        <li><a href="#operand-usage-examples"><span class="secno">19.3.1 </span><span class="content">Examples showing the Effect of Operand Usage</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#posture"><span class="secno">19.4 </span><span class="content">Determining the Posture of a Construct</span></a></li>
+                  <li><a href="#determining-context-posture"><span class="secno">19.5 </span><span class="content">Determining the Context Posture</span></a></li>
+                  <li><a href="#sweep"><span class="secno">19.6 </span><span class="content">The Sweep of a Construct</span></a></li>
+                  <li><a href="#grounded-consuming-constructs"><span class="secno">19.7 </span><span class="content">Grounded Consuming Constructs</span></a></li>
+                  <li><a href="#classifying-constructs"><span class="secno">19.8 </span><span class="content">Classifying Constructs</span></a><ol class="toc">
+                        <li><a href="#general-streamability-rules"><span class="secno">19.8.1 </span><span class="content">General Rules for Streamability</span></a></li>
+                        <li><a href="#general-streamability-examples"><span class="secno">19.8.2 </span><span class="content">Examples of the General Streamability Rules</span></a></li>
+                        <li><a href="#classifying-sequence-constructors"><span class="secno">19.8.3 </span><span class="content">Classifying Sequence Constructors</span></a></li>
+                        <li><a href="#classifying-instructions"><span class="secno">19.8.4 </span><span class="content">Classifying Instructions</span></a><a href="#streamability-literal-result-elements"><span class="secno">19.8.4.1 </span><span class="content">Streamability of Literal Result Elements</span></a>
+                           <a href="#streamability-extension-instructions"><span class="secno">19.8.4.2 </span><span class="content">Streamability of extension instructions</span></a>
+                           <a href="#streamability-xsl-analyze-string"><span class="secno">19.8.4.3 </span><span class="content">Streamability of xsl:analyze-string</span></a>
+                           <a href="#streamability-xsl-apply-imports"><span class="secno">19.8.4.4 </span><span class="content">Streamability of xsl:apply-imports</span></a>
+                           <a href="#streamability-xsl-apply-templates"><span class="secno">19.8.4.5 </span><span class="content">Streamability of xsl:apply-templates</span></a>
+                           <a href="#streamability-xsl-assert"><span class="secno">19.8.4.6 </span><span class="content">Streamability of xsl:assert</span></a>
+                           <a href="#streamability-xsl-attribute"><span class="secno">19.8.4.7 </span><span class="content">Streamability of xsl:attribute</span></a>
+                           <a href="#streamability-xsl-break"><span class="secno">19.8.4.8 </span><span class="content">Streamability of xsl:break</span></a>
+                           <a href="#streamability-xsl-call-template"><span class="secno">19.8.4.9 </span><span class="content">Streamability of xsl:call-template</span></a>
+                           <a href="#streamability-xsl-choose"><span class="secno">19.8.4.10 </span><span class="content">Streamability of xsl:choose</span></a>
+                           <a href="#streamability-xsl-comment"><span class="secno">19.8.4.11 </span><span class="content">Streamability of xsl:comment</span></a>
+                           <a href="#streamability-xsl-copy"><span class="secno">19.8.4.12 </span><span class="content">Streamability of xsl:copy</span></a>
+                           <a href="#streamability-xsl-copy-of"><span class="secno">19.8.4.13 </span><span class="content">Streamability of xsl:copy-of</span></a>
+                           <a href="#streamability-xsl-document"><span class="secno">19.8.4.14 </span><span class="content">Streamability of xsl:document</span></a>
+                           <a href="#streamability-xsl-element"><span class="secno">19.8.4.15 </span><span class="content">Streamability of xsl:element</span></a>
+                           <a href="#streamability-xsl-evaluate"><span class="secno">19.8.4.16 </span><span class="content">Streamability of xsl:evaluate</span></a>
+                           <a href="#streamability-xsl-fallback"><span class="secno">19.8.4.17 </span><span class="content">Streamability of xsl:fallback</span></a>
+                           <a href="#streamability-xsl-for-each"><span class="secno">19.8.4.18 </span><span class="content">Streamability of xsl:for-each</span></a>
+                           <a href="#streamability-xsl-for-each-group"><span class="secno">19.8.4.19 </span><span class="content">Streamability of xsl:for-each-group</span></a>
+                           <a href="#streamability-xsl-fork"><span class="secno">19.8.4.20 </span><span class="content">Streamability of xsl:fork</span></a>
+                           <a href="#streamability-xsl-if"><span class="secno">19.8.4.21 </span><span class="content">Streamability of xsl:if</span></a>
+                           <a href="#streamability-xsl-iterate"><span class="secno">19.8.4.22 </span><span class="content">Streamability of xsl:iterate</span></a>
+                           <a href="#streamability-xsl-map"><span class="secno">19.8.4.23 </span><span class="content">Streamability of xsl:map</span></a>
+                           <a href="#streamability-xsl-map-entry"><span class="secno">19.8.4.24 </span><span class="content">Streamability of xsl:map-entry</span></a>
+                           <a href="#streamability-xsl-merge"><span class="secno">19.8.4.25 </span><span class="content">Streamability of xsl:merge</span></a>
+                           <a href="#streamability-xsl-message"><span class="secno">19.8.4.26 </span><span class="content">Streamability of xsl:message</span></a>
+                           <a href="#streamability-xsl-namespace"><span class="secno">19.8.4.27 </span><span class="content">Streamability of xsl:namespace</span></a>
+                           <a href="#streamability-xsl-next-iteration"><span class="secno">19.8.4.28 </span><span class="content">Streamability of xsl:next-iteration</span></a>
+                           <a href="#streamability-xsl-next-match"><span class="secno">19.8.4.29 </span><span class="content">Streamability of xsl:next-match</span></a>
+                           <a href="#streamability-xsl-number"><span class="secno">19.8.4.30 </span><span class="content">Streamability of xsl:number</span></a>
+                           <a href="#streamability-xsl-on-empty"><span class="secno">19.8.4.31 </span><span class="content">Streamability of xsl:on-empty</span></a>
+                           <a href="#streamability-xsl-on-non-empty"><span class="secno">19.8.4.32 </span><span class="content">Streamability of xsl:on-non-empty</span></a>
+                           <a href="#streamability-xsl-perform-sort"><span class="secno">19.8.4.33 </span><span class="content">Streamability of xsl:perform-sort</span></a>
+                           <a href="#streamability-xsl-processing-instruction"><span class="secno">19.8.4.34 </span><span class="content">Streamability of xsl:processing-instruction</span></a>
+                           <a href="#streamability-xsl-result-document"><span class="secno">19.8.4.35 </span><span class="content">Streamability of xsl:result-document</span></a>
+                           <a href="#streamability-xsl-sequence"><span class="secno">19.8.4.36 </span><span class="content">Streamability of xsl:sequence</span></a>
+                           <a href="#streamability-xsl-stream"><span class="secno">19.8.4.37 </span><span class="content">Streamability of xsl:source-document</span></a>
+                           <a href="#streamability-xsl-text"><span class="secno">19.8.4.38 </span><span class="content">Streamability of xsl:text</span></a>
+                           <a href="#streamability-xsl-try"><span class="secno">19.8.4.39 </span><span class="content">Streamability of xsl:try</span></a>
+                           <a href="#streamability-xsl-value-of"><span class="secno">19.8.4.40 </span><span class="content">Streamability of xsl:value-of</span></a>
+                           <a href="#streamability-xsl-variable"><span class="secno">19.8.4.41 </span><span class="content">Streamability of xsl:variable</span></a>
+                           <a href="#streamability-xsl-where-populated"><span class="secno">19.8.4.42 </span><span class="content">Streamability of xsl:where-populated</span></a>
+                           
+                        </li>
+                        <li><a href="#streamable-stylesheet-functions"><span class="secno">19.8.5 </span><span class="content">Classifying Stylesheet Functions</span></a><a href="#category-unclassified"><span class="secno">19.8.5.1 </span><span class="content">Streamability Category: unclassified</span></a>
+                           <a href="#category-absorbing"><span class="secno">19.8.5.2 </span><span class="content">Streamability Category: absorbing</span></a>
+                           <a href="#category-inspection"><span class="secno">19.8.5.3 </span><span class="content">Streamability Category: inspection</span></a>
+                           <a href="#category-filter"><span class="secno">19.8.5.4 </span><span class="content">Streamability Category: filter</span></a>
+                           <a href="#category-shallow-descent"><span class="secno">19.8.5.5 </span><span class="content">Streamability Category: shallow-descent</span></a>
+                           <a href="#category-deep-descent"><span class="secno">19.8.5.6 </span><span class="content">Streamability Category: deep-descent</span></a>
+                           <a href="#category-ascent"><span class="secno">19.8.5.7 </span><span class="content">Streamability Category: ascent</span></a>
+                           
+                        </li>
+                        <li><a href="#classifying-attribute-sets"><span class="secno">19.8.6 </span><span class="content">Classifying Attribute Sets</span></a></li>
+                        <li><a href="#classifying-vts"><span class="secno">19.8.7 </span><span class="content">Classifying Value Templates</span></a></li>
+                        <li><a href="#classifying-expressions"><span class="secno">19.8.8 </span><span class="content">Classifying Expressions</span></a><a href="#streamability-of-for-expressions"><span class="secno">19.8.8.1 </span><span class="content">Streamability of for Expressions</span></a>
+                           <a href="#streamability-of-quantified-expressions"><span class="secno">19.8.8.2 </span><span class="content">Streamability of Quantified Expressions</span></a>
+                           <a href="#streamability-of-if-expressions"><span class="secno">19.8.8.3 </span><span class="content">Streamability of if expressions</span></a>
+                           <a href="#streamability-of-union-expressions"><span class="secno">19.8.8.4 </span><span class="content">Streamability of union, intersect, and
+                                 except Expressions</span></a>
+                           <a href="#streamability-of-instance-of-expressions"><span class="secno">19.8.8.5 </span><span class="content">Streamability of instance of Expressions</span></a>
+                           <a href="#streamability-of-treat-as-expressions"><span class="secno">19.8.8.6 </span><span class="content">Streamability of treat as Expressions</span></a>
+                           <a href="#streamability-of-simple-mapping-expressions"><span class="secno">19.8.8.7 </span><span class="content">Streamability of Simple Mapping Expressions</span></a>
+                           <a href="#streamability-of-path-expressions"><span class="secno">19.8.8.8 </span><span class="content">Streamability of Path Expressions</span></a>
+                           <a href="#streamability-of-axis-steps"><span class="secno">19.8.8.9 </span><span class="content">Streamability of Axis Steps</span></a>
+                           <a href="#streamability-of-filter-expressions"><span class="secno">19.8.8.10 </span><span class="content">Streamability of Filter Expressions</span></a>
+                           <a href="#streamability-of-dynamic-function-calls"><span class="secno">19.8.8.11 </span><span class="content">Streamability of Dynamic Function Calls</span></a>
+                           <a href="#streamability-of-variable-references"><span class="secno">19.8.8.12 </span><span class="content">Streamability of Variable References</span></a>
+                           <a href="#streamability-of-context-item-expression"><span class="secno">19.8.8.13 </span><span class="content">Streamability of the Context Item Expression</span></a>
+                           <a href="#streamability-of-function-calls"><span class="secno">19.8.8.14 </span><span class="content">Streamability of Static Function Calls</span></a>
+                           <a href="#streamability-of-named-function-ref"><span class="secno">19.8.8.15 </span><span class="content">Streamability of Named Function References</span></a>
+                           <a href="#streamability-of-inline-functions"><span class="secno">19.8.8.16 </span><span class="content">Streamability of Inline Function Declarations</span></a>
+                           <a href="#streamability-of-map-constructors"><span class="secno">19.8.8.17 </span><span class="content">Streamability of Map Constructors</span></a>
+                           <a href="#streamability-of-lookup-expressions"><span class="secno">19.8.8.18 </span><span class="content">Streamability of Lookup Expressions</span></a>
+                           
+                        </li>
+                        <li><a href="#classifying-built-in-functions"><span class="secno">19.8.9 </span><span class="content">Classifying Calls to Built-In Functions</span></a><a href="#streamability-fn-accumulator-after"><span class="secno">19.8.9.1 </span><span class="content">Streamability of the accumulator-after Function</span></a>
+                           <a href="#streamability-fn-accumulator-before"><span class="secno">19.8.9.2 </span><span class="content">Streamability of the accumulator-before Function</span></a>
+                           <a href="#streamability-fn-current"><span class="secno">19.8.9.3 </span><span class="content">Streamability of the current Function</span></a>
+                           <a href="#streamability-fn-current-group"><span class="secno">19.8.9.4 </span><span class="content">Streamability of the current-group Function</span></a>
+                           <a href="#streamability-fn-current-grouping-key"><span class="secno">19.8.9.5 </span><span class="content">Streamability of the current-grouping-key
+                                 Function</span></a>
+                           <a href="#streamability-fn-current-merge-group"><span class="secno">19.8.9.6 </span><span class="content">Streamability of the current-merge-group
+                                 Function</span></a>
+                           <a href="#streamability-fn-current-merge-key"><span class="secno">19.8.9.7 </span><span class="content">Streamability of the current-merge-key Function</span></a>
+                           <a href="#streamability-fn-fold-left"><span class="secno">19.8.9.8 </span><span class="content">Streamability of the fold-left Function</span></a>
+                           <a href="#streamability-fn-fold-right"><span class="secno">19.8.9.9 </span><span class="content">Streamability of the fold-right Function</span></a>
+                           <a href="#streamability-fn-for-each"><span class="secno">19.8.9.10 </span><span class="content">Streamability of the for-each Function</span></a>
+                           <a href="#streamability-fn-for-each-pair"><span class="secno">19.8.9.11 </span><span class="content">Streamability of the for-each-pair Function</span></a>
+                           <a href="#streamability-fn-function-lookup"><span class="secno">19.8.9.12 </span><span class="content">Streamability of the function-lookup Function</span></a>
+                           <a href="#streamability-fn-innermost"><span class="secno">19.8.9.13 </span><span class="content">Streamability of the innermost Function</span></a>
+                           <a href="#streamability-fn-last"><span class="secno">19.8.9.14 </span><span class="content">Streamability of the last Function</span></a>
+                           <a href="#streamability-fn-outermost"><span class="secno">19.8.9.15 </span><span class="content">Streamability of the outermost Function</span></a>
+                           <a href="#streamability-fn-position"><span class="secno">19.8.9.16 </span><span class="content">Streamability of the position Function</span></a>
+                           <a href="#streamability-fn-reverse"><span class="secno">19.8.9.17 </span><span class="content">Streamability of the reverse Function</span></a>
+                           <a href="#streamability-fn-root"><span class="secno">19.8.9.18 </span><span class="content">Streamability of the root Function</span></a>
+                           
+                        </li>
+                        <li><a href="#classifying-patterns"><span class="secno">19.8.10 </span><span class="content">Classifying Patterns</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#streamability-analysis-examples"><span class="secno">19.9 </span><span class="content">Examples of Streamability Analysis</span></a></li>
+                  <li><a href="#streamability-guarantees"><span class="secno">19.10 </span><span class="content">Streamability Guarantees</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#add-func"><span class="secno">20 </span><span class="content">Additional Functions</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#func-document"><span class="secno">20.1 </span><span class="content">fn:document</span></a></li>
+                  <li><a href="#key"><span class="secno">20.2 </span><span class="content">Keys</span></a><ol class="toc">
+                        <li><a href="#xsl-key"><span class="secno">20.2.1 </span><span class="content">The xsl:key Declaration</span></a></li>
+                        <li><a href="#func-key"><span class="secno">20.2.2 </span><span class="content">fn:key</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#keys-and-streaming"><span class="secno">20.3 </span><span class="content">Keys and Streaming</span></a></li>
+                  <li><a href="#misc-func"><span class="secno">20.4 </span><span class="content">Miscellaneous Additional Functions</span></a><ol class="toc">
+                        <li><a href="#func-current"><span class="secno">20.4.1 </span><span class="content">fn:current</span></a></li>
+                        <li><a href="#func-unparsed-entity-uri"><span class="secno">20.4.2 </span><span class="content">fn:unparsed-entity-uri</span></a></li>
+                        <li><a href="#func-unparsed-entity-public-id"><span class="secno">20.4.3 </span><span class="content">fn:unparsed-entity-public-id</span></a></li>
+                        <li><a href="#func-system-property"><span class="secno">20.4.4 </span><span class="content">fn:system-property</span></a></li>
+                        <li><a href="#func-available-system-properties"><span class="secno">20.4.5 </span><span class="content">fn:available-system-properties</span></a></li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+            <li><a href="#map"><span class="secno">21 </span><span class="content">Maps</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#map-type"><span class="secno">21.1 </span><span class="content">The Type of a Map</span></a></li>
+                  <li><a href="#map-functions"><span class="secno">21.2 </span><span class="content">Functions that Operate on Maps</span></a><ol class="toc">
+                        <li><a href="#func-same-key"><span class="secno">21.2.1 </span><span class="content">op:same-key</span></a></li>
+                        <li><a href="#func-map-merge"><span class="secno">21.2.2 </span><span class="content">map:merge</span></a></li>
+                        <li><a href="#func-map-size"><span class="secno">21.2.3 </span><span class="content">map:size</span></a></li>
+                        <li><a href="#func-map-keys"><span class="secno">21.2.4 </span><span class="content">map:keys</span></a></li>
+                        <li><a href="#func-map-contains"><span class="secno">21.2.5 </span><span class="content">map:contains</span></a></li>
+                        <li><a href="#func-map-get"><span class="secno">21.2.6 </span><span class="content">map:get</span></a></li>
+                        <li><a href="#func-map-put"><span class="secno">21.2.7 </span><span class="content">map:put</span></a></li>
+                        <li><a href="#func-map-entry"><span class="secno">21.2.8 </span><span class="content">map:entry</span></a></li>
+                        <li><a href="#func-map-remove"><span class="secno">21.2.9 </span><span class="content">map:remove</span></a></li>
+                        <li><a href="#func-map-for-each"><span class="secno">21.2.10 </span><span class="content">map:for-each</span></a></li>
+                        <li><a href="#func-map-find"><span class="secno">21.2.11 </span><span class="content">map:find</span></a></li>
+                        <li><a href="#func-collation-key"><span class="secno">21.2.12 </span><span class="content">fn:collation-key</span></a></li>
+                        <li><a href="#func-deep-equal"><span class="secno">21.2.13 </span><span class="content">fn:deep-equal</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#map-instructions"><span class="secno">21.3 </span><span class="content">Map Instructions</span></a></li>
+                  <li><a href="#map-constructors"><span class="secno">21.4 </span><span class="content">Map Constructors</span></a></li>
+                  <li><a href="#map-lookup-operator"><span class="secno">21.5 </span><span class="content">The Map Lookup Operator</span></a><ol class="toc">
+                        <li><a href="#unary-lookup-operator"><span class="secno">21.5.1 </span><span class="content">The Unary Lookup Operator</span></a></li>
+                        <li><a href="#postfix-lookup-operator"><span class="secno">21.5.2 </span><span class="content">The Postfix Lookup Operator</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#maps-streaming"><span class="secno">21.6 </span><span class="content">Maps and Streaming</span></a></li>
+                  <li><a href="#map-examples"><span class="secno">21.7 </span><span class="content">Examples using Maps</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#json"><span class="secno">22 </span><span class="content">Processing JSON Data</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#json-to-xml-mapping"><span class="secno">22.1 </span><span class="content">XML Representation of JSON</span></a></li>
+                  <li><a href="#options"><span class="secno">22.2 </span><span class="content">Option Parameter Conventions</span></a></li>
+                  <li><a href="#func-json-to-xml"><span class="secno">22.3 </span><span class="content">fn:json-to-xml</span></a></li>
+                  <li><a href="#func-xml-to-json"><span class="secno">22.4 </span><span class="content">fn:xml-to-json</span></a></li>
+                  <li><a href="#xml-to-json-transformation"><span class="secno">22.5 </span><span class="content">Transforming XML to JSON</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#diagnostics"><span class="secno">23 </span><span class="content">Diagnostics</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#message"><span class="secno">23.1 </span><span class="content">Messages</span></a></li>
+                  <li><a href="#assertions"><span class="secno">23.2 </span><span class="content">Assertions</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#extension"><span class="secno">24 </span><span class="content">Extensibility and Fallback</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#extension-functions"><span class="secno">24.1 </span><span class="content">Extension Functions</span></a><ol class="toc">
+                        <li><a href="#func-function-available"><span class="secno">24.1.1 </span><span class="content">fn:function-available</span></a></li>
+                        <li><a href="#calling-extension-functions"><span class="secno">24.1.2 </span><span class="content">Calling Extension Functions</span></a></li>
+                        <li><a href="#external-objects"><span class="secno">24.1.3 </span><span class="content">External Objects</span></a></li>
+                        <li><a href="#func-type-available"><span class="secno">24.1.4 </span><span class="content">fn:type-available</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#extension-instruction"><span class="secno">24.2 </span><span class="content">Extension Instructions</span></a><ol class="toc">
+                        <li><a href="#designating-extension-namespace"><span class="secno">24.2.1 </span><span class="content">Designating an Extension Namespace</span></a></li>
+                        <li><a href="#func-element-available"><span class="secno">24.2.2 </span><span class="content">fn:element-available</span></a></li>
+                        <li><a href="#fallback"><span class="secno">24.2.3 </span><span class="content">Fallback</span></a></li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+            <li><a href="#result-trees"><span class="secno">25 </span><span class="content">Transformation Results</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#creating-result-trees"><span class="secno">25.1 </span><span class="content">Creating Secondary Results</span></a></li>
+                  <li><a href="#result-document-restrictions"><span class="secno">25.2 </span><span class="content">Restrictions on the use of xsl:result-document</span></a></li>
+                  <li><a href="#current-output-uri"><span class="secno">25.3 </span><span class="content">The Current Output URI</span></a><ol class="toc">
+                        <li><a href="#func-current-output-uri"><span class="secno">25.3.1 </span><span class="content">fn:current-output-uri</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#validation"><span class="secno">25.4 </span><span class="content">Validation</span></a><ol class="toc">
+                        <li><a href="#validating-constructed-nodes"><span class="secno">25.4.1 </span><span class="content">Validating Constructed Elements and Attributes</span></a><a href="#validating-using-validation-attribute"><span class="secno">25.4.1.1 </span><span class="content">Validation using the [xsl:]validation Attribute</span></a>
+                           <a href="#validation-xsl-type"><span class="secno">25.4.1.2 </span><span class="content">Validation using the [xsl:]type Attribute</span></a>
+                           <a href="#validation-process"><span class="secno">25.4.1.3 </span><span class="content">The Validation Process</span></a>
+                           
+                        </li>
+                        <li><a href="#validating-document-nodes"><span class="secno">25.4.2 </span><span class="content">Validating Document Nodes</span></a></li>
+                        <li><a href="#validating-xml-id"><span class="secno">25.4.3 </span><span class="content">Validating xml:id attributes</span></a></li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+            <li><a href="#serialization"><span class="secno">26 </span><span class="content">Serialization</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#character-maps"><span class="secno">26.1 </span><span class="content">Character Maps</span></a></li>
+                  <li><a href="#disable-output-escaping"><span class="secno">26.2 </span><span class="content">Disabling Output Escaping</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#conformance"><span class="secno">27 </span><span class="content">Conformance</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#basic-conformance"><span class="secno">27.1 </span><span class="content">Basic XSLT Processor</span></a></li>
+                  <li><a href="#schema-aware-conformance"><span class="secno">27.2 </span><span class="content">Schema-Awareness Conformance Feature</span></a></li>
+                  <li><a href="#serialization-feature"><span class="secno">27.3 </span><span class="content">Serialization Feature</span></a></li>
+                  <li><a href="#backwards-compatibility-feature"><span class="secno">27.4 </span><span class="content">Compatibility Features</span></a></li>
+                  <li><a href="#streaming-feature"><span class="secno">27.5 </span><span class="content">Streaming Feature</span></a></li>
+                  <li><a href="#dynamic-evaluation-feature"><span class="secno">27.6 </span><span class="content">Dynamic Evaluation Feature</span></a></li>
+                  <li><a href="#xpath31-feature"><span class="secno">27.7 </span><span class="content">XPath 3.1 Feature</span></a><ol class="toc">
+                        <li><a href="#arrays"><span class="secno">27.7.1 </span><span class="content">Arrays</span></a></li>
+                     </ol>
+                  </li>
+                  <li><a href="#hof-feature"><span class="secno">27.8 </span><span class="content">Higher-Order Functions Feature</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#references"><span class="secno">A </span><span class="content">References</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#normative-references"><span class="secno">A.1 </span><span class="content">Normative References</span></a></li>
+                  <li><a href="#other-references"><span class="secno">A.2 </span><span class="content">Other References</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#json-in-xml"><span class="secno">B </span><span class="content">XML Representation of JSON</span></a>
+               
+               <ol class="toc">
+                  <li><a href="#schema-for-json"><span class="secno">B.1 </span><span class="content">Schema for the XML Representation of JSON</span></a></li>
+                  <li><a href="#xml-to-json-stylesheet"><span class="secno">B.2 </span><span class="content">Stylesheet for converting XML to JSON</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#glossary"><span class="secno">C </span><span class="content">Glossary</span></a> (Non-Normative)
+               <ol class="toc"></ol>
+            </li>
+            <li><a href="#element-syntax-summary"><span class="secno">D </span><span class="content">Element Syntax Summary</span></a> (Non-Normative)
+               <ol class="toc"></ol>
+            </li>
+            <li><a href="#error-summary"><span class="secno">E </span><span class="content">Summary of Error Conditions</span></a> (Non-Normative)
+               <ol class="toc"></ol>
+            </li>
+            <li><a href="#implementation-defined-features"><span class="secno">F </span><span class="content">Checklist of Implementation-Defined Features</span></a> (Non-Normative)
+               <ol class="toc">
+                  <li><a href="#imp-def-api"><span class="secno">F.1 </span><span class="content">Application Programming Interfaces</span></a></li>
+                  <li><a href="#imp-def-ext"><span class="secno">F.2 </span><span class="content">Vendor and User Extensions</span></a></li>
+                  <li><a href="#imp-def-feature"><span class="secno">F.3 </span><span class="content">Localization</span></a></li>
+                  <li><a href="#imp-def-optional-feature"><span class="secno">F.4 </span><span class="content">Optional Features</span></a></li>
+                  <li><a href="#imp-def-dependencies"><span class="secno">F.5 </span><span class="content">Dependencies</span></a></li>
+                  <li><a href="#imp-def-defaults-and-limits"><span class="secno">F.6 </span><span class="content">Defaults and Limits</span></a></li>
+                  <li><a href="#imp-def-errors"><span class="secno">F.7 </span><span class="content">Detection and Reporting of Errors</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#summary-list-of-functions"><span class="secno">G </span><span class="content">Summary of Available Functions</span></a> (Non-Normative)
+               <ol class="toc">
+                  <li><a href="#function-categories"><span class="secno">G.1 </span><span class="content">Function Classification</span></a></li>
+                  <li><a href="#XSLT-defined-functions"><span class="secno">G.2 </span><span class="content">List of XSLT-defined functions</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#schema-for-xslt"><span class="secno">H </span><span class="content">Schemas for XSLT 3.0 Stylesheets</span></a> (Non-Normative)
+               <ol class="toc">
+                  <li><a href="#xsd11-schema-for-xslt"><span class="secno">H.1 </span><span class="content">XSD 1.1 Schema for XSLT Stylesheets</span></a></li>
+                  <li><a href="#relax-ng-schema-for-xslt"><span class="secno">H.2 </span><span class="content">Relax-NG Schema for XSLT Stylesheets</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#acknowledgements"><span class="secno">I </span><span class="content">Acknowledgements</span></a> (Non-Normative)
+               <ol class="toc"></ol>
+            </li>
+            <li><a href="#changes-since-2.0"><span class="secno">J </span><span class="content">Changes since XSLT 2.0</span></a> (Non-Normative)
+               <ol class="toc">
+                  <li><a href="#xslt-changes-since-2.0"><span class="secno">J.1 </span><span class="content">Changes in this Specification</span></a></li>
+                  <li><a href="#xpath-changes-since-2.0"><span class="secno">J.2 </span><span class="content">Changes in Other Related Specifications</span></a></li>
+               </ol>
+            </li>
+            <li><a href="#changes-since-nov-2015"><span class="secno">K </span><span class="content">Changes since the Candidate Recommendation of 19 November 2015</span></a> (Non-Normative)
+               <ol class="toc"></ol>
+            </li>
+            <li><a href="#changes-since-feb-2017"><span class="secno">L </span><span class="content">Changes since the Candidate Recommendation of 7 February 2017</span></a> (Non-Normative)
+               <ol class="toc"></ol>
+            </li>
+            <li><a href="#changes-since-apr-2017"><span class="secno">M </span><span class="content">Changes since the Proposed Recommendation of 18 April 2017</span></a> (Non-Normative)
+               <ol class="toc"></ol>
+            </li>
+            <li><a href="#incompatibilities"><span class="secno">N </span><span class="content">Incompatibilities with XSLT 2.0</span></a> (Non-Normative)
+               <ol class="toc"></ol>
+            </li>
+         </ol>
+      </nav>
+      <hr />
+      <div class="body">
+         <div class="div1">
+            
+            <h2><a id="introduction"></a>1 <a href="#introduction" style="text-decoration: none">Introduction</a></h2>
+            <div class="div2">
+               
+               <h3><a id="what-is-xslt"></a>1.1 <a href="#what-is-xslt" style="text-decoration: none">What is XSLT?</a></h3>
+               <p>This specification defines the syntax and semantics of the XSLT <span>3.0</span> language.
+               </p>
+               <p>A transformation in the XSLT language is expressed in the
+                  form of a <b>stylesheet</b>. A stylesheet is made up of one or more well-formed
+                  XML <a href="#REC-xml">[XML 1.0]</a> documents conforming to the Namespaces in XML
+                  Recommendation <a href="#xml-names">[Namespaces in XML]</a>. 
+               </p>
+               <p>A stylesheet generally includes elements that are defined by XSLT as well as elements
+                  that are not defined by XSLT. XSLT-defined elements are distinguished by use of the
+                  namespace <code>http://www.w3.org/1999/XSL/Transform</code> (see <a href="#xslt-namespace"><i>3.1 XSLT Namespace</i></a>), which is referred to in this specification as the
+                  <a title="XSLT namespace" class="termref" href="#dt-xslt-namespace">XSLT namespace</a>. Thus this specification
+                  is a definition of the syntax and semantics of the XSLT namespace.
+               </p>
+               <p>The term <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> reflects the fact that one
+                  of the important roles of XSLT is to add styling information to an XML source
+                  document, by transforming it into a document consisting of XSL formatting objects
+                  (see <a href="#xsl11">[XSL-FO]</a>), or into another presentation-oriented format such as
+                  HTML, XHTML, or SVG. However, XSLT is used for a wide range of transformation tasks,
+                  not exclusively for formatting and presentation applications.
+               </p>
+               <p>A transformation expressed in XSLT describes rules for transforming <span> input data into output data. The inputs and outputs
+                     will all be instances of the XDM data model, described in <a href="#xpath-datamodel-30">[XDM 3.0]</a>. In the simplest and most common case, the input is
+                     an XML document referred to as the source tree, and the output is an XML document
+                     referred to as the result tree. It is also possible to process multiple source
+                     documents, to generate multiple result documents, and to handle formats other than
+                     XML.</span>
+                  The transformation is achieved by a set of
+                  <a title="template rule" class="termref" href="#dt-template-rule">template rules</a>. A template rule
+                  associates a <a title="pattern" class="termref" href="#dt-pattern">pattern</a>, which <span>typically</span> matches nodes in the source document, with a
+                  <a title="sequence constructor" class="termref" href="#dt-sequence-constructor">sequence constructor</a>. In many
+                  cases, evaluating the sequence constructor will cause new nodes to be constructed,
+                  which can be used to produce part of a result tree. The structure of the result trees
+                  can be completely different from the structure of the source trees. In constructing
+                  a
+                  result tree, nodes from the source trees can be filtered and reordered, and arbitrary
+                  structure can be added. This mechanism allows a <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> to be applicable to a wide class of documents that have
+                  similar source tree structures.
+               </p>
+               <p>Stylesheets have a modular structure; they may contain several packages developed
+                  independently of each other, and each package may consist of several stylesheet
+                  modules. 
+               </p>
+               <p><span class="definition">[Definition: </span><a id="dt-stylesheet" title="stylesheet"></a>A
+                  <b>stylesheet</b> consists of one or more packages: specifically, one
+                  <a title="top-level package" class="termref" href="#dt-top-level-package">top-level package</a> and zero or
+                  more <a title="library package" class="termref" href="#dt-library-package">library packages</a>.<span class="definition">]</span></p>
+               <p><span class="definition">[Definition: </span><a id="dt-top-level-package" title="top-level package"></a>For a given transformation, one <a title="package" class="termref" href="#dt-package">package</a> functions as the <b>top-level package</b>. The
+                  complete <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> is assembled by finding
+                  the packages referenced directly or indirectly from the top-level package using
+                  <a href="#element-use-package"><code>xsl:use-package</code></a> declarations: see <a href="#package-dependencies"><i>3.5.2 Dependencies between Packages</i></a>.<span class="definition">]</span></p>
+               <p><span class="definition">[Definition: </span><a id="dt-library-package" title="library package"></a>Every <a title="package" class="termref" href="#dt-package">package</a> within a <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>, other than the <a title="top-level package" class="termref" href="#dt-top-level-package">top-level package</a>, is referred to as a
+                  <b>library package</b>.<span class="definition">]</span></p>
+               <p><span class="definition">[Definition: </span><a id="dt-principal-stylesheet-module" title="principal stylesheet module"></a>Within a <a title="package" class="termref" href="#dt-package">package</a>, one <a title="stylesheet module" class="termref" href="#dt-stylesheet-module">stylesheet module</a> functions as the
+                  <b>principal stylesheet module</b>. The complete package is assembled by
+                  finding the stylesheet modules referenced directly or indirectly from the
+                  principal stylesheet module using <a href="#element-include"><code>xsl:include</code></a> and
+                  <a href="#element-import"><code>xsl:import</code></a> elements: see <a href="#include"><i>3.11.2 Stylesheet Inclusion</i></a> and <a href="#import"><i>3.11.3 Stylesheet Import</i></a>.<span class="definition">]</span></p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="whats-new-in-xslt3"></a>1.2 <a href="#whats-new-in-xslt3" style="text-decoration: none">What’s New in XSLT 3.0?</a></h3>
+               <p>A major focus for enhancements in XSLT 3.0 is the requirement to enable streaming
+                  of
+                  source documents. This is needed when source documents become too large to hold in
+                  main memory, and also for applications where it is important to start delivering
+                  results before the entire source document is available.
+               </p>
+               <p>While implementations of XSLT that use streaming have always been theoretically
+                  possible, the nature of the language has made it very difficult to achieve this in
+                  practice. The approach adopted in this specification is twofold: it identifies a set
+                  of restrictions which, if followed by stylesheet authors, will enable implementations
+                  to adopt a streaming mode of operation without placing excessive demands on the
+                  optimization capabilities of the processor; and it provides new constructs to
+                  indicate that streaming is required, or to express transformations in a way that
+                  makes it easier for the processor to adopt a streaming execution plan.
+               </p>
+               <p>Capabilities provided in this category include:</p>
+               <ul>
+                  <li>
+                     <p>A new <a href="#element-source-document"><code>xsl:source-document</code></a> instruction, which reads and processes a
+                        source document, <span>optionally</span> in streaming mode;
+                     </p>
+                  </li>
+                  <li>
+                     <p>The ability to declare that a <a title="mode" class="termref" href="#dt-mode">mode</a> is a
+                        streaming mode, in which case all the template rules using that mode must be
+                        streamable;
+                     </p>
+                  </li>
+                  <li>
+                     <p>A new <a href="#element-iterate"><code>xsl:iterate</code></a> instruction, which iterates over the items
+                        in a sequence, allowing parameters for the processing of one item to be set
+                        during the processing of the previous item;
+                     </p>
+                  </li>
+                  <li>
+                     <p>A new <a href="#element-merge"><code>xsl:merge</code></a> instruction, allowing multiple input streams
+                        to be merged into a single output stream;
+                     </p>
+                  </li>
+                  <li>
+                     <p>A new <a href="#element-fork"><code>xsl:fork</code></a> instruction, allowing multiple computations to
+                        be performed in parallel during a single pass through an input document;
+                     </p>
+                  </li>
+                  <li>
+                     <p><a title="accumulator function" class="termref" href="#dt-accumulator-function">Accumulators</a>, which allow a
+                        value to be computed progressively during streamed processing of a document,
+                        and accessed as a function of a node in the document, without compromise to the
+                        functional nature of the XSLT language.
+                     </p>
+                  </li>
+               </ul>
+               <p>A second focus for enhancements in XSLT 3.0 is the introduction of a new mechanism
+                  for stylesheet modularity, called the package. Unlike the stylesheet modules of XSLT
+                  1.0 and 2.0 (which remain available), a package defines an interface that regulates
+                  which functions, variables, templates and other components are visible outside the
+                  package, and which can be overridden. There are two main goals for this facility:
+                  it
+                  is designed to deliver software engineering benefits by improving the reusability
+                  and
+                  maintainability of code, and it is intended to streamline stylesheet deployment by
+                  allowing packages to be compiled independently of each other, and compiled instances
+                  of packages to be shared between multiple applications.
+               </p>
+               <p>Other significant features in XSLT 3.0 include:</p>
+               <ul>
+                  <li>
+                     <p>An <a href="#element-evaluate"><code>xsl:evaluate</code></a> instruction allowing evaluation of XPath
+                        expressions that are dynamically constructed as strings, or that are read from
+                        a source document;
+                     </p>
+                  </li>
+                  <li>
+                     <p>Enhancements to the syntax of <a title="pattern" class="termref" href="#dt-pattern">patterns</a>, in
+                        particular enabling the matching of atomic values as well as nodes;
+                     </p>
+                  </li>
+                  <li>
+                     <p>An <a href="#element-try"><code>xsl:try</code></a> instruction to allow recovery from dynamic
+                        errors;
+                     </p>
+                  </li>
+                  <li>
+                     <p>The element <a href="#element-global-context-item"><code>xsl:global-context-item</code></a>, used to declare the
+                        stylesheet’s expectations of the global context item (notably, its
+                        type);
+                     </p>
+                  </li>
+                  <li>
+                     <p>A new instruction <a href="#element-assert"><code>xsl:assert</code></a> to assist developers in producing
+                        correct and robust code.
+                     </p>
+                  </li>
+               </ul>
+               <p>XSLT 3.0 also delivers enhancements made to the XPath language and to the standard
+                  function library, including the following:
+               </p>
+               <ul>
+                  <li>
+                     <p>Variables can now be bound in XPath using the <code>let</code> expression.
+                     </p>
+                  </li>
+                  <li>
+                     <p>Functions are now first class values, and can be passed as arguments to other
+                        (higher-order) functions, making XSLT a fully-fledged functional programming
+                        language.
+                     </p>
+                  </li>
+                  <li>
+                     <p>A number of new functions are available, for example trigonometric functions,
+                        and the functions <a href="https://www.w3.org/TR/xpath-functions-30/#func-parse-xml"><code>parse-xml</code></a><sup><small>FO30</small></sup> and
+                        <a href="https://www.w3.org/TR/xpath-functions-30/#func-serialize"><code>serialize</code></a><sup><small>FO30</small></sup> to convert between lexical and tree
+                        representations of XML.
+                     </p>
+                  </li>
+               </ul>
+               <p>XSLT 3.0 also includes support for maps (a data structure
+                  consisting of key/value pairs, sometimes referred to in other programming languages
+                  as dictionaries, hashes, or associative arrays). This feature extends the data model,
+                  provides new syntax in XPath, and adds a number of new functions and operators. 
+                  Initially developed as XSLT-specific extensions, maps have now been integrated
+                  into XPath 3.1 (see <a href="#xpath-31">[XPath 3.1]</a>). XSLT 3.0 does not require implementations
+                  to support XPath 3.1 in its entirety, but it does requires support for these specific
+                  features.
+               </p>
+               <p>A full list of changes is at <a href="#changes-since-2.0"><i>J Changes since XSLT 2.0</i></a>.
+               </p>
+            </div>
+         </div>
+         <div class="div1">
+            
+            <h2><a id="concepts"></a>2 <a href="#concepts" style="text-decoration: none">Concepts</a></h2>
+            <div class="div2">
+               
+               <h3><a id="terminology"></a>2.1 <a href="#terminology" style="text-decoration: none">Terminology</a></h3>
+               <p>For a full glossary of terms, see <a href="#glossary"><i>C Glossary</i></a>.
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-processor" title="processor"></a>The software responsible for transforming
+                  source trees into result trees using an XSLT stylesheet is referred to as the
+                  <b>processor</b>. This is sometimes expanded to <em>XSLT
+                     processor</em> to avoid any confusion with other processors, for example an
+                  XML processor.<span class="definition">]</span>
+                  
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-implementation" title="implementation"></a>A specific product that
+                  performs the functions of an <a title="processor" class="termref" href="#dt-processor">XSLT processor</a>
+                  is referred to as an <b>implementation</b>.<span class="definition">]</span></p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-tree" title="tree"></a>The term <b>tree</b> is used (as in <a href="#xpath-datamodel-30">[XDM 3.0]</a>) to refer to the aggregate consisting of a
+                  parentless node together with all its descendant nodes, plus all their attributes
+                  and namespaces.<span class="definition">]</span>
+                  
+               </p>
+               <div class="note">
+                  <p class="prefix"><b>Note:</b></p>
+                  <p>The use of the term <b>tree</b> in this document does not imply the use
+                     of a data structure in memory that holds the entire contents of the document at
+                     one time. It implies rather a logical view of the XML input and output in which
+                     elements have a hierarchic relationship to each other. When a source document
+                     is being processed in a streaming manner, access to the nodes in this tree is
+                     constrained, but it is still viewed and described as a tree.
+                  </p>
+               </div>
+               <p>The output of a transformation consists of the
+                  following:
+               </p>
+               <ol class="enumar">
+                  <li>
+                     <p><span class="definition">[Definition: </span><a id="dt-principal-result" title="principal result"></a>A <b>principal
+                           result</b>: this can be any sequence of items (as defined in <a href="#xpath-datamodel-30">[XDM 3.0]</a>).<span class="definition">]</span> The principal result is the value
+                        returned by the function or template in the stylesheet that is nominated as the
+                        entry point, as described in <a href="#initiating"><i>2.3 Initiating a Transformation</i></a>.
+                     </p>
+                  </li>
+                  <li>
+                     <p><span class="definition">[Definition: </span><a id="dt-secondary-result" title="secondary result"></a>Zero or more
+                        <b>secondary results</b>: each secondary result can be any sequence
+                        of items (as defined in <a href="#xpath-datamodel-30">[XDM 3.0]</a>).<span class="definition">]</span> A
+                        secondary result is the value returned by evaluating the body of an
+                        <a href="#element-result-document"><code>xsl:result-document</code></a> instruction.
+                     </p>
+                  </li>
+                  <li>
+                     <p>Zero or more messages. Messages are generated by the
+                        <a href="#element-message"><code>xsl:message</code></a> and <a href="#element-assert"><code>xsl:assert</code></a> instructions, and are described in <a href="#message"><i>23.1 Messages</i></a> and <a href="#assertions"><i>23.2 Assertions</i></a>.
+                     </p>
+                  </li>
+                  <li>
+                     <p>Static or dynamic errors: see <a href="#errors"><i>2.14 Error Handling</i></a>. 
+                     </p>
+                  </li>
+               </ol>
+               <p>The <a title="principal result" class="termref" href="#dt-principal-result">principal result</a> and the <a title="secondary result" class="termref" href="#dt-secondary-result">secondary results</a> may be post-processed as
+                  described in <a href="#post-processing"><i>2.3.6 Post-processing the Raw Result</i></a>.
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-result-tree" title="result tree"></a>The term <b>result tree</b> is
+                  used to refer to any <a title="tree" class="termref" href="#dt-tree">tree</a> constructed by <a title="instruction" class="termref" href="#dt-instruction">instructions</a> in the stylesheet. A result tree is
+                  either a <a title="final result tree" class="termref" href="#dt-final-result-tree">final result tree</a> or a
+                  <a title="temporary tree" class="termref" href="#dt-temporary-tree">temporary tree</a>.<span class="definition">]</span>
+                  
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-final-result-tree" title="final result tree"></a>A <b>final result
+                     tree</b> is a <a title="result tree" class="termref" href="#dt-result-tree">result tree</a> that forms
+                  part of the output of a transformation: <span>specifically, a tree built by post-processing the items in the <a title="principal result" class="termref" href="#dt-principal-result">principal result</a> or in a <a title="secondary result" class="termref" href="#dt-secondary-result">secondary result</a></span>. Once created, the contents of a final result tree are not
+                  accessible within the stylesheet itself.<span class="definition">]</span>
+                  Any final result tree
+                  <span class="verb">may</span> be serialized as described in <a href="#serialization"><i>26 Serialization</i></a>.
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-source-tree" title="source tree"></a>The term <b>source tree</b>
+                  means any tree provided as input to the transformation. This includes the document
+                  containing the <span><a title="global context item" class="termref" href="#dt-global-context-item">global context item</a></span> if any, <span>documents containing
+                     nodes present in the <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a></span>,
+                  documents containing nodes supplied as the values of <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">stylesheet parameters</a>, documents
+                  obtained from the results of functions such as <a href="#func-document"><code>document</code></a>,
+                  <a href="https://www.w3.org/TR/xpath-functions-30/#func-doc"><code>doc</code></a><sup><small>FO30</small></sup>, and <a href="https://www.w3.org/TR/xpath-functions-30/#func-collection"><code>collection</code></a><sup><small>FO30</small></sup>, <span>documents read using the <a href="#element-source-document"><code>xsl:source-document</code></a>
+                     instruction,</span> and documents returned by extension functions or
+                  extension instructions. In the context of a particular XSLT instruction, the term
+                  <b>source tree</b> means any tree provided as input to that instruction;
+                  this may be a source tree of the transformation as a whole, or it may be a
+                  <a title="temporary tree" class="termref" href="#dt-temporary-tree">temporary tree</a> produced during the
+                  course of the transformation.<span class="definition">]</span>
+                  
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-temporary-tree" title="temporary tree"></a>The term <b>temporary
+                     tree</b> means any tree that is neither a <a title="source tree" class="termref" href="#dt-source-tree">source tree</a> nor a <a title="final result tree" class="termref" href="#dt-final-result-tree">final result
+                     tree</a>.<span class="definition">]</span> Temporary trees are used to hold intermediate results
+                  during the execution of the transformation.
+               </p>
+               <p>The use of the term “tree” in phrases such as <b>source
+                     tree</b>, <b>result tree</b>, and <b>temporary tree</b> is not
+                  confined to documents that the processor materializes in memory in their entirety.
+                  The processor <span class="verb">may</span>, and in some cases <span class="verb">must</span>, use
+                  streaming techniques to limit the amount of memory used to hold source and result
+                  documents. When streaming is used, the nodes of the tree may never all be in memory
+                  at the same time, but at an abstract level the information is still modeled as a tree
+                  of nodes, and the document is therefore still described as a tree. <span>Unless otherwise stated, the term “tree” refers to a tree rooted
+                     at a parentless node: that is, the term does not include subtrees of larger trees.
+                     Every node therefore belongs to exactly one tree.</span></p>
+               <p>In this specification the phrases <span class="verb">must</span>, <span class="verb">must
+                     not</span>, <span class="verb">should</span>, <span class="verb">should not</span>,
+                  <span class="verb">may</span>, <span class="verb">required</span>, and
+                  <span class="verb">recommended</span>, <span>when used in normative
+                     text and rendered in capitals,</span> are to be interpreted as described in
+                  <a href="#rfc2119">[RFC2119]</a>.
+               </p>
+               <p>Where the phrase <span class="verb">must</span>, <span class="verb">must not</span>, or
+                  <span class="verb">required</span> relates to the behavior of the XSLT processor, then an
+                  implementation is not conformant unless it behaves as specified, subject to the more
+                  detailed rules in <a href="#conformance"><i>27 Conformance</i></a>. 
+               </p>
+               <p>Where the phrase <span class="verb">must</span>, <span class="verb">must not</span>, or
+                  <span class="verb">required</span> relates to a stylesheet then the processor
+                  <span class="verb">must</span> enforce this constraint on stylesheets by reporting an
+                  error if the constraint is not satisfied.
+               </p>
+               <p>Where the phrase <span class="verb">should</span>, <span class="verb">should not</span>, or
+                  <span class="verb">recommended</span> relates to a stylesheet then a processor
+                  <span class="verb">may</span> produce warning messages if the constraint is not
+                  satisfied, but <span class="verb">must not</span> treat this as an error.
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-implementation-defined" title="implementation-defined"></a>In this
+                  specification, the term <b>implementation-defined</b> refers to a feature
+                  where the implementation is allowed some flexibility, and where the choices made
+                  by the implementation <span class="verb">must</span> be described in documentation that
+                  accompanies any conformance claim.<span class="definition">]</span>
+                  
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-implementation-dependent" title="implementation-dependent"></a>The term
+                  <b>implementation-dependent</b> refers to a feature where the behavior
+                  <span class="verb">may</span> vary from one implementation to another, and where the
+                  vendor is not expected to provide a full specification of the behavior.<span class="definition">]</span>
+                  (This might apply, for example, to limits on the size of source documents that can
+                  be
+                  transformed.)
+               </p>
+               <p>In all cases where this specification leaves the behavior implementation-defined or
+                  implementation-dependent, the implementation has the option of providing mechanisms
+                  that allow the user to influence the behavior.
+               </p>
+               <p>A paragraph labeled as a <b>Note</b> or described as an <b>example</b> is
+                  non-normative.
+               </p>
+               <p>Many terms used in this document are defined in the XPath specification <a href="#xpath-30">[XPath 3.0]</a> or the XDM specification <a href="#xpath-datamodel-30">[XDM 3.0]</a>.
+                  Particular attention is drawn to the following:
+               </p>
+               <ul>
+                  <li>
+                     <p>
+                        <span class="definition">[Definition: </span><a id="dt-atomization" title="atomize"></a>The term <b>atomization</b>
+                        is defined in <a href="https://www.w3.org/TR/xpath-30/#id-atomization">Section 
+                           
+                           2.4.2 Atomization
+                           </a><sup><small>XP30</small></sup>. It is a process that takes as input a sequence of
+                        <span>items</span>, and returns a sequence of
+                        atomic values, in which the nodes are replaced by their typed values as
+                        defined in <a href="#xpath-datamodel-30">[XDM 3.0]</a>. 
+                        <span>If the <a title="XPath 3.1 Feature" class="termref" href="#dt-xpath31-feature">XPath 3.1 Feature</a> is implemented,
+                           then arrays (see <a href="#arrays"><i>27.7.1 Arrays</i></a>) are atomized by atomizing their
+                           members, recursively.</span><span class="definition">]</span> For some <span>items</span> (for example, elements with element-only
+                        content, <span>function items</span>, and <a title="map" class="termref" href="#dt-map">maps</a>), atomization
+                        generates a <a title="dynamic error" class="termref" href="#dt-dynamic-error">dynamic error</a>.
+                     </p>
+                  </li>
+                  <li>
+                     <p>
+                        <span class="definition">[Definition: </span><a id="dt-typed-value" title="typed value"></a>The term <b>typed
+                           value</b> is defined in <a href="https://www.w3.org/TR/xpath-datamodel-30/#dm-typed-value">Section 
+                           
+                           5.15 typed-value Accessor
+                           </a><sup><small>DM30</small></sup>.
+                        Every node, <span>other than an element whose type
+                           annotation identifies it as having</span> element-only content, has a
+                        <a title="string value" class="termref" href="#dt-string-value">typed value</a>. For example, the
+                        <a title="typed value" class="termref" href="#dt-typed-value">typed value</a> of an attribute of
+                        type <code>xs:IDREFS</code> is a sequence of zero or more
+                        <code>xs:IDREF</code> values.<span class="definition">]</span>
+                        
+                     </p>
+                  </li>
+                  <li>
+                     <p>
+                        <span class="definition">[Definition: </span><a id="dt-string-value" title="string value"></a>The term <b>string
+                           value</b> is defined in
+                        <a href="https://www.w3.org/TR/xpath-datamodel-30/#dm-string-value">Section 
+                           
+                           5.13 string-value Accessor
+                           </a><sup><small>DM30</small></sup>. Every node has a <a title="string value" class="termref" href="#dt-string-value">string value</a>. For example, the <a title="string value" class="termref" href="#dt-string-value">string value</a> of an element is the concatenation of the
+                        <a title="string value" class="termref" href="#dt-string-value">string values</a> of all its
+                        descendant text nodes.<span class="definition">]</span>
+                        
+                     </p>
+                  </li>
+                  <li>
+                     <p>
+                        <span class="definition">[Definition: </span><a id="dt-xpath-compat-mode" title="XPath 1.0 compatibility mode"></a>The term
+                        <b>XPath 1.0 compatibility mode</b> is defined in <a href="https://www.w3.org/TR/xpath-30/#static_context">Section 
+                           
+                           2.1.1 Static Context
+                           </a><sup><small>XP30</small></sup>. This is a setting in the static
+                        context of an XPath expression; it has two values, <code>true</code> and
+                        <code>false</code>. When the value is set to true, the semantics of
+                        function calls and certain other operations are adjusted to give a greater
+                        degree of backwards compatibility between <span>XPath
+                           3.0</span> and XPath 1.0.<span class="definition">]</span>
+                        
+                     </p>
+                  </li>
+               </ul>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="notation"></a>2.2 <a href="#notation" style="text-decoration: none">Notation</a></h3>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-xslt-element" title="XSLT element"></a>An <b>XSLT element</b> is an
+                  element in the <a title="XSLT namespace" class="termref" href="#dt-xslt-namespace">XSLT namespace</a> whose
+                  syntax and semantics are defined in this specification.<span class="definition">]</span> For a
+                  non-normative list of XSLT elements, see <a href="#element-syntax-summary"><i>D Element Syntax Summary</i></a>.
+               </p>
+               <p>In this document the specification of each <a title="XSLT element" class="termref" href="#dt-xslt-element">XSLT
+                     element</a> is preceded by a summary of its syntax in the form of a model
+                  for elements of that element type. A full list of all these specifications can be
+                  found in <a href="#element-syntax-summary"><i>D Element Syntax Summary</i></a>. The meaning of the syntax summary
+                  notation is as follows:
+               </p>
+               <ul>
+                  <li>
+                     <p>An attribute that is <span class="verb">required</span> is shown with its name in
+                        bold. An attribute that may be omitted is shown with a question mark following
+                        its name.
+                     </p>
+                  </li>
+                  <li>
+                     <p>An attribute that is <a title="deprecated" class="termref" href="#dt-deprecated">deprecated</a> is shown
+                        in a grayed font within square brackets.
+                     </p>
+                  </li>
+                  <li>
+                     <p>The string that occurs in the place of an attribute value specifies the allowed
+                        values of the attribute. If this is surrounded by curly brackets
+                        (<code>{...}</code>), then the attribute value is treated as an <a title="attribute value template" class="termref" href="#dt-attribute-value-template">attribute value template</a>, and
+                        the string occurring within curly brackets specifies the allowed values of the
+                        result of evaluating the attribute value template. Alternative allowed values
+                        are separated by <code>|</code>. A quoted string indicates a value equal to
+                        that specific string. An unquoted, italicized name specifies a particular type
+                        of value.
+                     </p>
+                     <p>The types used, and their meanings, are as follows:</p>
+                     <dl>
+                        <dt class="label">
+                           <code>boolean</code>
+                           
+                        </dt>
+                        <dd>
+                           <p>One of the strings <code>"yes"</code>,
+                              <code>"true"</code>, or <code>"1"</code> to indicate the value
+                              <code>true</code>, or one of the strings <code>"no"</code>,
+                              <code>"false"</code>, or <code>"0"</code> to indicate the value
+                              <code>false</code>. Note: the values are synonyms; where this
+                              specification uses a phrase such as “If <code>required='yes'</code> is
+                              specified ...” this is to be interpreted as meaning “If the attribute
+                              named <code>required</code> is present, and has the value
+                              <code>yes</code>, <code>true</code>, or <code>1</code> (after
+                              stripping leading and trailing whitespace) ...”.
+                              
+                           </p>
+                        </dd>
+                        <dt class="label"><code>string</code></dt>
+                        <dd>
+                           <p>Any string</p>
+                        </dd>
+                        <dt class="label"><code>expression</code></dt>
+                        <dd>
+                           <p>An XPath <a title="expression" class="termref" href="#dt-expression">expression</a></p>
+                        </dd>
+                        <dt class="label"><code>pattern</code></dt>
+                        <dd>
+                           <p>A <a title="pattern" class="termref" href="#dt-pattern">pattern</a> as described in
+                              <a href="#patterns"><i>5.5 Patterns</i></a>.
+                           </p>
+                        </dd>
+                        <dt class="label"><code>item-type</code></dt>
+                        <dd>
+                           <p>An <a href="https://www.w3.org/TR/xpath-30/#prod-xpath30-ItemType">ItemType</a><sup><small>XP30</small></sup> as defined in the XPath
+                              3.0 specification <span>(or in XPath 3.1
+                                 if the processor implements the <a title="XPath 3.1 Feature" class="termref" href="#dt-xpath31-feature">XPath 3.1 Feature</a>)</span></p>
+                        </dd>
+                        <dt class="label"><code>sequence-type</code></dt>
+                        <dd>
+                           <p>A <a href="https://www.w3.org/TR/xpath-30/#prod-xpath30-SequenceType">SequenceType</a><sup><small>XP30</small></sup>
+                              as defined in the XPath 3.0 specification <span>(or in XPath 3.1 if the processor implements the
+                                 <a title="XPath 3.1 Feature" class="termref" href="#dt-xpath31-feature">XPath 3.1 Feature</a>)</span></p>
+                        </dd>
+                        <dt class="label"><code>uri; uris</code></dt>
+                        <dd>
+                           <p>A URI, for example a namespace URI or a collation URI; a
+                              whitespace-separated list of URIs
+                           </p>
+                        </dd>
+                        <dt class="label"><code>qname</code></dt>
+                        <dd>
+                           <p>A <a title="lexical QName" class="termref" href="#dt-lexical-qname">lexical QName</a> as defined
+                              in <a href="#qname"><i>5.1.1 Qualified Names</i></a></p>
+                        </dd>
+                        <dt class="label"><code>eqname; eqnames</code></dt>
+                        <dd>
+                           <p>An <a title="EQName" class="termref" href="#dt-eqname">EQName</a> as defined in <a href="#qname"><i>5.1.1 Qualified Names</i></a>; a whitespace-separated list of EQNames
+                           </p>
+                        </dd>
+                        <dt class="label"><code>token; tokens</code></dt>
+                        <dd>
+                           <p>A string containing no significant whitespace; a whitespace-separated
+                              list of such strings
+                           </p>
+                        </dd>
+                        <dt class="label"><code>nmtoken; nmtokens</code></dt>
+                        <dd>
+                           <p>A string conforming to the XML schema rules for the type
+                              <code>xs:NMTOKEN</code>; a whitespace-separated list of such
+                              strings.
+                           </p>
+                        </dd>
+                        <dt class="label"><code>char</code></dt>
+                        <dd>
+                           <p>A string comprising a single Unicode character</p>
+                        </dd>
+                        <dt class="label"><code>integer</code></dt>
+                        <dd>
+                           <p>An integer, that is a string in the lexical space of the schema type
+                              <code>xs:integer</code></p>
+                        </dd>
+                        <dt class="label"><code>decimal</code></dt>
+                        <dd>
+                           <p>A decimal value, that is a string in the lexical space of the schema
+                              type <code>xs:decimal</code></p>
+                        </dd>
+                        <dt class="label"><code>ncname</code></dt>
+                        <dd>
+                           <p>An unprefixed name: a string in the value space of the schema type
+                              <code>xs:NCName</code></p>
+                        </dd>
+                        <dt class="label"><code>prefix</code></dt>
+                        <dd>
+                           <p>An <code>xs:NCName</code> representing a namespace prefix, which must
+                              be in scope for the element on which it appears
+                           </p>
+                        </dd>
+                        <dt class="label"><code>id</code></dt>
+                        <dd>
+                           <p>An <code>xs:NCName</code> used as a unique identifier for an element
+                              in the containing XML document
+                           </p>
+                        </dd>
+                     </dl>
+                     <p>Except where the set of allowed values of an attribute is specified using the
+                        italicized name <em>string</em> or <em>char</em>, leading and trailing
+                        whitespace in the attribute value is ignored. In the case of an <a title="attribute value template" class="termref" href="#dt-attribute-value-template">attribute value template</a>, this
+                        applies to the <a title="effective value" class="termref" href="#dt-effective-value">effective value</a>
+                        obtained when the attribute value template is expanded.
+                     </p>
+                     <p>XPath comments (delimited by <code>(: ... :)</code>)
+                        are permitted anywhere that inter-token whitespace is permitted in attributes whose
+                        type is given as <em>expression</em>, <em>pattern</em>, <em>item-type</em>, 
+                        or <em>sequence-type</em>, and are not permitted in attributes of other types
+                        (other than within expressions enclosed by curly braces within an <a title="attribute value template" class="termref" href="#dt-attribute-value-template">attribute value template</a>).
+                     </p>
+                  </li>
+                  <li>
+                     <p>Unless the element is <span class="verb">required</span> to be empty, the model
+                        element contains a comment specifying the allowed content. The allowed content
+                        is specified in a similar way to an element type declaration in XML;
+                        <em>sequence constructor</em> means that any mixture of text nodes,
+                        <a title="literal result element" class="termref" href="#dt-literal-result-element">literal result elements</a>,
+                        <a title="extension instruction" class="termref" href="#dt-extension-instruction">extension instructions</a>,
+                        and <a title="XSLT element" class="termref" href="#dt-xslt-element">XSLT elements</a> from the <a title="instruction" class="termref" href="#dt-instruction">instruction</a> category is allowed;
+                        <em>other-declarations</em> means that any mixture of XSLT elements from
+                        the <a title="declaration" class="termref" href="#dt-declaration">declaration</a> category is allowed, together with <a title="user-defined data element" class="termref" href="#dt-data-element">user-defined data elements</a>.
+                     </p>
+                  </li>
+                  <li>
+                     <p>The element is prefaced by comments indicating if it belongs to the
+                        <code>instruction</code> category or <code>declaration</code> category or
+                        both. The category of an element only affects whether it is allowed in the
+                        content of elements that allow a <a title="sequence constructor" class="termref" href="#dt-sequence-constructor">sequence constructor</a> or <em>other-declarations</em>.
+                     </p>
+                  </li>
+               </ul>
+               <div class="example">
+                  
+                  <div class="exampleHeader"><a id="d7e1284"></a>Example: Syntax Notation
+                  </div>
+                  <p>This example illustrates the notation used to describe <a title="XSLT element" class="termref" href="#dt-xslt-element">XSLT elements</a>.
+                  </p>
+                  <p class="element-syntax"><a id="element-example-element"></a><code>&lt;!-- Category: instruction --&gt;<br />&lt;xsl:example-element<br />  <b>select</b> = <var>expression</var><br />  debug? = <var>boolean</var><br />  validation? = { "strict" | "lax" } &gt;<br />  &lt;!-- Content: ((<a href="#element-variable">xsl:variable</a> | <a href="#element-param">xsl:param</a>)*, <a href="#element-sequence">xsl:sequence</a>) --&gt;<br />&lt;/xsl:example-element&gt;</code></p>
+                  <p>This example defines a (non-existent) element <code>xsl:example-element</code>.
+                     The element is classified as an instruction. It takes the following
+                     attributes:
+                  </p>
+                  <ol class="enumar">
+                     <li>
+                        <p>A mandatory <code>select</code> attribute, whose value is an XPath <a title="expression" class="termref" href="#dt-expression">expression</a></p>
+                     </li>
+                     <li>
+                        <p>An optional <code>debug</code> attribute, whose
+                           value <span class="verb">must</span> be <code>yes</code>, <code>true</code>, or
+                           <code>1</code> to indicate <code>true</code>, or <code>no</code>,
+                           <code>false</code>, or <code>0</code> to indicate <code>false</code>.
+                        </p>
+                     </li>
+                     <li>
+                        <p>An optional <code>validation</code> attribute, whose value must be
+                           <code>strict</code> or <code>lax</code>; the curly brackets indicate that
+                           the value can be defined as an <a title="attribute value template" class="termref" href="#dt-attribute-value-template">attribute value template</a>, allowing a value such as
+                           <code>validation="{$val}"</code>, where the <a title="variable" class="termref" href="#dt-variable">variable</a>
+                           <code>val</code> is evaluated to yield <code>"strict"</code> or
+                           <code>"lax"</code> at run-time.
+                        </p>
+                     </li>
+                  </ol>
+                  <p>The content of an <code>xsl:example-element</code> instruction is defined to be a
+                     sequence of zero or more <a href="#element-variable"><code>xsl:variable</code></a> and
+                     <a href="#element-param"><code>xsl:param</code></a> elements, followed by an
+                     <a href="#element-sequence"><code>xsl:sequence</code></a> element.
+                  </p>
+               </div>
+               <p>
+                  <a id="err-XTSE0010"><span class="error">[ERR XTSE0010] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if an
+                  XSLT-defined element is used in a context where it is not permitted, if a
+                  <span class="verb">required</span> attribute is omitted, or if the content of the
+                  element does not correspond to the content that is allowed for the element.
+                  
+               </p>
+               <p>The rules in the element syntax summary (both for the
+                  element structure and for its attributes) apply to the stylesheet content after
+                  preprocessing as described in <a href="#preprocessing"><i>3.13 Stylesheet Preprocessing</i></a>.
+               </p>
+               <p>Attributes are validated as follows. These rules apply to the value of the attribute
+                  after removing leading and trailing whitespace.
+               </p>
+               <ul>
+                  <li>
+                     <p>
+                        <a id="err-XTSE0020"><span class="error">[ERR XTSE0020] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if an
+                        attribute (other than an attribute written using curly brackets in a
+                        position where an <a title="attribute value template" class="termref" href="#dt-attribute-value-template">attribute
+                           value template</a> is permitted) contains a value that is not
+                        one of the permitted values for that attribute.
+                        
+                     </p>
+                  </li>
+                  <li>
+                     <p>
+                        <a id="err-XTDE0030"><span class="error">[ERR XTDE0030] </span></a>It is a <a title="dynamic error" class="termref" href="#dt-dynamic-error"> dynamic error</a> if the <a title="effective value" class="termref" href="#dt-effective-value">effective value</a> of an attribute
+                        written using curly brackets, in a position where an <a title="attribute value template" class="termref" href="#dt-attribute-value-template">attribute value template</a>
+                        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 signal this as a
+                        static error.
+                        
+                     </p>
+                  </li>
+               </ul>
+               <p>Special rules apply if the construct appears in part of the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> that is processed with <a title="forwards compatible behavior" class="termref" href="#dt-forwards-compatible-behavior">forwards compatible behavior</a>: see <a href="#forwards"><i>3.10 Forwards Compatible Processing</i></a>.
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-deprecated" title="deprecated"></a>Some constructs defined in this
+                  specification are described as being <b>deprecated</b>. The use of this term
+                  implies that stylesheet authors <span class="verb">should not</span> use the construct,
+                  and that the construct may be removed in a later version of this
+                  specification.<span class="definition">]</span></p>
+               <div class="note">
+                  <p class="prefix"><b>Note:</b></p>
+                  <p>This specification includes a non-normative XML Schema for XSLT <a title="stylesheet module" class="termref" href="#dt-stylesheet-module">stylesheet modules</a> (see <a href="#schema-for-xslt"><i>H Schemas for XSLT 3.0 Stylesheets</i></a>). The syntax summaries described in this section are
+                     normative.
+                  </p>
+               </div>
+               <p>XSLT defines a set of standard functions which are additional to those defined in
+                  <a href="#xpath-functions-30">[Functions and Operators 3.0]</a>. <span>A list of these
+                     functions appears in <a href="#XSLT-defined-functions"><i>G.2 List of XSLT-defined functions</i></a>.</span> The
+                  signatures of these functions are described using the same notation as used in
+                  <a href="#xpath-functions-30">[Functions and Operators 3.0]</a>. The names of <span>many
+                     of</span> these functions are in the <a title="standard function namespace" class="termref" href="#dt-standard-function-namespace">standard function namespace</a>.
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="initiating"></a>2.3 <a href="#initiating" style="text-decoration: none">Initiating a Transformation</a></h3>
+               <p>This document does not specify any application programming interfaces or other
+                  interfaces for initiating a transformation. This section, however, describes the
+                  information that is supplied when a transformation is initiated. Except where
+                  otherwise indicated, the information is <span class="verb">required</span>.
+               </p>
+               <p>The execution of a stylesheet necessarily involves two activities: static analysis
+                  and dynamic evaluation. Static analysis consists of those tasks that can be performed
+                  by inspection of the stylesheet alone, including <span>the
+                     binding of <a title="static variable" class="termref" href="#dt-static-variable">static variables</a>,</span>
+                  the evaluation of <code>[xsl:]use-when</code> expressions (see <a href="#conditional-inclusion"><i>3.13.1 Conditional Element Inclusion</i></a>), <span>and shadow attributes
+                     (see <a href="#shadow-attributes"><i>3.13.2 Shadow Attributes</i></a>)</span> and detection of <a title="static error" class="termref" href="#dt-static-error">static errors</a>. Dynamic evaluation consists of
+                  tasks which in general cannot be carried out until a source document is
+                  available.
+               </p>
+               <p>Dynamic evaluation is further divided into two activities:
+                  <b>priming</b> the stylesheet, and <b>invoking</b> a selected
+                  component. 
+               </p>
+               <ul>
+                  <li>
+                     <p>Priming the stylesheet provides the dynamic context for evaluation, and
+                        supplies all the information needed to establish the values of global
+                        variables.
+                     </p>
+                  </li>
+                  <li>
+                     <p>Invoking a component (such as a template or function) causes evaluation of that
+                        template or function to produce a result, which is an arbitrary XDM value.
+                     </p>
+                     <p><span class="definition">[Definition: </span><a id="dt-raw-result" title="raw result"></a>The result of invoking the
+                        selected component, after any required conversion to the declared result
+                        type of the component, is referred to as the <b>raw
+                           result</b>.<span class="definition">]</span></p>
+                     <p>The <a title="raw result" class="termref" href="#dt-raw-result">raw result</a> of the invocation
+                        is the <a title="immediate result" class="termref" href="#dt-immediate-result">immediate result</a> of evaluating the <a title="sequence constructor" class="termref" href="#dt-sequence-constructor">sequence constructor</a>
+                        contained in the target template or function, modified by applying the <a title="function conversion rules" class="termref" href="#dt-function-conversion-rules">function conversion rules</a>
+                        to convert the <a title="immediate result" class="termref" href="#dt-immediate-result">immediate result</a> to the type declared in the <code>as</code>
+                        attribute of the <a href="#element-template"><code>xsl:template</code></a> or <a href="#element-function"><code>xsl:function</code></a> declaration, if present.
+                     </p>
+                     <p>This raw result may optionally be post-processed to construct a result tree, to
+                        serialize the result, or both, as described in <a href="#post-processing"><i>2.3.6 Post-processing the Raw Result</i></a>.
+                     </p>
+                  </li>
+               </ul>
+               <p>Implementations <span class="verb">may</span> allow static analysis and dynamic evaluation
+                  to be initiated independently, so that the cost of static analysis can be amortized
+                  over multiple transformations using the same stylesheet. <span>Implementations <span class="verb">may</span> also allow priming of a stylesheet and
+                     invocation of components to be initiated independently, in which case a single act
+                     of priming the stylesheet may be followed by a series of independent component
+                     invocations. Although this specification does not require such a separation, this
+                     section distinguishes information that is needed before static analysis can
+                     proceed, information that is needed to prime the stylesheet, and information that
+                     is needed when invoking components.</span></p>
+               <p>The language is designed to allow the static analysis of each
+                  <a title="package" class="termref" href="#dt-package">package</a> to be performed independently of other packages, with
+                  only basic knowledge of the properties of components made available by used packages.
+                  Beyond this, the specification leaves it to implementations to decide how to organize
+                  this process. When packages are not used explicitly, the entire stylesheet is treated
+                  as a single package.
+               </p>
+               <div class="div3">
+                  
+                  <h4><a id="info-for-static-analysis"></a>2.3.1 <a href="#info-for-static-analysis" style="text-decoration: none">Information needed for Static Analysis</a></h4>
+                  <p>The following information is needed prior to static analysis
+                     <span>of a package</span>:
+                  </p>
+                  <ul>
+                     <li>
+                        <p>The location of the <a title="package manifest" class="termref" href="#dt-package-manifest">package manifest</a>,
+                           or in the absence of a package manifest, the <a title="stylesheet module" class="termref" href="#dt-stylesheet-module">stylesheet module</a> that is to act as
+                           the <a title="principal stylesheet module" class="termref" href="#dt-principal-stylesheet-module">principal stylesheet
+                              module</a>
+                           <span>of the <a title="package" class="termref" href="#dt-package">package</a></span>. The complete <a title="package" class="termref" href="#dt-package">package</a> is
+                           assembled by recursively expanding the <a href="#element-import"><code>xsl:import</code></a> and
+                           <a href="#element-include"><code>xsl:include</code></a> declarations in the principal stylesheet
+                           module, as described in <a href="#include"><i>3.11.2 Stylesheet Inclusion</i></a> and <a href="#import"><i>3.11.3 Stylesheet Import</i></a>. 
+                        </p>
+                     </li>
+                     <li>
+                        <p>Information about the packages referenced from this
+                           package using <a href="#element-use-package"><code>xsl:use-package</code></a> declarations. The information
+                           needed will include the names and signatures of public components exported
+                           by the referenced package.
+                        </p>
+                     </li>
+                     <li>
+                        <p>A set (possibly empty) of values for <a title="static parameter" class="termref" href="#dt-static-parameter">static parameters</a> (see <a href="#global-variables"><i>9.5 Global Variables and Parameters</i></a>). These values are available for use within
+                           <a title="static expression" class="termref" href="#dt-static-expression">static expressions</a> (notably
+                           in <code>[xsl:]use-when</code> expressions and shadow attributes) as well as
+                           non-static expressions in the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>. As a minimum, values <span class="verb">must</span> be
+                           supplied for any static parameters declared with the attribute
+                           <code>required="yes"</code>.
+                        </p>
+                     </li>
+                  </ul>
+                  <p>Conceptually, the output of the static analysis of a package is
+                     an object which might be referred to (without constraining the implementation) as
+                     a compiled package. Prior to dynamic evaluation, all the compiled packages needed
+                     for execution must be checked for consistency, and component references must be
+                     resolved. This process may be referred to, again without constraining the
+                     implementation, as linking.
+                  </p>
+               </div>
+               <div class="div3">
+                  
+                  <h4><a id="priming-stylesheet"></a>2.3.2 <a href="#priming-stylesheet" style="text-decoration: none">Priming a Stylesheet</a></h4>
+                  <p>The information needed when priming a stylesheet is as
+                     follows:
+                  </p>
+                  <ul>
+                     <li>
+                        <p>A set (possibly empty) of values for <span>non-static</span>
+                           <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">stylesheet parameters</a> (see
+                           <a href="#global-variables"><i>9.5 Global Variables and Parameters</i></a>). These values are available for use
+                           within <a title="expression" class="termref" href="#dt-expression">expressions</a> in the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>. As a minimum, values
+                           <span class="verb">must</span> be supplied for any parameters declared with the
+                           attribute <code>required="yes"</code>.
+                        </p>
+                        <p>A supplied value is converted if necessary to the declared
+                           type of the stylesheet parameter using the <a title="function conversion rules" class="termref" href="#dt-function-conversion-rules">function conversion rules</a>.
+                        </p>
+                        <div class="note">
+                           <p class="prefix"><b>Note:</b></p>
+                           <p>Non-static stylesheet parameters <span>are implicitly</span>
+                              <code>public</code>, which ensures that all the parameters in the
+                              stylesheet for which values can be supplied externally have distinct
+                              names. Static parameters, <span>by contrast,
+                                 are local to a package</span>.
+                           </p>
+                        </div>
+                     </li>
+                     <li>
+                        <p>
+                           <span class="definition">[Definition: </span><a id="dt-global-context-item" title="global context item"></a><span>An item that acts as the <b>global
+                                 context item</b> for the transformation.</span> This item acts
+                           as the <a title="context item" class="termref" href="#dt-context-item">context item</a> when evaluating
+                           <span> the
+                              <code>select</code> expression or <a title="sequence constructor" class="termref" href="#dt-sequence-constructor">sequence constructor</a> of a
+                              <a title="global variable" class="termref" href="#dt-global-variable">global variable</a> declaration</span>
+                           <span>within the <a title="top-level package" class="termref" href="#dt-top-level-package">top-level package</a></span>, as described in <a href="#focus"><i>5.3.3.1 Maintaining Position: the Focus</i></a>. The global context item may also be available in a <a title="named template" class="termref" href="#dt-named-template">named template</a>
+                           when the stylesheet is invoked as described in <a href="#invoking-initial-template"><i>2.3.4 Call-Template Invocation</i></a><span class="definition">]</span>.
+                        </p>
+                        <div class="note">
+                           <p class="prefix"><b>Note:</b></p>
+                           <p>In previous releases of this specification, a single node was typically
+                              supplied to represent the source document for the transformation. This
+                              node was used as the target node for the implicit call on
+                              <a href="#element-apply-templates"><code>xsl:apply-templates</code></a> used to start the transformation
+                              process (now called the <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a>), and
+                              the root node of the containing tree was used as the context item for
+                              evaluation of global variables (now called the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a>). This relationship between the
+                              <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a> and the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a> is likely to be found for compatibility
+                              reasons in a transformation API designed to work with earlier versions of
+                              this specification, but it is no longer a necessary relationship; the two
+                              values can in principle be completely independent of each other.
+                           </p>
+                           <p>Stylesheet authors wanting to write code that can be invoked using legacy
+                              APIs should not rely on the caller being able to supply different values
+                              for the <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a> and the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a>.
+                           </p>
+                        </div>
+                        <p>The value given to the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a>
+                           (and the values given to <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">stylesheet parameters</a>)
+                           cannot be nodes in a streamed document. This rule ensures that all global variables
+                           can freely
+                           navigate within the relevant tree, with no constraints imposed by the streamability
+                           rules.
+                        </p>
+                        <p>The <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a> is potentially
+                           used when initializing global variables and parameters. If the
+                           initialization of any <a title="global variable" class="termref" href="#dt-global-variable">global
+                              variables</a> or <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">parameter</a> depends on the context item, a dynamic error can
+                           occur if the context item is absent. It is <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a> whether this error occurs during
+                           priming of the stylesheet or subsequently when the variable is referenced;
+                           and it is <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a> whether the error
+                           occurs at all if the variable or parameter is never referenced. The error
+                           can be suppressed by use of <a href="#element-try"><code>xsl:try</code></a> and
+                           <a href="#element-catch"><code>xsl:catch</code></a> within the <span>sequence constructor used to initialize the variable or parameter. It
+                              cannot be suppressed by use of <a href="#element-try"><code>xsl:try</code></a> around a
+                              reference to the global variable.</span>
+                           
+                        </p>
+                        <p><span>In a <a title="library package" class="termref" href="#dt-library-package">library package</a>,
+                              the <a title="context item" class="termref" href="#dt-context-item">context item</a>, <a title="context position" class="termref" href="#dt-context-position">context position</a>, and <a title="context size" class="termref" href="#dt-context-size">context size</a> used for evaluation of
+                              global variables will be <a title="absent" class="termref" href="#dt-absent">absent</a>, and
+                              the evaluation of any expression that references these values will result
+                              in a dynamic error. </span>
+                           <span>This will also be the case in the
+                              <a title="top-level package" class="termref" href="#dt-top-level-package">top-level package</a> if no <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a> is supplied.</span></p>
+                        <div class="note">
+                           <p class="prefix"><b>Note:</b></p>
+                           <p>If a context item is available within a global variable declaration, then
+                              the <a title="context position" class="termref" href="#dt-context-position">context position</a> and
+                              <a title="context size" class="termref" href="#dt-context-size">context size</a> will always be 1
+                              (one).
+                           </p>
+                        </div>
+                        <div class="note">
+                           <p class="prefix"><b>Note:</b></p>
+                           <p>For maximum reusability of code, it is best to avoid use of the context
+                              item when initializing global variables and parameters. Instead, all
+                              external information should be supplied using named <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">stylesheet parameters</a>.
+                              Especially when these use namespaces to avoid conflicts, there is then no
+                              risk of confusion between the information supplied externally to
+                              different packages.
+                           </p>
+                           <p>When a stylesheet parameter is defined in a library package, it is
+                              possible for a using package to supply a value for the parameter by
+                              overriding the parameter declaration within an
+                              <a href="#element-override"><code>xsl:override</code></a> element. If the using package is the
+                              <a title="top-level package" class="termref" href="#dt-top-level-package">top-level package</a> then the overriding declaration
+                              can refer to the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a>.
+                           </p>
+                        </div>
+                     </li>
+                     <li>
+                        <p>A mechanism for obtaining a document node and a media type, given an
+                           absolute URI. The total set of available documents (modeled as a mapping
+                           from URIs to document nodes) forms part of the context for evaluating XPath
+                           expressions, specifically the <a href="https://www.w3.org/TR/xpath-functions-30/#func-doc"><code>doc</code></a><sup><small>FO30</small></sup> function. The XSLT
+                           <a href="#func-document"><code>document</code></a> function additionally requires the media
+                           type of the resource representation, for use in interpreting any fragment
+                           identifier present within a URI Reference.
+                        </p>
+                        <div class="note">
+                           <p class="prefix"><b>Note:</b></p>
+                           <p>The set of documents that are available to the stylesheet is <a title="implementation-dependent" class="termref" href="#dt-implementation-dependent">implementation-dependent</a>,
+                              as is the processing that is carried out to construct a tree representing
+                              the resource retrieved using a given URI. Some possible ways of
+                              constructing a document (specifically, rules for constructing a document
+                              from an Infoset or from a PSVI) are described in <a href="#xpath-datamodel-30">[XDM 3.0]</a>.
+                           </p>
+                        </div>
+                     </li>
+                  </ul>
+                  <p>Once a stylesheet is primed, the values of global variables
+                     remain stable through all component invocations. In addition, priming a stylesheet
+                     creates an <a href="https://www.w3.org/TR/xpath-functions-30/#execution-scope">execution scope</a><sup><small>FO30</small></sup>
+                     during which the dynamic context and all <span>calls
+                        on <a href="https://www.w3.org/TR/xpath-functions-30/#dt-deterministic">deterministic</a><sup><small>FO30</small></sup>
+                        functions</span> remain stable; for example two calls on the
+                     <a href="https://www.w3.org/TR/xpath-functions-30/#func-current-dateTime"><code>current-dateTime</code></a><sup><small>FO30</small></sup> function within an execution scope are
+                     defined to return the same result.
+                  </p>
+                  <p>Parameters passed to the transformation by the client application <span>when a stylesheet is primed</span> are matched against
+                     <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">stylesheet parameters</a> (see
+                     <a href="#global-variables"><i>9.5 Global Variables and Parameters</i></a>), not against the <a title="template parameter" class="termref" href="#dt-template-parameter">template parameters</a> of any template
+                     executed during the course of the transformation. 
+                  </p>
+                  <p>
+                     <a id="err-XTDE0050"><span class="error">[ERR XTDE0050] </span></a>It is a <a title="dynamic error" class="termref" href="#dt-dynamic-error"> dynamic error</a> if a
+                     stylesheet declares a visible <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">stylesheet parameter</a>
+                     <span>that is <a title="explicitly mandatory" class="termref" href="#dt-explicitly-mandatory">explicitly</a> or <a title="implicitly mandatory" class="termref" href="#dt-implicitly-mandatory">implicitly</a> mandatory,</span>
+                     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 <a title="import precedence" class="termref" href="#dt-import-precedence">import precedence</a>. <span>If the parameter is a <a title="static parameter" class="termref" href="#dt-static-parameter">static parameter</a> then the value <span class="verb">must</span> be
+                        supplied prior to the static analysis phase.</span>
+                     
+                  </p>
+               </div>
+               <div class="div3">
+                  
+                  <h4><a id="invoking-initial-mode"></a>2.3.3 <a href="#invoking-initial-mode" style="text-decoration: none">Apply-Templates Invocation</a></h4>
+                  <p><span class="definition">[Definition: </span><a id="dt-initial-match-selection" title="initial match selection"></a>A stylesheet may be evaluated by supplying a
+                     value to be processed, together with an <a title="initial mode" class="termref" href="#dt-initial-mode">initial mode</a>. The
+                     value (which can be any sequence of items) is referred to as the <b>initial
+                        match selection</b>. The processing then corresponds to the effect of the
+                     <a href="#element-apply-templates"><code>xsl:apply-templates</code></a> instruction.<span class="definition">]</span></p>
+                  <p>The <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a> will
+                     often be a single document node, traditionally called the source document of the
+                     transformation; but in general, it can be any sequence. <span>If the initial match selection is an empty sequence, the result of the
+                        transformation will be empty, since no template rules are
+                        evaluated.</span></p>
+                  <p>Processing proceeds by finding the <a title="template rule" class="termref" href="#dt-template-rule">template rules</a> that match the items in the
+                     <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a>, and evaluating these template
+                     rules with a <a title="focus" class="termref" href="#dt-focus">focus</a> based on the <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a>. The template rules are evaluated in
+                     <a title="final output state" class="termref" href="#dt-final-output-state">final output state</a>.
+                  </p>
+                  <p>The following information is needed when dynamic evaluation is
+                     to start with a <a title="template rule" class="termref" href="#dt-template-rule">template rule</a>:
+                  </p>
+                  <ul>
+                     <li>
+                        <p>The <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a>.
+                           An API that chooses to maintain compatibility with previous versions of this
+                           specification <span class="verb">should</span> allow a method of invocation in which a singleton node is
+                           provided, which is then used in two ways: the node itself acts as the
+                           <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a>, and the <span>root node of the
+                              containing tree</span> acts as the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a>. 
+                        </p>
+                     </li>
+                     <li>
+                        <p>Optionally, an initial <a title="mode" class="termref" href="#dt-mode">mode</a>.
+                        </p>
+                        <p><span class="definition">[Definition: </span><a id="dt-initial-mode" title="initial mode"></a>The <b>initial mode</b>
+                           is the <a title="mode" class="termref" href="#dt-mode">mode</a> used to select <a title="template rule" class="termref" href="#dt-template-rule">template rules</a>
+                           for processing items in the <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a> when
+                           apply-templates invocation is used to initiate a transformation.<span class="definition">]</span></p>
+                        <p>In searching
+                           for the <a title="template rule" class="termref" href="#dt-template-rule">template rule</a> that best
+                           matches the <span>items in the <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a></span>, the processor
+                           considers only those rules that apply to the <a title="initial mode" class="termref" href="#dt-initial-mode">initial mode</a>.
+                        </p>
+                        <p>If no <a title="initial mode" class="termref" href="#dt-initial-mode">initial mode</a> is supplied explicitly, then the initial mode is that named in the
+                           <code>default-mode</code> attribute of the <span>(explicit or implicit) <a href="#element-package"><code>xsl:package</code></a>
+                              element of the <a title="top-level package" class="termref" href="#dt-top-level-package">top-level package</a></span> or in
+                           the absence of such an attribute, the <a title="unnamed mode" class="termref" href="#dt-unnamed-mode">unnamed mode</a>.
+                        </p>
+                        <p>
+                           <a id="err-XTDE0044"><span class="error">[ERR XTDE0044] </span></a>It is a <a title="dynamic error" class="termref" href="#dt-dynamic-error">dynamic error</a> if the
+                           invocation of the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>
+                           specifies an <a title="initial mode" class="termref" href="#dt-initial-mode">initial mode</a> when no <span><a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a> is
+                              supplied (either explicitly, or defaulted to the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a>)</span>.
+                           
+                        </p>
+                        <p>A (named or unnamed) <a title="mode" class="termref" href="#dt-mode">mode</a> <var>M</var> is <b>eligible as an initial mode</b> if one of the
+                           following conditions applies, where <var>P</var> is the <a title="top-level package" class="termref" href="#dt-top-level-package">top-level package</a> of the stylesheet:
+                        </p>
+                        <ol class="enumar">
+                           <li>
+                              <p><var>M</var> is explicitly declared in an <a href="#element-mode"><code>xsl:mode</code></a> declaration
+                                 within <var>P</var>, and has <code>public</code> or <code>final</code> <a title="visibility" class="termref" href="#dt-visibility">visibility</a> (either by virtue
+                                 of its <code>visibility</code> attribute, or by virtue of an <a href="#element-expose"><code>xsl:expose</code></a> declaration).
+                              </p>
+                           </li>
+                           <li>
+                              <p><var>M</var> is the unnamed mode.
+                              </p>
+                           </li>
+                           <li>
+                              <p><var>M</var> is named in the <code>default-mode</code> attribute of the (explicit or implicit) 
+                                 <a href="#element-package"><code>xsl:package</code></a> element of <var>P</var>.
+                              </p>
+                           </li>
+                           <li>
+                              <p><var>M</var> is declared in a package used by <var>P</var>, and is given <code>public</code> or <code>final</code>
+                                 <a title="visibility" class="termref" href="#dt-visibility">visibility</a> in <var>P</var> by means of an <a href="#element-accept"><code>xsl:accept</code></a> declaration.
+                              </p>
+                           </li>
+                           <li>
+                              <p>The effective value of the <code>declared-modes</code> attribute of the explicit or implicit
+                                 <a href="#element-package"><code>xsl:package</code></a> element of <var>P</var> is <code>no</code>, and <var>M</var> appears as 
+                                 a mode-name in the <code>mode</code> attribute of a <a title="template rule" class="termref" href="#dt-template-rule">template rule</a> declared within <var>P</var>.
+                              </p>
+                           </li>
+                        </ol>
+                        <p>
+                           <a id="err-XTDE0045"><span class="error">[ERR XTDE0045] </span></a>It is a <a title="dynamic error" class="termref" href="#dt-dynamic-error">dynamic error</a> if the
+                           invocation of the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>
+                           specifies an <a title="initial mode" class="termref" href="#dt-initial-mode">initial mode</a> and the
+                           specified mode is not eligible as an initial mode (as defined above).
+                           
+                        </p>
+                     </li>
+                     <li>
+                        <p>Parameters, which will be passed to the template rules
+                           used to process items in the input sequence. The parameters consist of two
+                           sets of (QName, value) pairs, one set for <a title="tunnel parameter" class="termref" href="#dt-tunnel-parameter">tunnel parameters</a> and one for non-tunnel parameters, in which
+                           the QName identifies the name of a parameter and the value provides the
+                           value of the parameter. Either or both sets of parameters may be empty. The
+                           effect is the same as when a template is invoked using
+                           <a href="#element-apply-templates"><code>xsl:apply-templates</code></a> with an
+                           <a href="#element-with-param"><code>xsl:with-param</code></a> child specifying
+                           <code>tunnel="yes"</code> or <code>tunnel="no"</code> as appropriate. If
+                           a parameter is supplied that is not declared or used, the value is simply
+                           ignored. These parameters are <em>not</em> used to set <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">stylesheet parameters</a>.
+                        </p>
+                        <p>A supplied value is converted if necessary to the declared
+                           type of the template parameter using the <a title="function conversion rules" class="termref" href="#dt-function-conversion-rules">function conversion rules</a>.
+                        </p>
+                     </li>
+                     <li>
+                        <p>Details of how the result of the initial template is to be returned.
+                           For details, see <a href="#post-processing"><i>2.3.6 Post-processing the Raw Result</i></a></p>
+                     </li>
+                  </ul>
+                  <p>The <a title="raw result" class="termref" href="#dt-raw-result">raw result</a> of the invocation is the
+                     result of processing the supplied input sequence as if by a call on
+                     <a href="#element-apply-templates"><code>xsl:apply-templates</code></a> in the specified mode: specifically, each
+                     item in the input sequence is processed by selecting and evaluating the best
+                     matching template rule, and converting the result (if necessary) to the type
+                     declared in the <code>as</code> attribute of that template using the <a title="function conversion rules" class="termref" href="#dt-function-conversion-rules">function conversion rules</a>; and the results of processing each item
+                     are then concatenated into a single sequence, respecting the order of items in the
+                     input sequence.
+                  </p>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>If the initial mode is <a title="declared-streamable" class="termref" href="#dt-declared-streamable">declared-streamable</a>,
+                        then a streaming processor <span class="verb">should</span> allow some or all of the items
+                        in the <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a> to be nodes supplied in streamable form,
+                        and any nodes that are supplied in this form <span class="verb">must</span> then be processed using streaming.
+                     </p>
+                     <p>Since the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a> cannot be a streamed node,
+                        in cases where the transformation is to proceed by applying streamable templates
+                        to a streamed input document, the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a> must
+                        either be absent, or must be something that differs from the <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a>.
+                     </p>
+                  </div>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>The design of the API for invoking a transformation should provide some means
+                        for users to designate the <a title="unnamed mode" class="termref" href="#dt-unnamed-mode">unnamed mode</a> as the <a title="initial mode" class="termref" href="#dt-initial-mode">initial mode</a> in cases where it is not the default mode.
+                     </p>
+                  </div>
+                  <p>It is a <a title="dynamic error" class="termref" href="#dt-dynamic-error">dynamic error</a>
+                     <span class="error">[see <a href="#err-XTDE0700">ERR XTDE0700</a>]</span> if the <a title="template rule" class="termref" href="#dt-template-rule">template rule</a> selected for processing any item in the <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a> defines a <a title="template parameter" class="termref" href="#dt-template-parameter">template parameter</a> that specifies <code>required="yes"</code>
+                     <span>and no value is supplied for that
+                        parameter.</span></p>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>A <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> can process further source
+                        documents in addition to those supplied when the transformation is invoked.
+                        These additional documents can be loaded using the functions
+                        <a href="#func-document"><code>document</code></a> (see <a href="#func-document"><i>20.1 fn:document</i></a>) or
+                        <a href="https://www.w3.org/TR/xpath-functions-30/#func-doc"><code>doc</code></a><sup><small>FO30</small></sup> or <a href="https://www.w3.org/TR/xpath-functions-30/#func-collection"><code>collection</code></a><sup><small>FO30</small></sup> (see <a href="#xpath-functions-30">[Functions and Operators 3.0]</a>), <span>or using the
+                           <a href="#element-source-document"><code>xsl:source-document</code></a> instruction</span>; alternatively, they can
+                        be supplied as <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">stylesheet
+                           parameters</a> (see <a href="#global-variables"><i>9.5 Global Variables and Parameters</i></a>), or returned as
+                        the result of an <a title="extension function" class="termref" href="#dt-extension-function">extension
+                           function</a> (see <a href="#extension-functions"><i>24.1 Extension Functions</i></a>).
+                     </p>
+                  </div>
+               </div>
+               <div class="div3">
+                  
+                  <h4><a id="invoking-initial-template"></a>2.3.4 <a href="#invoking-initial-template" style="text-decoration: none">Call-Template Invocation</a></h4>
+                  <p><span class="definition">[Definition: </span><a id="dt-initial-named-template" title="initial named template"></a>A stylesheet may be evaluated by selecting a
+                     named template to be evaluated; this is referred to as the <b>initial named
+                        template</b>.<span class="definition">]</span> The effect is analogous to the effect of
+                     executing an <a href="#element-call-template"><code>xsl:call-template</code></a> instruction. The following
+                     information is needed in this case:
+                  </p>
+                  <ul>
+                     <li>
+                        <p>Optionally, the name of the <a title="initial named template" class="termref" href="#dt-initial-named-template">initial
+                              named template</a> which is to be executed as the entry point to
+                           the transformation. <span>If no template name is
+                              supplied, the default template name is
+                              <code>xsl:initial-template</code>.</span> The selected template
+                           <span class="verb">must</span> exist within the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>. 
+                        </p>
+                     </li>
+                     <li>
+                        <p>Optionally, a context item for evaluation of this named
+                           template, defaulting to the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a> if it
+                           exists. <span>This is constrained by any
+                              <a href="#element-context-item"><code>xsl:context-item</code></a> element appearing within the
+                              selected <a href="#element-template"><code>xsl:template</code></a> element. The initial named
+                              template is evaluated with a <a title="singleton focus" class="termref" href="#dt-singleton-focus">singleton focus</a> based on
+                              this context item if it exists, or with an <a title="absent" class="termref" href="#dt-absent">absent</a>
+                              focus otherwise.</span></p>
+                     </li>
+                     <li>
+                        <p>Parameters, which will be passed to the selected template
+                           rule. The parameters consist of two sets of (QName, value) pairs, one set
+                           for <a title="tunnel parameter" class="termref" href="#dt-tunnel-parameter">tunnel parameters</a> and one
+                           for non-tunnel parameters, in which the QName identifies the name of a
+                           parameter and the value provides the value of the parameter. Either or both
+                           sets of parameters may be empty. The effect is the same as when a template
+                           is invoked using <a href="#element-call-template"><code>xsl:call-template</code></a> with an
+                           <a href="#element-with-param"><code>xsl:with-param</code></a> child specifying
+                           <code>tunnel="yes"</code> or <code>tunnel="no"</code> as appropriate. If
+                           a parameter is supplied that is not declared or used, the value is simply
+                           ignored. These parameters are <em>not</em> used to set <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">stylesheet parameters</a>.
+                        </p>
+                        <p>A supplied value is converted if necessary to the declared
+                           type of the template parameter using the <a title="function conversion rules" class="termref" href="#dt-function-conversion-rules">function conversion rules</a>.
+                        </p>
+                     </li>
+                     <li>
+                        <p>Details of how the result of the initial named template is to be returned.
+                           For details, see <a href="#post-processing"><i>2.3.6 Post-processing the Raw Result</i></a></p>
+                     </li>
+                  </ul>
+                  <p>The <a title="raw result" class="termref" href="#dt-raw-result">raw result</a> of the invocation is the
+                     result of evaluating the <a title="initial named template" class="termref" href="#dt-initial-named-template">initial named template</a>, after
+                     conversion of the result to the type declared in the <code>as</code> attribute of
+                     that template using the <a title="function conversion rules" class="termref" href="#dt-function-conversion-rules">function conversion rules</a>, if such
+                     conversion is necessary.
+                  </p>
+                  <p>The <a title="initial named template" class="termref" href="#dt-initial-named-template">initial named template</a> is
+                     evaluated in <a title="final output state" class="termref" href="#dt-final-output-state">final output state</a>.
+                  </p>
+                  <p>
+                     <a id="err-XTDE0040"><span class="error">[ERR XTDE0040] </span></a>It is a <a title="dynamic error" class="termref" href="#dt-dynamic-error"> dynamic error</a> if the invocation of
+                     the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> specifies a template
+                     name that does not match the <a title="expanded QName" class="termref" href="#dt-expanded-qname">expanded
+                        QName</a> of a named template defined in the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>, <span>whose
+                        visibility is <code>public</code> or <code>final</code></span>.
+                     
+                  </p>
+                  <p> It is a <a title="dynamic error" class="termref" href="#dt-dynamic-error"> dynamic error</a>
+                     <span><span class="error">[see <a href="#err-XTDE0700">ERR XTDE0700</a>]</span></span> if the <a title="initial named template" class="termref" href="#dt-initial-named-template">initial named template</a>, or any of the template rules invoked to
+                     process items in the <a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a>, defines a
+                     <a title="template parameter" class="termref" href="#dt-template-parameter">template parameter</a> that
+                     specifies <code>required="yes"</code>
+                     <span>and no value is supplied for that parameter.</span>
+                     
+                  </p>
+               </div>
+               <div class="div3">
+                  
+                  <h4><a id="invoking-initial-function"></a>2.3.5 <a href="#invoking-initial-function" style="text-decoration: none">Function Call Invocation</a></h4>
+                  <p><span class="definition">[Definition: </span><a id="dt-initial-function" title="initial function"></a>A stylesheet may be evaluated by calling a named
+                     <a title="stylesheet function" class="termref" href="#dt-stylesheet-function">stylesheet function</a>, referred to as the <b>initial
+                        function</b>.<span class="definition">]</span> The following additional information is needed in
+                     this case:
+                  </p>
+                  <ul>
+                     <li>
+                        <p>The name and arity of a <a title="stylesheet function" class="termref" href="#dt-stylesheet-function">stylesheet function</a> which is to
+                           be executed as the entry point to the transformation.
+                        </p>
+                        <div class="note">
+                           <p class="prefix"><b>Note:</b></p>
+                           <p>In the design of a concrete API, the arity may be inferred from the
+                              length of the parameter list.
+                           </p>
+                        </div>
+                     </li>
+                     <li>
+                        <p>A list of values to act as parameters to the <a title="initial function" class="termref" href="#dt-initial-function">initial function</a>. The number of values in the list must be the
+                           same as the arity of the function.
+                        </p>
+                        <p>A supplied value is converted if necessary to the declared
+                           type of the function parameter using the <a title="function conversion rules" class="termref" href="#dt-function-conversion-rules">function conversion rules</a>.
+                        </p>
+                     </li>
+                     <li>
+                        <p>Details of how the result of the initial function is to be returned.
+                           For details, see <a href="#post-processing"><i>2.3.6 Post-processing the Raw Result</i></a></p>
+                     </li>
+                  </ul>
+                  <p>The <a title="raw result" class="termref" href="#dt-raw-result">raw result</a> of the invocation is the
+                     result of evaluating the <a title="initial function" class="termref" href="#dt-initial-function">initial function</a>, after conversion of
+                     the result to the type declared in the <code>as</code> attribute of that function
+                     using the <a title="function conversion rules" class="termref" href="#dt-function-conversion-rules">function conversion rules</a>, if such conversion is
+                     necessary.
+                  </p>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p> The <a title="initial function" class="termref" href="#dt-initial-function">initial function</a> (like all stylesheet functions) is
+                        evaluated with an <a title="absent" class="termref" href="#dt-absent">absent</a>
+                        <a title="focus" class="termref" href="#dt-focus">focus</a>.
+                     </p>
+                  </div>
+                  <p>If the <a title="initial function" class="termref" href="#dt-initial-function">initial function</a> is 
+                     <a title="declared-streamable" class="termref" href="#dt-declared-streamable">declared-streamable</a>, a streaming processor <span class="verb">should</span> 
+                     allow the value of the first argument to be supplied in streamable form, and if it
+                     is 
+                     supplied in this form, then it <span class="verb">must</span> be processed using streaming.
+                  </p>
+                  <p>
+                     <a id="err-XTDE0041"><span class="error">[ERR XTDE0041] </span></a>It is a <a title="dynamic error" class="termref" href="#dt-dynamic-error">dynamic error</a> if the invocation of the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> specifies a function name and
+                     arity that does not match the <a title="expanded QName" class="termref" href="#dt-expanded-qname">expanded
+                        QName</a> and arity of a named <a title="stylesheet function" class="termref" href="#dt-stylesheet-function">stylesheet function</a> defined in the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>, whose visibility is
+                     <code>public</code> or <code>final</code>.
+                     
+                  </p>
+                  <p>When a transformation is invoked by calling an <a title="initial function" class="termref" href="#dt-initial-function">initial function</a>, the entire transformation executes in <a title="temporary output state" class="termref" href="#dt-temporary-output-state">temporary output state</a>, which means that calls on
+                     <a href="#element-result-document"><code>xsl:result-document</code></a> are not permitted.
+                  </p>
+               </div>
+               <div class="div3">
+                  
+                  <h4><a id="post-processing"></a>2.3.6 <a href="#post-processing" style="text-decoration: none">Post-processing the Raw Result</a></h4>
+                  <p>There are three ways the result of a transformation
+                     may be delivered. (This applies both to the principal result, described here, and
+                     also to secondary results, generated using <a href="#element-result-document"><code>xsl:result-document</code></a>.)
+                  </p>
+                  <ol class="enumar">
+                     <li>
+                        <p>The <a title="raw result" class="termref" href="#dt-raw-result">raw result</a> (a sequence of values) may be returned
+                           directly to the calling application.
+                        </p>
+                     </li>
+                     <li>
+                        <p>A result tree may be constructed from the <a title="raw result" class="termref" href="#dt-raw-result">raw result</a>.
+                           By default, a result tree is constructed if the <code>build-tree</code>
+                           attribute of the unnamed <a title="output definition" class="termref" href="#dt-output-definition">output definition</a>
+                           has the effective value <code>yes</code>. An API for invoking transformations <span class="verb">may</span>
+                           allow this setting to be overridden by the calling application. If result tree construction
+                           is requested, it is performed as described in <a href="#result-tree-construction"><i>2.3.6.1 Result Tree Construction</i></a>.
+                           
+                        </p>
+                     </li>
+                     <li>
+                        <p>Alternatively, the <a title="raw result" class="termref" href="#dt-raw-result">raw result</a> may be serialized
+                           as described in <a href="#result-serialization"><i>2.3.6.2 Serializing the Result</i></a>. The decision whether or not to
+                           serialize the result is determined by the rules of transformation API provided by
+                           the
+                           <a title="processor" class="termref" href="#dt-processor">processor</a>, and is not influenced by anything in the stylesheet.
+                        </p>
+                     </li>
+                  </ol>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>This specification does not constrain the design of application programming
+                        interfaces or the choice of defaults. In previous versions of this
+                        specification, result tree construction was a mandatory process, while
+                        serialization was optional. When invoking stylesheet functions directly,
+                        however, result tree construction and serialization may be inappropriate as
+                        defaults. These considerations may affect the design of APIs.
+                     </p>
+                     <p>In previous versions of XSLT, results were delivered either
+                        in serialized form (as a character or byte stream), or as a tree. In the latter case
+                        processors
+                        typically would use either their own tree representation, or a standardized tree
+                        representation such as the W3C Document Object Model (DOM) (see <a href="#DOM-Level-2-Core">[DOM Level 2]</a>),
+                        adapted to the data structures offered by the programming language in which the API
+                        is defined.
+                        To deliver a raw result, processors need to define a representation not only of XDM
+                        nodes but
+                        also of sequences, atomic values, maps and even functions. As with the return of a
+                        simple tree, 
+                        this may involve a trade-off between strict fidelity to the XDM data model and usability
+                        in the particular 
+                        programming language environment. It is <em>not</em> a requirement that an API should return results 
+                        in a way that exposes every property of the XDM data model; for example there may
+                        be APIs that do not expose
+                        the precise type annotation of a returned node or atomic value, or that fail to expose
+                        the base URI
+                        or document URI of a node, or that provide no way of determining whether two nodes
+                        in the result
+                        sequence are the same node in the sense of the XPath <code>is</code> operator.
+                        The way in which maps and functions (and where XPath 3.1 is supported, arrays)
+                        are returned requires careful design choices. It is <span class="verb">recommended</span> that an API should be capable
+                        of returning any XDM value without error, and that there should be minimal loss of
+                        information if
+                        the raw results output by one transformation are subsequently used as input to another
+                        transformation.
+                     </p>
+                  </div>
+                  <div class="div4">
+                     
+                     <h5><a id="result-tree-construction"></a>2.3.6.1 <a href="#result-tree-construction" style="text-decoration: none">Result Tree Construction</a></h5>
+                     <p>If a result tree is to be constructed from the <a title="raw result" class="termref" href="#dt-raw-result">raw result</a>, then this is done
+                        by applying the rules for the process of <a href="https://www.w3.org/TR/xslt-xquery-serialization-30/#sequence-normalization">sequence normalization</a><sup><small>SER30</small></sup> as defined in 
+                        <a href="#xslt-xquery-serialization-30">[XSLT and XQuery Serialization]</a>. This process takes as input the serialization parameters defined in the
+                        unnamed <a title="output definition" class="termref" href="#dt-output-definition">output definition</a> of the <a title="top-level package" class="termref" href="#dt-top-level-package">top-level package</a>; though the only parameter
+                        that is actually used by this process is <code>item-separator</code>. In particular, sequence normalization is carried
+                        out regardless of any <code>method</code> attribute in the unnamed <a title="output definition" class="termref" href="#dt-output-definition">output definition</a>.
+                     </p>
+                     <p>The sequence normalization process either returns a document node, or raises
+                        a serialization error. The content of the document node is not necessarily well-formed
+                        (the document node may have any number
+                        of element or text nodes among its children).
+                     </p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>More specifically, the process raises a serialization error if any item in the <a title="raw result" class="termref" href="#dt-raw-result">raw result</a> is
+                           an attribute node, a namespace node, or a function (including a map, <span>but not an array: arrays are flattened</span>).
+                        </p>
+                     </div>
+                     <p>The tree that is constructed is referred to as a <a title="final result tree" class="termref" href="#dt-final-result-tree">final result tree</a>.
+                     </p>
+                     <p>If the <a title="raw result" class="termref" href="#dt-raw-result">raw result</a> is an empty sequence, the <a title="final result tree" class="termref" href="#dt-final-result-tree">final result tree</a> will consist
+                        of a document node with no children.
+                     </p>
+                     <p>The base URI of the document node is set to the <a title="base output URI" class="termref" href="#dt-base-output-uri">base output URI</a>.
+                     </p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>The <code>item-separator</code> property has no effect if the raw result of the transformation is a sequence
+                           of length zero or one, which in practice will often be the case, especially in a traditional
+                           scenario such as
+                           transformation of an XML document to HTML.
+                        </p>
+                        <p>If there is no <code>item-separator</code>, then a single space is inserted between adjacent atomic values;
+                           for example if the raw result is the sequence <code>1 to 5</code>, then sequence normalization produces a tree
+                           comprising a document node with a single child, the child being a text node with the
+                           string value 
+                           <code>1 2 3 4 5</code>.
+                        </p>
+                        <p>If there is an <code>item-separator</code>, then it is used not only between adjacent atomic values,
+                           but between any pair of items in the raw result. For example if the raw result is
+                           a sequence of two
+                           element nodes <code>A</code> and <code>B</code>, and the <code>item-separator</code> is a comma,
+                           then the result of sequence normalization will be a document node with three children:
+                           a copy of <code>A</code>,
+                           a text node whose string value is a single comma, and a copy of <code>B</code>.
+                        </p>
+                     </div>
+                  </div>
+                  <div class="div4">
+                     
+                     <h5><a id="result-serialization"></a>2.3.6.2 <a href="#result-serialization" style="text-decoration: none">Serializing the Result</a></h5>
+                     <p>See <a href="#parsing-and-serialization"><i>2.7 Parsing and Serialization</i></a>.
+                     </p>
+                     <p>The <a title="raw result" class="termref" href="#dt-raw-result">raw result</a>
+                        may optionally be serialized as described in <a href="#serialization"><i>26 Serialization</i></a>. The serialization is controlled by the serialization
+                        parameters defined in the unnamed <a title="output definition" class="termref" href="#dt-output-definition">output definition</a> of the
+                        <a title="top-level package" class="termref" href="#dt-top-level-package">top-level package</a>.
+                     </p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>The first phase of serialization, called <a href="https://www.w3.org/TR/xslt-xquery-serialization-30/#sequence-normalization">sequence normalization</a><sup><small>SER30</small></sup>,
+                           takes place for some output methods but not others. For example, if the <code>json</code> output method
+                           (defined in <a href="#xslt-xquery-serialization-31">[XSLT and XQuery Serialization 3.1]</a>) is selected, then the process of constructing
+                           a tree is bypassed.
+                        </p>
+                     </div>
+                     <p>The effect of serialization is to generate a sequence of octets, representing the
+                        serialized result
+                        in some character encoding. The processor’s API may define mechanisms enabling this
+                        sequence of octets
+                        to be written to persistent storage at some location. The default location is the
+                        location identified
+                        by the <a title="base output URI" class="termref" href="#dt-base-output-uri">base output URI</a>.
+                     </p>
+                     <p>In previous versions of this specification it was stated that
+                        when the <a title="raw result" class="termref" href="#dt-raw-result">raw result</a> of the initial template or function is an empty sequence,
+                        a result tree should be produced if and only if the transformation generates no secondary
+                        results
+                        (that is, if it does not invoke <a href="#element-result-document"><code>xsl:result-document</code></a>). This provision is most likely
+                        to have a noticeable effect if the transformation produces serialized results, and
+                        these results
+                        are written to persistent storage: the effect is then that a transformation producing
+                        an empty
+                        principal result will overwrite any existing content at the base output URI location
+                        if and only
+                        if the transformation produces no other output. Processor APIs offering backwards
+                        compatibility
+                        with earlier versions of XSLT must respect this behavior, but there is no requirement
+                        for new
+                        processor APIs to do so.
+                     </p>
+                     <p><span class="definition">[Definition: </span><a id="dt-base-output-uri" title="base output URI"></a> The <b>base output URI</b> is a URI to be used as the base URI when
+                        resolving a relative URI <span>reference</span> allocated
+                        to a <a title="final result tree" class="termref" href="#dt-final-result-tree">final result tree</a>. If the
+                        transformation generates more than one final result tree, then typically each
+                        one will be allocated a URI relative to this base URI.<span class="definition">]</span> The way in
+                        which a base output URI is established is <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a>. Each invocation of the stylesheet may supply
+                        a different base output URI. It is acceptable for the base output URI to be
+                        <a title="absent" class="termref" href="#dt-absent">absent</a>, provided no constructs (such as
+                        <a href="#element-result-document"><code>xsl:result-document</code></a>) are evaluated that depend on the value of
+                        the base output URI.
+                     </p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>It will often be convenient for the base output URI to be the same as the
+                           location to which the principal result document is serialized, but this
+                           relationship is not a necessary one.
+                        </p>
+                     </div>
+                  </div>
+               </div>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="executing-a-transformation"></a>2.4 <a href="#executing-a-transformation" style="text-decoration: none">Instructions</a></h3>
+               <p>The main executable components of a stylesheet are templates and functions. The body
+                  of
+                  a template or function is a <a title="sequence constructor" class="termref" href="#dt-sequence-constructor">sequence constructor</a>, which is a sequence of elements
+                  and text nodes that can be evaluated to produce a result.
+               </p>
+               <p>A <a title="sequence constructor" class="termref" href="#dt-sequence-constructor">sequence constructor</a> is a sequence of sibling nodes in the
+                  stylesheet, each of which is either an <a title="XSLT instruction" class="termref" href="#dt-xslt-instruction">XSLT
+                     instruction</a>, a <a title="literal result element" class="termref" href="#dt-literal-result-element">literal result
+                     element</a>, a text node, or an <a title="extension instruction" class="termref" href="#dt-extension-instruction">extension instruction</a>.
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-instruction" title="instruction"></a>An <b>instruction</b> is either
+                  an <a title="XSLT instruction" class="termref" href="#dt-xslt-instruction">XSLT instruction</a> or an <a title="extension instruction" class="termref" href="#dt-extension-instruction">extension instruction</a>.<span class="definition">]</span>
+                  
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-xslt-instruction" title="XSLT instruction"></a>An <b>XSLT
+                     instruction</b> is an <a title="XSLT element" class="termref" href="#dt-xslt-element">XSLT element</a>
+                  whose syntax summary in this specification contains the annotation <code>&lt;!--
+                     category: instruction --&gt;</code>.<span class="definition">]</span>
+                  
+               </p>
+               <p>
+                  <a title="extension instruction" class="termref" href="#dt-extension-instruction">Extension instructions</a> are
+                  described in <a href="#extension-instruction"><i>24.2 Extension Instructions</i></a>.
+               </p>
+               <p>The main categories of <a title="XSLT instruction" class="termref" href="#dt-xslt-instruction">XSLT instruction</a>
+                  are as follows:
+               </p>
+               <ul>
+                  <li>
+                     <p>instructions that create new nodes: <a href="#element-document"><code>xsl:document</code></a>,
+                        <a href="#element-element"><code>xsl:element</code></a>, <a href="#element-attribute"><code>xsl:attribute</code></a>,
+                        <a href="#element-processing-instruction"><code>xsl:processing-instruction</code></a>, <a href="#element-comment"><code>xsl:comment</code></a>,
+                        <a href="#element-value-of"><code>xsl:value-of</code></a>, <a href="#element-text"><code>xsl:text</code></a>,
+                        <a href="#element-namespace"><code>xsl:namespace</code></a>;
+                     </p>
+                  </li>
+                  <li>
+                     <p>instructions that copy nodes: <a href="#element-copy"><code>xsl:copy</code></a>,
+                        <a href="#element-copy-of"><code>xsl:copy-of</code></a>;
+                     </p>
+                  </li>
+                  <li>
+                     <p>an instruction that returns an arbitrary sequence by evaluating an XPath
+                        expression: <a href="#element-sequence"><code>xsl:sequence</code></a>;
+                     </p>
+                  </li>
+                  <li>
+                     <p>instructions that cause conditional or repeated evaluation of nested
+                        instructions: <a href="#element-if"><code>xsl:if</code></a>, <a href="#element-choose"><code>xsl:choose</code></a>, <span><a href="#element-try"><code>xsl:try</code></a>,</span>
+                        <a href="#element-for-each"><code>xsl:for-each</code></a>, <a href="#element-for-each-group"><code>xsl:for-each-group</code></a>, <span><a href="#element-fork"><code>xsl:fork</code></a>, <a href="#element-iterate"><code>xsl:iterate</code></a>
+                           and its subordinate instructions <a href="#element-next-iteration"><code>xsl:next-iteration</code></a> and
+                           <a href="#element-break"><code>xsl:break</code></a></span>;
+                     </p>
+                  </li>
+                  <li>
+                     <p>instructions that generate output conditionally if elements are or are not
+                        empty: <a href="#element-on-empty"><code>xsl:on-empty</code></a>, <a href="#element-on-non-empty"><code>xsl:on-non-empty</code></a>,
+                        <a href="#element-where-populated"><code>xsl:where-populated</code></a>;
+                     </p>
+                  </li>
+                  <li>
+                     <p>instructions that invoke templates: <a href="#element-apply-templates"><code>xsl:apply-templates</code></a>,
+                        <a href="#element-apply-imports"><code>xsl:apply-imports</code></a>, <a href="#element-call-template"><code>xsl:call-template</code></a>,
+                        <a href="#element-next-match"><code>xsl:next-match</code></a>;
+                     </p>
+                  </li>
+                  <li>
+                     <p>Instructions that declare variables: <a href="#element-variable"><code>xsl:variable</code></a>;
+                     </p>
+                  </li>
+                  <li>
+                     <p>Instructions to assist debugging: <a href="#element-message"><code>xsl:message</code></a>,
+                        <a href="#element-assert"><code>xsl:assert</code></a>;
+                     </p>
+                  </li>
+                  <li>
+                     <p>other specialized instructions: <a href="#element-number"><code>xsl:number</code></a>,
+                        <a href="#element-analyze-string"><code>xsl:analyze-string</code></a>, <span><a href="#element-fork"><code>xsl:fork</code></a>, </span>
+                        <a href="#element-result-document"><code>xsl:result-document</code></a>, <span><a href="#element-source-document"><code>xsl:source-document</code></a>, <a href="#element-perform-sort"><code>xsl:perform-sort</code></a>,
+                           <a href="#element-merge"><code>xsl:merge</code></a></span>.
+                     </p>
+                  </li>
+               </ul>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="rule-based-processing"></a>2.5 <a href="#rule-based-processing" style="text-decoration: none">Rule-Based Processing</a></h3>
+               <p>The classic method of executing an XSLT transformation is to apply
+                  template rules to the root node of an input document (see <a href="#invoking-initial-mode"><i>2.3.3 Apply-Templates Invocation</i></a>).
+                  The operation of applying templates to a node searches the stylesheet for the best
+                  matching template
+                  rule for that node. This template rule is then evaluated. A common coding pattern,
+                  especially when XSLT
+                  is used to convert XML documents into display formats such as HTML, is to have one
+                  template rule 
+                  for each kind of element in the source document, and for that template rule to generate
+                  some 
+                  appropriate markup elements, and to apply templates recursively to its own children.
+                  The effect is to 
+                  perform a recursive traversal of the source tree, in which each node is processed
+                  using the best-fit 
+                  template rule for that node. The final result of the transformation is then the tree
+                  produced by this 
+                  recursive process. This result can then be optionally serialized (see <a href="#post-processing"><i>2.3.6 Post-processing the Raw Result</i></a>). 
+                  
+               </p>
+               <div class="example">
+                  
+                  <div class="exampleHeader"><a id="rule-based-processing-example"></a>Example: Example of Rule-Based Processing
+                  </div>
+                  <p>This example uses rule-based processing to convert a simple XML input document into
+                     an HTML
+                     output document.
+                  </p>
+                  <p>The input document takes the form:</p>
+                  <div class="exampleInner"><pre class="spectrum"><span class="es">&lt;</span><span class="en">PERSONAE</span><span class="z"> </span><span class="atn">PLAY</span><span class="atneq">=</span><span class="z">"</span><span class="av">OTHELLO</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">TITLE</span><span class="scx">&gt;</span><span class="txt">Dramatis Personae</span><span class="ez">&lt;/</span><span class="cl">TITLE</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">DUKE OF VENICE</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">BRABANTIO, a senator.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">Other Senators.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">GRATIANO, brother to Brabantio.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">LODOVICO, kinsman to Brabantio.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">OTHELLO, a noble Moor in the service of the Venetian state.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">CASSIO, his lieutenant.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">IAGO, his ancient.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">RODERIGO, a Venetian gentleman.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">MONTANO, Othello's predecessor in the government of Cyprus.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">Clown, servant to Othello. </span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">DESDEMONA, daughter to Brabantio and wife to Othello.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">EMILIA, wife to Iago.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">BIANCA, mistress to Cassio.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">PERSONA</span><span class="scx">&gt;</span><span class="txt">Sailor, Messenger, Herald, Officers, 
+             Gentlemen, Musicians, and Attendants.</span><span class="ez">&lt;/</span><span class="cl">PERSONA</span><span class="ec">&gt;</span><span class="txt">
+  </span><span class="ez">&lt;/</span><span class="cl">PERSONAE</span><span class="ec">&gt;</span><span class="txt"></span></pre></div>
+                  <p>The stylesheet to render this as HTML can be written as a set of template rules:</p>
+                  <div class="exampleInner"><pre class="spectrum"><span class="es">&lt;</span><span class="enxsl">xsl:stylesheet</span><span class="z"> </span><span class="atn">xmlns:xsl</span><span class="atneq">=</span><span class="z">"</span><span class="av">http://www.w3.org/1999/XSL/Transform</span><span class="z">"</span><span class="z">
+    </span><span class="atn">version</span><span class="atneq">=</span><span class="z">"</span><span class="av">3.0</span><span class="z">"</span><span class="z">
+    </span><span class="atn">expand-text</span><span class="atneq">=</span><span class="z">"</span><span class="av">yes</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+    
+ </span><span class="es">&lt;</span><span class="enxsl">xsl:strip-space</span><span class="z"> </span><span class="atn">elements</span><span class="atneq">=</span><span class="z">"</span><span class="av">PERSONAE</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">   
+    
+ </span><span class="es">&lt;</span><span class="enxsl">xsl:template</span><span class="z"> </span><span class="atn">match</span><span class="atneq">=</span><span class="z">"</span><span class="qname">PERSONAE</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+   </span><span class="es">&lt;</span><span class="en">html</span><span class="scx">&gt;</span><span class="txt">
+     </span><span class="es">&lt;</span><span class="en">head</span><span class="scx">&gt;</span><span class="txt">
+       </span><span class="es">&lt;</span><span class="en">title</span><span class="scx">&gt;</span><span class="txt">The Cast of </span><span class="op">{</span><span class="axis">@</span><span class="qname">PLAY</span><span class="op">}</span><span class="ez">&lt;/</span><span class="cl">title</span><span class="ec">&gt;</span><span class="txt">
+     </span><span class="ez">&lt;/</span><span class="cl">head</span><span class="ec">&gt;</span><span class="txt">
+     </span><span class="es">&lt;</span><span class="en">body</span><span class="scx">&gt;</span><span class="txt">
+       </span><span class="es">&lt;</span><span class="enxsl">xsl:apply-templates</span><span class="sc">/&gt;</span><span class="txt">
+     </span><span class="ez">&lt;/</span><span class="cl">body</span><span class="ec">&gt;</span><span class="txt">
+   </span><span class="ez">&lt;/</span><span class="cl">html</span><span class="ec">&gt;</span><span class="txt">
+ </span><span class="ez">&lt;/</span><span class="clxsl">xsl:template</span><span class="ec">&gt;</span><span class="txt">
+ 
+ </span><span class="es">&lt;</span><span class="enxsl">xsl:template</span><span class="z"> </span><span class="atn">match</span><span class="atneq">=</span><span class="z">"</span><span class="qname">TITLE</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+   </span><span class="es">&lt;</span><span class="en">h1</span><span class="scx">&gt;</span><span class="op">{</span><span class="context">.</span><span class="op">}</span><span class="ez">&lt;/</span><span class="cl">h1</span><span class="ec">&gt;</span><span class="txt">
+ </span><span class="ez">&lt;/</span><span class="clxsl">xsl:template</span><span class="ec">&gt;</span><span class="txt">
+ 
+ </span><span class="es">&lt;</span><span class="enxsl">xsl:template</span><span class="z"> </span><span class="atn">match</span><span class="atneq">=</span><span class="z">"</span><span class="qname">PERSONA</span><span class="filter">[</span><span class="function">count</span><span class="parenthesis">(</span><span class="function">tokenize</span><span class="parenthesis">(</span><span class="context">.</span><span class="op">,</span><span class="whitespace"> </span><span class="op">'</span><span class="literal">,</span><span class="op">'</span><span class="parenthesis">)</span><span class="whitespace"> </span><span class="op">=</span><span class="whitespace"> </span><span class="numeric">2</span><span class="filter">]</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+   </span><span class="es">&lt;</span><span class="en">p</span><span class="scx">&gt;</span><span class="txt"></span><span class="es">&lt;</span><span class="en">b</span><span class="scx">&gt;</span><span class="op">{</span><span class="function">substring-before</span><span class="parenthesis">(</span><span class="context">.</span><span class="op">,</span><span class="whitespace"> </span><span class="op">'</span><span class="literal">,</span><span class="op">'</span><span class="parenthesis">)</span><span class="op">}</span><span class="ez">&lt;/</span><span class="cl">b</span><span class="ec">&gt;</span><span class="txt">: </span><span class="op">{</span><span class="function">substring-after</span><span class="parenthesis">(</span><span class="context">.</span><span class="op">,</span><span class="whitespace"> </span><span class="op">'</span><span class="literal">,</span><span class="op">'</span><span class="parenthesis">)</span><span class="op">}</span><span class="ez">&lt;/</span><span class="cl">p</span><span class="ec">&gt;</span><span class="txt">
+ </span><span class="ez">&lt;/</span><span class="clxsl">xsl:template</span><span class="ec">&gt;</span><span class="txt"> 
+
+ </span><span class="es">&lt;</span><span class="enxsl">xsl:template</span><span class="z"> </span><span class="atn">match</span><span class="atneq">=</span><span class="z">"</span><span class="qname">PERSONA</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+   </span><span class="es">&lt;</span><span class="en">p</span><span class="scx">&gt;</span><span class="txt"></span><span class="es">&lt;</span><span class="en">b</span><span class="scx">&gt;</span><span class="op">{</span><span class="context">.</span><span class="op">}</span><span class="ez">&lt;/</span><span class="cl">b</span><span class="ec">&gt;</span><span class="txt"></span><span class="ez">&lt;/</span><span class="cl">p</span><span class="ec">&gt;</span><span class="txt">
+ </span><span class="ez">&lt;/</span><span class="clxsl">xsl:template</span><span class="ec">&gt;</span><span class="txt">
+
+</span><span class="ez">&lt;/</span><span class="clxsl">xsl:stylesheet</span><span class="ec">&gt;</span><span class="txt"></span></pre></div>
+                  <p>There are four template rules here:</p>
+                  <ul>
+                     <li>
+                        <p>The first rule matches the outermost element, named <code>PERSONAE</code> (it could equally
+                           have used <code>match="/"</code> to match the document node). The effect of this rule is to create
+                           the skeleton of the output HTML page. Technically, the body of the template is a sequence
+                           constructor
+                           comprising a single <a title="literal result element" class="termref" href="#dt-literal-result-element">literal result element</a> (the <code>html</code> element); this
+                           in turn contains a sequence constructor comprising two literal result elements (the
+                           <code>head</code>
+                           and <code>body</code> elements). The <code>head</code> element is populated with a literal <code>title</code>
+                           element whose content is computed as a mixture of fixed and variable text using a
+                           <a title="text value template" class="termref" href="#dt-text-value-template">text value template</a>. 
+                           The <code>body</code> element is populated by evaluating an <a href="#element-apply-templates"><code>xsl:apply-templates</code></a>
+                           instruction.
+                        </p>
+                        <p>The effect of the <a href="#element-apply-templates"><code>xsl:apply-templates</code></a> instruction is to process the children of
+                           the <code>PERSONAE</code> element in the source tree: that is, the <code>TITLE</code> and
+                           <code>PERSONA</code> elements. (It would also process any whitespace text node children, but these
+                           have been stripped by virtue of the <a href="#element-strip-space"><code>xsl:strip-space</code></a> declaration.) Each of these
+                           child elements is processed by the best matching template rule for that element, which
+                           will be one 
+                           of the other three rules in the stylesheet.
+                        </p>
+                     </li>
+                     <li>
+                        <p>The template rule for the <code>TITLE</code> element outputs an <code>h1</code> element
+                           to the HTML result document, and populates this with the value of ".", the context
+                           item. That is,
+                           it copies the text content of the <code>TITLE</code> element to the output <code>h1</code> element.
+                        </p>
+                     </li>
+                     <li>
+                        <p>The last two rules match <code>PERSONA</code> element. The first rule matches <code>PERSONA</code>
+                           elements whose text content contains exactly one comma; the second rule matches all
+                           <code>PERSONA</code> elements,
+                           but it has lower priority than the first rule, so in practice it only applies to <code>PERSONA</code>
+                           elements that contain no comma or multiple commas.
+                        </p>
+                        <p>For both rules the body of the rule is a sequence constructor containing a single
+                           literal result element,
+                           the <code>p</code> element. These literal result elements contain
+                           further sequence constructors comprising literal result elements and text nodes. 
+                           In each of these examples the text nodes are in the form of a <a title="text value template" class="termref" href="#dt-text-value-template">text value template</a>:
+                           in general this is a combination of fixed text together with XPath expressions enclosed
+                           in curly braces, which 
+                           are evaluated to form the content of the containing literal result element. 
+                        </p>
+                     </li>
+                  </ul>
+               </div>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-template-rule" title="template rule"></a>A stylesheet contains a set of
+                  <b>template rules</b> (see <a href="#rules"><i>6 Template Rules</i></a>). A template rule has
+                  three parts: a <a title="pattern" class="termref" href="#dt-pattern">pattern</a> that is matched against
+                  selected items (often but not necessarily nodes), a (possibly empty) set of <a title="template parameter" class="termref" href="#dt-template-parameter">template
+                     parameters</a>, and a <a title="sequence constructor" class="termref" href="#dt-sequence-constructor">sequence
+                     constructor</a> that is evaluated to produce a sequence of
+                  items.<span class="definition">]</span> In many cases these items are newly constructed nodes, which are
+                  then written to a <a title="result tree" class="termref" href="#dt-result-tree">result tree</a>.
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="context"></a>2.6 <a href="#context" style="text-decoration: none">The Evaluation Context</a></h3>
+               <p>The results of some expressions and instructions in a stylesheet may depend on
+                  information provided contextually. This context information is divided into two
+                  categories: the static context, which is known during static analysis of the
+                  stylesheet, and the dynamic context, which is not known until the stylesheet is
+                  evaluated. Although information in the static context is known at analysis time, it
+                  is sometimes used during stylesheet evaluation.
+               </p>
+               <p>Some context information can be set by means of declarations within the stylesheet
+                  itself. For example, the namespace bindings used for any XPath expression are
+                  determined by the namespace declarations present in containing elements in the
+                  stylesheet. Other information may be supplied externally or implicitly: an example
+                  is
+                  the current date and time.
+               </p>
+               <p>The context information used in processing an XSLT stylesheet includes as a subset
+                  all the context information required when evaluating XPath expressions. The <span>XPath 3.0</span> specification defines a static and dynamic
+                  context that the host language (in this case, XSLT) may initialize, which affects
+                  the
+                  results of XPath expressions used in that context. XSLT augments the context with
+                  additional information: this additional information is used firstly by XSLT
+                  constructs outside the scope of XPath (for example, the <a href="#element-sort"><code>xsl:sort</code></a>
+                  element), and secondly, by functions that are defined in the XSLT specification (such
+                  as <a href="#func-key"><code>key</code></a> and <a href="#func-current-group"><code>current-group</code></a>) that are
+                  available for use in XPath expressions appearing within a stylesheet.
+               </p>
+               <p>The static context for an expression or other construct in a stylesheet is determined
+                  by the place in which it appears lexically. The details vary for different components
+                  of the static context, but in general, elements within a stylesheet module affect
+                  the
+                  static context for their descendant elements within the same stylesheet module.
+               </p>
+               <p>The dynamic context is maintained as a stack. When an instruction or expression is
+                  evaluated, it may add dynamic context information to the stack; when evaluation is
+                  complete, the dynamic context reverts to its previous state. An expression that
+                  accesses information from the dynamic context always uses the value at the top of
+                  the
+                  stack.
+               </p>
+               <p>The most commonly used component of the dynamic context is the <a title="context item" class="termref" href="#dt-context-item">context item</a>. This is an implicit variable whose
+                  value is the item currently being processed (it may be a node, an atomic value,
+                  <span>or a function item</span>). The value of the context
+                  item can be referenced within an XPath expression using the expression <code>.</code>
+                  (dot).
+               </p>
+               <p>Full details of the static and dynamic context are provided in <a href="#static-and-dynamic-context"><i>5.3 The Static and Dynamic Context</i></a>.
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="parsing-and-serialization"></a>2.7 <a href="#parsing-and-serialization" style="text-decoration: none">Parsing and Serialization</a></h3>
+               <p>An XSLT <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>
+                  describes a process that constructs a set of results from a set of inputs. The inputs
+                  are the data provided at stylesheet invocation, as described in <a href="#initiating"><i>2.3 Initiating a Transformation</i></a>. The results include the <a title="principal result" class="termref" href="#dt-principal-result">principal result</a>
+                  (an arbitrary sequence), which is the result of the initial component invocation,
+                  together with any <a title="secondary result" class="termref" href="#dt-secondary-result">secondary results</a>
+                  produced using <a href="#element-result-document"><code>xsl:result-document</code></a> instructions. 
+               </p>
+               <p>The <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> does not describe how a
+                  <a title="source tree" class="termref" href="#dt-source-tree">source tree</a> is constructed. Some possible
+                  ways of constructing source trees are described in <a href="#xpath-datamodel-30">[XDM 3.0]</a>. Frequently an <a title="implementation" class="termref" href="#dt-implementation">implementation</a> will
+                  operate in conjunction with an XML parser (or more strictly, in the terminology of
+                  <a href="#REC-xml">[XML 1.0]</a>, an <em>XML processor</em>), to build a source tree
+                  from an input XML document. An implementation <span class="verb">may</span> also provide an
+                  application programming interface allowing the tree to be constructed directly, or
+                  allowing it to be supplied in the form of a DOM Document object (see <a href="#DOM-Level-2-Core">[DOM Level 2]</a>). This is outside the scope of this specification. Users
+                  should be aware, however, that since the input to the transformation is a tree
+                  conforming to the XDM data model as described in <a href="#xpath-datamodel-30">[XDM 3.0]</a>,
+                  constructs that might exist in the original XML document, or in the DOM, but which
+                  are not within the scope of the data model, cannot be processed by the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> and cannot be guaranteed to remain
+                  unchanged in the transformation output. Such constructs include CDATA section
+                  boundaries, the use of entity references, and the DOCTYPE declaration and internal
+                  DTD subset.
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-serialization" title="serialization"></a>A frequent requirement is to
+                  output a <a title="final result tree" class="termref" href="#dt-final-result-tree">final result tree</a> as an XML
+                  document (or in other formats such as HTML). This process is referred to as
+                  <b>serialization</b>.<span class="definition">]</span>
+                  
+               </p>
+               <p>Like parsing, serialization is not part of the transformation process, and it is not
+                  <span class="verb">required</span> that an XSLT processor <span class="verb">must</span> be able
+                  to perform serialization. However, for pragmatic reasons, this specification
+                  describes declarations (the <a href="#element-output"><code>xsl:output</code></a> element and the
+                  <a href="#element-character-map"><code>xsl:character-map</code></a> declarations, see <a href="#serialization"><i>26 Serialization</i></a>), and attributes on the <a href="#element-result-document"><code>xsl:result-document</code></a> instruction, that
+                  allow a <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> to specify the desired
+                  properties of a serialized output file. When serialization is not being performed,
+                  either because the implementation does not support the serialization option, or
+                  because the user is executing the transformation in a way that does not invoke
+                  serialization, then the content of the <a href="#element-output"><code>xsl:output</code></a> and
+                  <a href="#element-character-map"><code>xsl:character-map</code></a> declarations has no effect. Under these
+                  circumstances the processor <span class="verb">may</span> report any errors in an
+                  <a href="#element-output"><code>xsl:output</code></a> or <a href="#element-character-map"><code>xsl:character-map</code></a> declaration, or
+                  in the serialization attributes of <a href="#element-result-document"><code>xsl:result-document</code></a>, but is not
+                  <span class="verb">required</span> to do so.
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="packages-and-modules"></a>2.8 <a href="#packages-and-modules" style="text-decoration: none">Packages and Modules</a></h3>
+               <p>In previous versions of the XSLT language, it has been possible to structure a
+                  stylesheet as a collection of modules, using the <a href="#element-include"><code>xsl:include</code></a> and
+                  <a href="#element-import"><code>xsl:import</code></a> declarations to express the dependency of one module on
+                  others.
+               </p>
+               <p>In XSLT 3.0 an additional layer of modularization of stylesheet code is enabled
+                  through the introduction of <a title="package" class="termref" href="#dt-package">packages</a>. A package
+                  is a collection of stylesheet modules with a controlled interface to the packages
+                  that use it: for example, it defines which functions and templates defined in the
+                  package are visible to callers, which are purely internal, and which are not only
+                  public but capable of being overridden by other functions and templates supplied by
+                  the using package.
+               </p>
+               <p>Packages are introduced with several motivations, which broadly divide into two
+                  categories:
+               </p>
+               <ol class="enumar">
+                  <li>
+                     <p>Software engineering benefits: greater re-use of code, greater robustness
+                        through ease of testing, controlled evolution of code in response to new
+                        requirements, ability to deliver code that users cannot see or modify.
+                     </p>
+                  </li>
+                  <li>
+                     <p>Efficiency benefits: the ability to avoid compiling libraries repeatedly when
+                        they are used in multiple stylesheets, and to avoid holding multiple copies of
+                        the same library in memory simultaneously.
+                     </p>
+                  </li>
+               </ol>
+               <p>Packages are designed to allow separate compilation: that is, a package can be
+                  compiled independently of the packages that use it. This specification does not
+                  define a process model for compilation, or expand on what it means to compile
+                  different packages independently. Nor does it mandate that implementations offer any
+                  feature along these lines. It merely defines language features that are designed to
+                  make separate compilation of packages possible.
+               </p>
+               <p>To achieve this, packages (unlike modules):</p>
+               <ul>
+                  <li>
+                     <p>Must not contain unresolved references to functions, templates, or variables
+                        declared in other packages;
+                     </p>
+                  </li>
+                  <li>
+                     <p>Have strict rules governing the ability to override declarations in a <a title="library package" class="termref" href="#dt-library-package">library package</a> with declarations in a
+                        package that uses the library;
+                     </p>
+                  </li>
+                  <li>
+                     <p>Constrain the visibility of component names and of context declarations such as
+                        the declarations of keys and decimal formats;
+                     </p>
+                  </li>
+                  <li>
+                     <p>Can declare a mode (a collection of template rules) as final, which disallows
+                        the addition of new overriding template rules in a using package;
+                     </p>
+                  </li>
+                  <li>
+                     <p>Require explicit disambiguation where naming conflicts arise, for example when
+                        a package uses two other packages that both export like-named components;
+                     </p>
+                  </li>
+                  <li>
+                     <p>Allow multiple specializations of library components to coexist in the same
+                        application.
+                     </p>
+                  </li>
+               </ul>
+               <p>A package is defined <span>in XSLT</span>
+                  by means of an XML document whose
+                  outermost element is an <a href="#element-package"><code>xsl:package</code></a> element. This is referred to as
+                  the <a title="package manifest" class="termref" href="#dt-package-manifest">package manifest</a>. The <a href="#element-package"><code>xsl:package</code></a> element
+                  has optional child elements <a href="#element-use-package"><code>xsl:use-package</code></a> and
+                  <a href="#element-expose"><code>xsl:expose</code></a> describing properties of the package. The package
+                  manifest may refer to an external top-level stylesheet module using an
+                  <a href="#element-include"><code>xsl:include</code></a> or <a href="#element-import"><code>xsl:import</code></a> declaration, or it may
+                  contain the body of a stylesheet module inline (the two approaches can also be
+                  mixed).
+               </p>
+               <p>Although this specification defines packages as constructs 
+                  written using a defined XSLT syntax, implementations <span class="verb">may</span> provide mechanisms that allow 
+                  packages to be written using other languages (for example, XQuery).
+               </p>
+               <p>When no packages are explicitly defined, the entire
+                  stylesheet is treated as a single package; the effect is as if the
+                  <a href="#element-stylesheet"><code>xsl:stylesheet</code></a> or <a href="#element-transform"><code>xsl:transform</code></a> element of the
+                  <a title="principal stylesheet module" class="termref" href="#dt-principal-stylesheet-module">principal stylesheet
+                     module</a> were replaced by an <a href="#element-package"><code>xsl:package</code></a> element with no
+                  other information in the package manifest.
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="extensibility"></a>2.9 <a href="#extensibility" style="text-decoration: none">Extensibility</a></h3>
+               <p>XSLT defines a number of features that allow the language to be extended by
+                  implementers, or, if implementers choose to provide the capability, by users. These
+                  features have been designed, so far as possible, so that they can be used without
+                  sacrificing interoperability. Extensions other than those explicitly defined in this
+                  specification are not permitted.
+               </p>
+               <p>These features are all based on XML namespaces; namespaces are used to ensure that
+                  the extensions provided by one implementer do not clash with those of a different
+                  implementer.
+               </p>
+               <p>The most common way of extending the language is by providing additional functions,
+                  which can be invoked from XPath expressions. These are known as <a title="extension function" class="termref" href="#dt-extension-function">extension functions</a>, and are described in
+                  <a href="#extension-functions"><i>24.1 Extension Functions</i></a>.
+               </p>
+               <p>It is also permissible to extend the language by providing new <a title="instruction" class="termref" href="#dt-instruction">instructions</a>. These are referred to as <a title="extension instruction" class="termref" href="#dt-extension-instruction">extension instructions</a>, and are described
+                  in <a href="#extension-instruction"><i>24.2 Extension Instructions</i></a>. A stylesheet that uses extension
+                  instructions in a particular namespace must declare that it is doing so by using the
+                  <code>[xsl:]extension-element-prefixes</code> attribute.
+               </p>
+               <p>Extension instructions and extension functions defined according to these rules
+                  <span class="verb">may</span> be provided by the implementer of the XSLT processor, and
+                  the implementer <span class="verb">may</span> also provide facilities to allow users to
+                  create further extension instructions and extension functions.
+               </p>
+               <p>This specification defines how extension instructions and extension functions are
+                  invoked, but the facilities for creating new extension instructions and extension
+                  functions are <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a>. For further details, see <a href="#extension"><i>24 Extensibility and Fallback</i></a>.
+               </p>
+               <p>The XSLT language can also be extended by the use of <a title="extension attribute" class="termref" href="#dt-extension-attribute">extension attributes</a> (see <a href="#extension-attributes"><i>3.2 Extension Attributes</i></a>), and by means of <a title="user-defined data element" class="termref" href="#dt-data-element">user-defined data elements</a> (see <a href="#user-defined-top-level"><i>3.7.3 User-defined Data Elements</i></a>).
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="stylesheets-and-schemas"></a>2.10 <a href="#stylesheets-and-schemas" style="text-decoration: none">Stylesheets and XML Schemas</a></h3>
+               <p>An XSLT <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> can make use of information
+                  from a schema. An XSLT transformation can take place in the absence of a schema (and,
+                  indeed, in the absence of a DTD), but where the source document has undergone schema
+                  validity assessment, the XSLT processor has access to the type information associated
+                  with individual nodes, not merely to the untyped text.
+               </p>
+               <p>Information from a schema can be used both statically (when the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> is compiled), and dynamically (during
+                  evaluation of the stylesheet to transform a source document).
+               </p>
+               <p>There are places within a <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>, and
+                  within XPath <a title="expression" class="termref" href="#dt-expression">expressions</a> and <a title="pattern" class="termref" href="#dt-pattern">patterns</a> in a <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>, where it is possible to refer to named type definitions in
+                  a schema, or to element and attribute declarations. For example, it is possible to
+                  declare the types expected for the parameters of a function. This is done using
+                  a <a title="SequenceType" class="termref" href="#dt-sequence-type">SequenceType</a>.
+               </p>
+               <p><span class="definition">[Definition: </span><a id="dt-sequence-type" title="SequenceType"></a>A <b>SequenceType</b>
+                  constrains the type and number of items in a sequence. The term is used both to denote
+                  the
+                  concept, and to refer to the syntactic form in which sequence types are expressed
+                  in the
+                  XPath grammar: specifically <a href="https://www.w3.org/TR/xpath-30/#prod-xpath30-SequenceType">SequenceType</a><sup><small>XP30</small></sup> in
+                  <a href="#xpath-30">[XPath 3.0]</a>, or <a href="https://www.w3.org/TR/xpath-31/#prod-xpath31-SequenceType">SequenceType</a><sup><small>XP31</small></sup> in
+                  <a href="#xpath-31">[XPath 3.1]</a>, depending on whether or not the <a title="XPath 3.1 Feature" class="termref" href="#dt-xpath31-feature">XPath 3.1 Feature</a>
+                  is implemented.<span class="definition">]</span></p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-schema-component" title="schema component"></a>Type definitions and
+                  element and attribute declarations are referred to collectively as <b>schema
+                     components</b>.<span class="definition">]</span>
+                  
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-in-scope-schema-component" title="in-scope schema component"></a>The
+                  <a title="schema component" class="termref" href="#dt-schema-component">schema components</a> that may be
+                  referenced by name in a <span><a title="package" class="termref" href="#dt-package">package</a></span> are referred to as the
+                  <b>in-scope schema components</b>.<span class="definition">]</span></p>
+               <p>The set of in-scope schema components may vary between
+                  one package and another, but as explained in <a href="#import-schema"><i>3.15 Importing Schema Components</i></a>, the
+                  schema components used in different packages must be consistent with each other.
+               </p>
+               <p>The conformance rules for XSLT <span>3.0</span>, defined in
+                  <a href="#conformance"><i>27 Conformance</i></a>, distinguish between a <a title="basic XSLT processor" class="termref" href="#dt-basic-xslt-processor">basic XSLT processor</a> and a <a title="schema-aware XSLT processor" class="termref" href="#dt-schema-aware-xslt-processor">schema-aware XSLT processor</a>. As the
+                  names suggest, a basic XSLT processor does not support the features of XSLT that
+                  require access to schema information, either statically or dynamically. A <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> that works with a basic XSLT processor
+                  will produce the same results with a schema-aware XSLT processor provided that the
+                  source documents are untyped (that is, they are not validated against a schema).
+                  However, if source documents are validated against a schema then the results may be
+                  different from the case where they are not validated. Some constructs that work on
+                  untyped data may fail with typed data (for example, an attribute of type
+                  <code>xs:date</code> cannot be used as an argument of the
+                  <a href="https://www.w3.org/TR/xpath-functions-30/#func-substring"><code>substring</code></a><sup><small>FO30</small></sup> function) and other constructs may produce
+                  different results depending on the datatype (for example, given the element
+                  <code>&lt;product price="10.00" discount="2.00"/&gt;</code>, the expression
+                  <code>@price gt @discount</code> will return true if the attributes have type
+                  <code>xs:decimal</code>, but will return false if they are untyped).
+               </p>
+               <p>There is a standard set of type definitions that are always available as <a title="in-scope schema component" class="termref" href="#dt-in-scope-schema-component">in-scope schema components</a> in every
+                  stylesheet. These are defined in <a href="#built-in-types"><i>3.14 Built-in Types</i></a>. 
+               </p>
+               <p>The remainder of this section describes facilities that are available only with a
+                  <a title="schema-aware XSLT processor" class="termref" href="#dt-schema-aware-xslt-processor">schema-aware XSLT
+                     processor</a>.
+               </p>
+               <p>Additional <a title="schema component" class="termref" href="#dt-schema-component">schema components</a> (type
+                  definitions, element declarations, and attribute declarations) may be added to the
+                  <a title="in-scope schema component" class="termref" href="#dt-in-scope-schema-component">in-scope schema components</a>
+                  by means of the <a href="#element-import-schema"><code>xsl:import-schema</code></a> declaration in a stylesheet.
+               </p>
+               <p>The <a href="#element-import-schema"><code>xsl:import-schema</code></a> declaration may reference an external schema
+                  document by means of a URI, or it may contain an inline <code>xs:schema</code>
+                  element.
+               </p>
+               <p>It is only necessary to import a schema explicitly if one or more of its <a title="schema component" class="termref" href="#dt-schema-component">schema components</a> are referenced explicitly by
+                  name in the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>; it is not necessary to
+                  import a schema merely because the stylesheet is used to process a source document
+                  that has been assessed against that schema. It is possible to make use of the
+                  information resulting from schema assessment (for example, the fact that a particular
+                  attribute holds a date) even if no schema has been imported by the stylesheet.
+               </p>
+               <p>Importing a schema does not of itself say anything about the type of the source
+                  document that the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> is expected to
+                  process. The imported type definitions can be used for temporary nodes or for nodes
+                  on a <a title="result tree" class="termref" href="#dt-result-tree">result tree</a> just as much as for nodes in
+                  source documents. It is possible to make assertions about the type of an input
+                  document by means of tests within the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>. For example:
+               </p>
+               <div class="example">
+                  
+                  <div class="exampleHeader"><a id="d7e3711"></a>Example: Asserting the Required Type of the Source Document
+                  </div>
+                  <div class="exampleInner"><pre class="spectrum"><span class="es">&lt;</span><span class="enxsl">xsl:mode</span><span class="z"> </span><span class="atn">typed</span><span class="atneq">=</span><span class="z">"</span><span class="av">lax</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+</span><span class="es">&lt;</span><span class="enxsl">xsl:global-context-item</span><span class="z"> </span><span class="atn">use</span><span class="atneq">=</span><span class="z">"</span><span class="qname">required</span><span class="z">"</span><span class="z">
+            </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">document-node(schema-element(my:invoice))</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt"></span></pre></div>
+                  <p>This example will cause the transformation to fail with an error message, unless
+                     the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a> is valid against the top-level element
+                     declaration <code>my:invoice</code>, and has been annotated as such.
+                  </p>
+                  <p>The setting <code>typed="lax"</code> further ensures that in any
+                     match pattern for a template rule in this mode, an element name that corresponds
+                     to the name of an element declaration in the schema is taken as referring to
+                     elements validated against that declaration: for example,
+                     <code>match="employee"</code> will only match a validated <code>employee</code>
+                     element. Selecting this option enables the XSLT processor to do more compile-time
+                     type-checking against the schema, for example it allows the processor to produce
+                     warning or error messages when path expressions contain misspelt element names, or
+                     confuse an element with an attribute.
+                  </p>
+               </div>
+               <p>It is also true that importing a schema does not of itself say
+                  anything about the structure of the result tree. It is possible to request validation
+                  of a result tree against the schema by using the <a href="#element-result-document"><code>xsl:result-document</code></a>
+                  instruction, for example:
+               </p>
+               <div class="example">
+                  
+                  <div class="exampleHeader"><a id="d7e3739"></a>Example: Requesting Validation of the Result Document
+                  </div>
+                  <div class="exampleInner"><pre class="spectrum"><span class="es">&lt;</span><span class="enxsl">xsl:template</span><span class="z"> </span><span class="atn">match</span><span class="atneq">=</span><span class="z">"</span><span class="step">/</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:result-document</span><span class="z"> </span><span class="atn">validation</span><span class="atneq">=</span><span class="z">"</span><span class="av">strict</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="en">xhtml:html</span><span class="scx">&gt;</span><span class="txt">
+      </span><span class="es">&lt;</span><span class="enxsl">xsl:apply-templates</span><span class="sc">/&gt;</span><span class="txt">
+    </span><span class="ez">&lt;/</span><span class="cl">xhtml:html</span><span class="ec">&gt;</span><span class="txt">
+  </span><span class="ez">&lt;/</span><span class="clxsl">xsl:result-document</span><span class="ec">&gt;</span><span class="txt">
+</span><span class="ez">&lt;/</span><span class="clxsl">xsl:template</span><span class="ec">&gt;</span><span class="txt">
+               </span></pre></div>
+                  <p>This example will cause the transformation to fail with an error message unless
+                     the document element of the result document is valid against the top-level element
+                     declaration <code>xhtml:html</code>.
+                  </p>
+               </div>
+               <p>It is possible that a source document may contain nodes whose <a title="type annotation" class="termref" href="#dt-type-annotation">type annotation</a> is not one of the types
+                  imported by the stylesheet. This creates a potential problem because in the case of
+                  an expression such as <code>data(.) instance of xs:integer</code> the system needs to
+                  know whether the type named in the type annotation of the context node is derived
+                  by
+                  restriction from the type <code>xs:integer</code>. This information is not explicitly
+                  available in an XDM tree, as defined in <a href="#xpath-datamodel-30">[XDM 3.0]</a>. The
+                  implementation may choose one of several strategies for dealing with this
+                  situation:
+               </p>
+               <ol class="enumar">
+                  <li>
+                     <p>The processor may signal a <a title="dynamic error" class="termref" href="#dt-dynamic-error"> dynamic error</a> if a source
+                        document is found to contain a <a title="type annotation" class="termref" href="#dt-type-annotation">type annotation</a> that is not
+                        known to the processor.
+                     </p>
+                  </li>
+                  <li>
+                     <p>The processor may maintain additional metadata, beyond that described in
+                        <a href="#xpath-datamodel-30">[XDM 3.0]</a>, that allows the source document to be
+                        processed as if all the necessary schema information had been imported using
+                        <a href="#element-import-schema"><code>xsl:import-schema</code></a>. Such metadata might be held in the data
+                        structure representing the source document itself, or it might be held in a
+                        system catalog or repository.
+                     </p>
+                  </li>
+                  <li>
+                     <p>The processor may be configured to use a fixed set of schemas, which are
+                        automatically used to validate all source documents before they can be supplied
+                        as input to a transformation. In this case it is impossible for a source
+                        document to have a <a title="type annotation" class="termref" href="#dt-type-annotation">type annotation</a> that the processor is
+                        not aware of.
+                     </p>
+                  </li>
+                  <li>
+                     <p>The processor may be configured to treat the source document as if no schema
+                        processing had been performed, that is, effectively to strip all type
+                        annotations from elements and attributes on input, marking them instead as
+                        having type <code>xs:untyped</code> and <code>xs:untypedAtomic</code>
+                        respectively.
+                     </p>
+                  </li>
+               </ol>
+               <p>Where a stylesheet author chooses to make assertions about the types of nodes or of
+                  <a title="variable" class="termref" href="#dt-variable">variables</a> and <a title="parameter" class="termref" href="#dt-parameter">parameters</a>, it is possible for an XSLT processor to perform static
+                  analysis of the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> (that is, analysis
+                  in the absence of any source document). Such analysis <span class="verb">may</span> reveal
+                  errors that would otherwise not be discovered until the transformation is actually
+                  executed. An XSLT processor is not <span class="verb">required</span> to perform such static
+                  type-checking. Under some circumstances (see <a href="#errors"><i>2.14 Error Handling</i></a>) type errors
+                  that are detected early <span class="verb">may</span> be reported as static errors. In
+                  addition an implementation <span class="verb">may</span> report any condition found during
+                  static analysis as a warning, provided that this does not prevent the stylesheet
+                  being evaluated as described by this specification.
+               </p>
+               <p>A <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> can also control the <a title="type annotation" class="termref" href="#dt-type-annotation">type annotations</a> of nodes that it constructs in
+                  a <span><a title="result tree" class="termref" href="#dt-result-tree">result
+                        tree</a></span>. This can be done in a number of ways.
+               </p>
+               <ul>
+                  <li>
+                     <p>It is possible to request explicit validation of a complete document, that is,
+                        a <span><a title="result tree" class="termref" href="#dt-result-tree">result
+                              tree</a></span> rooted at a document node.  Validation
+                        is either strict or lax, as described in <a href="#xmlschema-1">[XML Schema Part 1]</a>. If
+                        validation of a <a title="result tree" class="termref" href="#dt-result-tree">result tree</a> fails
+                        (strictly speaking, if the outcome of the validity assessment is
+                        <code>invalid</code>), then the transformation fails, but in all other
+                        cases, the element and attribute nodes of the tree will be annotated with the
+                        names of the types to which these nodes conform. These <a title="type annotation" class="termref" href="#dt-type-annotation">type annotations</a> will be discarded if the
+                        result tree is serialized as an XML document, but they remain available when
+                        the result tree is passed to an application (perhaps another <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>) for further processing.
+                     </p>
+                  </li>
+                  <li>
+                     <p>It is also possible to validate individual element and attribute nodes as they
+                        are constructed. This is done using the <code>type</code> and
+                        <code>validation</code> attributes of the <a href="#element-element"><code>xsl:element</code></a>,
+                        <a href="#element-attribute"><code>xsl:attribute</code></a>, <a href="#element-copy"><code>xsl:copy</code></a>, and
+                        <a href="#element-copy-of"><code>xsl:copy-of</code></a> instructions, or the <code>xsl:type</code> and
+                        <code>xsl:validation</code> attributes of a literal result element.
+                     </p>
+                  </li>
+                  <li>
+                     <p>When elements, attributes, or document nodes are copied, either explicitly
+                        using the <a href="#element-copy"><code>xsl:copy</code></a> or <a href="#element-copy-of"><code>xsl:copy-of</code></a>
+                        instructions, or implicitly when nodes in a sequence are attached to a new
+                        parent node, the options <code>validation="strip"</code> and
+                        <code>validation="preserve"</code> are available, to control whether
+                        existing <a title="type annotation" class="termref" href="#dt-type-annotation">type annotations</a> are to be
+                        retained or not.
+                     </p>
+                  </li>
+               </ul>
+               <p>When nodes in a <a title="temporary tree" class="termref" href="#dt-temporary-tree">temporary tree</a> are
+                  validated, type information is available for use by operations carried out on the
+                  temporary tree, in the same way as for a source document that has undergone schema
+                  assessment.
+               </p>
+               <p>For details of how validation of element and attribute nodes works, see <a href="#validation"><i>25.4 Validation</i></a>.
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="streaming-concepts"></a>2.11 <a href="#streaming-concepts" style="text-decoration: none">Streaming</a></h3>
+               <p><span class="definition">[Definition: </span><a id="dt-streaming" title="streaming"></a>The term <b>streaming</b> refers to
+                  a manner of processing in which XML documents (such as source and result documents)
+                  are not represented by a complete tree of nodes occupying memory proportional to
+                  document size, but instead are processed “on the fly” as a sequence of events,
+                  similar in concept to the stream of events notified by an XML parser to represent
+                  markup in lexical XML.<span class="definition">]</span></p>
+               <p><span class="definition">[Definition: </span><a id="dt-streamed-document" title="streamed document"></a>A <b>streamed
+                     document</b> is a <a title="source tree" class="termref" href="#dt-source-tree">source tree</a> that
+                  is processed using streaming, that is, without constructing a complete tree of
+                  nodes in memory.<span class="definition">]</span></p>
+               <p><span class="definition">[Definition: </span><a id="dt-streamed-node" title="streamed node"></a>A <b>streamed
+                     node</b> is a node in a <a title="streamed document" class="termref" href="#dt-streamed-document">streamed
+                     document</a>.<span class="definition">]</span></p>
+               <p>Many processors implementing earlier versions of this specification have adopted an
+                  architecture that allows streaming of the <a title="result tree" class="termref" href="#dt-result-tree">result
+                     tree</a> directly to a serializer, without first materializing the complete
+                  result tree in memory. Streaming of the <a title="source tree" class="termref" href="#dt-source-tree">source
+                     tree</a>, however, has proved to be more difficult without subsetting the
+                  language. This has created a situation where documents exceeding the capacity of
+                  virtual memory could not be transformed. XSLT 3.0 therefore introduces facilities
+                  allowing stylesheets to be written in a way that makes streaming of source documents
+                  possible, without excessive reliance on processor-specific optimization
+                  techniques.
+               </p>
+               <p>Streaming achieves two important objectives: it allows large documents to be
+                  transformed without requiring correspondingly large amounts of memory; and it allows
+                  the processor to start producing output before it has finished receiving its input,
+                  thus reducing latency.
+               </p>
+               <p>This specification does not attempt to legislate precisely which implementation
+                  techniques fall under the definition of streaming, and which do not. A number of
+                  techniques are available that reduce memory requirements, while still requiring a
+                  degree of buffering, or allocation of memory to partial results. A stylesheet that
+                  requests streaming of a source document is indicating that the processor should avoid
+                  assuming that the entire source document will fit in memory; in return, the
+                  stylesheet must be written in a way that makes streaming possible. This specification
+                  does not attempt to describe the algorithms that the processor should actually use,
+                  or to impose quantitative constraints on the resources that these algorithms should
+                  consume.
+               </p>
+               <p>Nothing in this specification, nor in its predecessors <a href="#xslt">[XSLT 1.0]</a> and
+                  <a href="#xslt20">[XSLT 2.0]</a>, prevents a processor using streaming whenever it sees an
+                  opportunity to do so. However, experience has shown that in order to achieve
+                  streaming, it is often necessary to write stylesheet code in such a way as to make
+                  this possible. Therefore, XSLT 3.0 provides explicit constructs allowing the
+                  stylesheet author to request streaming, and defines explicit static constraints on
+                  the structure of the code which are designed to make streaming possible.
+               </p>
+               <p>A processor that claims conformance with the streaming option offers a guarantee that
+                  when streaming is requested for a source document, and when the stylesheet conforms
+                  to the rules that make the processing <a title="guaranteed-streamable" class="termref" href="#dt-guaranteed-streamable">guaranteed-streamable</a>, then
+                  an algorithm will be adopted in which memory consumption is either completely
+                  independent of document size, or increases only very slowly as document size
+                  increases, allowing documents to be processed that are orders-of-magnitude larger
+                  than the physical memory available. A processor that does not claim conformance with
+                  the streaming option must still process a stylesheet and deliver the correct results,
+                  but is not required to use streaming algorithms, and may therefore fail with
+                  out-of-memory errors when presented with large source documents.
+               </p>
+               <p>Apart from the fact that there are constructs to request streaming, and rules that
+                  must be followed to guarantee that streaming is possible, the language has been
+                  designed so there are as few differences as possible between streaming and
+                  non-streaming evaluation. The semantics of the language continue to be expressed in
+                  terms of the XDM data model, which is substantively unchanged; but readers must take
+                  care to observe that when terms like “node” and “axis” are used, the concepts are
+                  completely abstract and may have no direct representation in the run-time execution
+                  environment.
+               </p>
+               <p>Streamed processing of a document can be initiated in one of <span>three</span> ways:
+               </p>
+               <ul>
+                  <li>
+                     <p>The <a title="initial mode" class="termref" href="#dt-initial-mode">initial mode</a> can be declared as a
+                        <a title="streamable mode" class="termref" href="#dt-streamable-mode">streamable mode</a>. In this case
+                        the <span><a title="initial match selection" class="termref" href="#dt-initial-match-selection">initial match selection</a> will generally be a document node (or
+                           sequence of document nodes),</span> supplied by the calling application in
+                        a form that allows streaming (that is, in some form other than a tree in
+                        memory; for example, as a reference to a push or pull XML parser primed to
+                        deliver a stream of events). <span>The type of
+                           these nodes can be constrained by using the attribute
+                           <code>on-no-match="fail"</code> on the <a title="initial mode" class="termref" href="#dt-initial-mode">initial mode</a>,
+                           and using this mode only for processing the top-level nodes.</span>
+                        
+                     </p>
+                  </li>
+                  <li>
+                     <p>Streamed processing of any document can be initiated using the
+                        <a href="#element-source-document"><code>xsl:source-document</code></a> instruction. This has an attribute  
+                        <code>href</code> whose value is the URI of a document to be processed,
+                        <span>and an attribute <code>streamable</code> that
+                           indicates whether it is to be processed</span> using
+                        streaming; the actual processing to be applied is defined by the
+                        instructions written as children of the <a href="#element-source-document"><code>xsl:source-document</code></a>
+                        instruction. 
+                     </p>
+                  </li>
+                  <li>
+                     <p>Streamed merging of a set of input documents can be initiated using the
+                        <a href="#element-merge"><code>xsl:merge</code></a> instruction.
+                     </p>
+                  </li>
+               </ul>
+               <p>The rules for streamability, which are defined in detail in <a href="#streamability"><i>19 Streamability</i></a>, impose two main constraints:
+               </p>
+               <ul>
+                  <li>
+                     <p>The only nodes reachable from the node that is currently being processed are
+                        its attributes and namespaces, its ancestors and their attributes and
+                        namespaces, and its descendants and their attributes and namespaces. The
+                        siblings of the node, and the siblings of its ancestors, are not reachable in
+                        the tree, and any attempt to use their values is a <a title="static error" class="termref" href="#dt-static-error">static error</a>. 
+                     </p>
+                  </li>
+                  <li>
+                     <p>When processing a given node in the tree, each descendant node can only be
+                        visited once. Essentially this allows two styles of processing: either visit
+                        each of the children once, and then process that child with the same
+                        restrictions applied; or process all the descendants in a single pass, in which
+                        case it is not possible while processing a descendant to make any further
+                        downward selection.
+                     </p>
+                  </li>
+               </ul>
+               <p>The second restriction, that only one visit to the children is
+                  allowed, means that XSLT code that was not designed with streaming in mind will often
+                  need to be rewritten to make it streamable. In many cases it is possible to do this
+                  using a technique sometimes called <em>windowing</em> or <em>burst-mode
+                     streaming</em> (note this is not quite the same meaning as
+                  <em>windowing</em> in XQuery 3.0). Many XML documents consist of a large
+                  number of elements, each of manageable size, representing transactions or business
+                  objects where each such element can be processed independently: in such cases, an
+                  effective design pattern is to write a streaming transformation that takes a snapshot
+                  of each element in turn, processing the snapshot using the full power of the XSLT
+                  language. Each snapshot is a tree built in memory and is therefore fully navigable.
+                  For details see the <a href="#func-snapshot"><code>snapshot</code></a> and <a href="#func-copy-of"><code>copy-of</code></a>
+                  functions.
+               </p>
+               <p>The new facility of <em>accumulators</em> allows applications
+                  complete control over how much information is retained (and by implication, how much
+                  memory is required) in the course of a pass over a <a title="streamed document" class="termref" href="#dt-streamed-document">streamed document</a>. An accumulator computes a value for every node in a
+                  streamed document: or more accurately, two values, one for the first visit to a node
+                  (before visiting its descendants), and a second value for the second visit to the
+                  node (after visiting the descendants). The computation is structured in such a way
+                  that the value for a given node can depend only on the value for the previous node
+                  in
+                  document order together with the data available when positioned at the current node
+                  (for example, the attribute values). Based on the well-established fold operation
+                  of
+                  functional programming languages, accumulators provide the convenience and economy
+                  of
+                  mutable variables while remaining within the constraints of a purely declarative
+                  processing model.
+               </p>
+               <p>When streaming is initiated, for example using the
+                  <a href="#element-source-document"><code>xsl:source-document</code></a> instruction, it is necessary to declare which
+                  accumulators are applicable to the streamed document.
+               </p>
+               <p>Streaming applications often fall into one of the following categories:</p>
+               <ul>
+                  <li>
+                     <p>Aggregation applications, where a single aggregation operation (perhaps
+                        <a href="https://www.w3.org/TR/xpath-functions-30/#func-count"><code>count</code></a><sup><small>FO30</small></sup>, <a href="https://www.w3.org/TR/xpath-functions-30/#func-sum"><code>sum</code></a><sup><small>FO30</small></sup>,
+                        <a href="https://www.w3.org/TR/xpath-functions-30/#func-exists"><code>exists</code></a><sup><small>FO30</small></sup>, or <a href="https://www.w3.org/TR/xpath-functions-30/#func-distinct-values"><code>distinct-values</code></a><sup><small>FO30</small></sup>) is
+                        applied to a set of elements selected from the streamed source document by
+                        means of a path expression.
+                     </p>
+                  </li>
+                  <li>
+                     <p>Record-at-a-time applications, where the source document consists of a long
+                        sequence of elements with similar structure (“records”), and each “record” is
+                        processed using the same logic, independently of any other “records”. This kind
+                        of processing is facilitated using the <a href="#func-snapshot"><code>snapshot</code></a> and
+                        <a href="#func-copy-of"><code>copy-of</code></a> function mentioned earlier.
+                     </p>
+                  </li>
+                  <li>
+                     <p>Grouping applications, where the output follows the structure of the input,
+                        except that an extra layer of hierarchy is added. For example, the input might
+                        be a flat series of banking transactions in date/time order, and the output
+                        might contain the same transactions grouped by date.
+                     </p>
+                  </li>
+                  <li>
+                     <p>Accumulator applications, which are the same as record-at-a-time applications,
+                        except that the processing of one “record” might depend on data encountered
+                        earlier in the document. A classic example is processing a sequence of banking
+                        transactions in which the input transaction contains a debit or credit amount,
+                        and the output adds a running total (the account balance). The
+                        <a href="#element-iterate"><code>xsl:iterate</code></a> instruction has been introduced to facilitate
+                        this style of processing.
+                     </p>
+                  </li>
+                  <li>
+                     <p>Isomorphic transformations, in which there is an ordered (often largely
+                        one-to-one) relationship between the nodes of the source tree and the nodes of
+                        the result tree: for example, transformations that involve only the renaming or
+                        selective deletion of nodes, or scalar manipulations of the values held in the
+                        leaf nodes. Such transformations are most conveniently expressed using
+                        recursive application of template rules. This is possible with a streamed input
+                        document only if all the template rules adhere to the constraints required for
+                        streamability. To enforce these rules, while still allowing unrestricted
+                        processing of other documents within the same transformation, all streaming
+                        evaluation must be carried out using a specific <a title="mode" class="termref" href="#dt-mode">mode</a>, which is declared to be a streaming mode by means of an
+                        <a href="#element-mode"><code>xsl:mode</code></a> declaration in the stylesheet.
+                     </p>
+                  </li>
+               </ul>
+               <p>There are important classes of application in which streaming is possible only if
+                  multiple streams can be processed in parallel. This specification therefore provides
+                  facilities:
+               </p>
+               <ol class="enumar">
+                  <li>
+                     <p>allowing multiple sorted input sequences to be merged into one sorted output
+                        sequence (the <a href="#element-merge"><code>xsl:merge</code></a> instruction)
+                     </p>
+                  </li>
+                  <li>
+                     <p>allowing multiple output sequences to be generated during a single pass of an
+                        input sequence (the <a href="#element-fork"><code>xsl:fork</code></a> instruction).
+                     </p>
+                  </li>
+               </ol>
+               <p>These facilities have been designed in such a way that they can readily be
+                  implemented using streaming, that is, without materializing the input or output
+                  sequences in memory.
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="streamed-validation"></a>2.12 <a href="#streamed-validation" style="text-decoration: none">Streamed Validation</a></h3>
+               <p>Streaming can be combined with schema-aware processing: that is, the streamed input
+                  to a transformation 
+                  can be subjected to on-the-fly validation, a process which typically accepts an input
+                  stream from the 
+                  XML parser and delivers an output stream (of type-annotated nodes) to the transformation
+                  processor. 
+                  The XSD specification is designed so that validation is, with one or two exceptions,
+                  a streamable process. 
+                  The exceptions include:
+                  
+               </p>
+               <ul>
+                  <li>
+                     <p>There may be a need to allocate memory to hold keys, in order to enforce uniqueness
+                        and 
+                        referential integrity constraints (<code>xs:unique</code>, <code>xs:key</code>, <code>xs:keyref</code>).
+                        
+                     </p>
+                  </li>
+                  <li>
+                     <p>In XSD 1.1, assertions can be defined by means of XPath expressions. These are not
+                        constrained 
+                        to be streamable; in the general case, any subtree of the document that is validated
+                        using an assertion 
+                        may need to be buffered in memory while the assertion is processed.
+                        
+                     </p>
+                  </li>
+               </ul>
+               <p>Applications that need to run in finite memory may therefore need to avoid these XSD
+                  features, 
+                  or to use them with care.
+                  
+               </p>
+               <p>XSD is designed so that the intended type of an element (the “governing type”) can
+                  be determined as soon 
+                  as the start tag of the element is encountered: the process of validation checks whether
+                  the content of 
+                  the element actually conforms to this type, and by the time the end tag is encountered,
+                  the process will 
+                  have established either that the element is valid against the governing type, or that
+                  it is invalid. 
+                  
+               </p>
+               <p>By default, dynamic errors occurring during streamed processing are fatal: they typically
+                  cause the 
+                  transformation to fail immediately. XSLT 3.0 introduces the ability to catch dynamic
+                  errors and recover 
+                  from them. Schema invalidity, however, is treated as a dynamic error of the instruction
+                  that 
+                  processes the entire input stream, so after a validation failure, no further processing
+                  of that input stream 
+                  is possible.
+                  
+               </p>
+               <p>In consequence, a streamed validator that is running in tandem with a streamed transformation
+                  
+                  can present the transformer with element nodes that carry a provisional type annotation
+                  representing 
+                  the type that the element will have if it turns out to be valid. As soon as a node
+                  is encountered that 
+                  violates this assumption, the validator should stop the flow of data to the transformer,
+                  so that the 
+                  transformer never sees invalid data. This allows the stylesheet code to be compiled
+                  with the assumption 
+                  of type-safety: at run-time, all nodes seen by the transformation will conform to
+                  their XSLT-declared types
+                  (for example, a type declared implicitly using <code>match="schema-element(invoice)"</code> on an 
+                  <a href="#element-template"><code>xsl:template</code></a> element).
+                  
+               </p>
+               <p>A streamed transformation that only accesses part of the input document (for example,
+                  a header
+                  at the start of a document) is not required to continue reading once the data it needs
+                  
+                  has been read. This means that XML well-formedness or validity errors occurring in
+                  the unread part 
+                  of the input stream may go undetected.
+                  
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="streaming-non-xml"></a>2.13 <a href="#streaming-non-xml" style="text-decoration: none">Streaming of non-XML data</a></h3>
+               <p>The facilities in this specification designed to enable large data sets to be processed
+                  in a streaming
+                  manner are oriented almost entirely to XML data. This does not mean that there is
+                  never a requirement
+                  to stream non-XML data, or that the Working Group has ignored this requirement; rather,
+                  the Working Group
+                  has concluded that for the most part, streaming of non-XML data can be achieved by
+                  implementations without
+                  the need for specific language features in XSLT.
+               </p>
+               <p>To make streamed processing of unparsed text files easier, the function <a href="https://www.w3.org/TR/xpath-functions-30/#func-unparsed-text-lines"><code>unparsed-text-lines</code></a><sup><small>FO30</small></sup>
+                  has been introduced. This is not only more convenient for stylesheet authors than
+                  reading the entire input
+                  using the <a href="https://www.w3.org/TR/xpath-functions-30/#func-unparsed-text"><code>unparsed-text</code></a><sup><small>FO30</small></sup> function and then tokenizing the result, it is also easier for implementations
+                  to optimize, allowing each line of text to be discarded from memory after it has been
+                  processed.
+               </p>
+               <p>For all functions that access external data, including <a href="#func-document"><code>document</code></a>, <a href="https://www.w3.org/TR/xpath-functions-30/#func-doc"><code>doc</code></a><sup><small>FO30</small></sup>,
+                  <a href="https://www.w3.org/TR/xpath-functions-30/#func-collection"><code>collection</code></a><sup><small>FO30</small></sup>, <a href="https://www.w3.org/TR/xpath-functions-30/#func-unparsed-text"><code>unparsed-text</code></a><sup><small>FO30</small></sup>, <a href="https://www.w3.org/TR/xpath-functions-30/#func-unparsed-text-lines"><code>unparsed-text-lines</code></a><sup><small>FO30</small></sup>,
+                  and (in XPath 3.1) <a href="https://www.w3.org/TR/xpath-functions-31/#func-json-doc"><code>json-doc</code></a><sup><small>FO31</small></sup>, the requirements on determinism can now
+                  be relaxed using <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a> configuration options. This is significant
+                  because it means that when a transformation reads the same external resource more
+                  than once, it becomes
+                  legitimate for the contents of the resource to be different on different invocations,
+                  and this eliminates
+                  the need for the processor to cache the contents of the resource in memory.
+               </p>
+               <p>In the XDM data model, every value is a sequence, and (as with most functional programming
+                  languages),
+                  processing of sequences of items is pervasive throughout the XSLT and XPath languages
+                  and their function
+                  library. Good performance of a functional programming language often depends on sequence-based
+                  operations
+                  being pipelined, and being evaluated in a lazy fashion (that is, many operations process
+                  items in a sequence
+                  one at a time, in order; and many operations can deliver a result without processing
+                  the entire sequence).
+                  The semantics of XSLT and XPath permit pipelined and lazy evaluation (for example,
+                  the error handling semantics
+                  are carefully written to ensure this), but they do not require it: the details are
+                  left to implementations.
+                  Pipelined processing of a sequence is not the same thing as streamed processing of
+                  a tree, and where the XSLT
+                  specification talks of operations being “guaranteed streamable”, this is always referring
+                  to processing of
+                  trees, not of sequences.
+               </p>
+               <p>The facilities for streaming of XML trees include operations such as <a href="#func-copy-of"><code>copy-of</code></a>
+                  and <a href="#func-snapshot"><code>snapshot</code></a> which are able to take a sequence of streamed nodes as input, 
+                  and produce a sequence of in-memory (unstreamed) nodes as output. It is also possible
+                  to generate
+                  a sequence of strings or other atomic values through the process of <a title="atomize" class="termref" href="#dt-atomization">atomization</a>.
+                  The actual memory usage of a streamed
+                  XSLT application may depend significantly on whether the processing of the resulting
+                  sequence of in-memory
+                  nodes or atomic values is pipelined or not. The specification, however, has nothing
+                  to say on this matter: 
+                  it is considered an area where implementers can exercise their discretion and ingenuity.
+               </p>
+               <p>Streaming of JSON input receives little attention in this specification. One can envisage
+                  an implementation
+                  of the <a href="#func-json-to-xml"><code>json-to-xml</code></a> function in which the XML delivered by the function consists of
+                  streamed nodes; but the Working Group has not researched the feasibility of such an
+                  implementation in any detail.
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="errors"></a>2.14 <a href="#errors" style="text-decoration: none">Error Handling</a></h3>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-static-error" title="static error"></a>An error that can be detected by
+                  examining a <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> before execution
+                  starts (that is, before the source document and values of stylesheet parameters
+                  are available) is referred to as a <b>static error</b>.<span class="definition">]</span>
+                  
+               </p>
+               <p>Generally, errors in the structure of the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>, or in the syntax of XPath <a title="expression" class="termref" href="#dt-expression">expressions</a> contained in the stylesheet, are classified as <a title="static error" class="termref" href="#dt-static-error">static errors</a>. Where this specification states
+                  that an element in the stylesheet <span class="verb">must</span> or <span class="verb">must
+                     not</span> appear in a certain position, or that it <span class="verb">must</span> or
+                  <span class="verb">must not</span> have a particular attribute, or that an attribute
+                  <span class="verb">must</span> or <span class="verb">must not</span> have a value satisfying
+                  specified conditions, then any contravention of this rule is a static error unless
+                  otherwise specified. 
+               </p>
+               <p>A processor <span class="verb">must</span> provide a mode of operation 
+                  that takes a (possibly erroneous) stylesheet <a title="package" class="termref" href="#dt-package">package</a> as 
+                  input and enables the user to determine whether or not that package contains any
+                  <a title="static error" class="termref" href="#dt-static-error">static errors</a>.
+                  
+               </p>
+               <div class="note">
+                  <p class="prefix"><b>Note:</b></p>
+                  <p>The manner in which static errors are reported, and the behavior when there are multiple
+                     static errors, are left as design choices for the implementer. It is <span class="verb">recommended</span> 
+                     that the error codes defined in this specification should be made available in any
+                     diagnostics.
+                     
+                  </p>
+               </div>
+               <p>A processor <span class="verb">may</span> also provide a mode of operation in which 
+                  <a title="static error" class="termref" href="#dt-static-error">static errors</a> in parts of the stylesheet that 
+                  are not evaluated can go unreported.
+                  
+               </p>
+               <div class="note">
+                  <p class="prefix"><b>Note:</b></p>
+                  <p>For example, when operating in this mode, a processor might report static errors 
+                     in a template rule only if the input document contains nodes that match that template
+                     rule. 
+                     Such a mode of operation can provide performance benefits when large and well-tested
+                     stylesheets 
+                     are used to process source documents that might only use a small part of the XML vocabulary
+                     
+                     that the stylesheet is designed to handle.
+                     
+                  </p>
+               </div>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-dynamic-error" title="dynamic error"></a>An error that is not 
+                  <span>capable of detection</span>
+                  until a source document is being transformed is referred to as a <b>dynamic
+                     error</b>.<span class="definition">]</span>
+                  
+               </p>
+               <p>When a <a title="dynamic error" class="termref" href="#dt-dynamic-error">dynamic error</a> occurs, and is not caught
+                  using <a href="#element-catch"><code>xsl:catch</code></a>, the <a title="processor" class="termref" href="#dt-processor">processor</a>
+                  <span class="verb">must</span> signal the error, and the transformation fails.
+               </p>
+               <p>Because different implementations may optimize execution of the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> in different ways, the detection of
+                  dynamic errors is to some degree <a title="implementation-dependent" class="termref" href="#dt-implementation-dependent">implementation-dependent</a>. In cases where an implementation is able to
+                  produce <span>a <a title="principal result" class="termref" href="#dt-principal-result">principal result</a> or
+                     <a title="secondary result" class="termref" href="#dt-secondary-result">secondary result</a></span>
+                  without evaluating a particular construct, the
+                  implementation is never <span class="verb">required</span> to evaluate that construct solely
+                  in order to determine whether doing so causes a dynamic error. For example, if a
+                  <a title="variable" class="termref" href="#dt-variable">variable</a> is declared but never referenced, an
+                  implementation <span class="verb">may</span> choose whether or not to evaluate the variable
+                  declaration, which means that if evaluating the variable declaration causes a dynamic
+                  error, some implementations will signal this error and others will not.
+               </p>
+               <p>There are some cases where this specification requires that a construct <span class="verb">must
+                     not</span> be evaluated: for example, the content of an <a href="#element-if"><code>xsl:if</code></a>
+                  instruction <span class="verb">must not</span> be evaluated if the test condition is false.
+                  This means that an implementation <span class="verb">must not</span> signal any dynamic
+                  errors that would arise if the construct were evaluated.
+               </p>
+               <p>An implementation <span class="verb">may</span> signal a <a title="dynamic error" class="termref" href="#dt-dynamic-error">dynamic error</a> before any source document is available, but only if it
+                  can determine that the error would be signaled for every possible source document
+                  and
+                  every possible set of parameter values. For example, some <a title="circularity" class="termref" href="#dt-circularity">circularity</a> errors fall into this category: see
+                  <a href="#circularity"><i>9.11 Circular Definitions</i></a>.
+               </p>
+               <p>There are also some <a title="dynamic error" class="termref" href="#dt-dynamic-error">dynamic
+                     errors</a> where the specification gives a processor license to signal the
+                  error during the analysis phase even if the construct might never be executed; an
+                  example is the use of an invalid QName as a literal argument to a function such as
+                  <a href="#func-key"><code>key</code></a>, or the use of an invalid regular expression in the
+                  <code>regex</code> attribute of the <a href="#element-analyze-string"><code>xsl:analyze-string</code></a>
+                  instruction.
+               </p>
+               <p>A <a title="dynamic error" class="termref" href="#dt-dynamic-error">dynamic error</a>
+                  <span>is also</span> signaled during the static
+                  analysis phase if the error occurs during evaluation of a <a title="static expression" class="termref" href="#dt-static-expression">static expression</a>.
+               </p>
+               <p>The XPath specification states (see <a href="https://www.w3.org/TR/xpath-30/#id-kinds-of-errors">Section 
+                     
+                     2.3.1 Kinds of Errors
+                     </a><sup><small>XP30</small></sup>)
+                  that if any expression (at any level) can be evaluated during the analysis phase
+                  (because all its explicit operands are known and it has no dependencies on the
+                  dynamic context), then any error in performing this evaluation <span class="verb">may</span>
+                  be reported as a static error. For XPath expressions used in an XSLT stylesheet,
+                  however, any such errors <span class="verb">must not</span> be reported as static errors in
+                  the stylesheet unless they would occur in every possible evaluation of that
+                  stylesheet; instead, they must be signaled as dynamic errors, and signaled only if
+                  the XPath expression is actually evaluated.
+               </p>
+               <div class="example">
+                  
+                  <div class="exampleHeader"><a id="d7e4541"></a>Example: Errors in Constant Subexpressions
+                  </div>
+                  <p>An XPath processor may report statically that the expression <code>1 div 0</code>
+                     fails with a “divide by zero” error. But suppose this XPath expression occurs in
+                     an XSLT construct such as:
+                  </p>
+                  <div class="exampleInner"><pre class="spectrum"><span class="es">&lt;</span><span class="enxsl">xsl:choose</span><span class="scx">&gt;</span><span class="txt">
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:when</span><span class="z"> </span><span class="atn">test</span><span class="atneq">=</span><span class="z">"</span><span class="function">system-property</span><span class="parenthesis">(</span><span class="op">'</span><span class="literal">xsl:version</span><span class="op">'</span><span class="parenthesis">)</span><span class="whitespace"> </span><span class="op">=</span><span class="whitespace"> </span><span class="op">'</span><span class="literal">1.0</span><span class="op">'</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:value-of</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="numeric">1</span><span class="whitespace"> </span><span class="op">div</span><span class="whitespace"> </span><span class="numeric">0</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+  </span><span class="ez">&lt;/</span><span class="clxsl">xsl:when</span><span class="ec">&gt;</span><span class="txt">
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:otherwise</span><span class="scx">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:value-of</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="function">xs:double</span><span class="parenthesis">(</span><span class="op">'</span><span class="literal">INF</span><span class="op">'</span><span class="parenthesis">)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+  </span><span class="ez">&lt;/</span><span class="clxsl">xsl:otherwise</span><span class="ec">&gt;</span><span class="txt">
+</span><span class="ez">&lt;/</span><span class="clxsl">xsl:choose</span><span class="ec">&gt;</span><span class="txt"></span></pre></div>
+                  <p>Then the XSLT processor must not report an error, because the relevant XPath
+                     construct appears in a context where it will never be executed by an XSLT 2.0
+                     <span>or 3.0</span> processor. (An XSLT 1.0 processor
+                     will execute this code successfully, returning positive infinity, because it uses
+                     double arithmetic rather than decimal arithmetic.)
+                  </p>
+               </div>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-type-error" title="type error"></a>Certain errors are classified as
+                  <b>type errors</b>. A type error occurs when the value supplied as input
+                  to an operation is of the wrong type for that operation, for example when an
+                  integer is supplied to an operation that expects a node.<span class="definition">]</span> If a type error
+                  occurs in an instruction that is actually evaluated, then it <span class="verb">must</span>
+                  be signaled in the same way as a <a title="dynamic error" class="termref" href="#dt-dynamic-error"> dynamic error</a>. Alternatively, an
+                  implementation <span class="verb">may</span> signal a type error during the analysis phase
+                  in the same way as a <a title="static error" class="termref" href="#dt-static-error">static error</a>, even if
+                  it occurs in part of the stylesheet that is never evaluated, provided it can
+                  establish that execution of a particular construct would never succeed.
+               </p>
+               <p>It is <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a> whether type errors are signaled
+                  statically.
+               </p>
+               <div class="example">
+                  
+                  <div class="exampleHeader"><a id="d7e4586"></a>Example: A Type Error
+                  </div>
+                  <p>The following construct contains a type error, because
+                     <code>42</code> is not allowed as the value of the <code>select</code>
+                     expression of the <a href="#element-number"><code>xsl:number</code></a> instruction (it must be a node). An
+                     implementation <span class="verb">may</span> optionally signal this as a static error,
+                     even though the offending instruction will never be evaluated, and the type error
+                     would therefore never be signaled as a dynamic error.
+                  </p>
+                  <div class="exampleInner"><pre class="spectrum"><span class="es">&lt;</span><span class="enxsl">xsl:if</span><span class="z"> </span><span class="atn">test</span><span class="atneq">=</span><span class="z">"</span><span class="function">false</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:number</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="numeric">42</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+</span><span class="ez">&lt;/</span><span class="clxsl">xsl:if</span><span class="ec">&gt;</span><span class="txt"></span></pre></div>
+                  <p>On the other hand, in the following example it is not possible to determine
+                     statically whether the operand of <span><a href="#element-number"><code>xsl:number</code></a></span> will have a suitable dynamic type. An
+                     implementation <span class="verb">may</span> produce a warning in such cases, but it
+                     <span class="verb">must not</span> treat it as an error.
+                  </p>
+                  <div class="exampleInner"><pre class="spectrum"><span class="es">&lt;</span><span class="enxsl">xsl:template</span><span class="z"> </span><span class="atn">match</span><span class="atneq">=</span><span class="z">"</span><span class="qname">para</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:param</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="pname">p</span><span class="z">"</span><span class="z"> </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">item()</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:number</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="variable">$p</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+</span><span class="ez">&lt;/</span><span class="clxsl">xsl:template</span><span class="ec">&gt;</span><span class="txt"></span></pre></div>
+               </div>
+               <p>If more than one error arises, an implementation is not <span class="verb">required</span>
+                  to signal any errors other than the first one that it detects. It is <a title="implementation-dependent" class="termref" href="#dt-implementation-dependent">implementation-dependent</a> which of the
+                  several errors is signaled. This applies both to static errors and to dynamic errors.
+                  An implementation is allowed to signal more than one error, but if any errors have
+                  been signaled, it <span class="verb">must not</span> finish as if the transformation were
+                  successful.
+               </p>
+               <p>When a transformation signals one or more dynamic errors, the final state of any
+                  persistent resources updated by the transformation is <a title="implementation-dependent" class="termref" href="#dt-implementation-dependent">implementation-dependent</a>.
+                  Implementations are not <span class="verb">required</span> to restore such resources to
+                  their initial state. In particular, where a transformation produces multiple result
+                  documents, it is possible that one or more serialized result documents
+                  <span class="verb">may</span> be written successfully before the transformation
+                  terminates, but the application cannot rely on this behavior.
+               </p>
+               <p>Everything said above about error handling applies equally to errors in evaluating
+                  XSLT instructions, and errors in evaluating XPath <a title="expression" class="termref" href="#dt-expression">expressions</a>. Static errors and dynamic errors may occur in both
+                  cases.
+               </p>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-serialization-error" title="serialization error"></a>If a transformation
+                  has successfully produced a <span><a title="principal result" class="termref" href="#dt-principal-result">principal result</a> or <a title="secondary result" class="termref" href="#dt-secondary-result">secondary result</a>, it is
+                     still possible that errors may occur in serializing that result</span>
+                  . For example, it may be impossible to
+                  serialize the result  using the
+                  encoding selected by the user. Such an error is referred to as a
+                  <b>serialization error</b>.<span class="definition">]</span> If the processor performs
+                  serialization, then it <span class="verb">must</span> do so as specified in <a href="#serialization"><i>26 Serialization</i></a>, and in particular it <span class="verb">must</span> signal any
+                  serialization errors that occur.
+               </p>
+               <p>Errors are identified by a QName. For errors defined in this specification, the
+                  namespace of the QName is always <code>http://www.w3.org/2005/xqt-errors</code> (and
+                  is therefore not given explicitly), while the local part is an 8-character code in
+                  the form <var>PPSSNNNN</var>. Here <var>PP</var> is always <code>XT</code> (meaning
+                  XSLT), and <var>SS</var> is one of <code>SE</code> (static error), <code>DE</code>
+                  (dynamic error),  or <code>TE</code>
+                  (type error). Note that the allocation of an error to one of these categories is
+                  purely for convenience and carries no normative implications about the way the error
+                  is handled. Many errors, for example, can be reported either dynamically or
+                  statically. These error codes are used to label error conditions in this
+                  specification, and are summarized in <a href="#error-summary"><i>E Summary of Error Conditions</i></a>. 
+               </p>
+               <p>Errors defined in related specifications (<a href="#xpath-30">[XPath 3.0]</a>, <a href="#xpath-functions-30">[Functions and Operators 3.0]</a>
+                  <a href="#xslt-xquery-serialization-30">[XSLT and XQuery Serialization]</a>) use QNames with a similar structure, in
+                  the same namespace. When errors occur in processing XPath expressions, an XSLT
+                  processor <span class="verb">should</span> use the original error code reported by the XPath
+                  processor, unless a more specific XSLT error code is available.
+               </p>
+               <p><span>Implementations <span class="verb">must</span> use the codes
+                     defined in these specifications when signaling <span>dynamic</span> errors, to ensure that
+                     <a href="#element-catch"><code>xsl:catch</code></a> behaves in an interoperable way across
+                     implementations. Stylesheet authors should note, however, that there are many
+                     examples of errors where more than one rule in this specification is violated, and
+                     where the processor therefore has discretion in deciding which error code to
+                     associate with the condition: there is therefore no guarantee that different
+                     processors will always use the same error code for the same erroneous
+                     input.</span></p>
+               <p>Additional errors defined by an implementation (or by an application)
+                  <span class="verb">may</span> use QNames in an implementation-defined (or user-defined)
+                  namespace without risk of collision.
+               </p>
+            </div>
+         </div>
+         <div class="div1">
+            
+            <h2><a id="stylesheet-structure"></a>3 <a href="#stylesheet-structure" style="text-decoration: none">Stylesheet Structure</a></h2>
+            <p>This section describes the overall structure of a stylesheet as a collection of XML
+               documents.
+            </p>
+            <div class="div2">
+               
+               <h3><a id="xslt-namespace"></a>3.1 <a href="#xslt-namespace" style="text-decoration: none">XSLT Namespace</a></h3>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-xslt-namespace" title="XSLT namespace"></a>The <b>XSLT namespace</b>
+                  has the URI <code>http://www.w3.org/1999/XSL/Transform</code>. It is used to
+                  identify elements, attributes, and other names that have a special meaning defined
+                  in this specification.<span class="definition">]</span>
+                  
+               </p>
+               <div class="note">
+                  <p class="prefix"><b>Note:</b></p>
+                  <p>The <code>1999</code> in the URI indicates the year in which the URI was allocated
+                     by the W3C. It does not indicate the version of XSLT being used, which is
+                     specified by attributes (see <a href="#stylesheet-element"><i>3.7 Stylesheet Element</i></a> and <a href="#simplified-stylesheet"><i>3.8 Simplified Stylesheet Modules</i></a>).
+                  </p>
+               </div>
+               <p>XSLT <a title="processor" class="termref" href="#dt-processor">processors</a>
+                  <span class="verb">must</span> use the XML namespaces mechanism <a href="#xml-names">[Namespaces in XML]</a> to
+                  recognize elements and attributes from this namespace. Elements from the XSLT
+                  namespace are recognized only in the <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a> and not in the source document. The complete list of
+                  XSLT-defined elements is specified in <a href="#element-syntax-summary"><i>D Element Syntax Summary</i></a>.
+                  <a title="implementation" class="termref" href="#dt-implementation">Implementations</a>
+                  <span class="verb">must not</span> extend the XSLT namespace with additional elements or
+                  attributes. Instead, any extension <span class="verb">must</span> be in a separate
+                  namespace. Any namespace that is used for additional instruction elements
+                  <span class="verb">must</span> be identified by means of the <a title="extension instruction" class="termref" href="#dt-extension-instruction">extension instruction</a> mechanism specified
+                  in <a href="#extension-instruction"><i>24.2 Extension Instructions</i></a>.
+               </p>
+               <p>This specification uses a prefix of <code>xsl:</code> for referring to elements in
+                  the XSLT namespace. However, XSLT stylesheets are free to use any prefix, provided
+                  that there is a namespace declaration that binds the prefix to the URI of the XSLT
+                  namespace.
+               </p>
+               <div class="note">
+                  <p class="prefix"><b>Note:</b></p>
+                  <p>Throughout this specification, an element or attribute that is in no namespace, or
+                     an <a title="expanded QName" class="termref" href="#dt-expanded-qname">expanded QName</a> whose namespace part
+                     is an empty sequence, is referred to as having a <b>null namespace
+                        URI</b>.
+                  </p>
+               </div>
+               <div class="note">
+                  <p class="prefix"><b>Note:</b></p>
+                  <p>By convention, the names of <a title="XSLT element" class="termref" href="#dt-xslt-element">XSLT
+                        elements</a>, attributes and functions are all lower-case;
+                     they use hyphens to separate words, and they use abbreviations only if these already
+                     appear
+                     in the syntax of a related language such as XML or HTML. Names of types defined in
+                     XML Schema are regarded as single words and are capitalized exactly as in XML
+                     Schema. This sometimes leads to composite function names such as
+                     <a href="https://www.w3.org/TR/xpath-functions-30/#func-current-dateTime"><code>current-dateTime</code></a><sup><small>FO30</small></sup>.
+                  </p>
+               </div>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="extension-attributes"></a>3.2 <a href="#extension-attributes" style="text-decoration: none">Extension Attributes</a></h3>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-extension-attribute" title="extension attribute"></a>An element from the
+                  XSLT namespace may have any attribute not from the XSLT namespace, provided that
+                  the <a title="expanded QName" class="termref" href="#dt-expanded-qname">expanded QName</a> (see <a href="#xpath-30">[XPath 3.0]</a>) of the attribute has a non-null namespace URI. These
+                  attributes are referred to as <b>extension attributes</b>.<span class="definition">]</span> The
+                  presence of an extension attribute <span class="verb">must not</span> cause the <span><a title="principal result" class="termref" href="#dt-principal-result">principal result</a> or any <a title="secondary result" class="termref" href="#dt-secondary-result">secondary result</a> of the transformation to be different from the
+                     results</span>
+                  that a conformant XSLT <span>3.0</span>
+                  processor might produce. They <span class="verb">must not</span> cause the processor to fail
+                  to signal an error that a conformant processor is required to signal. This means that
+                  an extension attribute <span class="verb">must not</span> change the effect of any <a title="instruction" class="termref" href="#dt-instruction">instruction</a> except to the extent that the effect is
+                  <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a> or
+                  <a title="implementation-dependent" class="termref" href="#dt-implementation-dependent">implementation-dependent</a>.
+               </p>
+               <p>Furthermore, if serialization is performed using one of the serialization methods
+                  described in <a href="#xslt-xquery-serialization-30">[XSLT and XQuery Serialization]</a>, 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.
+               </p>
+               <div class="note">
+                  <p class="prefix"><b>Note:</b></p>
+                  <p>
+                     <a title="extension attribute" class="termref" href="#dt-extension-attribute">Extension attributes</a> may be used
+                     to modify the behavior of <a title="extension function" class="termref" href="#dt-extension-function">extension
+                        functions</a> and <a title="extension instruction" class="termref" href="#dt-extension-instruction">extension
+                        instructions</a>. They may be used to select processing options in cases
+                     where the specification leaves the behavior <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a> or <a title="implementation-dependent" class="termref" href="#dt-implementation-dependent">implementation-dependent</a>. They may
+                     also be used for optimization hints, for diagnostics, or for documentation.
+                  </p>
+                  <p>
+                     <a title="extension attribute" class="termref" href="#dt-extension-attribute">Extension attributes</a> may also be
+                     used to influence the behavior of the serialization methods <code>xml</code>,
+                     <code>xhtml</code>, <code>html</code>, or <code>text</code>, to the extent that
+                     the behavior of the serialization method is <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a> or <a title="implementation-dependent" class="termref" href="#dt-implementation-dependent">implementation-dependent</a>. For example, an extension attribute might
+                     be used to define the amount of indentation to be used when
+                     <code>indent="yes"</code> is specified. If a serialization method other than
+                     one of these four is requested (using a prefixed 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.
+                  </p>
+                  <p>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.
+                  </p>
+                  <p>The namespace used for an extension attribute will be copied to the <a title="result tree" class="termref" href="#dt-result-tree">result tree</a> in the normal way if it is in scope
+                     for a <a title="literal result element" class="termref" href="#dt-literal-result-element">literal result element</a>.
+                     This can be prevented using the <code>[xsl:]exclude-result-prefixes</code>
+                     attribute.
+                  </p>
+               </div>
+               <div class="example">
+                  
+                  <div class="exampleHeader"><a id="d7e4961"></a>Example: An Extension Attribute for <code>xsl:message</code>
+                     
+                  </div>
+                  <p>The following code might be used to indicate to a particular implementation that
+                     the <a href="#element-message"><code>xsl:message</code></a> instruction is to ask the user for confirmation
+                     before continuing with the transformation:
+                  </p>
+                  <div class="exampleInner"><pre class="spectrum"><span class="es">&lt;</span><span class="enxsl">xsl:message</span><span class="z"> </span><span class="atn">abc:pause</span><span class="atneq">=</span><span class="z">"</span><span class="av">yes</span><span class="z">"</span><span class="z">
+    </span><span class="atn">xmlns:abc</span><span class="atneq">=</span><span class="z">"</span><span class="av">http://vendor.example.com/xslt/extensions</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+       Phase 1 complete
+</span><span class="ez">&lt;/</span><span class="clxsl">xsl:message</span><span class="ec">&gt;</span><span class="txt">
+</span></pre></div>
+                  <p>Implementations that do not recognize the namespace
+                     <code>http://vendor.example.com/xslt/extensions</code> will simply ignore the
+                     extra attribute, and evaluate the <a href="#element-message"><code>xsl:message</code></a> instruction in the
+                     normal way.
+                  </p>
+               </div>
+               <p>
+                  <a id="err-XTSE0090"><span class="error">[ERR XTSE0090] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> 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.
+                  
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="xslt-media-type"></a>3.3 <a href="#xslt-media-type" style="text-decoration: none">XSLT Media Type</a></h3>
+               <p>The media type <code>application/xslt+xml</code>
+                  <span>has been</span> registered for XSLT stylesheet
+                  modules.
+               </p>
+               <p>The definition of the media type is at <a href="#XSLT-Mime-Type">[XSLT Media Type]</a>.
+               </p>
+               <p>This media type <span class="verb">should</span> be used for an XML document containing a
+                  <a title="standard stylesheet module" class="termref" href="#dt-standard-stylesheet-module">standard stylesheet module</a>
+                  at its top level, and it <span class="verb">may</span> also be used for a <a title="simplified stylesheet" class="termref" href="#dt-simplified-stylesheet-module">simplified stylesheet module</a>. It
+                  <span class="verb">should not</span> be used for an XML document containing an <a title="embedded stylesheet module" class="termref" href="#dt-embedded-stylesheet-module">embedded stylesheet module</a>.
+               </p>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="standard-attributes"></a>3.4 <a href="#standard-attributes" style="text-decoration: none">Standard Attributes</a></h3>
+               <p>
+                  <span class="definition">[Definition: </span><a id="dt-standard-attributes" title="standard attributes"></a>There are a number of
+                  <b>standard attributes</b> that may appear on any <a title="XSLT element" class="termref" href="#dt-xslt-element">XSLT element</a>: specifically
+                  <code>default-collation</code>, <code>default-mode</code>,
+                  <code>default-validation</code>,
+                  <code>exclude-result-prefixes</code>, <span><code>expand-text</code>, </span><code>extension-element-prefixes</code>,
+                  <code>use-when</code>, <code>version</code>, and
+                  <code>xpath-default-namespace</code>.<span class="definition">]</span>
+                  
+               </p>
+               <p>These attributes may also appear on a <a title="literal result element" class="termref" href="#dt-literal-result-element">literal result element</a>, but in this case, to distinguish them from
+                  user-defined attributes, the names of the attributes are in the <a title="XSLT namespace" class="termref" href="#dt-xslt-namespace">XSLT namespace</a>. They are thus typically written
+                  as <code>xsl:default-collation</code>, <code>xsl:default-mode</code>, <code>xsl:default-validation</code>,
+                  <code>xsl:exclude-result-prefixes</code>, <span><code>xsl:expand-text</code>, </span>
+                  <code>xsl:extension-element-prefixes</code>, <code>xsl:use-when</code>,
+                  <code>xsl:version</code>, or <code>xsl:xpath-default-namespace</code>.
+               </p>
+               <p>It is <span class="verb">recommended</span> that all these attributes should also be
+                  permitted on <a title="extension instruction" class="termref" href="#dt-extension-instruction">extension
+                     instructions</a>, but this is at the discretion of the implementer of each
+                  extension instruction. They <span class="verb">may</span> also be permitted on <a title="user-defined data element" class="termref" href="#dt-data-element">user-defined data elements</a>, though they will only
+                  have any useful effect in the case of data elements that are designed to behave like
+                  XSLT declarations or instructions.
+               </p>
+               <p>In the following descriptions, these attributes are referred to generically as
+                  <code>[xsl:]version</code>, and so on.
+               </p>
+               <p>These attributes all affect the element they appear on, together with any elements
+                  and attributes that have that element as an ancestor. The two forms with and without
+                  the XSLT namespace have the same effect; the XSLT namespace is used for the attribute
+                  if and only if its parent element is <em>not</em> in the XSLT namespace.
+               </p>
+               <p>In the case of <code>[xsl:]default-collation</code>, <span><code>[xsl:]expand-text</code>, </span>
+                  <code>[xsl:]version</code>, and <code>[xsl:]xpath-default-namespace</code>, the value
+                  can be overridden by a different value for the same attribute appearing on a
+                  descendant element. The effective value of the attribute for a particular stylesheet
+                  element is determined by the innermost ancestor-or-self element on which the
+                  attribute appears.
+               </p>
+               <p>In an <a title="embedded stylesheet module" class="termref" href="#dt-embedded-stylesheet-module">embedded stylesheet
+                     module</a>, <a title="standard attributes" class="termref" href="#dt-standard-attributes">standard
+                     attributes</a> appearing on ancestors of the outermost element of the
+                  stylesheet module have no effect.
+               </p>
+               <p>In the case of <code>[xsl:]exclude-result-prefixes</code> and
+                  <code>[xsl:]extension-element-prefixes</code> the values are cumulative. For these
+                  attributes, the value is given as a whitespace-separated list of namespace prefixes,
+                  and the effective value for an element is the combined set of namespace URIs
+                  designated by the prefixes that appear in this attribute for that element and any
+                  of
+                  its ancestor elements. Again, the two forms with and without the XSLT namespace are
+                  equivalent.
+               </p>
+               <p>The effect of the <code>[xsl:]use-when</code> attribute is described in <a href="#conditional-inclusion"><i>3.13.1 Conditional Element Inclusion</i></a>.
+               </p>
+               <p>Because these attributes may appear on any <a title="XSLT element" class="termref" href="#dt-xslt-element">XSLT
+                     element</a>, they are not listed in the syntax summary of each individual
+                  element. Instead they are listed and described in the entry for the
+                  <a href="#element-stylesheet"><code>xsl:stylesheet</code></a>, <a href="#element-transform"><code>xsl:transform</code></a>, <span>and <a href="#element-package"><code>xsl:package</code></a></span> elements only. This
+                  reflects the fact that these attributes are often used on the <span>outermost element of the stylesheet</span>, in which case they apply to
+                  the entire <a title="stylesheet module" class="termref" href="#dt-stylesheet-module">stylesheet module</a>
+                  <span>or <a title="package manifest" class="termref" href="#dt-package-manifest">package manifest</a></span>.
+               </p>
+               <p>Note that the effect of these attributes does <em>not</em> extend to <a title="stylesheet module" class="termref" href="#dt-stylesheet-module">stylesheet modules</a> referenced by
+                  <a href="#element-include"><code>xsl:include</code></a> or <a href="#element-import"><code>xsl:import</code></a> declarations, <span>nor to packages referenced using
+                     <a href="#element-use-package"><code>xsl:use-package</code></a></span>.
+               </p>
+               <p>For the detailed effect of each attribute, see the following sections:</p>
+               <dl>
+                  <dt class="label">
+                     <code>[xsl:]default-collation</code>
+                     
+                  </dt>
+                  <dd>
+                     <p>see <a href="#default-collation-attribute"><i>3.7.1 The default-collation Attribute</i></a>
+                        
+                     </p>
+                  </dd>
+                  <dt class="label">
+                     <code>[xsl:]default-mode</code>
+                     
+                  </dt>
+                  <dd>
+                     <p>see <a href="#default-mode"><i>3.7.2 The default-mode Attribute</i></a>
+                        
+                     </p>
+                  </dd>
+                  <dt class="label">
+                     <code>[xsl:]default-validation</code>
+                     
+                  </dt>
+                  <dd>
+                     <p>see <a href="#validation"><i>25.4 Validation</i></a>
+                        
+                     </p>
+                  </dd>
+                  <dt class="label">
+                     <code>[xsl:]exclude-result-prefixes</code>
+                     
+                  </dt>
+                  <dd>
+                     <p>see <a href="#lre-namespaces"><i>11.1.3 Namespace Nodes for Literal Result Elements</i></a>
+                        
+                     </p>
+                  </dd>
+                  <dt class="label">
+                     <code>[xsl:]expand-text</code>
+                     
+                  </dt>
+                  <dd>
+                     <p>see <a href="#text-value-templates"><i>5.6.2 Text Value Templates</i></a>
+                        
+                     </p>
+                  </dd>
+                  <dt class="label">
+                     <code>[xsl:]extension-element-prefixes</code>
+                     
+                  </dt>
+                  <dd>
+                     <p>see <a href="#extension-instruction"><i>24.2 Extension Instructions</i></a>
+                        
+                     </p>
+                  </dd>
+                  <dt class="label">
+                     <code>[xsl:]use-when</code>
+                     
+                  </dt>
+                  <dd>
+                     <p>see <a href="#conditional-inclusion"><i>3.13.1 Conditional Element Inclusion</i></a>
+                        
+                     </p>
+                  </dd>
+                  <dt class="label">
+                     <code>[xsl:]version</code>
+                     
+                  </dt>
+                  <dd>
+                     <p>see <a href="#backwards"><i>3.9 Backwards Compatible Processing</i></a> and <a href="#forwards"><i>3.10 Forwards Compatible Processing</i></a>
+                        
+                     </p>
+                  </dd>
+                  <dt class="label">
+                     <code>[xsl:]xpath-default-namespace</code>
+                     
+                  </dt>
+                  <dd>
+                     <p>see <a href="#unprefixed-qnames"><i>5.1.2 Unprefixed Lexical QNames in Expressions and Patterns</i></a>
+                        
+                     </p>
+                  </dd>
+               </dl>
+            </div>
+            <div class="div2">
+               
+               <h3><a id="packages"></a>3.5 <a href="#packages" style="text-decoration: none">Packages</a></h3>
+               <p><span class="definition">[Definition: </span><a id="dt-package" title="package"></a>An explicit <b>package</b> is
+                  represented by an <a href="#element-package"><code>xsl:package</code></a> element, which will generally be
+                  the outermost element of an XML document. <span>When the
+                     <a href="#element-package"><code>xsl:package</code></a> element is not used explicitly, the entire
+                     stylesheet comprises a single implicit package.</span><span class="definition">]</span> (This
+                  specification does not preclude the <a href="#element-package"><code>xsl:package</code></a> being embedded in
+                  another XML document, but it will never have any other XSLT element as an
+                  ancestor).
+               </p>
+               <p class="element-syntax"><a id="element-package"></a><code>&lt;xsl:package<br />  id? = <var>id</var><br />  name? = <var>uri</var><br />  package-version? = <var>string</var><br />  <b>version</b> = <var>decimal</var><br />  input-type-annotations? = "preserve" | "strip" | "unspecified"<br />  declared-modes? = <var>boolean</var><br />  default-mode? = <var>eqname</var> | "#unnamed"<br />  default-validation? = "preserve" | "strip"<br />  default-collation? = <var>uris</var><br />  extension-element-prefixes? = <var>prefixes</var><br />  exclude-result-prefixes? = <var>prefixes</var><br />  expand-text? = <var>boolean</var><br />  use-when? = <var>expression</var><br />  xpath-default-namespace? = <var>uri</var> &gt;<br />  &lt;!-- Content: ((<a href="#element-expose">xsl:expose</a> | <var>declarations</var>)*) --&gt;<br />&lt;/xsl:package&gt;</code></p>
+               <p><span class="definition">[Definition: </span><a id="dt-package-manifest" title="package manifest"></a>The content of the
+                  <a href="#element-package"><code>xsl:package</code></a> element is referred to as the <b>package
+                     manifest</b><span class="definition">]</span>.
+               </p>
+               <p>The <span><code>version</code></span> attribute indicates the
+                  version of the XSLT language specification to which the package manifest conforms.
+                  <span>The value <span class="verb">should</span> normally be
+                     <code>3.0</code>. If the value is numerically less than <code>3.0</code>, the
+                     content of the <a href="#element-package"><code>xsl:package</code></a> element is processed using the rules
+                     for <a title="backwards compatible behavior" class="termref" href="#dt-backwards-compatible-behavior">backwards compatible
+                        behavior</a> (see <a href="#backwards"><i>3.9 Backwards Compatible Processing</i></a>). If the value is
+                     numerically greater than <code>3.0</code>, it is processed using the rules for
+                     <a title="forwards compatible behavior" class="termref" href="#dt-forwards-compatible-behavior">forwards compatible behavior</a> (see <a href="#forwards"><i>3.10 Forwards Compatible Processing</i></a>).</span></p>
+               <p>A package typically has a name, given in its <code>name</code>
+                  attribute, which <span class="verb">must</span> be an absolute URI. Unnamed packages are
+                  allowed, but they can only be used as the “top level” of an application; they cannot
+                  be the target of an <a href="#element-use-package"><code>xsl:use-package</code></a> declaration in another
+                  package.
+               </p>
+               <p><span>A package may have</span> a version identifier, given in
+                  its <code>package-version</code> attribute. This is used to distinguish different
+                  versions of a package. <span>The value of the version
+                     attribute, after trimming leading and trailing whitespace, <span class="verb">must</span>
+                     conform to the syntax given in <a href="#package-versions"><i>3.5.1 Versions of a Package</i></a>. If no version
+                     number is specified for a package, version <code>1</code> is assumed.</span></p>
+               <p>The attributes <code>default-collation</code>, <code>default-mode</code>, <code>default-validation</code>,
+                  <code>exclude-result-prefixes</code>, <code>expand-text</code>,
+                  <code>extension-element-prefixes</code>, <code>use-when</code>,
+                  <code>version</code>, and <code>xpath-default-namespace</code> are standard
+                  attributes that can appear on any XSLT element, and potentially affect all descendant
+                  elements. Their meaning is described in <a href="#standard-attributes"><i>3.4 Standard Attributes</i></a>.
+               </p>
+               <p>The package manifest <span>contains the following
+                     elements, arbitrarily ordered</span>:
+               </p>
+               <ol class="enumar">
+                  <li>
+                     <p>Zero or more <a href="#element-expose"><code>xsl:expose</code></a> declarations that define the interface
+                        offered by this package to the outside world. An <a href="#element-expose"><code>xsl:expose</code></a>
+                        declaration may appear only as a child of <a href="#element-package"><code>xsl:package</code></a>.
+                     </p>
+                  </li>
+                  <li>
+                     <p>Zero or more additional <a title="declaration" class="termref" href="#dt-declaration">declarations</a>.
+                        These are the same as the declarations permitted as children of <a href="#element-stylesheet"><code>xsl:stylesheet</code></a>
+                        or <a href="#element-transform"><code>xsl:transform</code></a>.
+                     </p>
+                     <p>Some declarations of particular relevance to packages include:</p>
+                     <ol class="enumla">
+                        <li>
+                           <p>The <a href="#element-use-package"><code>xsl:use-package</code></a> declaration, which declares the names and
+                              versions of the packages on which this package is dependant.
+                           </p>
+                        </li>
+                        <li>
+                           <p>The optional <a href="#element-global-context-item"><code>xsl:global-context-item</code></a> element; if present this
+                              element defines constraints on the existence and type of the <a title="global context item" class="termref" href="#dt-global-context-item">global context item</a>.
+                           </p>
+                        </li>
+                        <li>
+                           <p>Zero or more <a href="#element-include"><code>xsl:include</code></a> and <a href="#element-import"><code>xsl:import</code></a>
+                              declarations, which define additional stylesheet modules to be incorporated into this
+                              package.
+                           </p>
+                        </li>
+                        <li>
+                           <p>Zero or more ordinary <a title="declaration" class="termref" href="#dt-declaration">declarations</a>, that is,
+                              elements that are permitted as children of <a href="#element-stylesheet"><code>xsl:stylesheet</code></a> or
+                              <a href="#element-transform"><code>xsl:transform</code></a>. One possible coding style is to include in
+                              the package manifest just a single <a href="#element-import"><code>xsl:import</code></a> or
+                              <a href="#element-include"><code>xsl:include</code></a> declaration as a reference to the effective
+                              top-level stylesheet module; this approach is particularly suitable when
+                              writing code that is required to run under earlier releases of XSLT as well as
+                              under XSLT 3.0. Another approach is to include the substance of the top-level
+                              stylesheet module inline within the package manifest.
+                           </p>
+                        </li>
+                     </ol>
+                  </li>
+               </ol>
+               <div class="example">
+                  
+                  <div class="exampleHeader"><a id="d7e5557"></a>Example: An example package
+                  </div>
+                  <p>The following example shows a package that offers a number of functions for
+                     manipulating complex numbers. A complex number is represented as a map with two
+                     entries, the keys being 0 for the real part, and 1 for the imaginary part.
+                  </p>
+                  <div class="exampleInner"><pre class="spectrum"><span class="es">&lt;</span><span class="enxsl">xsl:package</span><span class="z">
+  </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="av">http://example.org/complex-arithmetic.xsl</span><span class="z">"</span><span class="z">
+  </span><span class="atn">package-version</span><span class="atneq">=</span><span class="z">"</span><span class="av">1.0</span><span class="z">"</span><span class="z">
+  </span><span class="atn">version</span><span class="atneq">=</span><span class="z">"</span><span class="av">3.0</span><span class="z">"</span><span class="z">
+  </span><span class="atn">xmlns:xsl</span><span class="atneq">=</span><span class="z">"</span><span class="av">http://www.w3.org/1999/XSL/Transform</span><span class="z">"</span><span class="z">
+  </span><span class="atn">xmlns:xs</span><span class="atneq">=</span><span class="z">"</span><span class="av">http://www.w3.org/2001/XMLSchema</span><span class="z">"</span><span class="z">
+  </span><span class="atn">xmlns:f</span><span class="atneq">=</span><span class="z">"</span><span class="av">http://example.org/complex-arithmetic.xsl</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+  
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:function</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="fname">f:complex-number</span><span class="z">"</span><span class="z"> 
+                </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">map(xs:integer, xs:double)</span><span class="z">"</span><span class="z"> </span><span class="atn">visibility</span><span class="atneq">=</span><span class="z">"</span><span class="av">public</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:param</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="pname">real</span><span class="z">"</span><span class="z"> </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">xs:double</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:param</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="pname">imaginary</span><span class="z">"</span><span class="z"> </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">xs:double</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:sequence</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="qname">map</span><span class="op">{</span><span class="whitespace"> </span><span class="numeric">0</span><span class="op">:</span><span class="variable">$real</span><span class="op">,</span><span class="whitespace"> </span><span class="numeric">1</span><span class="op">:</span><span class="variable">$imaginary</span><span class="whitespace"> </span><span class="op">}</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+  </span><span class="ez">&lt;/</span><span class="clxsl">xsl:function</span><span class="ec">&gt;</span><span class="txt">
+  
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:function</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="fname">f:real</span><span class="z">"</span><span class="z"> 
+                </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">xs:double</span><span class="z">"</span><span class="z"> </span><span class="atn">visibility</span><span class="atneq">=</span><span class="z">"</span><span class="av">public</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:param</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="pname">complex</span><span class="z">"</span><span class="z"> </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">map(xs:integer, xs:double)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:sequence</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="function">$complex</span><span class="parenthesis">(</span><span class="numeric">0</span><span class="parenthesis">)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+  </span><span class="ez">&lt;/</span><span class="clxsl">xsl:function</span><span class="ec">&gt;</span><span class="txt">
+  
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:function</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="fname">f:imag</span><span class="z">"</span><span class="z"> 
+                </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">xs:double</span><span class="z">"</span><span class="z"> </span><span class="atn">visibility</span><span class="atneq">=</span><span class="z">"</span><span class="av">public</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:param</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="pname">complex</span><span class="z">"</span><span class="z"> </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">map(xs:integer, xs:double)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:sequence</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="function">$complex</span><span class="parenthesis">(</span><span class="numeric">1</span><span class="parenthesis">)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+  </span><span class="ez">&lt;/</span><span class="clxsl">xsl:function</span><span class="ec">&gt;</span><span class="txt">
+  
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:function</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="fname">f:add</span><span class="z">"</span><span class="z"> 
+                </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">map(xs:integer, xs:double)</span><span class="z">"</span><span class="z"> </span><span class="atn">visibility</span><span class="atneq">=</span><span class="z">"</span><span class="av">public</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:param</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="pname">x</span><span class="z">"</span><span class="z"> </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">map(xs:integer, xs:double)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:param</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="pname">y</span><span class="z">"</span><span class="z"> </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">map(xs:integer, xs:double)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:sequence</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="whitespace">
+         </span><span class="function">f:complex-number</span><span class="parenthesis">(</span><span class="whitespace">
+           </span><span class="function">f:real</span><span class="parenthesis">(</span><span class="variable">$x</span><span class="parenthesis">)</span><span class="whitespace"> </span><span class="op">+</span><span class="whitespace"> </span><span class="function">f:real</span><span class="parenthesis">(</span><span class="variable">$y</span><span class="parenthesis">)</span><span class="op">,</span><span class="whitespace"> 
+           </span><span class="function">f:imag</span><span class="parenthesis">(</span><span class="variable">$x</span><span class="parenthesis">)</span><span class="whitespace"> </span><span class="op">+</span><span class="whitespace"> </span><span class="function">f:imag</span><span class="parenthesis">(</span><span class="variable">$y</span><span class="parenthesis">)</span><span class="parenthesis">)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+  </span><span class="ez">&lt;/</span><span class="clxsl">xsl:function</span><span class="ec">&gt;</span><span class="txt">
+  
+  </span><span class="es">&lt;</span><span class="enxsl">xsl:function</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="fname">f:multiply</span><span class="z">"</span><span class="z"> 
+                </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">map(xs:integer, xs:double)</span><span class="z">"</span><span class="z"> </span><span class="atn">visibility</span><span class="atneq">=</span><span class="z">"</span><span class="av">public</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:param</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="pname">x</span><span class="z">"</span><span class="z"> </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">map(xs:integer, xs:double)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:param</span><span class="z"> </span><span class="atn">name</span><span class="atneq">=</span><span class="z">"</span><span class="pname">y</span><span class="z">"</span><span class="z"> </span><span class="atn">as</span><span class="atneq">=</span><span class="z">"</span><span class="av">map(xs:integer, xs:double)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:sequence</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="whitespace">
+         </span><span class="function">f:complex-number</span><span class="parenthesis">(</span><span class="whitespace">
+           </span><span class="function">f:real</span><span class="parenthesis">(</span><span class="variable">$x</span><span class="parenthesis">)</span><span class="function">*f:real</span><span class="parenthesis">(</span><span class="variable">$y</span><span class="parenthesis">)</span><span class="whitespace"> </span><span class="op">-</span><span class="whitespace"> </span><span class="function">f:imag</span><span class="parenthesis">(</span><span class="variable">$x</span><span class="parenthesis">)</span><span class="function">*f:imag</span><span class="parenthesis">(</span><span class="variable">$y</span><span class="parenthesis">)</span><span class="op">,</span><span class="whitespace">
+           </span><span class="function">f:real</span><span class="parenthesis">(</span><span class="variable">$x</span><span class="parenthesis">)</span><span class="function">*f:imag</span><span class="parenthesis">(</span><span class="variable">$y</span><span class="parenthesis">)</span><span class="whitespace"> </span><span class="op">+</span><span class="whitespace"> </span><span class="function">f:imag</span><span class="parenthesis">(</span><span class="variable">$x</span><span class="parenthesis">)</span><span class="function">*f:real</span><span class="parenthesis">(</span><span class="variable">$y</span><span class="parenthesis">)</span><span class="parenthesis">)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+  </span><span class="ez">&lt;/</span><span class="clxsl">xsl:function</span><span class="ec">&gt;</span><span class="txt">
+  
+  </span><span class="z">&lt;!--</span><span class="cm"> etc. </span><span class="z">--&gt;</span><span class="txt">
+  
+</span><span class="ez">&lt;/</span><span class="clxsl">xsl:package</span><span class="ec">&gt;</span><span class="txt"></span></pre></div>
+                  <p>A more complex package might include private or abstract functions as well as
+                     public functions; it might expose components other than functions (for example,
+                     templates or global variables), and it might contain
+                     <a href="#element-use-package"><code>xsl:use-package</code></a> elements to allow it to call on the services
+                     of other packages.
+                  </p>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>In this example, the way in which complex numbers are represented is exposed to
+                        users of the package. It would be possible to hide the representation by
+                        declaring the types on public functions simply as <code>item()</code>; but this
+                        would be at the cost of type safety.
+                     </p>
+                  </div>
+               </div>
+               <p>A package that does not itself expose any components  may be written
+                  using a simplified syntax: the <a href="#element-package"><code>xsl:package</code></a> element is omitted, and
+                  the <a href="#element-stylesheet"><code>xsl:stylesheet</code></a> or <a href="#element-transform"><code>xsl:transform</code></a> element is now
+                  the outermost element of the stylesheet module. For compatibility reasons, all the
+                  named templates and modes declared in the package are made public. More formally,
+                  the
+                  principal stylesheet module of the <a title="top-level package" class="termref" href="#dt-top-level-package">top-level
+                     package</a> may be expressed as an <a href="#element-stylesheet"><code>xsl:stylesheet</code></a> or
+                  <a href="#element-transform"><code>xsl:transform</code></a> element, which is equivalent to the package represented
+                  by the output of the following transformation, preserving the base URI of the
+                  source:
+               </p>
+               <div class="exampleInner"><pre class="spectrum"><span class="es">&lt;</span><span class="enxsl">xsl:transform</span><span class="z"> </span><span class="atn">version</span><span class="atneq">=</span><span class="z">"</span><span class="av">3.0</span><span class="z">"</span><span class="z"> 
+    </span><span class="atn">xmlns:xsl</span><span class="atneq">=</span><span class="z">"</span><span class="av">http://www.w3.org/1999/XSL/Transform</span><span class="z">"</span><span class="z">
+    </span><span class="atn">xmlns:t</span><span class="atneq">=</span><span class="z">"</span><span class="av">http://www.w3.org/1999/XSL/TransformAlias</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+ 
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:namespace-alias</span><span class="z"> </span><span class="atn">stylesheet-prefix</span><span class="atneq">=</span><span class="z">"</span><span class="av">t</span><span class="z">"</span><span class="z"> </span><span class="atn">result-prefix</span><span class="atneq">=</span><span class="z">"</span><span class="av">xsl</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+    
+    </span><span class="es">&lt;</span><span class="enxsl">xsl:template</span><span class="z"> </span><span class="atn">match</span><span class="atneq">=</span><span class="z">"</span><span class="qname">xsl:stylesheet</span><span class="op">|</span><span class="qname">xsl:transform</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+      </span><span class="es">&lt;</span><span class="en">t:package</span><span class="z"> </span><span class="atn">declared-modes</span><span class="atneq">=</span><span class="z">"</span><span class="av">no</span><span class="z">"</span><span class="scx">&gt;</span><span class="txt">
+        </span><span class="es">&lt;</span><span class="enxsl">xsl:copy-of</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="axis">@</span><span class="op">*</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+        </span><span class="es">&lt;</span><span class="en">t:expose</span><span class="z"> </span><span class="atn">component</span><span class="atneq">=</span><span class="z">"</span><span class="av">mode</span><span class="z">"</span><span class="z"> </span><span class="atn">names</span><span class="atneq">=</span><span class="z">"</span><span class="av">*</span><span class="z">"</span><span class="z"> </span><span class="atn">visibility</span><span class="atneq">=</span><span class="z">"</span><span class="av">public</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+        </span><span class="es">&lt;</span><span class="en">t:expose</span><span class="z"> </span><span class="atn">component</span><span class="atneq">=</span><span class="z">"</span><span class="av">template</span><span class="z">"</span><span class="z"> </span><span class="atn">names</span><span class="atneq">=</span><span class="z">"</span><span class="av">*</span><span class="z">"</span><span class="z"> </span><span class="atn">visibility</span><span class="atneq">=</span><span class="z">"</span><span class="av">public</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+        </span><span class="es">&lt;</span><span class="enxsl">xsl:copy-of</span><span class="z"> </span><span class="atn">select</span><span class="atneq">=</span><span class="z">"</span><span class="node-type">node</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="z">"</span><span class="sc">/&gt;</span><span class="txt">
+      </span><span class="ez">&lt;/</span><span class="cl">t:package</span><span class="ec">&gt;</span><span class="txt">
+    </span><span class="ez">&lt;/</span><span class="clxsl">xsl:template</span><span class="ec">&gt;</span><span class="txt">
+ </span><span class="ez">&lt;/</span><span class="clxsl">xsl:transform</span><span class="ec">&gt;</span><span class="txt">
+       </span></pre></div>
+               <p>The effect of the <code>input-type-annotations</code>
+                  attribute is defined in <a href="#stripping-annotations"><i>4.4.1 Stripping Type Annotations from a Source Tree</i></a>.
+               </p>
+               <p>A more extensive example of a package, illustrating how components
+                  in a package can be overridden in a client package, is given in <a href="#packages-csv-library-example"><i>3.5.7 Worked Example of a Library Package</i></a>.
+               </p>
+               <div class="div3">
+                  
+                  <h4><a id="package-versions"></a>3.5.1 <a href="#package-versions" style="text-decoration: none">Versions of a Package</a></h4>
+                  <p>If a package has a version number, the version number must conform to the
+                     grammar:
+                  </p>
+                  <div class="exampleInner"><pre>        PackageVersion   ::= NumericPart ( "-" NamePart )?
+        NumericPart      ::= IntegerLiteral ( "." IntegerLiteral )*
+        NamePart         ::= NCName
+               </pre></div>
+                  <p>Here <span><a href="https://www.w3.org/TR/xpath-30/#prod-xpath30-IntegerLiteral">IntegerLiteral</a><sup><small>XP30</small></sup> and <code>NCName</code> are as defined in
+                        the XPath 3.0 grammar productions of the same name (including rules on
+                        limits)</span>. Leading and trailing whitespace is ignored; no other
+                     whitespace is allowed.
+                  </p>
+                  <p>Examples of valid version numbers are <code>2.0.5</code> or
+                     <code>3.10-alpha</code>.
+                  </p>
+                  <p><span class="definition">[Definition: </span><a id="dt-portion" title="portion"></a>The integer literals and the optional
+                     <code>NamePart</code> within the version number are referred to as the
+                     <b>portions</b> of the version number.<span class="definition">]</span></p>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>This means that <code>1-alpha-2</code> is a valid version number, with two
+                        <a title="portion" class="termref" href="#dt-portion">portions</a>: <code>1</code> and
+                        <code>alpha-2</code>. The second hyphen is part of the <code>NCName</code>,
+                        it does not act as a portion separator.
+                     </p>
+                  </div>
+                  <p>Versions are ordered. When comparing two versions:</p>
+                  <ol class="enumar">
+                     <li>
+                        <p>Trailing zero <a title="portion" class="termref" href="#dt-portion">portions</a> (that is, any
+                           zero-valued integer that is not followed by another integer) are
+                           discarded.
+                        </p>
+                     </li>
+                     <li>
+                        <p>Comparison proceeds by comparing <a title="portion" class="termref" href="#dt-portion">portions</a> pairwise from the left.
+                        </p>
+                     </li>
+                     <li>
+                        <p>If both versions have the same number of <a title="portion" class="termref" href="#dt-portion">portions</a> and all <a title="portion" class="termref" href="#dt-portion">portions</a>
+                           compare equal <span>(under the rules of the
+                              XPath <code>eq</code> operator using the Unicode codepoint
+                              collation)</span>, then the versions compare equal.
+                        </p>
+                     </li>
+                     <li>
+                        <p>If the number of <a title="portion" class="termref" href="#dt-portion">portions</a> in the two
+                           versions <var>V<sub>1</sub></var> and <var>V<sub>2</sub></var> is <var>N<sub>1</sub></var> and <var>N<sub>2</sub></var>,
+                           with <var>N<sub>1</sub></var>&lt;<var>N<sub>2</sub></var>, and if all <a title="portion" class="termref" href="#dt-portion">portions</a> in positions 1 to <var>N</var> compare equal, then
+                           <var>V<sub>1</sub></var> is less than <var>V<sub>2</sub></var> if the <a title="portion" class="termref" href="#dt-portion">portion</a> of <var>V<sub>2</sub></var> in position <var>N<sub>1</sub></var> is an integer, and is
+                           greater than <var>V<sub>2</sub></var> if this <a title="portion" class="termref" href="#dt-portion">portion</a> is an
+                           <code>NCName</code>. For example, <code>1.2</code> is less than
+                           <code>1.2.5</code>, while <code>2.0</code> is greater than
+                           <code>2.0-rc1</code>.
+                        </p>
+                     </li>
+                     <li>
+                        <p><a title="portion" class="termref" href="#dt-portion">Portions</a> are compared as follows:
+                        </p>
+                        <ol class="enumla">
+                           <li>
+                              <p>If both <a title="portion" class="termref" href="#dt-portion">portions</a> are integers,
+                                 they are compared <span>using the rules
+                                    of XPath value comparisons</span>.
+                              </p>
+                           </li>
+                           <li>
+                              <p>If both <a title="portion" class="termref" href="#dt-portion">portions</a> are NCNames, they
+                                 are compared <span>using the rules of
+                                    XPath value comparisons</span>, using the Unicode Codepoint
+                                 Collation.
+                              </p>
+                           </li>
+                           <li>
+                              <p>If one <a title="portion" class="termref" href="#dt-portion">portion</a> is an integer and the other is an
+                                 <code>NCName</code>, the <code>NCName</code> comes first.
+                              </p>
+                           </li>
+                        </ol>
+                     </li>
+                  </ol>
+                  <p>For example, the following shows a possible ordered sequence of version
+                     numbers:
+                  </p>
+                  <div class="exampleInner"><pre>0-rc1 &lt; 0-rc2 &lt; 0 &lt; 1 = 1.0 &lt; 1.0.2 
+   &lt; 1.0.3-rc1 &lt; 1.0.3 &lt; 1.0.3.2 &lt; 1.0.10</pre></div>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>The version number format defined here is designed to be general enough to
+                        accommodate a variety of conventions in common use, and to allow useful
+                        semantics for matching of versions and ranges of versions, without being
+                        over-prescriptive. It is influenced by <a href="#SemVer">[SemVer]</a>, but is not as
+                        prescriptive, and it imposes no assumptions about backwards compatibility of
+                        packages between successive versions.
+                     </p>
+                  </div>
+                  <p>Implementations <span class="verb">may</span> impose limits on the values
+                     used in a version number (or a version range: see below). Such limits are
+                     <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a>. As a minimum, 
+                     a processor <span class="verb">must</span> accept version numbers including:
+                  </p>
+                  <ul>
+                     <li>
+                        <p>A numeric part containing four integers;</p>
+                     </li>
+                     <li>
+                        <p>Each integer being in the range 0 to 999999;</p>
+                     </li>
+                     <li>
+                        <p>An <code>NCName</code> of up to 100 characters
+                        </p>
+                     </li>
+                  </ul>
+                  <p>Dependencies between packages may specify a version range (see <a href="#package-dependencies"><i>3.5.2 Dependencies between Packages</i></a>). A version range represents a set of accepted
+                     versions. <span>The syntax of a version range is
+                        shown below. Whitespace is permitted only where indicated, using the terminal
+                        symbol <var>S</var>.</span></p>
+                  <div class="exampleInner"><pre>        PackageVersionRange    ::=  AnyVersion | VersionRanges
+        AnyVersion             ::=  "*"
+        VersionRanges          ::=  <span>VersionRange (S? "," S? VersionRange)*</span>
+        VersionRange           ::=  <span>PackageVersion |</span> VersionPrefix | 
+                                      VersionFrom | VersionTo | VersionFromTo
+        VersionPrefix          ::=  PackageVersion ".*"
+        VersionFrom            ::=  PackageVersion "+"
+        VersionTo              ::=  "to" S <span>(PackageVersion | VersionPrefix)</span>
+        VersionFromTo          ::=  PackageVersion S "to" S <span>(PackageVersion | VersionPrefix)</span>     
+               </pre></div>
+                  <p>The meanings of the various forms of version range are
+                     defined below:
+                  </p>
+                  <ul>
+                     <li>
+                        <p>The range <code>AnyVersion</code> matches any version.
+                        </p>
+                     </li>
+                     <li>
+                        <p>The range <code>VersionRanges</code> matches a version if any constituent
+                           <code>VersionRange</code> matches that version.
+                        </p>
+                        <p>For example, <code>9.5.0.8, 9.6.1.2</code>
+                           matches those specific versions only, while <code>9.5.0.8, 9.6+</code>
+                           matches either version 9.5.0.8 or any version from 9.6 onwards.
+                        </p>
+                     </li>
+                     <li>
+                        <p>A range that is a <code>PackageVersion</code> matches that version only.
+                        </p>
+                     </li>
+                     <li>
+                        <p>The range <code>VersionPrefix</code> matches any version whose leading
+                           <a title="portion" class="termref" href="#dt-portion">portions</a> are the same as the <a title="portion" class="termref" href="#dt-portion">portions</a> in the <span><code>PackageVersion</code> part of the
+                              <code>VersionPrefix</code></span>.
+                        </p>
+                        <p>For example, <code>1.3.*</code> matches <code>1.3</code>, 
+                           <code>1.3.5</code>,  <code>1.3.10.2</code>,  and
+                           <code>1.3-beta</code>
+                           <span>(but not <code>1</code> or
+                              <code>1.4</code>)</span>.
+                        </p>
+                        <div class="note">
+                           <p class="prefix"><b>Note:</b></p>
+                           <p>The <code>.*</code> indicates that additional <a title="portion" class="termref" href="#dt-portion">portions</a> may follow; it does not indicate a substring match
+                              on the final <a title="portion" class="termref" href="#dt-portion">portion</a>. So
+                              <code>1.3.*</code> does not match <code>1.35</code>, and
+                              <code>3.3-beta.*</code> does not match <code>3.3-beta12</code>. Also,
+                              <code>3.3-beta.*</code> does not match <code>3.3-beta.5</code>: this
+                              is because the last dot is not a portion separator, but is part of the
+                              final <code>NCName</code>. In fact, using <code>.*</code> after a version
+                              number that includes an <code>NCName</code> portion is pointless, because
+                              an <code>NCName</code> portion can never be followed by further
+                              portions.
+                           </p>
+                        </div>
+                     </li>
+                     <li>
+                        <p>The range <code>VersionFrom</code> matches any version that is greater than
+                           or equal to the version supplied.
+                        </p>
+                        <p>For example <code>1.3+</code> matches
+                           <code>1.3</code>,  <code>1.3.2</code>,  <code>1.4</code>, 
+                           and <code>2.1</code> (but not <code>1.3-beta</code> or <code>1.2</code>).
+                           And <code>1.3-beta+</code> matches <code>1.3-beta</code>, 
+                           <code>1.3-gamma</code>,  <code>1.3.0</code>,  <code>1.4</code>,
+                           and <code>8.0</code>, but not <code>1.3-alpha</code> or
+                           <code>1.2</code>.
+                        </p>
+                     </li>
+                     <li>
+                        <p>The range <code>VersionTo</code> matches any version that is less than or
+                           equal to some version that matches the <code>VersionPrefix</code>.
+                        </p>
+                        <p>For example, <code>to 4.0</code> matches <code>1.5</code>, 
+                           <code>2.3</code>,  <code>3.8</code>,  <code>4.0</code>, 
+                           and <code>4.0-beta</code> (but not <code>4.0.1</code>), while <code>to
+                              3.3.*</code> matches <code>1.5</code> or <code>2.0.6</code> or
+                           <code>3.3.4621</code>, but not <code>3.4.0</code> or
+                           <code>3.4.0-beta</code>. 
+                        </p>
+                     </li>
+                     <li>
+                        <p>The range <code>VersionFromTo</code> matches any version that is greater
+                           than or equal to the starting <code>PackageVersion</code>, and less than or
+                           equal to some version that matches the <code>VersionPrefix</code>.
+                        </p>
+                        <p>For example, <code>1 to 5</code> matches <code>1.1</code>, 
+                           <code>2.1</code>,  <code>3.1</code>,  or <code>5.0</code> (but
+                           not <code>5.1</code>), while <code>1 to 5.*</code> matches all of these,
+                           plus versions such as <code>5.7.2</code> (but not <code>6.0</code> or
+                           <code>6.0-beta</code>). <span>Similarly,
+                              <code>1.0-beta to 1.0</code> matches <code>1.0-beta</code>,
+                              <code>1.0-beta.2</code>, <code>1.0-gamma</code>, and <code>1.0</code>,
+                              but not <code>1.0-alpha</code> or <code>1.0.1</code>.</span></p>
+                     </li>
+                  </ul>
+               </div>
+               <div class="div3">
+                  
+                  <h4><a id="package-dependencies"></a>3.5.2 <a href="#package-dependencies" style="text-decoration: none">Dependencies between Packages</a></h4>
+                  <p>When <a title="component" class="termref" href="#dt-component">components</a> in one <a title="package" class="termref" href="#dt-package">package</a> reference components in another, the dependency of the first
+                     package on the second must be represented by an <a href="#element-use-package"><code>xsl:use-package</code></a>
+                     element. <span>This may appear in the <a title="principal stylesheet module" class="termref" href="#dt-principal-stylesheet-module">principal stylesheet module</a>
+                        of the first package (which may be a <a title="package manifest" class="termref" href="#dt-package-manifest">package manifest</a>), or
+                        it may appear in a <a title="stylesheet module" class="termref" href="#dt-stylesheet-module">stylesheet module</a> that is referenced from
+                        the <a title="principal stylesheet module" class="termref" href="#dt-principal-stylesheet-module">principal stylesheet module</a> via one or more
+                        <a href="#element-include"><code>xsl:include</code></a> declarations; however it must not be referenced
+                        via <a href="#element-import"><code>xsl:import</code></a> declarations (this is to avoid complications
+                        caused by multiple <a href="#element-use-package"><code>xsl:use-package</code></a> declarations with
+                        different <a title="import precedence" class="termref" href="#dt-import-precedence">import precedence</a>).</span></p>
+                  <p><span class="definition">[Definition: </span><a id="dt-use" title="use"></a>If a package <var>Q</var> contains an
+                     <a href="#element-use-package"><code>xsl:use-package</code></a> element that references package
+                     <var>P</var>, then package <var>Q</var> is said to <b>use</b> package
+                     <var>P</var>. In this relationship package <var>Q</var> is referred to as
+                     the <b>using</b> package, package <var>P</var> as the <b>used</b>
+                     package.<span class="definition">]</span></p>
+                  <p>The phrase <b>directly uses</b> is synonymous with <b>uses</b> as
+                     defined above, while <b>directly or indirectly uses</b> refers to the
+                     transitive closure of this relationship.
+                  </p>
+                  <p class="element-syntax"><a id="element-use-package"></a><code>&lt;!-- Category: declaration --&gt;<br />&lt;xsl:use-package<br />  <b>name</b> = <var>uri</var><br />  package-version? = <var>string</var> &gt;<br />  &lt;!-- Content: (<a href="#element-accept">xsl:accept</a> | <a href="#element-override">xsl:override</a>)* --&gt;<br />&lt;/xsl:use-package&gt;</code></p>
+                  <p>A <a title="package" class="termref" href="#dt-package">package</a> may be <a title="use" class="termref" href="#dt-use">used</a> by more than one other package, but the relationship
+                     <span class="verb">must not</span> be cyclic. It is possible, but by no means
+                     inevitable, that using the same package in more than one place within a stylesheet
+                     will cause static errors due to the presence of conflicting components according
+                     to the above rules. Where a package is successfully used by more than one other
+                     package, its components may be overridden in different ways by different using
+                     packages.
+                  </p>
+                  <p>The <code>name</code> and <code>package-version</code> attributes together
+                     identify the used package. <span>The value of the
+                        <code>package-version</code> attribute, if present, must conform to the
+                        rules for a <span><code>PackageVersionRange</code></span> given in <a href="#package-versions"><i>3.5.1 Versions of a Package</i></a>; if omitted the value <code>*</code> is assumed,
+                        which matches any version. The used package must have a name that is an exact
+                        match for the name in the <code>name</code> attribute (using codepoint
+                        comparison), and its explicit or implicit <code>package-version</code> must
+                        match the version range given in the <code>package-version</code>
+                        attribute</span>.
+                  </p>
+                  <p>This specification does not define how the implementation locates a package given
+                     its name and version. <span>If several matching
+                        versions of a package are available, it does not define which of them is
+                        chosen.</span> Nor does it define whether this process locates source code or
+                     some other representation of the package contents. Such mechanisms are <a title="implementation-defined" class="termref" href="#dt-implementation-defined">implementation-defined</a>. Use of the package name as a dereferenceable
+                     URI is <span class="verb">not recommended</span>, because the intent of the packaging
+                     feature is to allow a package to be distributed as reusable code and therefore to
+                     exist in many different locations.
+                  </p>
+                  <p><a id="err-XTSE3000"><span class="error">[ERR XTSE3000] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if no package matching the package
+                     name and version specified in an <a href="#element-use-package"><code>xsl:use-package</code></a>
+                     declaration can be located.
+                  </p>
+                  <p><a id="err-XTSE3005"><span class="error">[ERR XTSE3005] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if a package is dependent on
+                     itself, where package <var>A</var> is defined as being dependent on package
+                     <var>B</var> if <var>A</var> contains an <a href="#element-use-package"><code>xsl:use-package</code></a>
+                     declaration that references <var>B</var>, or if <var>A</var> contains an
+                     <a href="#element-use-package"><code>xsl:use-package</code></a> declaration that references a package
+                     <var>C</var> that is itself dependent on <var>B</var>.
+                  </p>
+                  <p><a id="err-XTSE3008"><span class="error">[ERR XTSE3008] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if an <a href="#element-use-package"><code>xsl:use-package</code></a>
+                     declaration appears in a <a title="stylesheet module" class="termref" href="#dt-stylesheet-module">stylesheet module</a> that is not in the
+                     same <a title="stylesheet level" class="termref" href="#dt-stylesheet-level">stylesheet level</a> as the <a title="principal stylesheet module" class="termref" href="#dt-principal-stylesheet-module">principal stylesheet module</a>
+                     of the <a title="package" class="termref" href="#dt-package">package</a>.
+                  </p>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>Depending on the implementation architecture, there may be a need to locate
+                        used packages both during static analysis (for example, to get information
+                        about the names and type signatures of the components exposed by the used
+                        package), and also at evaluation time (to link to the implementation of these
+                        components so they can be invoked). A failure to locate a package may cause an
+                        error at either stage.
+                     </p>
+                  </div>
+                  <p>The <a href="#element-accept"><code>xsl:accept</code></a> and <a href="#element-override"><code>xsl:override</code></a> elements are
+                     used to modify the visibility or behavior of components acquired from the used
+                     package; they are described in <a href="#accepting-components"><i>3.5.3.2 Accepting Components</i></a> below.
+                  </p>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>It is not intrinsically an error to have two 
+                        <a href="#element-use-package"><code>xsl:use-package</code></a> declarations that identify the same package
+                        (or different versions of the same package). This has the same effect as
+                        having two declarations that identify packages with different names but
+                        identical content. In most cases it will result in an error (<span class="error">[see <a href="#err-XTSE3050">ERR XTSE3050</a>]</span>)
+                        due to the presence of multiple components with the same name; but 
+                        no error would occur, for example, if the used package is empty, or if the 
+                        two <a href="#element-use-package"><code>xsl:use-package</code></a> declarations use <a href="#element-accept"><code>xsl:accept</code></a>
+                        to accept non-overlapping subsets of the components in the used package.
+                     </p>
+                  </div>
+               </div>
+               <div class="div3">
+                  
+                  <h4><a id="named-components"></a>3.5.3 <a href="#named-components" style="text-decoration: none">Named Components in Packages</a></h4>
+                  <p>This section discusses the use of named components in packages.</p>
+                  <p>The components which can be declared in one package and
+                     referenced in another are: <a title="stylesheet function" class="termref" href="#dt-stylesheet-function">functions</a>, <a title="named template" class="termref" href="#dt-named-template">named
+                        templates</a>, <a title="attribute set" class="termref" href="#dt-attribute-set">attribute sets</a>,
+                     <a title="mode" class="termref" href="#dt-mode">modes</a>,  and <a title="global variable" class="termref" href="#dt-global-variable">global variables</a> and <a title="stylesheet parameter" class="termref" href="#dt-stylesheet-parameter">parameters</a>.
+                  </p>
+                  <p>In addition, <span><a title="key" class="termref" href="#dt-key">keys</a></span> and <span><a title="accumulator" class="termref" href="#dt-accumulator">accumulators</a></span>
+                     are classified as named components because they can contain references to
+                     components in another package, even though they cannot themselves be referenced
+                     from outside the package.
+                  </p>
+                  <p>Named and unnamed <a title="mode" class="termref" href="#dt-mode">modes</a> come within the scope of this section, but there are
+                     differences noted in <a href="#modes-and-packages"><i>3.5.4 Overriding Template Rules from a Used Package</i></a>.
+                  </p>
+                  <p>Not all <a title="declaration" class="termref" href="#dt-declaration">declarations</a> result in <a title="component" class="termref" href="#dt-component">components</a>:
+                  </p>
+                  <ul>
+                     <li>
+                        <p>Named <a title="declaration" class="termref" href="#dt-declaration">declarations</a> that can neither be referenced from outside their
+                           containing package, nor can contain references to components in other
+                           packages (examples are <a href="#element-output"><code>xsl:output</code></a>,
+                           <a href="#element-character-map"><code>xsl:character-map</code></a>, and
+                           <a href="#element-decimal-format"><code>xsl:decimal-format</code></a>) are not considered to be components
+                           and are therefore outside the scope of this section.
+                        </p>
+                     </li>
+                     <li>
+                        <p>Some declarations, such as <a href="#element-decimal-format"><code>xsl:decimal-format</code></a> and
+                           <a href="#element-strip-space"><code>xsl:strip-space</code></a>, declare aspects of the processing
+                           context which are not considered to be components as defined here.
+                        </p>
+                     </li>
+                     <li>
+                        <p><a title="template rule" class="termref" href="#dt-template-rule">Template rules</a>
+                           (<a href="#element-template"><code>xsl:template</code></a> with a <code>match</code> attribute) are
+                           also not considered to be components for the purposes of this section, which
+                           is concerned only with components that are bound by name. However, when an
+                           <a href="#element-template"><code>xsl:template</code></a> has both a <code>match</code> attribute and
+                           a <code>name</code> attribute, then it establishes both a template rule and
+                           a <a title="named template" class="termref" href="#dt-named-template">named template</a>, and in its role
+                           as a named template it comes within the scope of this discussion.
+                        </p>
+                     </li>
+                     <li>
+                        <p>A named declaration, for example a named template, a function, 
+                           or a global
+                           variable, may be overridden within the same package by another like-named
+                           declaration having higher <a title="import precedence" class="termref" href="#dt-import-precedence">import
+                              precedence</a>. When a declaration is overridden in this way it cannot
+                           be referenced <span>by name</span> either from within its containing package or
+                           from outside that package. 
+                        </p>
+                     </li>
+                     <li>
+                        <p>In the case of <a href="#element-attribute-set"><code>xsl:attribute-set</code></a>
+                           and <a href="#element-key"><code>xsl:key</code></a> declarations, several declarations combine to
+                           form a single component.
+                        </p>
+                     </li>
+                  </ul>
+                  <p>The section is largely concerned with details of the rules that affect references
+                     from one component to another by name, whether the components are in the same
+                     package or in different packages. The rules are designed to meet a number of
+                     requirements:
+                  </p>
+                  <ul>
+                     <li>
+                        <p>A component defined in one package can be overridden by a component in
+                           another package, provided the signatures are type-compatible.
+                        </p>
+                     </li>
+                     <li>
+                        <p>The author of a package can declare whether the components in the package
+                           are public or private (that is, whether or not they can be used from outside
+                           the package) and whether they are final, overridable, or abstract (that is
+                           whether they can or must be overridden by the using package).
+                        </p>
+                     </li>
+                     <li>
+                        <p>Within an application, two packages can make use of a common library and
+                           override its components in different ways.
+                        </p>
+                     </li>
+                     <li>
+                        <p>Visibility of components can be defined either as part of the declaration of
+                           the component, or in the package manifest.
+                        </p>
+                     </li>
+                     <li>
+                        <p>An application that wishes to make use of a <a title="library package" class="termref" href="#dt-library-package">library package</a> can be selective about
+                           which components from the library it acquires, perhaps to avoid name clashes
+                           between components acquired from different libraries.
+                        </p>
+                     </li>
+                  </ul>
+                  <p><span class="definition">[Definition: </span><a id="dt-component" title="component"></a>The term <b>component</b> is
+                     used to refer to any of the following: a <a title="stylesheet function" class="termref" href="#dt-stylesheet-function">stylesheet function</a>, a <a title="named template" class="termref" href="#dt-named-template">named
+                        template</a>, a <a title="mode" class="termref" href="#dt-mode">mode</a>, <span>an <a title="accumulator function" class="termref" href="#dt-accumulator-function">accumulator</a>,</span> an <a title="attribute set" class="termref" href="#dt-attribute-set">attribute set</a>, a <span><a title="key" class="termref" href="#dt-key">key</a></span>, <a title="global variable" class="termref" href="#dt-global-variable">global variable</a>, or a <a title="mode" class="termref" href="#dt-mode">mode</a>.<span class="definition">]</span></p>
+                  <p><span class="definition">[Definition: </span><a id="dt-symbolic-identifier" title="symbolic identifier"></a>The <b>symbolic
+                        identifier</b> of a <a title="component" class="termref" href="#dt-component">component</a> is a
+                     composite name used to identify the component uniquely within a package. The
+                     symbolic identifier comprises the kind of component (stylesheet function, named
+                     template, <span>accumulator</span>, attribute set, global
+                     variable, key, or mode), the <a title="expanded QName" class="termref" href="#dt-expanded-qname">expanded
+                        QName</a> of the component (namespace URI plus local name), and in the
+                     case of stylesheet functions, the <a title="arity" class="termref" href="#dt-arity">arity</a>.<span class="definition">]</span></p>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>In the case of the <a title="unnamed mode" class="termref" href="#dt-unnamed-mode">unnamed mode</a>,
+                        the expanded QName of the component may be considered to be some
+                        system-allocated name different from any user-defined mode name.
+                     </p>
+                  </div>
+                  <p><span class="definition">[Definition: </span><a id="dt-homonymous" title="homonymous"></a>Two <a title="component" class="termref" href="#dt-component">components</a> are said to be <b>homonymous</b> if they have
+                     the same <a title="symbolic identifier" class="termref" href="#dt-symbolic-identifier">symbolic
+                        identifier</a>.<span class="definition">]</span></p>
+                  <p>Every <a title="component" class="termref" href="#dt-component">component</a> has a <a title="declaration" class="termref" href="#dt-declaration">declaration</a> in some <a title="stylesheet module" class="termref" href="#dt-stylesheet-module">stylesheet module</a> and therefore within some <a title="package" class="termref" href="#dt-package">package</a>. <span>In the
+                        case of <a title="attribute set" class="termref" href="#dt-attribute-set">attribute sets</a> and <a title="key" class="termref" href="#dt-key">keys</a>, there may be several declarations.</span> The
+                     declaration is an element in an XDM tree representing the stylesheet module.
+                     Declarations therefore have identity, based on XDM node identity.
+                  </p>
+                  <p><span class="definition">[Definition: </span><a id="dt-declaring-package" title="declaring package"></a>The <b>declaring
+                        package</b> of a <a title="component" class="termref" href="#dt-component">component</a> is the
+                     package that contains the declaration <span>(or,
+                        in the case of <a href="#element-attribute-set"><code>xsl:attribute-set</code></a> and
+                        <a href="#element-key"><code>xsl:key</code></a>, multiple declarations)</span> of the
+                     component.<span class="definition">]</span></p>
+                  <p>When a <a title="component" class="termref" href="#dt-component">component</a> declared in one <a title="package" class="termref" href="#dt-package">package</a> is made available in another, the using
+                     package will contain a separate component that can be regarded as a modified copy
+                     of the original. The new component shares the same <a title="symbolic identifier" class="termref" href="#dt-symbolic-identifier">symbolic identifier</a> as the original, and
+                     it has the same <a title="declaration" class="termref" href="#dt-declaration">declaration</a>, but it has
+                     other properties such as its <a title="visibility" class="termref" href="#dt-visibility">visibility</a>
+                     that may differ from the original.
+                  </p>
+                  <p><span class="definition">[Definition: </span><a id="dt-containing-package" title="containing package"></a>A
+                     component declaration results in multiple components, one in the package in
+                     which the declaration appears, and potentially one in each package that uses
+                     the declaring package, directly or indirectly, subject to the visibility of the
+                     component. Each of these multiple components has the same <a title="declaring package" class="termref" href="#dt-declaring-package">declaring package</a>, but each has a different <b>containing
+                        package</b>. For the original component, the declaring package and the
+                     containing package are the same; for a copy of a component made as a result of
+                     an <a href="#element-use-package"><code>xsl:use-package</code></a> declaration, the declaring package will be
+                     the original package, and the containing package will be the package in which
+                     the <a href="#element-use-package"><code>xsl:use-package</code></a> declaration appears.<span class="definition">]</span></p>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>Within this specification, we generally use the
+                        notation <var>C<sub>P</sub></var> for a component named C whose declaring package and
+                        containing package are both <var>P</var>; and the notation <var>C<sub>PQ</sub></var> for
+                        a component whose containing package is <var>P</var> and whose declaring
+                        package is <var>Q</var> (that is, a component in <var>P</var> that is derived
+                        from a component <var>C<sub>Q</sub></var> in the used package <var>Q</var>).
+                     </p>
+                  </div>
+                  <p>The properties of a <a title="component" class="termref" href="#dt-component">component</a> are as
+                     follows:
+                  </p>
+                  <ul>
+                     <li>
+                        <p>The original <a title="declaration" class="termref" href="#dt-declaration">declaration</a> of the
+                           component.
+                        </p>
+                     </li>
+                     <li>
+                        <p>The <a title="package" class="termref" href="#dt-package">package</a> to which the component
+                           belongs (called its <b>containing</b> package, not to be confused with
+                           the <a title="declaring package" class="termref" href="#dt-declaring-package">declaring package</a>).
+                        </p>
+                     </li>
+                     <li>
+                        <p>The <a title="symbolic identifier" class="termref" href="#dt-symbolic-identifier">symbolic identifier</a> of
+                           the component.
+                        </p>
+                     </li>
+                     <li>
+                        <p>The <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of the component,
+                           which determines the way in which the component is seen by other components
+                           within the same package and within using packages. This is one of
+                           <code>public</code>, <code>private</code>, <code>abstract</code>,
+                           <code>final</code>, or <code>hidden</code>. The visibility of components
+                           is discussed further in <a href="#visibility"><i>3.5.3.1 Visibility of Components</i></a>.
+                        </p>
+                     </li>
+                     <li>
+                        <p>A set of bindings for the <a title="symbolic reference" class="termref" href="#dt-symbolic-reference">symbolic
+                              references</a> in the component. The way in which these bindings
+                           are established is discussed further in <a href="#component-references"><i>3.5.3.5 Binding References to Components</i></a>.
+                        </p>
+                     </li>
+                  </ul>
+                  <div class="note">
+                     <p class="prefix"><b>Note:</b></p>
+                     <p>When a function <var>F</var> defined in a package <var>P</var> is acquired by
+                        two using packages <var>Q</var> and <var>R</var>, we may think of <var>P</var>,
+                        <var>Q</var>, and <var>R</var> as all providing access to the “same”
+                        function. The detailed semantics, however, demand an understanding that there
+                        is one function declaration, but three components. The three components
+                        representing the function <var>F</var> within packages <var>P</var>,
+                        <var>Q</var>, and <var>R</var> have some properties in common (the same
+                        symbolic identifier, the same declaration), but other properties (the
+                        visibility and the bindings of symbolic references) that may vary from one of
+                        these components to another.
+                     </p>
+                  </div>
+                  <p><span class="definition">[Definition: </span><a id="dt-symbolic-reference" title="symbolic reference"></a>The <a title="declaration" class="termref" href="#dt-declaration">declaration</a> of a component includes
+                     constructs that can be interpreted as references to other <a title="component" class="termref" href="#dt-component">components</a> by means of their <a title="symbolic identifier" class="termref" href="#dt-symbolic-identifier">symbolic identifiers</a>. These
+                     constructs are generically referred to as <b>symbolic references</b>.
+                     Examples of constructs that give rise to symbolic references are the
+                     <code>name</code> attribute of <a href="#element-call-template"><code>xsl:call-template</code></a>; the
+                     <code>[xsl:]use-attribute-sets</code> attribute of
+                     <a href="#element-copy"><code>xsl:copy</code></a>, <a href="#element-element"><code>xsl:element</code></a>, and <a title="literal result element" class="termref" href="#dt-literal-result-element">literal result elements</a>; the
+                     <span>explicit or implicit</span>
+                     <code>mode</code> attribute of <a href="#element-apply-templates"><code>xsl:apply-templates</code></a>; XPath
+                     variable references referring to global variables; XPath <span>static function calls (including partial function
+                        applications)</span> referring to <a title="stylesheet function" class="termref" href="#dt-stylesheet-function">stylesheet functions</a>; <span>and
+                        named function references (example: <code>my:f#1</code>) referring to
+                        stylesheet functions.</span>
+                     <span class="definition">]</span></p>
+                  <p>Symbolic references exist as properties of the <a title="declaration" class="termref" href="#dt-declaration">declaration</a> of a <a title="component" class="termref" href="#dt-component">component</a>.
+                     The <a title="symbolic identifier" class="termref" href="#dt-symbolic-identifier">symbolic identifier</a> being
+                     referred to can be determined straightforwardly from the syntactic form and
+                     context of the reference: for example, the instruction <code>&lt;xsl:value-of
+                        select="f:price($o)" xmlns:f="http://f.com/"/&gt;</code> contains a symbolic
+                     reference to a function with expanded name <code>{http://f.com/}price</code> and
+                     with arity=1. However, because there may be several (homonymous) function
+                     components with this symbolic identifier, translating this symbolic reference into
+                     a reference to a specific component (a process called “binding”) is less
+                     straightforward, and is described in the text that follows. 
+                  </p>
+                  <p>The process of assembling a stylesheet from its constituent packages is primarily
+                     a process of binding these symbolic references to actual components. Within any
+                     <a title="component" class="termref" href="#dt-component">component</a> whose <a title="declaration" class="termref" href="#dt-declaration">declaration</a> is <var>D</var>, there is a set of
+                     bindings; each binding is an association between a <a title="symbolic reference" class="termref" href="#dt-symbolic-reference">symbolic reference</a> in <var>D</var> and a
+                     <a title="component" class="termref" href="#dt-component">component</a> whose <a title="symbolic identifier" class="termref" href="#dt-symbolic-identifier">symbolic identifier</a> matches the outward
+                     reference. Outward references for which a component <var>C</var> contains a
+                     binding are said to be <b>bound</b> in <var>C</var>; those for which
+                     <var>C</var> contains no binding are said to be <b>unbound</b>.
+                  </p>
+                  <p>For example, suppose that in some package <var>Q</var>, function <var>A</var>
+                     calls <var>B</var>, which in turn calls <var>C</var>, and that <var>B</var> is
+                     <code>private</code>. Now suppose that in some package <var>P</var> which uses
+                     <var>Q</var>, <var>C</var> is overridden. The effect of the binding process is
+                     that <var>P</var> will contain three components corresponding to <var>A</var>,
+                     <var>B</var>, and <var>C</var>, which we might call <var>A<sub>P</sub></var>,
+                     <var>B<sub>P</sub></var>, and <var>C<sub>P</sub></var>. The <a title="declaration" class="termref" href="#dt-declaration">declarations</a> of <var>A<sub>P</sub></var> and <var>B<sub>P</sub></var> are in package
+                     <var>Q</var>, but the declaration of <var>C<sub>P</sub></var> is in <var>P</var>. The
+                     internal visibility of <var>B<sub>P</sub></var> will be <code>hidden</code> (meaning that it
+                     cannot be referenced from within <var>P</var>), and <var>B<sub>P</sub></var> will contain a
+                     binding for the component <var>C<sub>P</sub></var> that corresponds to the outward reference
+                     from <var>B</var> to <var>C</var>. The effect is that when <var>A</var> calls
+                     <var>B</var> and <var>B</var> calls <var>C</var>, it is the overriding version
+                     of <var>C</var> that is executed.
+                  </p>
+                  <p>In another package <var>R</var> that uses <var>Q</var> without overriding
+                     <var>C</var>, there will be three different components <var>A<sub>R</sub></var>,
+                     <var>B<sub>R</sub></var>, and <var>C<sub>R</sub></var>. This time the declaration of all three
+                     components is in the original package <var>Q</var>. Component <var>B<sub>R</sub></var> will
+                     contain a binding to <var>C<sub>R</sub></var>, so in this package, the original version of
+                     <var>C</var> is executed. The fact that one package <var>P</var> overrides
+                     <var>C</var> thus has no effect on <var>R</var>, which does not override
+                     it.
+                  </p>
+                  <p>The binding process outlined above is described in more detail in <a href="#component-references"><i>3.5.3.5 Binding References to Components</i></a>.
+                  </p>
+                  <p>Template rules are not components in their own right;
+                     unlike named templates, they are never referenced by name. Component references
+                     within a template rule (for example, references to functions, global variables, or
+                     named templates) are treated as occurring within the component that represents the
+                     containing mode. This includes component references within the match patterns of
+                     template rules. If a template rule lists several modes, it is treated as if there
+                     were multiple template rules one in each mode.
+                  </p>
+                  <p>An <a href="#element-apply-templates"><code>xsl:apply-templates</code></a> instruction
+                     with no <code>mode</code> attribute is treated as a reference to the default mode
+                     defined for that <a title="instruction" class="termref" href="#dt-instruction">instruction</a> (see <a href="#default-mode"><i>3.7.2 The default-mode Attribute</i></a>), which in turn defaults to the <a title="unnamed mode" class="termref" href="#dt-unnamed-mode">unnamed mode</a>. An implicit
+                     reference to the unnamed made is treated in the same way as any other <a title="symbolic reference" class="termref" href="#dt-symbolic-reference">symbolic reference</a>. Note that there is an unnamed mode in every
+                     package, and the unnamed mode always has private visibility.
+                  </p>
+                  <p>Where an <a href="#element-template"><code>xsl:template</code></a> element has both
+                     a <code>name</code> and a <code>match</code> attribute, it is treated as if there
+                     were two separate <a href="#element-template"><code>xsl:template</code></a> elements, one with a
+                     <code>name</code> attribute and one with a <code>match</code> attribute. 
+                  </p>
+                  <p><a title="key" class="termref" href="#dt-key">Keys</a>
+                     <span>and <a title="accumulator" class="termref" href="#dt-accumulator">accumulators</a></span> behave rather differently from other
+                     components. Their visibility is always private, which means they can only be used
+                     within their declaring package. In addition, the component binding is generally
+                     made dynamically rather than statically, <span>by
+                        virtue of a string passed as an argument to the function
+                        <a href="#func-key"><code>key</code></a>, <a href="#func-accumulator-before"><code>accumulator-before</code></a>, or
+                        <a href="#func-accumulator-after"><code>accumulator-after</code></a>. (In the case of accumulators, there
+                        can also be static references: see the <code>use-accumulators</code> attribute
+                        of <a href="#element-source-document"><code>xsl:source-document</code></a>, </span>
+                     <span><a href="#element-merge-source"><code>xsl:merge-source</code></a>, and <a href="#element-mode"><code>xsl:mode</code></a></span>.) 
+                     However, outward references from key
+                     definitions <span>and <a title="accumulator" class="termref" href="#dt-accumulator">accumulators</a></span> to other components (such as global
+                     variables and functions) behave in the same way as component references contained
+                     in any other private component, in that they may be re-bound to an overriding
+                     declaration of the target component.
+                  </p>
+                  <div class="div4">
+                     
+                     <h5><a id="visibility"></a>3.5.3.1 <a href="#visibility" style="text-decoration: none">Visibility of Components</a></h5>
+                     <p><span class="definition">[Definition: </span><a id="dt-visibility" title="visibility"></a>The <b>visibility</b> of a
+                        <a title="component" class="termref" href="#dt-component">component</a> is one of:
+                        <code>private</code>, <code>public</code>, <code>abstract</code>,
+                        <code>final</code>, or <code>hidden</code>.<span class="definition">]</span></p>
+                     <p>The meanings of these visibility values is as follows:</p>
+                     <dl>
+                        <dt class="label">public</dt>
+                        <dd>
+                           <p>The component can be referenced from other components in this package
+                              or in any using package; it can be overridden by a different component
+                              in any using package.
+                           </p>
+                        </dd>
+                        <dt class="label">private</dt>
+                        <dd>
+                           <p>The component can be referenced from other components in this
+                              package; it cannot be referenced or overridden within a using
+                              package.
+                           </p>
+                        </dd>
+                        <dt class="label">abstract</dt>
+                        <dd>
+                           <p>The component can be referenced from other components in this package
+                              or in any using package; in a using package it can either remain
+                              abstract or be overridden by a different component. 
+                           </p>
+                        </dd>
+                        <dt class="label">final</dt>
+                        <dd>
+                           <p>The component can be referenced from other components in this package
+                              or in any using package; it cannot be overridden by a different
+                              component in any using package.
+                           </p>
+                        </dd>
+                        <dt class="label">hidden</dt>
+                        <dd>
+                           <p>The component cannot be referenced from other components in this
+                              package; it cannot be referenced or overridden within a using
+                              package.
+                           </p>
+                        </dd>
+                     </dl>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>The visibility of a component in a package <var>P</var> primarily affects
+                           how the component can be used in other packages, specifically, packages that
+                           use <var>P</var>. There is one exception: if the visibility is
+                           <code>hidden</code>, it also affects how the component can be used within
+                           <var>P</var>.
+                        </p>
+                     </div>
+                     <p>When a component is declared within a particular
+                        package, its <a title="visibility" class="termref" href="#dt-visibility">visibility</a>, which affects
+                        how it can be used in other (using) packages, depends on two factors: the value
+                        of the <code>visibility</code> declaration on the declaration itself (if
+                        present), and the rules given in the <a href="#element-expose"><code>xsl:expose</code></a> declarations
+                        of the package manifest.
+                     </p>
+                     <p>The <a href="#element-function"><code>xsl:function</code></a>, <a href="#element-template"><code>xsl:template</code></a>,
+                        <a href="#element-attribute-set"><code>xsl:attribute-set</code></a>, <a href="#element-variable"><code>xsl:variable</code></a>, 
+                        and
+                        <a href="#element-mode"><code>xsl:mode</code></a>
+                        <a title="declaration" class="termref" href="#dt-declaration">declarations</a> each have an optional
+                        <code>visibility</code> attribute. The value is one of <code>private</code>,
+                        <code>public</code>, <code>abstract</code>, or <code>final</code> (never
+                        <code>hidden</code>). <span>In the case of
+                           an <a href="#element-param"><code>xsl:param</code></a> element there is no explicit 
+                           <code>visibility</code> attribute; rather the declaration has the
+                           implicit attribute <code>visibility="public"</code>.</span></p>
+                     <p>Any <a href="#element-expose"><code>xsl:expose</code></a> declarations that
+                        appear as children of <a href="#element-package"><code>xsl:package</code></a> define the visibility of
+                        components whose declaration has no explicit <code>visibility</code> attribute,
+                        and can also be used to reduce the visibility of components where this
+                        attribute is present.
+                     </p>
+                     <p class="element-syntax"><a id="element-expose"></a><code>&lt;xsl:expose<br />  <b>component</b> = "template" | "function" | "attribute-set" | "variable" | "mode" | "*"<br />  <b>names</b> = <var>tokens</var><br />  <b>visibility</b> = "public" | "private" | "final" | "abstract" /&gt;</code></p>
+                     <p>The <a href="#element-expose"><code>xsl:expose</code></a> element allows the <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of selected components within a package to be defined.
+                     </p>
+                     <p>The components in question are identified using their <a title="symbolic identifier" class="termref" href="#dt-symbolic-identifier">symbolic identifiers</a>. The
+                        <code>component</code> attribute defines the kind of component that is
+                        selected.
+                        <span>The value <code>*</code> means “all component kinds”;
+                           in this case the value of the <code>names</code> attribute must be a <a href="https://www.w3.org/TR/xpath-30/#prod-xpath30-Wildcard">Wildcard</a><sup><small>XP30</small></sup>.</span></p>
+                     <p>An <a href="#element-expose"><code>xsl:expose</code></a> declaration has no effect on the 
+                        <a title="unnamed mode" class="termref" href="#dt-unnamed-mode">unnamed mode</a>, which is always private to a package.
+                     </p>
+                     <p>The <code>names</code> attribute selects a subset of these components by name
+                        (and in the case of functions, arity); its value is a whitespace-separated
+                        sequence of tokens each of which is either a <a href="https://www.w3.org/TR/xpath-30/#prod-xpath30-NameTest">NameTest</a><sup><small>XP30</small></sup> or a <a href="https://www.w3.org/TR/xpath-30/#prod-xpath30-NamedFunctionRef">NamedFunctionRef</a><sup><small>XP30</small></sup>. (Examples are
+                        <code>*</code>, <code>p:*</code>, <code>*:local</code>,
+                        <code>p:local</code>, and <code>p:local#2</code>.)
+                     </p>
+                     <p>The value may be a <code>NamedFunctionRef</code> only in the case of stylesheet
+                        functions, and distinguishes functions with the same name and different
+                        arity.
+                     </p>
+                     <p>The visibility of a 
+                        <span>named template, function, variable, attribute set, or mode</span>
+                        declared within a package is the first of the following that applies, subject to consistency
+                        constraints which are defined below:
+                     </p>
+                     <ol class="enumar">
+                        <li>
+                           <p>The visibility of a variable declared using
+                              an <a href="#element-param"><code>xsl:param</code></a> element is
+                              always <code>public</code>. No <a href="#element-expose"><code>xsl:expose</code></a> element
+                              ever matches an <a href="#element-param"><code>xsl:param</code></a> component.
+                           </p>
+                           <div class="note">
+                              <p class="prefix"><b>Note:</b></p>
+                              <p>Attempting to match an <a href="#element-param"><code>xsl:param</code></a> with
+                                 an explicit <code>EQName</code> will therefore always give an error, while
+                                 using a wildcard has no effect.
+                              </p>
+                           </div>
+                        </li>
+                        <li>
+                           <p>If the package manifest contains an <a href="#element-expose"><code>xsl:expose</code></a> element
+                              that matches this component by virtue of an explicit <code>EQName</code>
+                              or <code>NamedFunctionRef</code> (that is, not by virtue of a wildcard
+                              match), then the value of the <code>visibility</code> attribute of the
+                              last such <a href="#element-expose"><code>xsl:expose</code></a> element in document order (call
+                              this the <b>explicit exposed visibility</b>).
+                           </p>
+                        </li>
+                        <li>
+                           <p>If the declaration of the component has a <code>visibility</code>
+                              attribute, then the value of this attribute (call this the <b>declared
+                                 visibility</b>).
+                           </p>
+                        </li>
+                        <li>
+                           <p>If the package manifest contains an <a href="#element-expose"><code>xsl:expose</code></a> element
+                              that matches this component by virtue of a wildcard match that specifies
+                              either the namespace part of the component name or the local part of the
+                              name (for example, <code>prefix:*</code> or <code>*:local</code> or
+                              <code>Q{uri}*</code>), then the value of the <code>visibility</code>
+                              attribute of the last such <a href="#element-expose"><code>xsl:expose</code></a> element in
+                              document order.
+                           </p>
+                        </li>
+                        <li>
+                           <p>If the package manifest contains an <a href="#element-expose"><code>xsl:expose</code></a> element
+                              that matches this component by virtue of a wildcard match that matches
+                              all names (that is, <code>*</code>), then the value of the
+                              <code>visibility</code> attribute of the last such
+                              <a href="#element-expose"><code>xsl:expose</code></a> element in document order.
+                           </p>
+                        </li>
+                        <li>
+                           <p>Otherwise, <code>private</code>.
+                           </p>
+                        </li>
+                     </ol>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>In the above rules, no distinction is made between declarations that specify
+                           a specific component kind, and those that specify <code>component="*"</code>. If both match,
+                           the value of the <code>component</code> attribute plays no role in deciding which 
+                           declaration wins.
+                        </p>
+                     </div>
+                     <p>If both a declared visibility and an explicit
+                        exposed visibility exist for the same component, then as mentioned above, they
+                        must be consistent. This is determined by reference to the following table,
+                        where the entry N/P means “not permitted”. (In cases where the combination is
+                        permitted, the actual visibility is always the same as the visibility
+                        determined by <a href="#element-expose"><code>xsl:expose</code></a>.)
+                     </p>
+                     <div class="overlarge"><table class="data">
+                        <caption>Relationship of Exposed Visibility to Potential Visibility</caption>
+                        <thead>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top" rowspan="2">Explicit exposed visibility</th>
+                              <th style="text-align:left; vertical-align:top" colspan="4">Declared visibility</th>
+                           </tr>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">public</th>
+                              <th style="text-align:left; vertical-align:top">private</th>
+                              <th style="text-align:left; vertical-align:top">final</th>
+                              <th style="text-align:left; vertical-align:top">abstract</th>
+                           </tr>
+                        </thead>
+                        <tbody>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">public</th>
+                              <td style="text-align:left; vertical-align:top">public</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                           </tr>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">private</th>
+                              <td style="text-align:left; vertical-align:top">private</td>
+                              <td style="text-align:left; vertical-align:top">private</td>
+                              <td style="text-align:left; vertical-align:top">private</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                           </tr>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">final</th>
+                              <td style="text-align:left; vertical-align:top">final</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">final</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                           </tr>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">abstract</th>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">abstract</td>
+                           </tr>
+                        </tbody>
+                     </table></div>
+                     <p>
+                        <a id="err-XTSE3010"><span class="error">[ERR XTSE3010] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> 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
+                        <code>visibility</code> attribute, and the component is also listed
+                        explicitly by name in an <a href="#element-expose"><code>xsl:expose</code></a> declaration.)
+                        
+                     </p>
+                     <p>
+                        <a id="err-XTSE3020"><span class="error">[ERR XTSE3020] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if a token
+                        in the <code>names</code> attribute of <a href="#element-expose"><code>xsl:expose</code></a>, other
+                        than a wildcard, matches no component in the containing package.
+                        
+                     </p>
+                     <p>
+                        <a id="err-XTSE3022"><span class="error">[ERR XTSE3022] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if the 
+                        <code>component</code> attribute of <a href="#element-expose"><code>xsl:expose</code></a> specifies <code>*</code>
+                        (meaning all component kinds) and the <code>names</code> attribute is not a wildcard.
+                        
+                     </p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>There is no ambiguity, and no error, if several tokens within the same
+                           <a href="#element-expose"><code>xsl:expose</code></a> element match the same component.
+                        </p>
+                     </div>
+                     <p>If the visibility of a component as established by the above rules
+                        is <code>abstract</code>, then the component must have a declared visibility of <code>abstract</code>.
+                     </p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>In other words, the <a href="#element-expose"><code>xsl:expose</code></a> declaration cannot be used to make a component
+                           abstract unless it was declared as abstract to start with.
+                        </p>
+                     </div>
+                     <p>
+                        <a id="err-XTSE3025"><span class="error">[ERR XTSE3025] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if the
+                        effect of an <a href="#element-expose"><code>xsl:expose</code></a> declaration would be to make a component
+                        <code>abstract</code>, unless the component is already <code>abstract</code>
+                        in the absence of the <a href="#element-expose"><code>xsl:expose</code></a> declaration.
+                        
+                        
+                     </p>
+                     <p>For a component accepted into a package <var>P</var>
+                        from another package <var>Q</var>, the <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of the component in <var>P</var> (which primarily
+                        affects how it can be used in a package <var>R</var> that uses <var>P</var>)
+                        depends on the visibility declared in the relevant <a href="#element-accept"><code>xsl:accept</code></a>
+                        or <a href="#element-override"><code>xsl:override</code></a> element in <var>P</var> (see <a href="#accepting-components"><i>3.5.3.2 Accepting Components</i></a>); this in turn has a default that depends on
+                        the visibility of the corresponding component in <var>Q</var>. In this case the
+                        visibility is unaffected by any <a href="#element-expose"><code>xsl:expose</code></a> declaration in
+                        <var>P</var>.
+                     </p>
+                  </div>
+                  <div class="div4">
+                     
+                     <h5><a id="accepting-components"></a>3.5.3.2 <a href="#accepting-components" style="text-decoration: none">Accepting Components</a></h5>
+                     <p>When a package <var>P</var> uses a package <var>Q</var>, by virtue of an
+                        <a href="#element-use-package"><code>xsl:use-package</code></a> element in the <a title="package manifest" class="termref" href="#dt-package-manifest">package manifest</a> of <var>P</var>, then
+                        <var>P</var> will contain a <a title="component" class="termref" href="#dt-component">component</a>
+                        corresponding to every component in <var>Q</var>. The <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of the component within
+                        <var>P</var> depends on the <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of the component in <var>Q</var>, optionally modified
+                        by two elements that may appear as children of the
+                        <a href="#element-use-package"><code>xsl:use-package</code></a> element, namely <a href="#element-accept"><code>xsl:accept</code></a>
+                        and <a href="#element-override"><code>xsl:override</code></a>.
+                     </p>
+                     <p>For every component <var>C<sub>Q</sub></var> in package <var>Q</var> that is not matched
+                        by any <a href="#element-override"><code>xsl:override</code></a> or <a href="#element-accept"><code>xsl:accept</code></a> element in
+                        the package manifest of <var>P</var>, there will be a corresponding component
+                        <var>C<sub>P</sub></var> in package <var>P</var> that has the same <a title="symbolic identifier" class="termref" href="#dt-symbolic-identifier">symbolic identifier</a> and <a title="declaration" class="termref" href="#dt-declaration">declaration</a> as <var>C<sub>Q</sub></var>.
+                     </p>
+                     <p>If <var>C<sub>Q</sub></var> is an <a href="#element-param"><code>xsl:param</code></a>
+                        component, then the <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of <var>C<sub>P</sub></var> is
+                        <code>public</code>.
+                     </p>
+                     <p>In other cases, the <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of <var>C<sub>P</sub></var> 
+                        <span>depends on the <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of <var>C<sub>Q</sub></var>, as defined by the following table:</span></p>
+                     <div class="overlarge"><table class="data">
+                        <caption>Visibility of Components in Used and Using Packages</caption>
+                        <thead>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">Visibility in used package <var>C<sub>Q</sub></var></th>
+                              <th style="text-align:left; vertical-align:top">Visibility in using package <var>C<sub>P</sub></var></th>
+                           </tr>
+                        </thead>
+                        <tbody>
+                           <tr>
+                              <td style="text-align:left; vertical-align:top">public</td>
+                              <td style="text-align:left; vertical-align:top">private</td>
+                           </tr>
+                           <tr>
+                              <td style="text-align:left; vertical-align:top">final</td>
+                              <td style="text-align:left; vertical-align:top">private</td>
+                           </tr>
+                           <tr>
+                              <td style="text-align:left; vertical-align:top">private</td>
+                              <td style="text-align:left; vertical-align:top">hidden</td>
+                           </tr>
+                           <tr>
+                              <td style="text-align:left; vertical-align:top">hidden</td>
+                              <td style="text-align:left; vertical-align:top">hidden</td>
+                           </tr>
+                           <tr>
+                              <td style="text-align:left; vertical-align:top">abstract</td>
+                              <td style="text-align:left; vertical-align:top">hidden</td>
+                           </tr>
+                        </tbody>
+                     </table></div>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>The effect of these rules is as follows:</p>
+                        <ul>
+                           <li>
+                              <p>Components that are public or final in the used package <var>Q</var> become
+                                 private in the using package <var>P</var>. This means that they can be referenced
+                                 within <var>P</var> but are not (by default) visible within a package <var>R</var>
+                                 that uses <var>P</var>.
+                              </p>
+                           </li>
+                           <li>
+                              <p>Components that are private or hidden in the used package <var>Q</var> become
+                                 hidden in the using package <var>P</var>. This means that they cannot be referenced
+                                 within <var>P</var>; but if they contain references to components that are overridden
+                                 in <var>P</var>, the hidden component’s references are bound to the overriding components
+                                 in <var>P</var>.
+                              </p>
+                           </li>
+                           <li>
+                              <p>Components that are abstract in the used package <var>Q</var> become
+                                 hidden in the using package <var>P</var>. The hidden component in this case raises a dynamic
+                                 error if it is invoked. Such an invocation cannot originate within <var>P</var>,
+                                 because the component is not visible within <var>P</var>; but it can occur
+                                 if a public component in <var>Q</var> is invoked, which in turn invokes the abstract
+                                 component.
+                              </p>
+                           </li>
+                        </ul>
+                     </div>
+                     <p class="element-syntax"><a id="element-accept"></a><code>&lt;xsl:accept<br />  <b>component</b> = "template" | "function" | "attribute-set" | "variable" | "mode" | "*"<br />  <b>names</b> = <var>tokens</var><br />  <b>visibility</b> = "public" | "private" | "final" | "abstract" | "hidden" /&gt;</code></p>
+                     <p>The <a href="#element-accept"><code>xsl:accept</code></a> element has very similar syntax and semantics
+                        to <a href="#element-expose"><code>xsl:expose</code></a>. Whereas <a href="#element-expose"><code>xsl:expose</code></a> allows a
+                        package to restrict the visibility of its own components to other (using)
+                        packages, <a href="#element-accept"><code>xsl:accept</code></a> allows a package to restrict the
+                        visibility of components exposed by a package that it uses. This may be
+                        necessary if, for example, it uses two different packages whose component names
+                        conflict. It may also simply be good practice if the package author knows that
+                        only a small subset of the functionality of a used package is required.
+                     </p>
+                     <p>The rules for determining whether an <a href="#element-accept"><code>xsl:accept</code></a> element
+                        matches a particular component, and for which element to use if there are
+                        several matches, are the same as the rules for the <a href="#element-expose"><code>xsl:expose</code></a>
+                        element.
+                     </p>
+                     <p>No <a href="#element-accept"><code>xsl:accept</code></a> element
+                        ever matches a variable declared using <a href="#element-param"><code>xsl:param</code></a>.
+                     </p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>Attempting to match an <a href="#element-param"><code>xsl:param</code></a> with
+                           an explicit <code>EQName</code> will therefore always give an error, while
+                           using a wildcard has no effect.
+                        </p>
+                     </div>
+                     <p>
+                        <a id="err-XTSE3030"><span class="error">[ERR XTSE3030] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if a token
+                        in the <code>names</code> attribute of <a href="#element-accept"><code>xsl:accept</code></a>, other
+                        than a wildcard, matches no component in the used package.
+                        
+                     </p>
+                     <p>
+                        <a id="err-XTSE3032"><span class="error">[ERR XTSE3032] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if the 
+                        <code>component</code> attribute of <a href="#element-accept"><code>xsl:accept</code></a> specifies <code>*</code>
+                        (meaning all component kinds) and the <code>names</code> attribute is not a wildcard.
+                        
+                     </p>
+                     <p>In the absence of a matching <a href="#element-override"><code>xsl:override</code></a> element (see
+                        <a href="#package-overriding-components"><i>3.5.3.3 Overriding Components from a Used Package</i></a>), the <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of a component that matches an
+                        <a href="#element-accept"><code>xsl:accept</code></a> element depends both on the
+                        <code>visibility</code> attribute of the best-matching
+                        <a href="#element-accept"><code>xsl:accept</code></a> element and on the <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of the corresponding component in the used package,
+                        according to the following table. In this table the entry “N/P” means “not
+                        permitted”.
+                     </p>
+                     <div class="overlarge"><table class="data">
+                        <caption>Relationship of the Visibility given in xsl:accept to Visibility in the Used Package</caption>
+                        <thead>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top" rowspan="2">Visibility in <a href="#element-accept"><code>xsl:accept</code></a> element
+                              </th>
+                              <th style="text-align:left; vertical-align:top" colspan="4">Visibility in used package</th>
+                           </tr>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">public</th>
+                              <th style="text-align:left; vertical-align:top">private</th>
+                              <th style="text-align:left; vertical-align:top">final</th>
+                              <th style="text-align:left; vertical-align:top">abstract</th>
+                           </tr>
+                        </thead>
+                        <tbody>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">public</th>
+                              <td style="text-align:left; vertical-align:top">public</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                           </tr>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">private</th>
+                              <td style="text-align:left; vertical-align:top">private</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">private</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                           </tr>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">final</th>
+                              <td style="text-align:left; vertical-align:top">final</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">final</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                           </tr>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">abstract</th>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">abstract</td>
+                           </tr>
+                           <tr>
+                              <th style="text-align:left; vertical-align:top">hidden</th>
+                              <td style="text-align:left; vertical-align:top">hidden</td>
+                              <td style="text-align:left; vertical-align:top">N/P</td>
+                              <td style="text-align:left; vertical-align:top">hidden</td>
+                              <td style="text-align:left; vertical-align:top"><span>hidden</span></td>
+                           </tr>
+                        </tbody>
+                     </table></div>
+                     <p>
+                        <a id="err-XTSE3040"><span class="error">[ERR XTSE3040] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if the
+                        visibility assigned to a component by an <a href="#element-accept"><code>xsl:accept</code></a>
+                        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
+                        <a href="#element-accept"><code>xsl:accept</code></a> element is treated as not matching that
+                        component.
+                        
+                     </p>
+                     <p>
+                        <a id="err-XTSE3050"><span class="error">[ERR XTSE3050] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if the
+                        <a href="#element-use-package"><code>xsl:use-package</code></a> elements in a <a title="package manifest" class="termref" href="#dt-package-manifest">package manifest</a> cause two or more
+                        <a title="homonymous" class="termref" href="#dt-homonymous">homonymous</a> components to be
+                        accepted with a visibility other than <code>hidden</code>.
+                        
+                     </p>
+                     <p>Conflicts between the components accepted from used packages and those declared
+                        within the package itself are handled as follows:
+                     </p>
+                     <ol class="enumar">
+                        <li>
+                           <p>If the conflict is between two components both declared within the
+                              package itself, then it is resolved by the rules relating to <a title="import precedence" class="termref" href="#dt-import-precedence">import precedence</a> defined for
+                              each kind of component.
+                           </p>
+                        </li>
+                        <li>
+                           <p>If the conflict is between two components both accepted from used
+                              packages, or between a component declared within the package and an
+                              accepted component, then a static error occurs.
+                           </p>
+                        </li>
+                        <li>
+                           <p>If a component is explicitly accepted from a used package (by name, rather
+                              than by a matching wildcard), and if the same component is the subject
+                              of an <a href="#element-override"><code>xsl:override</code></a> declaration, then a static error
+                              occurs (see below). There is no conflict, however, if a component declared
+                              within <a href="#element-override"><code>xsl:override</code></a> also matches a wildcard in an <a href="#element-accept"><code>xsl:accept</code></a>
+                              element.
+                           </p>
+                           <p>
+                              <a id="err-XTSE3051"><span class="error">[ERR XTSE3051] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if
+                              a token in the <code>names</code> attribute of <a href="#element-accept"><code>xsl:accept</code></a>,
+                              other than a wildcard, matches the symbolic name of a component declared
+                              within an <a href="#element-override"><code>xsl:override</code></a> child of the same
+                              <a href="#element-use-package"><code>xsl:use-package</code></a> element.
+                              
+                           </p>
+                        </li>
+                     </ol>
+                     <p>Where the used package <var>Q</var> contains a component whose
+                        visibility is <code>abstract</code>, the using package <var>P</var> has three options:
+                     </p>
+                     <ol class="enumar">
+                        <li>
+                           <p><var>P</var> can accept the component with <code>visibility="abstract"</code>.
+                              In this case <var>P</var> can contain references to the component, but invocation via
+                              these references will fail unless a non-abstract overriding component has
+                              been supplied in some package <var>R</var> that (directly or indirectly) uses <var>P</var>.
+                           </p>
+                        </li>
+                        <li>
+                           <p><var>P</var> can accept the component with <code>visibility="hidden"</code>.
+                              In this case <var>P</var> cannot contain references to the component, and invocation via
+                              references in <var>Q</var> will always fail with a dynamic error. This is the default
+                              if <var>P</var> does not explicitly accept or override the component.
+                           </p>
+                        </li>
+                        <li>
+                           <p><var>P</var> can provide a concrete implementation of the component
+                              within an <a href="#element-override"><code>xsl:override</code></a> element.
+                           </p>
+                        </li>
+                     </ol>
+                     <p>Any invocation of the absent component (typically from within its
+                        declaring package) causes a dynamic error, as if the component were
+                        overridden by a component that unconditionally raises a dynamic
+                        error.
+                     </p>
+                     <p>
+                        <a id="err-XTDE3052"><span class="error">[ERR XTDE3052] </span></a>It is a <a title="dynamic error" class="termref" href="#dt-dynamic-error">dynamic error</a> if
+                        an invocation of an abstract component is evaluated.
+                        
+                        
+                     </p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>This can occur when a public component in the used package invokes
+                           an abstract component in the used package, and the using package provides
+                           no concrete implementation for the component in an <a href="#element-override"><code>xsl:override</code></a>
+                           element.
+                        </p>
+                     </div>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>To override a component accepted from a used package, the overriding
+                           declaration must appear as a child of the <a href="#element-override"><code>xsl:override</code></a>
+                           element.
+                        </p>
+                     </div>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>There is no rule that prevents a function (say) being declared in the using
+                           package with the same name as a <code>private</code> function in the used
+                           package. This does not create a conflict, since all references in the used
+                           package are bound to one function and all those in the using package are
+                           bound to another.
+                        </p>
+                     </div>
+                  </div>
+                  <div class="div4">
+                     
+                     <h5><a id="package-overriding-components"></a>3.5.3.3 <a href="#package-overriding-components" style="text-decoration: none">Overriding Components from a Used Package</a></h5>
+                     <p><span class="definition">[Definition: </span><a id="dt-override" title="override"></a>A component in a using package may
+                        <b>override</b> a component in a used package, provided that the
+                        <a title="visibility" class="termref" href="#dt-visibility">visibility</a> of the component in the
+                        used package is either <code>abstract</code> or <code>public</code>. The
+                        overriding declaration is written as a child of the
+                        <a href="#element-override"><code>xsl:override</code></a> element, which in turn appears as a child
+                        of <a href="#element-use-package"><code>xsl:use-package</code></a>.<span class="definition">]</span></p>
+                     <p class="element-syntax"><a id="element-override"></a><code>&lt;xsl:override&gt;<br />  &lt;!-- Content: (<a href="#element-template">xsl:template</a> | <a href="#element-function">xsl:function</a> | <a href="#element-variable">xsl:variable</a> | <a href="#element-param">xsl:param</a> | <a href="#element-attribute-set">xsl:attribute-set</a>)* --&gt;<br />&lt;/xsl:override&gt;</code></p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>This mechanism is distinct from the mechanism for overriding declarations
+                           within the same package by relying on <a title="import precedence" class="termref" href="#dt-import-precedence">import precedence</a>. It imposes stricter rules: the overriding
+                           component is required to be type-compatible with the component that it
+                           overrides.
+                        </p>
+                     </div>
+                     <p>If the used package <var>Q</var> contains a <a title="component" class="termref" href="#dt-component">component</a>
+                        <var>C<sub>Q</sub></var> and the <a href="#element-use-package"><code>xsl:use-package</code></a> element contains an
+                        <a href="#element-override"><code>xsl:override</code></a> element which contains a declaration
+                        <var>D</var> whose <a title="symbolic identifier" class="termref" href="#dt-symbolic-identifier">symbolic
+                           identifier</a> matches the symbolic identifier of <var>C<sub>Q</sub></var>, then
+                        the using package <var>P</var> will contain a component <var>C<sub>P</sub></var> whose
+                        declaration is D, whose symbolic identifier is that of D, and whose <a title="visibility" class="termref" href="#dt-visibility">visibility</a> is equal to the value of the <code>visibility</code>
+                        attribute of <var>D</var>, or <code>private</code> if this is absent, 
+                        <span>except in the case
+                           of <a href="#element-param"><code>xsl:param</code></a>, which is implicitly
+                           <code>public</code></span>.
+                     </p>
+                     <p>The using package <var>P</var> will also contain a component <var>C<sub>PQ</sub></var>
+                        whose body is the same as the body of <var>C<sub>Q</sub></var> and whose <a title="visibility" class="termref" href="#dt-visibility">visibility</a> is <code>hidden</code>. This
+                        component is used as the target of a binding for the symbolic reference
+                        <code>xsl:original</code> described below.
+                     </p>
+                     <p>Other than its appearance as a child of <a href="#element-override"><code>xsl:override</code></a>, the
+                        overriding declaration is a normal <a href="#element-function"><code>xsl:function</code></a>,
+                        <a href="#element-template"><code>xsl:template</code></a>, ,
+                        <a href="#element-variable"><code>xsl:variable</code></a>, <a href="#element-param"><code>xsl:param</code></a>, or
+                        <a href="#element-attribute-set"><code>xsl:attribute-set</code></a> element. In the case of
+                        <a href="#element-variable"><code>xsl:variable</code></a> and <a href="#element-param"><code>xsl:param</code></a>, the variable
+                        that is declared is a <a title="global variable" class="termref" href="#dt-global-variable">global
+                           variable</a>.
+                     </p>
+                     <p>The rules in the remainder of this section apply to
+                        components having a <code>name</code> attribute (<b>named
+                           components</b>). The only element with no <code>name</code> attribute that
+                        can appear as a child of <a href="#element-override"><code>xsl:override</code></a> is an
+                        <a href="#element-template"><code>xsl:template</code></a> declaration having a <code>match</code>
+                        attribute (that is, a <a title="template rule" class="termref" href="#dt-template-rule">template rule</a>). The rules for
+                        overriding of template rules appear in <a href="#modes-and-packages"><i>3.5.4 Overriding Template Rules from a Used Package</i></a>. If
+                        an <a href="#element-template"><code>xsl:template</code></a> element has both a <code>name</code> attribute
+                        and a <code>match</code> attribute, then it defines both a named component and
+                        a template rule, and both sections apply.
+                     </p>
+                     <p>
+                        <a id="err-XTSE3055"><span class="error">[ERR XTSE3055] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if a
+                        component declaration appearing as a child of
+                        <a href="#element-override"><code>xsl:override</code></a> is <a title="homonymous" class="termref" href="#dt-homonymous">homonymous</a> with any other declaration in the using package,
+                        regardless of <a title="import precedence" class="termref" href="#dt-import-precedence">import
+                           precedence</a>, including any other overriding declaration in
+                        the package manifest of the using package.
+                     </p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>When an attribute set is overridden, the
+                           overriding attribute set must be defined using a single
+                           <a href="#element-attribute-set"><code>xsl:attribute-set</code></a> element. Attribute sets defined in
+                           different packages are never merged by virtue of having the same name,
+                           though they may be merged explicitly by using the
+                           <code>use-attribute-sets</code> attribute.
+                        </p>
+                     </div>
+                     <p>
+                        <a id="err-XTSE3058"><span class="error">[ERR XTSE3058] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if a
+                        component declaration appearing as a child of
+                        <a href="#element-override"><code>xsl:override</code></a> does not match (is not <a title="homonymous" class="termref" href="#dt-homonymous">homonymous</a> with) some component in the
+                        used package.
+                     </p>
+                     <p>
+                        <a id="err-XTSE3060"><span class="error">[ERR XTSE3060] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if the
+                        component referenced by an <a href="#element-override"><code>xsl:override</code></a> declaration has
+                        <a title="visibility" class="termref" href="#dt-visibility">visibility</a> other than
+                        <code>public</code> or <code>abstract</code>
+                        
+                     </p>
+                     <p>A package is executable if and only if it contains no <a title="component" class="termref" href="#dt-component">component</a> whose <a title="visibility" class="termref" href="#dt-visibility">visibility</a> is <code>abstract</code>. A package that is not
+                        executable is not a <a title="stylesheet" class="termref" href="#dt-stylesheet">stylesheet</a>, and
+                        therefore cannot be nominated as the stylesheet to be used when initiating a
+                        transformation.
+                     </p>
+                     <div class="note">
+                        <p class="prefix"><b>Note:</b></p>
+                        <p>In other words, if a component is declared as abstract, then some package
+                           that uses the declaring package of that component directly or indirectly
+                           must override that component with one that is not abstract. It is not
+                           necessary for the override to happen in the immediately using package.
+                        </p>
+                     </div>
+                     <p>
+                        <a id="err-XTSE3070"><span class="error">[ERR XTSE3070] </span></a>It is a <a title="static error" class="termref" href="#dt-static-error">static error</a> if the
+                        signature of an overriding component is not <a title="compatible" class="termref" href="#dt-compatible">compatible</a> with the signature of the component that it is
+                        overriding.
+                        
+                     </p>
+                     <p><span class="definition">[Definition: </span><a id="dt-compatible" title="compatible"></a>The signatures of two <a title="component" class="termref" href="#dt-component">components</a> are <b>compatible</b> if
+                        they present the same interface to the user of the component. The additional
+                        rules depend on the kind of component.<span class="definition">]</span></p>
+                     <p>Compatibility is only relevant when comparing two components that have the same
+                        <a title="symbolic identifier" class="termref" href="#dt-symbolic-identifier">symbolic identifier</a>. The compatibility rules for each
+                        kind of component are as follows:
+                     </p>
+                     <ul>
+                        <li>
+                           <p>Two attribute sets with the same name are compatible if
+                              and only if they satisfy the following rule:
+                           </p>
+                           <ol class="enumar">
+                              <li>
+                                 <p>If the overridden attribute set specifies
+                                    <code>streamable="yes"</code> then the overriding attribute set
+                                    also specifies <code>streamable="yes"</code>.
+                                 </p>
+                              </li>
+                           </ol>
+                        </li>
+                        <li>
+                           <p>Two functions with the same name and arity are compatible if and only if
+                              they satisfy all the following rules:
+                           </p>