<?xml version="1.0" encoding="UTF-8"?><article id="functions" title="Reference: Function library">
  <h1>Reference: Function library</h1>

  <p>Hover over a listed function to view a brief description. For full details, select the function
    entry.</p>
  <section id="fn" title="Namespace fn">
    <h1>Namespace fn</h1>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">abs</name>
      <signatures>
        <proto return-type="xs:numeric?">
          <arg name="value" type="xs:numeric?" desc="The input number"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/abs">math:abs()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the absolute value of a given number. Returns the same type as the supplied
          argument.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">accumulator-after</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="name" type="xs:string" desc="The name of the accumulator"/>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL_SINCE_9.8 PE/EE_9.6</saxon-edition>
      <description>
        <p>Returns the post-descent value of the selected accumulator at the context node. See <a class="bodylink code" href="/xsl-elements/accumulator">xsl:accumulator</a> for more on
          accumulators.</p>
      </description>
      <see-also name="accumulator-before" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">accumulator-before</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="name" type="xs:string" desc="The name of the accumulator"/>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL_SINCE_9.8 PE/EE_9.6</saxon-edition>
      <description>
        <p>Returns the pre-descent value of the selected accumulator at the context node. See <a class="bodylink code" href="/xsl-elements/accumulator">xsl:accumulator</a> for more on
          accumulators.</p>
      </description>
      <see-also name="accumulator-after" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">adjust-date-to-timezone</name>
      <signatures>
        <proto return-type="xs:date?">
          <arg name="value" type="xs:date?" desc="The input date"/>
          <arg name="timezone" type="xs:dayTimeDuration?" default="fn:implicit-timezone()" desc="The new timezone, as an offset from UTC, or () for no timezone"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a date value equivalent to the original date, but adjusted to a different
          timezone, or with the timezone removed.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">adjust-dateTime-to-timezone</name>
      <signatures>
        <proto return-type="xs:dateTime?">
          <arg name="value" type="xs:dateTime?" desc="The input date/time"/>
          <arg name="timezone" type="xs:dayTimeDuration?" default="fn:implicit-timezone()" desc="The new timezone, as an offset from UTC, or () for no timezone"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a dateTime value equivalent to the original dateTime, but adjusted to a different
          timezone, or with the timezone removed.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">adjust-time-to-timezone</name>
      <signatures>
        <proto return-type="xs:time?">
          <arg name="value" type="xs:time?" desc="The input time"/>
          <arg name="timezone" type="xs:dayTimeDuration?" default="fn:implicit-timezone()" desc="The new timezone, as an offset from UTC, or () for no timezone"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a time value equivalent to the original time, but adjusted to a different
          timezone, or with the timezone removed.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">all-different</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="values" type="xs:anyAtomicType*" desc="The input sequence"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns <code>true</code> if no two items in the supplied sequence are equal.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">all-equal</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="values" type="xs:anyAtomicType*" desc="The input sequence"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns <code>true</code> if all items in the supplied sequence (after atomization) are
          equal.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">analyze-string</name>
      <signatures>
        <proto return-type="element(fn:analyze-string-result)">
          <arg name="value" type="xs:string?" desc="The input string"/>
          <arg name="pattern" type="xs:string" desc="A regular expression"/>
          <arg name="flags" type="xs:string?" default="&#34;&#34;" desc="Flags controlling the interpretation of the regular expression"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.3.</p>
        <p>Saxon supports extended syntax for the flags argument: see the <code>fn:matches</code>
          function for details.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Analyzes a string using a regular expression, returning an XML structure that identifies
          which parts of the input string matched or failed to match the regular expression, and in
          the case of matched substrings, which substrings matched each capturing group in the
          regular expression.</p>
      </description>
      <see-also name="matches" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">apply</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="function" type="fn(*)" desc="The function to be applied"/>
          <arg name="arguments" type="array(*)" desc="Array whose members are to be used as arguments to the function"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7. Available in Saxon-HE since 10.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.7</saxon-edition>
      <description>
        <p>Makes a dynamic call on a function with an argument list supplied in the form of an
          array.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">apply-templates</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="select" type="item()*" desc="Selected items for which to apply templates"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map used to supply non-tunnel parameters, tunnel parameters, and the mode to be used"/>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Applies template rules to selected items.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">atomic-equal</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="value1" type="xs:anyAtomicType" desc="The first item"/>
          <arg name="value2" type="xs:anyAtomicType" desc="The second item"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.1 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Determines whether two atomic items are equal, under the rules used for comparing keys in
          a map.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">atomic-type-annotation</name>
      <signatures>
        <proto return-type="fn:schema-type-record">
          <arg name="value" type="xs:anyAtomicType" desc="The input item"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns a record containing information about the type annotation of an atomic item.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">available-environment-variables</name>
      <signatures>
        <proto return-type="xs:string*">
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.4, but without enforcing the rule that the result must be
          deterministic.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns a list of environment variable names that are suitable for passing to
            <code>environment-variable()</code>, as a (possibly empty) sequence of strings.</p>
      </description>
      <see-also name="environment-variable" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">available-system-properties</name>
      <signatures>
        <proto return-type="xs:QName*">
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
      <description>
        <p>Returns a list of system property names that are suitable for passing to
            <code>system-property()</code>, as a sequence of QNames.</p>
      </description>
      <see-also name="system-property" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">avg</name>
      <signatures>
        <proto return-type="xs:anyAtomicType?">
          <arg name="values" type="xs:anyAtomicType*" desc="The input sequence of numbers or durations"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the average of a set of numbers or durations.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">base-uri</name>
      <signatures>
        <proto return-type="xs:anyURI?">
          <arg name="node" type="node()?" default="." desc="The node whose base URI is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <details>
        <p>If a node is supplied to Saxon as a JAXP <code>Source</code> object, then the base URI of
          the document node will be the value returned by the method
            <code>Source.getSystemId()</code>. The base URI of other nodes within the document may
          differ from this for either of two reasons:</p>
        <ul>
          <li>An <code>xml:base</code> attribute may be present on an element to identify the base
            URI for that element and its contained subtree.</li>
          <li>In the case of documents delivered by a SAX parser, the base URI of nodes constructed
            from the content of an external entity will reflect the location of that entity.</li>
        </ul>
        <p>It is possible for the base URI of a document to be absent (unknown). This happens when
          the document is supplied to Saxon with no location information: for example when the node
          is represented using a tree model such as DOM that has no base URI information; or when a
            <code>Source</code> is supplied for which <code>getSystemId()</code> returns null. The
          most common example of this is a <code>Source</code> created using <code>new
            StreamSource(new FileInputStream("input.xml"))</code>. The problem can be fixed by using
          the second argument of the <code>StreamSource</code> constructor, or by using the
          constructor that expects a <code>File</code> rather than an <code>InputStream</code>.</p>
        <p>If the base URI is absent, the <code>base-uri()</code> function returns an empty
          sequence. No error occurs unless an operation is needed that requires a base URI, for
          example using the base URI as an argument of <a class="bodylink code" href="/functions/fn/resolve-uri">resolve-uri()</a>.</p>
      </details>
      <description>
        <p>Returns the base URI of a node.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">boolean</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="input" type="item()*" desc="The sequence whose effective boolean value is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Obtains the effective boolean value of the supplied argument. The result is true if the
          argument value is a sequence starting with a node, or the singleton boolean
            <code>true()</code>, a singleton non-zero number, or a singleton non-zero-length string
          (or untypedAtomic). The result is false if the argument is an empty sequence, the
          singleton boolean <code>false()</code>, a singleton number zero or NaN, or a singleton
          zero-length string (or untypedAtomic). In all other cases the result is an error.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">build-dateTime</name>
      <signatures>
        <proto return-type="(xs:dateTime | xs:date | xs:time | xs:gYear | xs:gYearMonth | xs:gMonth | xs:gMonthDay | xs:gDay)?">
          <arg name="value" type="fn:dateTime-record?" desc="The date/time record"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Constructs a date/time value from the values of the components specified.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">build-uri</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="parts" type="fn:uri-structure-record" desc="The components of the URI, provided as a map"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.1 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Constructs a URI from the parts provided.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">ceiling</name>
      <signatures>
        <proto return-type="xs:numeric?">
          <arg name="value" type="xs:numeric?" desc="The supplied number"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Rounds a value towards positive infinity.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">char</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="(xs:string | xs:positiveInteger)" desc="A value identifying a particular character: either a Unicode codepoint, an HTML5             character reference name, or one of the backslash-escape sequences \n, \r or \t"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns a string containing a particular character or glyph.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">character-map</name>
      <signatures>
        <proto return-type="map(xs:string, xs:string)?">
          <arg name="name" type="xs:QName" desc="Name of a declared character map"/>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Delivers the content of a character map declared using <a href="/xsl-elements/character-map" class="bodylink code">xsl:character-map</a>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">characters</name>
      <signatures>
        <proto return-type="xs:string*">
          <arg name="value" type="xs:string?" desc="The input string"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 11 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <description>
        <p>Splits the supplied string into a sequence of single-character strings.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">civil-timezone</name>
      <signatures>
        <proto return-type="xs:dayTimeDuration">
          <arg name="value" type="xs:dateTime" desc="The input date/time"/>
          <arg name="place" type="xs:string?" default="()" desc="An IANA timezone name"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the timezone offset from UTC that is in conventional use at a given place and
          time.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">codepoint-equal</name>
      <signatures>
        <proto return-type="xs:boolean?">
          <arg name="value1" type="xs:string?" desc="The first value to be compared"/>
          <arg name="value2" type="xs:string?" desc="The second value to be compared"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Compares two strings using the Unicode codepoint collation.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">codepoints-to-string</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="values" type="xs:integer*" desc="A sequence of Unicode codepoint values"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The function throws an error if any of the integers doesn't represent a valid XML
          character. With Saxon, the set of valid XML characters depends on whether XML 1.0 or 1.1
          is the chosen version in the <a class="javalink" href="net.sf.saxon.Configuration">Configuration</a>.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Converts a sequence of integers representing Unicode characters to the corresponding
          string. </p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">collation</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="options" type="map(*)" desc="A map defining the properties required of the collation"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Constructs a collation URI with requested properties.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">collation-available</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="collation" type="xs:string" desc="A collation URI"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Asks whether a collation URI is recognized by the implementation.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">collation-key</name>
      <signatures>
        <proto return-type="xs:base64Binary">
          <arg name="value" type="xs:string" desc="A string whose collation key is required"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="A collation URI"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Fully available since Saxon 9.7. Available since Saxon 9.6 for use with XSLT 3.0
          enabled.</p>
        <p>Since 9.7.0.10, the implementation always returns the collation key as a value of type
            <code>xs:base64Binary</code>.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.7</saxon-edition>
      <description>
        <p>Returns a value that can be used for matching strings under a given collation. If two
          strings are equal under a given collation, then <code>collation-key()</code> when applied
          to these two strings returns values that compare equal.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">collection</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="source" type="xs:string?" default="()" desc="The supplied collection URI"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon implements the zero-argument function by using the default collection URI
          registered with the <code>Configuration</code>; if none has been registered, the function
          raises error <code>FODC0002</code>.</p>
        <p>If a user-defined <code>CollectionFinder</code> has been registered, the action of this
          function is entirely user-defined. A collection finder may be registered using the
            <code>setCollectionFinder()</code> method on the <a class="javalink" href="net.sf.saxon.Configuration">Configuration</a> object, or (in XSLT) using
            <code>setAttribute()</code> on the <code>TransformerFactory</code>. The
            <code>CollectionFinder</code> may also be nominated using the <code>-cf</code> option on
          the command line. </p>
        <p>For details of the behavior of the standard collection finder, and more information on
          supplying your own, see <a class="bodylink" href="/sourcedocs/collections">Collections</a>.</p>
        <p>The <code>collection()</code> function is multi-threaded in Saxon-EE (since 9.5). Each
          document in the collection is parsed in a separate thread, and the documents are processed
          in the order in which parsing completes. This makes the order of the documents
          unpredictable.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a sequence of items making up the collection whose URI is supplied; or the
          default collection if no URI is supplied.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">compare</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value1" type="xs:anyAtomicType?" desc="The first string to be compared"/>
          <arg name="value2" type="xs:anyAtomicType?" desc="The second string to be compared"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation to be used for the comparison"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Compares two strings using the specified collation, or the default collation if none is
          supplied.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">concat</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="values" type="xs:anyAtomicType* ..." default="()" desc="A sequence of strings"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Concatenates the string-values of the arguments into a single string. There must be at
          least two arguments.</p>
      </description>
      <details>
        <p class="qt4">From XPath 4.0, the function can take any number of arguments, and the
          arguments can be sequences of strings. Previously, there had to be at least two arguments,
          and these had to be single strings.</p>
      </details>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">contains</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="value" type="xs:string?" desc="The containing string"/>
          <arg name="substring" type="xs:string?" desc="The contained string"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns true if the second string is a substring of the first.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">contains-subsequence</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="subsequence" type="item()*" desc="The subsequence to check for"/>
          <arg name="compare" type="(fn(item(), item()) as xs:boolean?)?" default="fn:deep-equal#2" desc="A comparison function"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 under the previous name
          <code>fn:contains-sequence</code> provided that syntax extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Determines whether one sequence contains another as a contiguous subsequence, using a
          supplied callback function to compare items.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">contains-token</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="value" type="xs:string*" desc="The input string"/>
          <arg name="token" type="xs:string" desc="The token"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
      <description>
        <p>Determines whether or not any of the supplied strings, when tokenized at whitespace
          boundaries, contains the supplied token, under the rules of the supplied collation.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">copy-of</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" default="." desc="The sequence to be copied"/>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.5 for use in XSLT 3.0. Since Saxon 9.6 the function is also made
          available in XQuery.</p>
        <p>Since Saxon 9.7 the function can operate on any sequence of items (not just nodes).</p>
      </status>
      <saxon-edition>ALL_SINCE_9.8 PE/EE_9.5</saxon-edition>
      <description>
        <p>Makes a deep copy of a sequence (typically streamed nodes, to allow navigation within the
          subtree rooted at each node). The zero-argument form applies the function to the context
          item.</p>
      </description>
      <see-also name="snapshot" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">count</name>
      <signatures>
        <proto return-type="xs:integer">
          <arg name="input" type="item()*" desc="The sequence whose items are to be counted"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Counts the number of items in a sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">csv-doc</name>
      <signatures>
        <proto return-type="fn:parsed-csv-structure-record?">
          <arg name="source" type="xs:string?" desc="The URI of the CSV file to be read"/>
          <arg name="options" type="map(*)?" default="{}" desc="Parsing options"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Reads an external resource containing CSV, and returns the results as a record containing
          information about the names in the header, as well as the data itself.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">csv-to-arrays</name>
      <signatures>
        <proto return-type="array(xs:string)*">
          <arg name="value" type="xs:string?" desc="The input CSV data"/>
          <arg name="options" type="map(*)?" default="{}" desc="Parsing options"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Parses CSV data supplied as a string, returning the results in the form of a sequence of
          arrays of strings.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">csv-to-xml</name>
      <signatures>
        <proto return-type="document-node(fn:csv)?">
          <arg name="value" type="xs:string?" desc="The input CSV data"/>
          <arg name="options" type="map(*)?" default="{}" desc="Parsing options"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Parses CSV data supplied as a string, returning the results as an XML document.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">current</name>
      <signatures>
        <proto return-type="item()">
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the item that was the current item supplied on entry to the XPath expression.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">current-date</name>
      <signatures>
        <proto return-type="xs:date">
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the current date.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">current-dateTime</name>
      <signatures>
        <proto return-type="xs:dateTimeStamp">
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the current date and time. Note that this does not change during the execution of
          the query or transformation.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">current-group</name>
      <signatures>
        <proto return-type="item()*">
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon 9.3 and earlier releases implement the XSLT 2.0 definition of this function. The
          additional behaviour associated with the <a href="/xsl-elements/merge" class="bodylink code">xsl:merge</a> instruction was implemented in Saxon 9.4 and 9.5,
          but is dropped in 9.6, because the W3C XSLT 3.0 specification was changed; this use of
            <code>current-group()</code> was replaced by <a class="bodylink code" href="/functions/fn/current-merge-group">current-merge-group()</a>.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the contents of the current group selected by <a href="/xsl-elements/for-each-group" class="bodylink code">xsl:for-each-group</a>. </p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">current-grouping-key</name>
      <signatures>
        <proto return-type="xs:anyAtomicType*">
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the value that is the grouping key of the current group selected by <a href="/xsl-elements/for-each-group" class="bodylink code">xsl:for-each-group</a>. </p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">current-merge-group</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="source" type="xs:string?" default="()" desc="The name of a merge source"/>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The <code>current-merge-group()</code> function is introduced in Saxon 9.6, reflecting
          changes in the XSLT 3.0 specification. It replaces <code>current-group()</code>, which was
          overloaded to handle merging in earlier versions. In Saxon 9.6, the implementation did not
          match the latest version of the W3C spec for this function. Instead of returning a map, it
          returned a sequence containing all the items from the current group, regardless which
          merge source they came from. Since Saxon 9.7, the implementation conforms with the final
          Recommendation.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.8</saxon-edition>
      <description>
        <p>Returns the contents of the current group of items being processed by <a href="/xsl-elements/merge-action" class="bodylink code">xsl:merge-action</a>. </p>
      </description>
      <see-also name="current-merge-key" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">current-merge-key</name>
      <signatures>
        <proto return-type="xs:anyAtomicType*">
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Introduced in Saxon 9.6; previously <code>current-grouping-key()</code> was overloaded
          for this purpose.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.8</saxon-edition>
      <description>
        <p>Used within <a href="/xsl-elements/merge-action" class="bodylink code">xsl:merge-action</a>, this returns the value that is the merge key of the items being
          processed by this activation of <code>xsl:merge-action</code>. </p>
      </description>
      <see-also name="current-merge-group" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">current-merge-key-array</name>
      <signatures>
        <proto return-type="array(xs:anyAtomicType*)">
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the merge key of the merge group currently being processed using the
          <code>xsl:merge</code> instruction.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">current-output-uri</name>
      <signatures>
        <proto return-type="xs:anyURI?">
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.6.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.8 PE/EE_9.6</saxon-edition>
      <description>
        <p>Returns the value of the current output URI.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">current-time</name>
      <signatures>
        <proto return-type="xs:time">
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the current time. Note that this does not change during the execution of the
          query or transformation.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">data</name>
      <signatures>
        <proto return-type="xs:anyAtomicType*">
          <arg name="input" type="item()*" default="." desc="The value to be atomized"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The zero-argument version of this function is available since Saxon 9.3, provided XPath
          3.0 support is enabled.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the result of atomizing a sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">dateTime</name>
      <signatures>
        <proto return-type="xs:dateTime?">
          <arg name="date" type="xs:date?" desc="The supplied date"/>
          <arg name="time" type="xs:time?" desc="The supplied time"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The result will be an instance of <code>xs:dateTimeStamp</code>, and retains nanosecond
          precision (or more typically, the precision of the system clock).</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Combines the given date and time. The result has a timezone if either of the inputs has a
          timezone; if they both have a timezone, then the two timezones must be the same.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">day-from-date</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:date?" desc="The supplied date"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the day component of a date value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">day-from-dateTime</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="(xs:dateTime | xs:date | xs:time | xs:gYear | xs:gYearMonth | xs:gMonth | xs:gMonthDay | xs:gDay)?" desc="The supplied dateTime"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the day component of a dateTime value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">days-from-duration</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:duration?" desc="The supplied dateTime"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the days component of a dayTimeDuration value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">decode-from-uri</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The input URI string"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.4 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Decodes URI-escaped characters in a string.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">deep-equal</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="input1" type="item()*" desc="The first value to be compared"/>
          <arg name="input2" type="item()*" desc="The second value to be compared"/>
          <arg name="options" type="(xs:string | map(*))?" default="{}" desc="The collation to be used whenever strings are compared"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The Saxon implementation handles maps as described for the <code>deep-equal</code>
          specification in the <a class="bodylink" href="http://www.w3.org/TR/xslt-30/#func-deep-equal">XSLT 3.0 Recommendation</a>.</p>
        <p>A Saxon-specific variant of this function is also available, with additional comparison
          options: see <code>saxon:deep-equal</code>. </p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Compares two sequences for deep equality; string values are compared using the specified
          collation; nodes are compared for deep equality of names and content.</p>
      </description>
      <see-also name="deep-equal" namespace="http://saxon.sf.net/"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">default-collation</name>
      <signatures>
        <proto return-type="xs:string">
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Various Saxon APIs allow the default collation to be set for a transformation or query.
          It is also possible to set this from the command line, by using the option
            <code>--defaultCollation</code>.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the name of the default collation. If no collation has been set explicitly this
          will be the URI of the Unicode codepoint collation.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">default-language</name>
      <signatures>
        <proto return-type="xs:language">
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
      <description>
        <p>Returns the value of the default language property from the dynamic context.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">distinct-ordered-nodes</name>
      <signatures>
        <proto return-type="gnode()*">
          <arg name="nodes" type="gnode()*" desc="The input sequence of GNodes"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Removes duplicate GNodes and sorts the input into document order.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">distinct-values</name>
      <signatures>
        <proto return-type="xs:anyAtomicType*">
          <arg name="values" type="xs:anyAtomicType*" desc="The sequence to be de-duplicated"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The current Saxon implementation returns the values in "order of first appearance", but
          it cannot be assumed that this will always remain the case.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the set of distinct values present in a given sequence. </p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">divide-decimals</name>
      <signatures>
        <proto return-type="record(quotient as xs:decimal, remainder as xs:decimal)">
          <arg name="value" type="xs:decimal" desc="The decimal number to be divided"/>
          <arg name="divisor" type="xs:decimal" desc="The number to divide by"/>
          <arg name="precision" type="xs:integer?" default="0" desc="The required precision"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The 4.0 specification states that the limits on precision are implementation-defined.
          Saxon requires the precision to be in the range -100 to +100; a requested precision
          outside this range is adjusted to -100 or +100 as appropriate.</p>
      </status>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Divides one <code>xs:decimal</code> by another to a defined precision, returning both the
          quotient and the remainder.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">do-until</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input value"/>
          <arg name="action" type="fn(item()*, xs:integer) as item()*" desc="The function to be applied to the value iteratively"/>
          <arg name="predicate" type="fn(item()*, xs:integer) as xs:boolean?" desc="The predicate function"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Processes a supplied value repeatedly, continuing when some condition is false, and
          returning the value that satisfies the condition.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">doc</name>
      <signatures>
        <proto return-type="document-node()?">
          <arg name="source" type="xs:string?" desc="The URI of the required document (relative to the static base URI)"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>By default the URI is dereferenced using the conventional URL behaviour, as implemented
          by the Java run-time library; this behaviour can be modified by means of a user-supplied
            <code>URIResolver</code>.</p>
        <p>If the same URI is requested repeatedly, Saxon retains the document node in memory and
          returns the same instance each time.</p>


        <p>The way the URI is handled depends on the <code>URIResolver</code> in use. The standard
          URI resolver has an option (set using <code>-p</code> on the command line, or via options
          on the <code>Configuration</code> or <code>TransformerFactory</code> classes) to recognize
          query parameters in the URI. These are keyword=value pairs, separated by semicolons or
          ampersand characters, giving options for parsing the file located via the URI. The options
          that are then recognized are:</p>

        <ul>
          <li>
            <p>
              <code>validation=strict|lax|preserve|strip</code>: determines how the input document
              will be validated. The options <code>strict</code> and <code>lax</code> require
              Saxon-EE.</p>
          </li>
          <li>
            <p>
              <code>strip-space=yes|no|ignorable</code>: determines whether whitespace-only text
              nodes will be stripped from the source document. (Such nodes are stripped if this is
              requested either using this option, or using <code>xsl:strip-space</code> declarations
              in the stylesheet.) The value <code>ignorable</code> causes whitespace text nodes to
              be stripped if they belong to an element defined in a DTD or schema as having
              element-only content.</p>
          </li>
          <li>
            <p>
              <code>parser=full.class.name</code>: determines the name of the parser (XMLReader) to
              be used to parse this input file. For example,
                <code>parser=org.ccil.cowan.tagsoup.Parser</code> causes John Cowan's TagSoup parser
              for HTML to be used.</p>
          </li>
          <li>
            <p>
              <code>xinclude=yes|no</code>: determines whether XInclude processing should be applied
              to the input document. This overrides any setting in the <a class="javalink" href="net.sf.saxon.Configuration">Configuration</a> (or any command line
              option).</p>
          </li>
        </ul>
        <p class="qt4">From Saxon 13, when XPath 4.0 is enabled, the new two-argument version of the
          function allows some of these options (<code>strip-space</code>, <code>xinclude</code>,
          and <code>xsd-validation</code>), plus other new ones, to be set using a map in the second
          argument. (But note that XInclude processing is not available in SaxonCS, and
          <code>trusted="no"</code> is not yet implemented in SaxonCS.)</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Retrieves an XML document located at the specified URI, parses it, and returns its
          document node.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">doc-available</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="source" type="xs:string?" desc="The URI of the required document (relative to the static base URI)"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon effectively executes the <code>doc()</code> function and returns true if it
          succeeded; as a side-effect, the document will be available in memory for use when the
            <code>doc()</code> function is subsequently called with this URI.</p>
        <p>A user-supplied <code>URIResolver</code> is invoked in the same way as for the
            <code>doc()</code> function.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns true if a document with the given URI can be successfully loaded, false
          otherwise.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">document</name>
      <signatures>
        <proto return-type="node()*">
          <arg name="uri" type="item()*"/>
          <arg name="base-node" type="node()*" default="()"/>
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The Saxon implementation calls the same underlying code as the <code>doc()</code>
          function; the differences are in the way relative URIs are handled, and the fact that a
          single call can process multiple URIs.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Loads one or more documents identified by their URIs (using the base URI of the node
          given in the second argument, if it is supplied, to resolve any relative URIs). URIs are
          handled by the <code>URIResolver</code> in the same way as the <code>doc()</code>
          function.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">document-uri</name>
      <signatures>
        <proto return-type="xs:anyURI?">
          <arg name="node" type="node()?" default="." desc="The node whose document URI is required"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the URI of a document.</p>
      </description>
      <details>
        <div>
          <p>The W3C specification requires that if <code>document-uri(D) = U</code>, then
              <code>doc(U) is D</code>. A consequence of this rule is that two different documents
            cannot have the same document URI. This realisation led to a significant change in the
            implementation of the function between Saxon 10 and 11, with the effect that many
            documents no longer have a document URI. For example, at one time a document built from
            a JAXP <code>Source</code> object would automatically have a <code>document-uri()</code>
            based on the <code>systemID</code> property of the <code>Source</code>. This is no
            longer the case, because there is no way of preventing two different <code>Source</code>
            objects having the same <code>systemID</code> property.</p>

          <p>For documents read using the XPath <code>doc()</code> or <code>document()</code>
            functions, or the XSLT <code>&lt;xsl:source-document&gt;</code> instruction, it will
            normally be the absolutized URI that was used to read the document, even if a
            user-supplied <code>URIResolver</code> redirected the request to some other URI. By
            contrast, the <code>base-uri()</code> function returns the URI of the actual document
            returned by the <code>URIResolver</code>.</p>

          <p>Internally, Saxon maintains a document pool whose scope is a particular transformation
            (or query). The document pool is a set of (URI, document) pairs, and a document has a
              <code>document-uri()</code> property if and only if there is an entry for this pair in
            the document pool.</p>

          <p>Documents read using the <code>collection()</code> function are added to the document
            pool (and therefore have a <code>document-uri()</code> property) if and only if the
            collection is stable. In Saxon, for performance reasons, collections are not stable
            unless the configuration option <code>STABLE_COLLECTION_URI</code> is set, or unless
            stability is requested in some other way, for example by including the parameter
              <code>stable=yes</code> in the collection URI.</p>

        </div>
      </details>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">duplicate-values</name>
      <signatures>
        <proto return-type="xs:anyAtomicType*">
          <arg name="values" type="xs:anyAtomicType*" desc="The input sequence"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the values that appear in a sequence more than once.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">element-available</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="name" type="(xs:string | xs:QName)" desc="The name of the extension element (a lexical QName)"/>
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The effect of the function changed in XSLT 3.0 to return true for all defined elements in
          the XSLT namespace, not only those classified as instructions. Saxon implements the 3.0
          specification.</p>
        <p>If XSLT 4.0 extensions are enabled, then <code>element-available</code>
          returns true for the newly defined elements (such as <code>xsl:item-type</code> and
            <code>xsl:array</code>).</p>
        <p>For <code>xsl:evaluate</code>, <code>element-available()</code> returns true unless the
          configuration option <a class="bodylink" href="/configuration/config-features#DISABLE_XSL_EVALUATE">DISABLE_XSL_EVALUATE</a> is set.</p>
        <p>For <code>xsl:import-schema</code>, <code>element-available()</code> returns true if
          executed under a configuration that supports schema processing (that is, Saxon-EE with a
          suitable license file), provided that the execution target (for exported SEF files) is
          also "EE".</p>
        <p>For a SaxonJS stylesheet using elements in the <code>ixsl</code> namespace (such as
            <code>ixsl:schedule-action</code>), SaxonJ and SaxonCS report <code>element-available()
            = true</code> only if the execution target (for exported SEF files) is "JS".</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Determines whether a particular instruction (typically, an extension element) is
          available for use in a stylesheet.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">element-to-map</name>
      <signatures>
        <proto return-type="map(xs:string, item()?)?">
          <arg name="element" type="element()?" desc="An input element node"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Converts an element node into a map that is suitable for JSON serialization.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">element-to-map-plan</name>
      <signatures>
        <proto return-type="map(xs:string, (fn:element-conversion-plan-record|fn:attribute-conversion-plan-record))">
          <arg name="input" type="(document-node() | element())*" desc="An input sequence of element and document nodes"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Analyzes sample data to generate a conversion plan suitable for use by the
          <code>element-to-map()</code> function.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">element-with-id</name>
      <signatures>
        <proto return-type="element()*">
          <arg name="values" type="xs:string*" desc="The ID value being sought"/>
          <arg name="node" type="node()" default="." desc="A node (typically the root) of the document being searched"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p> Returns the sequence of element nodes that have an <code>ID</code> value matching the
          value of one or more of the <code>IDREF</code> values supplied in <code>$values</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">empty</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="input" type="item()*" desc="The supplied sequence"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns true if the given sequence is empty.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">encode-for-uri</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The string to be encoded for inclusion in a URI"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Applies the %HH escaping convention to a URI, escaping both disallowed characters and
          reserved characters such as "/" and ":".</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">ends-with</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="value" type="xs:string?" desc="The containing string"/>
          <arg name="substring" type="xs:string?" desc="The supposed ending of the string"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns true if the first string ends with the second string.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">ends-with-subsequence</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="subsequence" type="item()*" desc="The subsequence to check for"/>
          <arg name="compare" type="(fn(item(), item()) as xs:boolean?)?" default="fn:deep-equal#2" desc="A comparison function"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 under the previous name
          <code>fn:ends-with-sequence</code> provided that syntax extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Determines whether one sequence ends with another, using a supplied callback function to
          compare items.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">environment-variable</name>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="name" type="xs:string" desc="The name of the required environment variable"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented in Saxon 9.3 under the name <code>get-environment-variable</code>; name
          changed to <code>environment-variable</code> in Saxon 9.4. Available provided XPath 3.0 is
          enabled.</p>
        <p>Implemented in Saxon using the Java method <code>System.getenv()</code>. The rule in the
          XPath specification requiring the result to be deterministic is not enforced.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the value of a system environment variable, if it exists.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">error</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="code" type="xs:QName?" default="()" desc="The error code to be returned"/>
          <arg name="description" type="xs:string?" default="()" desc="An error message"/>
          <arg name="value" type="item()*" default="." desc="An object or value associated with the error"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon allows the first argument to be an empty sequence, treating this as equivalent to
          calling <code>fn:error()</code> with no arguments. The error code (local part and
          namespace URI part) is recorded as part of the exception that's supplied to a user-defined
          JAXP <code>ErrorListener</code>, or that is returned to the calling application. The value
          of the <code>$description</code> is available by calling <code>getMessage()</code> on the
            <code>Exception</code> object. The error details are also available to the
            <code>catch</code> part of a call when using the XQuery 3.0 or XSLT 3.0 try/catch
          construct.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Raises an error.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">escape-html-uri</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The uri to be escaped"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Applies the %HH escaping convention to a URI, according to the rules of the HTML
          specification: that is, non-ASCII characters are escaped, but all ASCII characters,
          including spaces, are retained intact.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">every</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="predicate" type="(fn(item(), xs:integer) as xs:boolean?)?" default="fn:boolean#1" desc="The predicate function"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.4 provided that syntax
          extensions are enabled, and since Saxon 11 under the previous name <code>fn:all</code>.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns <code>true</code> if every item in the input sequence satisfies a supplied
          predicate.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">exactly-one</name>
      <signatures>
        <proto return-type="item()">
          <arg name="input" type="item()*" desc="The sequence to be tested"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Checks whether <code>$input</code> contains exactly one item; fails if it is empty or
          contains multiple items.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">exists</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns true if the given sequence is not empty.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">expanded-QName</name>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="value" type="xs:QName?" desc="The input QName"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns a string representation of an <code>xs:QName</code> in the format
            <code>Q{uri}local</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">false</name>
      <signatures>
        <proto return-type="xs:boolean">
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the boolean value false.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">filter</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The sequence to be filtered"/>
          <arg name="predicate" type="fn(item(), xs:integer) as xs:boolean?" desc="The filtering function (used to test each item in the sequence)"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon 9.3 - 9.5 with altered argument order (<code>$predicate,$input</code>), and
          provided XPath 3.0 is enabled.</p>
        <p>Saxon 10, unlike the W3C XSLT 3.0 specification, makes <code>fn:filter</code> streamable
          under appropriate circumstances. Calls on <code>fn:filter</code> are streamable provided
          that the function supplied as the predicate is either (a) a reference to a user-declared
          stylesheet function declared with <code>streamability="inspection"</code>, or (b) an
          inline function whose body is grounded and motionless. More specifically, if the predicate
          function satisfies these conditions then the posture and sweep of the function call are
          the same as the posture and sweep of the first argument.</p>
        <p>Available in Saxon-HE from Saxon 10; in Saxon-PE/EE since 9.6.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.6</saxon-edition>
      <description>
        <p>Returns those items from the sequence <code>$input</code> for which the supplied function
          <code>$predicate</code> returns true.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">floor</name>
      <signatures>
        <proto return-type="xs:numeric?">
          <arg name="value" type="xs:numeric?" desc="The input number"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Rounds a number towards minus infinity.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">fold-left</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="init" type="item()*" desc="The initial value (the value to be returned if the sequence is empty)"/>
          <arg name="action" type="fn(item()*, item()) as item()*" desc="The function to be applied to each item in the sequence"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE since 10; in Saxon-PE/EE since 9.6.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.6</saxon-edition>
      <description>
        <p>Processes the supplied sequence from left to right, applying the supplied function
          repeatedly to each item in turn, together with an accumulated result value.</p>
      </description>
      <see-also name="fold-right" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">fold-right</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="init" type="item()*" desc="The initial value (the value to be returned if the sequence is empty)"/>
          <arg name="action" type="fn(item(), item()*) as item()*" desc="The function to be applied to each item in the sequence"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE since 10; in Saxon-PE/EE since 9.6.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.6</saxon-edition>
      <description>
        <p>Processes the supplied sequence from right to left, applying the supplied function
          repeatedly to each item in turn, together with an accumulated result value.</p>
      </description>
      <see-also name="fold-left" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">foot</name>
      <signatures>
        <proto return-type="item()?">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns the last item in a sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">for-each</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence: the supplied function will be applied to each item in this sequence"/>
          <arg name="action" type="fn(item(), xs:integer) as item()*" desc="The function item to be invoked on each member of the supplied sequence"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE since 10; in Saxon-PE/EE since 9.6.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.6</saxon-edition>
      <description>
        <p>Applies the function item <code>$action</code> to every item from the sequence
          <code>$input</code> in turn, returning the concatenation of the resulting sequences in
          order.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">for-each-pair</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input1" type="item()*" desc="The first sequence"/>
          <arg name="input2" type="item()*" desc="The second sequence"/>
          <arg name="action" type="fn(item(), item(), xs:integer) as item()*" desc="The function which will be applied to each pair of items from the two sequences"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE since 10; in Saxon-PE/EE since 9.6.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.6</saxon-edition>
      <description>
        <p>Applies the function item <code>$action</code> to successive pairs of items taken one from
          <code>$input1</code> and one from <code>$input2</code>, returning the concatenation of the
          resulting sequences in order.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">format-date</name>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="value" type="xs:date?" desc="The date to be formatted"/>
          <arg name="picture" type="xs:string" desc="Picture showing how the date is to be formatted"/>
          <arg name="language" type="xs:string?" default="()" desc="The language for the output"/>
          <arg name="calendar" type="xs:string?" default="()" desc="The calendar for the output"/>
          <arg name="place" type="xs:string?" default="()" desc="The country or Olson timezone associated with the event"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt20</in-spec>
        </proto>
      </signatures>
      <status>
        <p>See <code>format-dateTime</code>.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <see-also name="format-dateTime" namespace="http://www.w3.org/2005/xpath-functions"/>
      <description>
        <p>Formats a date, using a format controlled by the picture string.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">format-dateTime</name>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="value" type="xs:dateTime?" desc="The dateTime to be formatted"/>
          <arg name="picture" type="xs:string" desc="Picture showing how the dateTime is to be formatted"/>
          <arg name="language" type="xs:string?" default="()" desc="The language for the output"/>
          <arg name="calendar" type="xs:string?" default="()" desc="The calendar for the output"/>
          <arg name="place" type="xs:string?" default="()" desc="The country or Olson timezone where the event took place"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt20</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Formats a date, using a format controlled by the picture string. If no language is
          specified, the value is taken from the current Java locale. If the language (explicitly
          supplied or defaulted) is other than <code>en</code>, the system tries to locate a
          localization class for the language (called, for historic reasons, a <i>Numberer</i>);
          this class must provide methods to perform the localization.</p>

        <p>Support for English (<code>language="en"</code>) is built-in in all versions of the
          product.</p>

        <p>In Saxon-PE and Saxon-EE, support for a variety of other languages is provided by
          facilities from the <a href="http://site.icu-project.org/">ICU - International Components
            for Unicode</a>. For full details see <a href="/localization/ICU-numbers-and-dates">Numbers and dates from ICU</a>.</p>
        

        <p>Localization modules for other languages can be configured. They are written to implement
          the interface <a class="javalink" href="net.sf.saxon.lib.Numberer">Numberer</a>, typically
          as subclasses of <a class="javalink" href="net.sf.saxon.expr.number.AbstractNumberer">AbstractNumberer</a>. In Saxon-HE they are configured as described above. In Saxon-PE
          and Saxon-EE they can be registered in one of two ways: programmatically using the call
            <code>Configuration.getLocalizerFactory().setLanguageProperties("ja", props))</code>
          where <code>props</code> is a <code>Properties</code> object in which the
            <code>class</code> property is set to the name of the relevant <code>Numberer</code>
          class; or by setting an entry in the <a href="/configuration/configuration-file">configuration file</a>. For more information on writing localization modules, see <a href="/localization/localizing-numbers-and-dates">Localizing numbers and dates</a>.</p>

        <p>If a calendar other than AD or ISO is specified, the result is prefixed "[Calendar: AD]"
          and is otherwise output as if the default calendar were used.</p>

        <p>The country argument is currently used only when the format requests output of timezones
          by name (using <code>[ZN]</code>): for example with <code>language="en",
            country="gb"</code> and a date that falls in British Summer Time, +01:00 is output as
          "BST". This is problematic, because the information is not really available: the data type
          maintains only a time zone offset, and different countries (time zones) use different
          names for the same offset, at different times of year. If the value is a date or dateTime,
          and if the country argument is supplied, Saxon uses the Java database of time zones and
          daylight savings time (summer time) changeover dates to work out the most likely timezone
          applicable to the date in question.</p>

        <p>If the timezone is formatted as <code>[ZN,6]</code> (specifically, with a minimum length
          of 6 or more) then the Olsen timezone name is output (again, this requires the country to
          be supplied). The Olsen timezone name generally takes the form
          <code>Continent/City</code>, for example <code>Europe/London</code> or
            <code>America/Los_Angeles</code>. If the date/time is in daylight savings time for that
          timezone, an asterisk is appended to the Olsen timezone name.</p>

        <p>When formatting times in the 12-hour clock, with <code>language="en"</code>, the
          abbreviations "a.m." and "p.m." are used. These can be shortened to "am" and "pm" by
          giving a maximum width of 2 (<code>[PN,*-2]</code>). The US convention of denoting noon as
          "pm" and midnight as "am" is followed, unless the maximum width is 8 or more
            (<code>[PN,*-8]</code>) in which case these values are represented as "noon" and
          "midnight" respectively.</p>

        <p>
          <i>The rules for formatting of timezones have been clarified and extended in the XPath 3.0
            version of the specification. These changes are implemented in 9.5, and apply whether or
            not support for XPath 3.0 is enabled.</i>
        </p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Formats a dateTime, using a format controlled by the picture string.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">format-integer</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:integer?" desc="The integer to be formatted"/>
          <arg name="picture" type="xs:string" desc="Picture showing how the integer is to be formatted"/>
          <arg name="language" type="xs:string?" default="()" desc="Language used for the output"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.3, provided XPath 3.0 is enabled.</p>
        <p>Localization capabilities extended (a little) in Saxon 12.0.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Formats an integer according to a given picture string, using the conventions of a given
          natural language if specified.</p>
        <p>For localization details, see <a href="/localization/number-formatting" class="bodylink code">Formatting numbers</a>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">format-number</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:numeric?" desc="The number to be formatted"/>
          <arg name="picture" type="xs:string" desc="Picture showing how the number is to be formatted"/>
          <arg name="options" type="(xs:string | map(*))?" default="{}" desc="Name of a decimal format definition defined in the context"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt20</in-spec>
        </proto>
      </signatures>
      <status>
        <p>From Saxon 9.3 this function becomes available for XPath/XQuery as well as XSLT. The
          query prolog declarations for defining a decimal format in XQuery become available in
          Saxon 9.4.</p>
        <p>The function rules were enhanced to allow formatting using exponential notation in
            the XPath 3.1 version of the specification. These changes are implemented since Saxon
            9.7, and are available provided XPath 3.1 is enabled.</p>
        <div class="qt4">
          <p>Changes for this function in the XPath 4.0 specification are available from Saxon 13:</p>
          <ul>
            <li>
              <p>The decimal format name can now be supplied as a value of type
                <code>xs:QName</code>, as an alternative to supplying a lexical QName as an
                instance of <code>xs:string</code>.</p>
            </li>
            <li>
              <p>Decimal format parameters can now be supplied directly as a map in the third
                argument, rather than referencing a format defined in the static context.</p>
            </li>
            <li>
              <p>For selected properties including minus sign, exponent-separator, percent and
                per-mille, it is now possible to specify a single-character marker to be used
                in the picture string, together with a multi-character rendition to be used in
                the formatted output.</p>
            </li>
          </ul>
        </div>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Formats a number as specified by a picture string and decimal format.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">format-time</name>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="value" type="xs:time?" desc="The xs:time value to be formatted"/>
          <arg name="picture" type="xs:string" desc="Picture showing how the time should be formatted"/>
          <arg name="language" type="xs:string?" default="()" desc="The language for the output"/>
          <arg name="calendar" type="xs:string?" default="()" desc="The calendar for the output"/>
          <arg name="place" type="xs:string?" default="()" desc="The country or Olsen timezone where the event took place"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt20</in-spec>
        </proto>
      </signatures>
      <status>
        <p>See <code>format-dateTime()</code>. </p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Formats a time value, using a format controlled by the picture string.</p>
      </description>
      <see-also name="format-dateTime" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">function-annotations</name>
      <signatures>
        <proto return-type="map(xs:QName, xs:anyAtomicType*)*">
          <arg name="function" type="fn(*)" desc="The input function item"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the annotations of the function item.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">function-arity</name>
      <signatures>
        <proto return-type="xs:integer">
          <arg name="function" type="fn(*)" desc="The function item whose arity is required"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE since 10; in Saxon-PE/EE since 9.6.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.6</saxon-edition>
      <description>
        <p>Returns the arity of the function identified by a function item.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">function-available</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="name" type="(xs:string | xs:QName)" desc="The name of the requested function, as a lexical QName"/>
          <arg name="arity" type="xs:integer?" default="()" desc="The arity of the requested function (number of arguments)"/>
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>XPath 3.0 introduces the function <code>function-lookup()</code>, which returns null in
          cases where <code>function-available()</code> would return false, but actually provides
          access to the function in cases where <code>function-available()</code> would return true.
        </p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <see-also name="function-lookup" namespace="http://www.w3.org/2005/xpath-functions"/>
      <description>
        <p>Determines whether a function with a given name, and arity if supplied, is available in
          the context.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">function-identity</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="function" type="fn(*)" desc="The input function item"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns a string representing the identity of a function item.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">function-lookup</name>
      <signatures>
        <proto return-type="fn(*)?">
          <arg name="name" type="xs:QName" desc="The name of the requested function"/>
          <arg name="arity" type="xs:integer" desc="The arity of the requested function (number of arguments)"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <description>
        <p>Determines whether a function with a given name and arity is available in the context,
          and if so, returns a function item that can be used to call the function. The function is
          useful to allow fallback action when a function is not available: for example, when
          calling an XPath 3.0 function, the code can be conditional on whether the function is or
          is not available.</p>
      </description>
      <status>
        <p>Available in Saxon-HE since 10; in Saxon-PE/EE since 9.6.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.6</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">function-name</name>
      <signatures>
        <proto return-type="xs:QName?">
          <arg name="function" type="fn(*)" desc="The function item whose name is required"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE since 10; in Saxon-PE/EE since 9.3.</p>
      </status>
      <saxon-edition>ALL_SINCE_10</saxon-edition>
      <description>
        <p>Returns the name of the function identified by a function item.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">generate-id</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="node" type="gnode()?" default="." desc="The node for which a generated identifier is required"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt20</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Since Saxon 9.3 this function has been available for use in XPath and XQuery as well as
          XSLT, provided that XPath 3.0 is enabled.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a generated unique ASCII identifier for a node.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">graphemes</name>
      <signatures>
        <proto return-type="xs:string*">
          <arg name="value" type="xs:string?" desc="The input string"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Splits the supplied string into a sequence of single-grapheme strings.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">has-children</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="node" type="gnode()?" default="." desc="The input node"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available from Saxon 9.5, provided XPath 3.0 is enabled. Streaming for the
            <code>has-children()</code> function is implemented from Saxon 9.7; specifically, a call
          on <code>has-children()</code> is now motionless, so that the call does not consume the
          content. This means, for example, that the call can appear as a predicate in a match
          pattern. The implementation uses a tiny amount of look-ahead in the parsing pipeline.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Asks whether the supplied node has one or more children.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">hash</name>
      <signatures>
        <proto return-type="xs:hexBinary?">
          <arg name="value" type="(xs:string | xs:hexBinary | xs:base64Binary)?" desc="The input value"/>
          <arg name="algorithm" type="xs:string?" default="&#34;MD5&#34;" desc="The algorithm to use, specified by a recognised code string"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>To support the <code>BLAKE3</code> option, the Saxon implementation uses the Blake3
          hashing algorithm derived from the implementation in Apache Commons. (See <a class="bodylink" href="/conditions/third-party-components">Third party source
            components</a> and the <a class="javalink" href="com.saxonica.functions.qt4.Blake3">Blake3</a> java module for details.)</p>
      </status>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the results of a specified hash, checksum, or cyclic redundancy check function
          applied to the input.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">head</name>
      <signatures>
        <proto return-type="item()?">
          <arg name="input" type="item()*" desc="The sequence whose first item is required"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.3, provided XPath 3.0 is enabled.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the first item in a sequence. </p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">highest</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The             collation used for comparing strings"/>
          <arg name="key" type="(fn(item()) as xs:anyAtomicType*)?" default="fn:data#1" desc="A function used for computing sort keys"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 11 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <description>
        <p>Returns those items from a supplied sequence that have the highest value of a sort key,
          where the sort key can be computed using a caller-supplied function.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">hours-from-dateTime</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="(xs:dateTime | xs:date | xs:time | xs:gYear | xs:gYearMonth | xs:gMonth | xs:gMonthDay | xs:gDay)?" desc="The dateTime value whose hour component is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the hour component of a dateTime value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">hours-from-duration</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:duration?" desc="The duration value whose hours component is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the hours component of a dayTimeDuration value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">hours-from-time</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:time?" desc="The time value whose hours component is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the hours component of a time value. Note that this is from the localized value,
          not the normalized value: for example if the supplied time value is 01:23:00+05:00 then
          the result is 1.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">html-doc</name>
      <signatures>
        <proto return-type="document-node(*:html)?">
          <arg name="source" type="xs:string?" desc="The URI of the HTML file to be read"/>
          <arg name="options" type="map(*)?" default="{}" desc="Parsing options"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Reads an external resource containing HTML, and returns the result of parsing the
          resource as HTML.</p>
        <p>The HTML parsing uses the same logic as the <code>parse-html</code> function: see
        the description of that function for constraints applicable to SaxonJ and SaxonCS.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">id</name>
      <signatures>
        <proto return-type="element()*">
          <arg name="values" type="xs:string*" desc="The ID value being sought"/>
          <arg name="node" type="node()" default="." desc="The document in which the search takes place"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Finds the elements with given <code>ID</code> attribute values.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">identity</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 11 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <description>
        <p>Returns the value of the argument, unchanged. Useful in situations where a function must
          be supplied, but the desired action is to do nothing.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">idref</name>
      <signatures>
        <proto return-type="node()*">
          <arg name="values" type="xs:string*" desc="The ID value being sought"/>
          <arg name="node" type="node()" default="." desc="The document in which the search takes place"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Some external object models do not provide information about <code>ID</code> attributes;
          in such cases this function will always return an empty sequence. In particular, this is
          true when the object model is a DOM.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Finds the nodes that link to the element with a given <code>ID</code> value. These will
          be element or attribute nodes marked by virtue of schema or DTD validation as
            <code>IDREF</code> or <code>IDREFS</code> values.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">implicit-timezone</name>
      <signatures>
        <proto return-type="xs:dayTimeDuration">
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The implicit timezone in Saxon is always the same as the timezone component of the value
          returned by <a class="bodylink code" href="/functions/fn/current-dateTime">current-dateTime()</a>.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the implicit timezone.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">in-scope-namespaces</name>
      <signatures>
        <proto return-type="map((xs:NCName | enum('')), xs:anyURI)">
          <arg name="element" type="element()" desc="An element node"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 11 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <description>
        <p>Returns the in-scope namespaces of an element node, as a map.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">in-scope-prefixes</name>
      <signatures>
        <proto return-type="xs:string*">
          <arg name="element" type="element()" desc="The element node whose in-scope namespace prefixes are required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the names of the namespaces that are in scope for an element. Except for the
          unnamed namespace, which is represented by the string <code>""</code>, the names will be
          of type <code>xs:NCName</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">index-of</name>
      <signatures>
        <proto return-type="xs:integer*">
          <arg name="input" type="xs:anyAtomicType*" desc="The sequence being searched"/>
          <arg name="target" type="xs:anyAtomicType" desc="The value being sought"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Finds the positions of items in a sequence that match the second argument.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">index-where</name>
      <signatures>
        <proto return-type="xs:integer*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="predicate" type="fn(item(), xs:integer) as xs:boolean?" desc="The predicate function"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 11 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <description>
        <p>Returns the positions in an input sequence of items that satisfy a supplied predicate.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">innermost</name>
      <signatures>
        <proto return-type="gnode()*">
          <arg name="nodes" type="gnode()*" desc="The input sequence"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.5.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Given a sequence of nodes, returns those nodes in the sequence that have no descendant
          that is also in the sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">insert-before</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="Input sequence, into which new values are inserted"/>
          <arg name="position" type="xs:integer" desc="The position of the item before which the new values are inserted"/>
          <arg name="insert" type="item()*" desc="The values to be inserted into the sequence"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Insert an item into a sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">insert-separator</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="separator" type="item()*" desc="A separator"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 under the previous name
          <code>fn:intersperse</code> provided that syntax extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Inserts a separator between adjacent items in a sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">invisible-xml</name>
      <signatures>
        <proto return-type="fn(xs:string) as item()">
          <arg name="grammar" type="(xs:string | element(Q{}ixml))?" default="()" desc="The input grammar"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Not available in SaxonCS.</p>
      </status>
      <saxon-edition platform="J C">PE/EE 13</saxon-edition>
      <description>
        <p>Creates an Invisible XML parser for a grammar.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">iri-to-uri</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The supplied IRI which will be escaped to form a valid URI"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Applies the %HH escaping convention to a URI, escaping only disallowed characters (but
          not reserved characters such as "/" and ":").</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">is-NaN</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="value" type="xs:anyAtomicType" desc="The input item"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 11 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <description>
        <p>Returns <code>true</code> if the argument is the <code>xs:float</code> or
            <code>xs:double</code> value <code>NaN</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">items-at</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="at" type="xs:integer*" desc="A sequence of positions"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns a sequence containing the items from <code>$input</code> at positions defined by
            <code>$at</code>, in the order specified.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">jkey</name>
      <signatures>
        <proto return-type="xs:anyAtomicType?">
          <arg name="input" type="jnode()?" default="." desc="The input JNode"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the <em>jkey</em> property of a JNode.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">jposition</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="input" type="jnode()?" default="." desc="The input JNode"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the <em>jposition</em> property of a JNode.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">json-doc</name>
      <signatures>
        <proto return-type="item()?">
          <arg name="source" type="xs:string?" desc="The URI of the JSON file to be read"/>
          <arg name="options" type="map(*)?" default="{}" desc="Parsing options"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7. The parsing options recognized are
            <code>'liberal':true()|false()</code>,
            <code>'duplicates':'reject'|'use-first'|'retain'</code>,
            <code>'escape':true()|false()</code>, <code>'fallback':(function)</code>. For full
          details see the specification. Use of the <code>fallback</code> option is available in
          Saxon-HE from Saxon 10; but requires Saxon-PE or Saxon-EE in earlier versions.</p>
        <p>For the effect of the option <code>liberal=true()</code>, see <a class="bodylink code" href="/functions/fn/parse-json">parse-json()</a>.</p>
        <p>The Saxon implementation also offers an additional option: <code>'number-parser' :
            xs:decimal#1</code> causes number values in the source JSON to be delivered as
            <code>xs:decimal</code> values rather than <code>xs:double</code>. This is useful where
          the values require higher precision than <code>xs:double</code> retains. It is also
          possible to return the string value as written using the option <code>'number-parser' :
            xs:string#1</code>. In general, the value of the option is any function that takes as
          input the string value as written, and that delivers an atomic item containing the
          desired representation of the number.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
      <description>
        <p>Reads an external resource containing JSON, and returns the result of parsing the
          resource as JSON.</p>
      </description>
      <see-also name="parse-json" namespace="http://www.w3.org/2005/xpath-functions"/>
      <see-also name="json-to-xml" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">json-to-xml</name>
      <signatures>
        <proto return-type="document-node(fn:*)?">
          <arg name="value" type="xs:string?" desc="The JSON input text"/>
          <arg name="options" type="map(*)?" default="{}" desc="Used to control the way in which parsing takes place"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7. The parsing options recognized are
            <code>'liberal':true()|false()</code>,
            <code>'duplicates':'reject'|'use-first'|'retain'</code>,
            <code>'validate':true()|false()</code>, <code>'escape':true()|false()</code>,
          <code>'fallback':(function)</code>. For full details see the specification. Use of the
          <code>fallback</code> option is available in Saxon-HE from Saxon 10; but requires
          Saxon-PE or Saxon-EE in earlier versions.</p>
        <p>For the effect of the option <code>liberal=true()</code>, see <a class="bodylink code" href="/functions/fn/parse-json">parse-json()</a>.</p>
        <p>The Saxon implementation also offers an additional option: <code>'number-parser' :
            xs:decimal#1</code> causes number values in the source JSON to be delivered as
            <code>xs:decimal</code> values rather than <code>xs:double</code>. This is useful where
          the values require higher precision than <code>xs:double</code> retains. It is also
          possible to return the string value as written using the option <code>'number-parser' :
            xs:string#1</code>. In general, the value of the option is any function that takes as
          input the string value as written, and that delivers an atomic item containing the
          desired representation of the number.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
      <description>
        <p>Parses a string supplied in the form of a JSON text, returning the results in the form of
          an XML document node.</p>
      </description>
      <see-also name="parse-json" namespace="http://www.w3.org/2005/xpath-functions"/>
      <see-also name="json-doc" namespace="http://www.w3.org/2005/xpath-functions"/>
      <see-also name="xml-to-json" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">jtree</name>
      <signatures>
        <proto return-type="jnode((), (map(*)|array(*)))">
          <arg name="input" type="(map(*)|array(*))" desc="The input map or array"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Delivers a root JNode wrapping a map or array, enabling the use of lookup expression to
          navigate a JTree rooted at that map or array.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">jvalue</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="jnode()?" default="." desc="The input JNode"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the <em>jvalue</em> property of a JNode.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">key</name>
      <signatures>
        <proto return-type="node()*">
          <arg name="key-name" type="(xs:string | xs:QName)" desc="The name of the key"/>
          <arg name="key-value" type="xs:anyAtomicType*" desc="The key value"/>
          <arg name="top" type="node()" default="/" desc="Used to specify a subtree"/>
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the nodes that match a supplied key value. See <a class="bodylink code" href="/xsl-elements/key">xsl:key</a> for more on keys.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">lang</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="language" type="xs:string?" desc="The language being tested for"/>
          <arg name="node" type="node()" default="." desc="The node being tested"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns true if the <code>xml:lang</code> value for the supplied node (or the context
          item if the second argument is omitted) matches the given language.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">last</name>
      <signatures>
        <proto return-type="xs:integer">
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the context size (the size of the sequence of items currently being
          processed).</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">load-xquery-module</name>
      <signatures>
        <proto return-type="fn:load-xquery-module-record">
          <arg name="module-uri" type="xs:string" desc="The namespace of the target library module"/>
          <arg name="options" type="map(*)?" default="{}" desc="Used to control the way in which the function operates"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7. The options available are listed in the specification. There
          are no specific Saxon-defined configuration options for use with the
            <code>vendor-options</code> parameter.</p>
        <p>Separate compilation of XQuery modules requires Saxon-EE. If the function is
        called in Saxon-HE or -PE, it raises FOQM0006 (no suitable XQuery processor available).</p>
      </status>
      <saxon-edition>EE 9.7</saxon-edition>
      <description>
        <p>Provides access to the public functions and global variables of a dynamically-loaded
          XQuery library module.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">local-name</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="node" type="node()?" default="." desc="The node whose local name is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the local part of the name of a node.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">local-name-from-QName</name>
      <signatures>
        <proto return-type="xs:NCName?">
          <arg name="value" type="xs:QName?" desc="The QName whose local part is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the local name component of a QName value, as an <code>xs:NCName</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">lower-case</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The string to be converted to lower-case"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Translates characters in a string to lower case.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">lowest</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <arg name="key" type="(fn(item()) as xs:anyAtomicType*)?" default="fn:data#1" desc="A function used for computing sort keys"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 11 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <description>
        <p>Returns those items from a supplied sequence that have the lowest value of a sort key,
          where the sort key can be computed using a caller-supplied function.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">map-for-key</name>
      <signatures>
        <proto return-type="map(xs:anyAtomicType, node()*)">
          <arg name="key-name" type="(xs:string | xs:QName)" desc="The name of the key"/>
          <arg name="top" type="(document-node() | element())" default="/" desc="Used to specify a subtree"/>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>New in XSLT 4.0. Not yet implemented in Saxon.</p>
      </status>
      <saxon-edition platform="NONE">NOT_IMPLEMENTED</saxon-edition>
      <description>
        <p>Delivers the content of a key, for a specific document or subtree, as a map.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">matches</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="value" type="xs:string?" desc="The string to be matched against a regular expression"/>
          <arg name="pattern" type="xs:string" desc="The regular expression"/>
          <arg name="flags" type="xs:string?" default="&#34;&#34;" desc="Flags that control the interpretation of the regular expression"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon 9.3 introduced support for the <code>q</code> flag, and for XPath 3.0 regular
          expression enhancements, provided XPath 3.0 is enabled.</p>
        <p>Saxon implements some extensions to the flags argument. The value of this argument
          contains the standard flags defined in the spec (<code>i</code>, <code>m</code>,
            <code>s</code>, <code>x</code>, <code>q</code>) followed optionally by a semicolon and
          then Saxon-specific flags. The Saxon-specific flags are:</p>
        <ul>
          <li>
            <p>
              <code>j</code> - Use the standard Java regular expression engine, allowing native Java
              regex syntax. This allows, for example, the use of "\b" in a regular expression to
              match word boundaries. </p>
            <p>If used with SaxonCS, the <code>j</code> flag is treated as if <code>n</code> were
              specified.</p>

          </li>
          <li>
            <p>
              <code>n</code> - Use the standard .NET regular expression engine, allowing native .NET
              regex syntax. This is supported in SaxonCS only.</p>
          </li>
          <li>
            <p>
              <code>g</code> - Switch on diagnostics. Not currently used.</p>
          </li>
          <li>
            <p>
              <code>k</code> - Treat unknown Unicode block names as matching any character (this is
              the default for XSD 1.1). This option applies to the Saxon regular expression engine
              only.</p>
          </li>
          <li>
            <p>
              <code>K</code> - Treat unknown Unicode block names as an error (this is the default
              for XSD 1.0 and for XPath/XSLT/XQuery). This option applies to the Saxon regular
              expression engine only.</p>
          </li>
        </ul>
        <p>If the native regex engine is used, then the flags preceding the semicolon are
          interpreted as follows:</p>
        <ul>
          <li class="javaonly">
            <p>For Java: </p>
            <ul>
              <li>
                <code>'d': Pattern.UNIX_LINES</code>
              </li>
              <li>
                <code>'m': Pattern.MULTILINE</code>
              </li>
              <li>
                <code>'i': Pattern.CASE_INSENSITIVE</code>
              </li>
              <li>
                <code>'s': Pattern.DOTALL</code>
              </li>
              <li>
                <code>'x': Pattern.COMMENTS</code>
              </li>
              <li>
                <code>'u': Pattern.UNICODE_CASE</code>
              </li>
              <li>
                <code>'q': Pattern.LITERAL</code>
              </li>
              <li>
                <code>'c': Pattern.CANON_EQ</code>
              </li>
            </ul>
          </li>
          <li class="csonly">
            <p>For .NET: </p>
            <ul>
              <li>
                <code>'d': RegexOptions.Multiline</code>
              </li>
              <li>
                <code>'m': RegexOptions.Multiline</code>
              </li>
              <li>
                <code>'i': RegexOptions.IgnoreCase</code>
              </li>
              <li>
                <code>'s': RegexOptions.Singleline</code>
              </li>
              <li>
                <code>'x': RegexOptions.IgnorePatternWhitespace</code>
              </li>
              <li>
                <code>'u': ignored</code>
              </li>
              <li>
                <code>'q': ignored</code>
              </li>
              <li>
                <code>'c': ignored</code>
              </li>
            </ul>
          </li>
        </ul>
        <p>In the case of <a class="bodylink code" href="../replace">fn:replace()</a>, if the
          platform-native regex engine is used (Java or .NET) then the syntax for the replacement
          expression in the third argument also follows the rules for the platform. For example, the
          syntax <code>${name}</code> can be used in a reference to a named captured group.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns true if the given string matches the given regular expression.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">max</name>
      <signatures>
        <proto return-type="xs:anyAtomicType?">
          <arg name="values" type="xs:anyAtomicType*" desc="The input sequence"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/max">math:max()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the highest value in a sequence of comparable items.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">message</name>
      <signatures>
        <proto return-type="empty-sequence()">
          <arg name="input" type="item()*" desc="The value to be traced"/>
          <arg name="label" type="xs:string?" default="()" desc="Label to be included in the trace output"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Outputs trace information and discards the result.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">min</name>
      <signatures>
        <proto return-type="xs:anyAtomicType?">
          <arg name="values" type="xs:anyAtomicType*" desc="The input sequence"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/min">math:min()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the lowest value in a sequence of comparable items.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">minutes-from-dateTime</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="(xs:dateTime | xs:date | xs:time | xs:gYear | xs:gYearMonth | xs:gMonth | xs:gMonthDay | xs:gDay)?" desc="The supplied dateTime value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the minutes component of a dateTime value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">minutes-from-duration</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:duration?" desc="The supplied duration value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the minutes component of a duration value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">minutes-from-time</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:time?" desc="The supplied time value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the minutes component of a time value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">month-from-date</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:date?" desc="The supplied date value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the month component of a date value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">month-from-dateTime</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="(xs:dateTime | xs:date | xs:time | xs:gYear | xs:gYearMonth | xs:gMonth | xs:gMonthDay | xs:gDay)?" desc="The supplied dateTime value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the month component of a dateTime value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">months-from-duration</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:duration?" desc="The supplied duration value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the months component of a duration value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">name</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="node" type="node()?" default="." desc="The node whose name is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the name of a node, as a string in the lexical form of a QName.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">namespace-uri</name>
      <signatures>
        <proto return-type="xs:anyURI">
          <arg name="node" type="node()?" default="." desc="The node whose namespace URI is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the namespace URI of the name of a node.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">namespace-uri-for-prefix</name>
      <signatures>
        <proto return-type="xs:anyURI?">
          <arg name="value" type="(xs:NCName | enum(''))?" desc="The supplied prefix"/>
          <arg name="element" type="element()" desc="The element node whose in-scope namespaces are to be examined"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the namespace URI corresponding to a given prefix, using the namespaces that are
          in scope for a given element.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">namespace-uri-from-QName</name>
      <signatures>
        <proto return-type="xs:anyURI?">
          <arg name="value" type="xs:QName?" desc="The QName value whose URI component is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the namespace URI component of a QName value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">nilled</name>
      <signatures>
        <proto return-type="xs:boolean?">
          <arg name="node" type="node()?" default="." desc="The node (typically an element) to be examined to see if it is nilled"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>This function will always return false in the case of an untyped node, which means it
          will always return false for external object models that do not support typed
          (schema-validated) data, such as the DOM and JDOM models. Essentially the function returns
          true if (a) the node is schema-validated, and (b) it has the attribute
            <code>xsi:nil="true"</code>.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns true if the argument is an element that has the "nilled" property.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">node-name</name>
      <signatures>
        <proto return-type="xs:QName?">
          <arg name="node" type="node()?" default="." desc="The node whose name is required"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The single-argument version of this function is new in XPath 3.0, and is first
          implemented in Saxon 9.3, provided that support for XPath 3.0 is enabled.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the name of a node, as a QName value (that is, a namespace URI plus local
          name).</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">node-type-annotation</name>
      <signatures>
        <proto return-type="fn:schema-type-record">
          <arg name="node" type="(element() | attribute())" desc="The input element or attribute node"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns a record containing information about the type annotation of an element or
          attribute node.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">normalize-space</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:anyAtomicType?" default="string(.)" desc="The string to be normalized"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Eliminates redundant spaces from the supplied string, or the string value of the context
          item.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">normalize-unicode</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The string to be normalized"/>
          <arg name="form" type="xs:string?" default="&#34;NFC&#34;" desc="The Unicode normalization form to apply"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon supports normalization forms NFC, NFD, NFKC, and NFKD.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Converts a string to the specified Unicode normalization form (the default is NFC) by
          modifying the way in which combining characters are represented.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">not</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="input" type="item()*" desc="The input value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns true if the effective boolean value of the argument is false, and vice versa.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">number</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="value" type="xs:anyAtomicType?" default="." desc="The input value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Converts the supplied value (or the value of the context item) to a double, or returns
          NaN if conversion is not possible.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">one-or-more</name>
      <signatures>
        <proto return-type="item()+">
          <arg name="input" type="item()*" desc="The sequence to be tested"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Tests whether <code>$input</code> contains one or more items; fails if it is an empty
          sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">op</name>
      <signatures>
        <proto return-type="fn(item()*, item()*) as item()*">
          <arg name="operator" type="xs:string" desc="A binary operator"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns a function whose effect is to apply a supplied binary operator to two
          arguments.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">outermost</name>
      <signatures>
        <proto return-type="gnode()*">
          <arg name="nodes" type="gnode()*" desc="The input sequence"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.5.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Given a sequence of nodes, returns those nodes in the sequence that have no ancestor that
          is also in the sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">parse-csv</name>
      <signatures>
        <proto return-type="fn:parsed-csv-structure-record?">
          <arg name="value" type="xs:string?" desc="The input CSV data"/>
          <arg name="options" type="map(*)?" default="{}" desc="Parsing options"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Parses CSV data, returning the results in the form of a record containing information
          about the names in the header, as well as the data itself.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">parse-html</name>
      <signatures>
        <proto return-type="document-node(*:html)?">
          <arg name="value" type="(xs:string | xs:hexBinary | xs:base64Binary)?" desc="An HTML             document"/>
          <arg name="options" type="map(*)?" default="{}" desc="Parsing options"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. An earlier one-argument version of the function
          was available since Saxon 12.0 provided that syntax extensions are enabled.</p>
        <p>In SaxonJ this is implemented using <code>validator.nu</code>; in SaxonCS the
          implementation uses <code>AngleSharp</code>.</p>
      </status>
      <saxon-edition>PE/EE 13 12_EXPERIMENTAL</saxon-edition>
      <description>
        <p>This function takes as input an HTML document, and returns the document node at the root
          of an XDM tree representing the parsed document.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">parse-ietf-date</name>
      <signatures>
        <proto return-type="xs:dateTime?">
          <arg name="value" type="xs:string?" desc="The input string"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>All 9.7</saxon-edition>
      <description>
        <p>Parses a string containing the date and time in IETF format, returning the corresponding
            <code>xs:dateTime</code> value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">parse-integer</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:string?" desc="The input string"/>
          <arg name="radix" type="xs:integer?" default="10" desc="The required radix"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Converts a string to an integer, recognizing any radix in the range 2 to 36.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">parse-json</name>
      <signatures>
        <proto return-type="item()?">
          <arg name="value" type="xs:string?" desc="The JSON input to be parsed"/>
          <arg name="options" type="map(*)?" default="{}" desc="Parsing options"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7. The parsing options recognized are
            <code>'liberal':true()|false()</code>,
            <code>'duplicates':'reject'|'use-first'|'retain'</code>,
            <code>'escape':true()|false()</code>, <code>'fallback':(function)</code>. For full
          details see the specification. Use of the <code>fallback</code> option is available in
          Saxon-HE from Saxon 10; but requires Saxon-PE or Saxon-EE in earlier versions.</p>
        <p>When <code>liberal=true()</code>, the following extensions to the JSON grammar are
          accepted: <ul>
            <li>Within arrays and objects, trailing commas are ignored: for example
                <code>[1,2,3,]</code> is treated as <code>[1,2,3]</code>. (This does not apply if
              the array or object is otherwise empty, so <code>[,]</code> and <code>{,}</code> are
              not accepted.)</li>
            <li>Within numeric literals, anything accepted as an XPath numeric literal is accepted
              (for example, leading plus signs, leading zeroes, absent fractional part, absent
              integer part: but not <code>INF</code> or <code>NaN</code>).</li>
            <li>Within a string literal, if backslash is followed by a character <code>X</code> and
                <code>\X</code> is not a recognized JSON escape sequence, then it is treated as
              representing the character <code>X</code>.</li>
            <li>The key of a key-value pair in an object can be written without quotation marks
              provided it takes the form of an XML NCName, and is not "true", "false", or "null".
              For example, <code>{a:3, b:4}</code> is accepted.</li>
          </ul></p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>This function takes as input a string in JSON format and parses it typically returning a
          map or array.</p>
      </description>
      <see-also name="json-doc" namespace="http://www.w3.org/2005/xpath-functions"/>
      <see-also name="json-to-xml" namespace="http://www.w3.org/2005/xpath-functions"/>
      <see-also name="serialize" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">parse-QName</name>
      <signatures>
        <proto return-type="xs:QName?">
          <arg name="value" type="xs:string?" desc="An EQName"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns an <code>xs:QName</code> value formed by parsing an EQName (i.e. a name in one
          of the formats <code>"local"</code>, <code>"prefix:local"</code>, or
          <code>"Q{uri}local"</code>).</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">parse-uri</name>
      <signatures>
        <proto return-type="fn:uri-structure-record?">
          <arg name="value" type="xs:string?" desc="The input URI"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.1 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Parses the URI provided and returns a map of its parts.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">parse-xml</name>
      <signatures>
        <proto return-type="document-node(*)?">
          <arg name="value" type="(xs:string | xs:hexBinary | xs:base64Binary)?" desc="The lexical XML string to be parsed as a document"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.3, provided XPath 3.0 is enabled; replaces the extension function
            <code>saxon:parse</code> which is retained for the time being.</p>
        <p>Saxon parses the supplied document using the "source parser" registered with the
          configuration. It sets a custom <code>ErrorHandler</code> to be notified of parsing
          errors; this outputs nothing, but instead captures any notified exceptions. If the parsing
          failure is caught using try/catch, these exceptions are available as the value of
            <code>$err:value</code>: specifically, <code>$err:value</code> is a sequence of items,
          each of which is a Java <code>ExternalObject</code> wrapping a
            <code>SAXParseException</code>, which can be interrogated using reflexive extension
          functions to obtain details such as the line number of the error.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>This function takes as input an XML document represented as a string, and returns the
          document node at the root of an XDM tree representing the parsed document.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">parse-xml-fragment</name>
      <signatures>
        <proto return-type="document-node()?">
          <arg name="value" type="(xs:string | xs:hexBinary | xs:base64Binary)?" desc="The lexical XML string to be parsed as a document fragment"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.5, provided XPath 3.0 is enabled.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>This function takes as input an XML external entity represented as a string, and returns
          the document node at the root of an XDM tree representing the parsed document
          fragment.</p>
        <p>For details of error handling, see the <a class="bodylink code" href="/functions/fn/parse-xml">parse-xml()</a> function.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">partial-apply</name>
      <signatures>
        <proto return-type="fn(*)">
          <arg name="function" type="fn(*)" desc="The input function item"/>
          <arg name="arguments" type="map(xs:positiveInteger, item()*)" desc="A map providing argument values"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Performs partial application of a function item by binding values to selected
          arguments.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">partition</name>
      <signatures>
        <proto return-type="array(item()*)*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="split-when" type="fn(item()*, item(), xs:integer) as xs:boolean?" desc="Function determining the condition for starting a new partition"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Partitions a sequence of items into a sequence of non-empty arrays containing the same
          items, starting a new partition when a supplied condition is true.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">parts-of-dateTime</name>
      <signatures>
        <proto return-type="fn:dateTime-record?">
          <arg name="value" type="(xs:dateTime | xs:date | xs:time | xs:gYear | xs:gYearMonth | xs:gMonth | xs:gMonthDay | xs:gDay)?" desc="The date/time value"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status_ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the components of a date/time value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">path</name>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="node" type="gnode()?" default="." desc="The node whose path is to be determined"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Fully available since Saxon 9.6. Available since Saxon 9.4 provided XPath 3.0 is enabled.
          Replaces the extension function <code>saxon:path</code> which is retained for the time
          being.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>This function takes as input a node (defaulting to the context node), and returns an
          XPath expression defining a path to that node from the root of its containing tree (which
          must be a document node). The path will use expanded QNames so that it is not sensitive to
          the namespace context.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">position</name>
      <signatures>
        <proto return-type="xs:integer">
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the context position (that is, the position of the context item in the sequence
          currently being processed).</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">prefix-from-QName</name>
      <signatures>
        <proto return-type="xs:NCName?">
          <arg name="value" type="xs:QName?" desc="The QName whose prefix component is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the prefix component of a QName value. Returns an empty sequence if the QName
          has no prefix.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">put</name>
      <signatures>
        <proto return-type="xs:NCName?">
          <arg name="doc" type="node()" desc="The document to be written to disk"/>
          <arg name="uri" type="xs:string" desc="The location where the document is to be written, as a file:/// URI"/>
          <in-spec>xquery-update10</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented in Saxon; available only when XQuery Updates is enabled.</p>
        <p>From Saxon 9.9, the serialization of the supplied document is performed according to the
          serialization properties defined in the query prolog (for example <code>declare option
            output:indent "yes"</code>), which default to the properties defined in the
          <code>Configuration</code>. Serialization properties specified on the XQuery command line
          have no effect.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Writes a document to disk. Often (but not necessarily) the document will be the result of
          applying updates to a source document. It can, however, be a completely new document
          constructed by the query, or a document copied from a different location.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">QName</name>
      <signatures>
        <proto return-type="xs:QName">
          <arg name="uri" type="xs:string?" desc="The namespace URI component of the constructed QName"/>
          <arg name="qname" type="xs:string" desc="A lexical QName that supplies the local name component of the constructed QName, and optionally the prefix"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Constructs a QName value from a URI and local name. The second argument may be a lexical
          QName, and the prefix of the lexical QName is returned in the constructed value, for use
          if it is converted back to a string.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">random-number-generator</name>
      <signatures>
        <proto return-type="fn:random-number-generator-record">
          <arg name="seed" type="xs:anyAtomicType?" default="()" desc="The supplied seed"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE since 10; in Saxon-PE/EE since 9.7.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.7</saxon-edition>
      <description>
        <p>Returns a random number generator, which can be used to generate sequences of random
          numbers.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">regex-group</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="group-number" type="xs:integer" desc="Integer identifying the group"/>
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the contents of the substring that matched the n'th subexpression in a regular
          expression processed using <a class="bodylink code" href="/xsl-elements/analyze-string">xsl:analyze-string</a>. </p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">regex-groups</name>
      <signatures>
        <proto return-type="map(xs:integer, record(value as xs:string, position as xs:integer))">
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>New in XSLT 4.0. Not yet implemented in Saxon.</p>
      </status>
      <saxon-edition platform="NONE">NOT_IMPLEMENTED</saxon-edition>
      <description>
        <p>Returns the set of captured groups associated with a matching segment during evaluation
          of the <a class="bodylink code" href="/xsl-elements/analyze-string">xsl:analyze-string</a>
          instruction.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">remove</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence, from which items are to be removed"/>
          <arg name="positions" type="xs:integer*" desc="The positions of the items to be removed"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p class="qt4">In the XPath 4.0 specification, the function is extended to allow several
          items to be removed at the same time. This extension is available since Saxon 13 in XPath
          4.0, and available since Saxon 12.3 provided that syntax extensions are enabled.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Removes the items at the given positions in a sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">replace</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The input string, parts of which are to be replaced"/>
          <arg name="pattern" type="xs:string" desc="The regular expression matching parts of the string that are to be replaced"/>
          <arg name="replacement" type="(xs:string | fn(xs:untypedAtomic, xs:untypedAtomic*) as item()?)?" default="&#34;&#34;" desc="The replacement string"/>
          <arg name="flags" type="xs:string?" default="&#34;&#34;" desc="Flags controlling how the regular expression is interpreted"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon 9.3 introduces support for the <code>q</code> flag, and for XPath 3.0 regular
          expression enhancements, provided XPath 3.0 is enabled.</p>
        <p>Saxon supports extended syntax for the flags argument: see the <a class="bodylink code" href="/functions/fn/matches">matches()</a> function for details.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Replaces sequences of characters within a string that match a given regular
          expression.</p>
      </description>
      <see-also namespace="http://www.w3.org/2005/xpath-functions" name="matches"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">replicate</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="count" type="xs:nonNegativeInteger" desc="The required number of copies"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Produces multiple copies of a sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">resolve-QName</name>
      <signatures>
        <proto return-type="xs:QName?">
          <arg name="value" type="xs:string?" desc="The lexical QName to be expanded"/>
          <arg name="element" type="element()" desc="The element whose in-scope namespaces determine how the QName is expanded"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Expands a lexical QName using the in-scope namespaces from the given element.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">resolve-uri</name>
      <signatures>
        <proto return-type="xs:anyURI?">
          <arg name="href" type="xs:string?" desc="A relative URI reference to be resolved against the specified base URI"/>
          <arg name="base" type="xs:string?" default="()" desc="The base URI used for resolving the relative reference; if not supplied or the             supplied value is the empty sequence, then the static base URI from the context is used"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The Saxon implementation recognizes the "jar:file:" URI scheme originally defined by Sun,
          which was never officially registered and which does not conform to RFC 2396. Technically,
          because these are not legal URIs, it is non-conformant to accept them, but Saxon does so
          in the interests of usability.</p>
        <p>Saxon does NOT, however, accept Windows file names as URIs.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Resolves a relative URI against a base URI.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">reverse</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The sequence whose items are to be reversed in order"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Reverses the order of the items in the input sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">root</name>
      <signatures>
        <proto return-type="gnode()?">
          <arg name="node" type="gnode()?" default="." desc="A node in the tree whose root is required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the root node (typically but not necessarily a document node) of the tree
          containing a node.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">round</name>
      <signatures>
        <proto return-type="xs:numeric?">
          <arg name="value" type="xs:numeric?" desc="The value to be rounded"/>
          <arg name="precision" type="xs:integer?" default="0" desc="The number of decimal places required"/>
          <arg name="mode" type="enum('floor',&#xA; 'ceiling',&#xA; 'toward-zero',&#xA; 'away-from-zero',&#xA; 'half-to-floor',&#xA; 'half-to-ceiling',&#xA; 'half-toward-zero',&#xA; 'half-away-from-zero',&#xA; 'half-to-even')?" default="'half-to-ceiling'" desc="The rounding mode"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The two-argument form of this function was introduced in XPath 3.0, and has been
          available since Saxon 9.3.</p>
        <p>Saxon 12.6 fixed a long-standing bug (6537), whereby negative "midway"
            <code>xs:decimal</code> values were rounded away from zero rather than towards zero. For
          example <code>round(-0.125e0, 2)</code> returned <code>-0.13</code> rather than
            <code>-0.12</code>.</p>
        <p>XPath 4.0 introduces a 3-argument form of this function in which the rounding mode can be
          specified explicitly. This is implemented since Saxon 12.6; for details see
          the XPath 4.0 specification.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Rounds a numeric value to a specified number of decimal places, with control over how the
          rounding takes place.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">round-half-to-even</name>
      <signatures>
        <proto return-type="xs:numeric?">
          <arg name="value" type="xs:numeric?" desc="The value to be rounded"/>
          <arg name="precision" type="xs:integer?" default="0" desc="The number of decimal places required"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Rounds a numeric value to a specified number of decimal places, rounding to make the last
          digit even if two such values are equally near.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">scan-left</name>
      <signatures>
        <proto return-type="array(*)*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="init" type="item()*" desc="The initial value"/>
          <arg name="action" type="fn(item()*, item()) as item()*" desc="The function to be applied to each item in the sequence"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>New in XPath 4.0. Not yet implemented in Saxon.</p>
      </status>
      <saxon-edition platform="NONE">NOT_IMPLEMENTED</saxon-edition>
      <description>
        <p>Produces the sequence of successive partial results from the evaluation of
          <code>fn:fold-left()</code> with the same arguments.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">scan-right</name>
      <signatures>
        <proto return-type="array(*)*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="init" type="item()*" desc="The initial value"/>
          <arg name="action" type="fn(item(), item()*) as item()*" desc="The function to be applied to each item in the sequence"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>New in XPath 4.0. Not yet implemented in Saxon.</p>
      </status>
      <saxon-edition platform="NONE">NOT_IMPLEMENTED</saxon-edition>
      <description>
        <p>Produces the sequence of successive partial results from the evaluation of
          <code>fn:fold-right()</code> with the same arguments.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">schema-type</name>
      <signatures>
        <proto return-type="fn:schema-type-record?">
          <arg name="name" type="xs:QName" desc="A named schema type"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns a record containing information about a named schema type in the static
          context.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">seconds</name>
      <signatures>
        <proto return-type="xs:dayTimeDuration?">
          <arg name="value" type="xs:decimal?" desc="The input number"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns an <code>xs:dayTimeDuration</code> whose length is a given number of seconds.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">seconds-from-dateTime</name>
      <signatures>
        <proto return-type="xs:decimal?">
          <arg name="value" type="(xs:dateTime | xs:date | xs:time | xs:gYear | xs:gYearMonth | xs:gMonth | xs:gMonthDay | xs:gDay)?" desc="The input dateTime value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the seconds component of a dateTime value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">seconds-from-duration</name>
      <signatures>
        <proto return-type="xs:decimal?">
          <arg name="value" type="xs:duration?" desc="The input duration value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the seconds component of a dayTimeDuration value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">seconds-from-time</name>
      <signatures>
        <proto return-type="xs:decimal?">
          <arg name="value" type="xs:time?" desc="The input time value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the seconds component of a time value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">serialize</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="input" type="item()*" desc="The input (typically a document or element node) to be serialized"/>
          <arg name="options" type="(element(output:serialization-parameters) | map(*))?" default="{}" desc="Serialization parameters"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Since XPath 3.1 (implemented in Saxon 9.7), the serialization parameters may be supplied
          as a map, or as an <code>output:serialization-parameters</code> element; see the
          specification for details. See <a class="bodylink code" href="/xsl-elements/output">xsl:output</a> for more information on serialization parameters.</p>
        <p>The function is available since Saxon 9.3, provided XPath 3.0 is enabled. It replaces the
          Saxon extension function <code>saxon:serialize</code>. Saxon 9.3 and Saxon 9.4 implemented
          the 2009 version of the specification, in which the serialization parameters were supplied
          without a wrapper element: see <a href="http://www.w3.org/TR/2009/WD-xpath-functions-11-20091215/#func-serialize">here</a>. In Saxon 9.5 the implementation was changed to match the 2011 version of the
          serialization specification.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>This function serializes the supplied input sequence <code>$input</code>, returning the
          serialized representation of the sequence as a string.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">siblings</name>
      <signatures>
        <proto return-type="gnode()*">
          <arg name="node" type="gnode()?" default="." desc="The input GNode"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the supplied GNode together with its siblings, in document order.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">slice</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="start" type="xs:integer?" default="0" desc="The position of the first item from the input sequence to be included in the result"/>
          <arg name="end" type="xs:integer?" default="0" desc="The position of the last item from the input sequence to be included in the result"/>
          <arg name="step" type="xs:integer?" default="0" desc="Step between positions to include in the result"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 11 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <description>
        <p>Returns a sequence containing selected items from a supplied input sequence based on
          their position.</p>
      </description>
      <details>
        <p>Selects items from a sequence. <code>$start</code> and <code>$end</code> can be positive
          integers for 1-based positions counting from the start of the sequence, or negative
          integers to count from the end; <code>$step</code> can be a positive integer to select
          every Nth item, or a negative integer to count backwards.</p>
      </details>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">snapshot</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" default="." desc="The sequence to be copied"/>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.5 for use in XSLT 3.0. Since Saxon 9.6 the function is also made
          available in XQuery.</p>
        <p>Since Saxon 9.7, the function can operate on any sequence of items (not just nodes).</p>
      </status>
      <saxon-edition>ALL_SINCE_9.8 PE/EE_9.5</saxon-edition>
      <description>
        <p>Makes a deep copy of a sequence, such that any node in the sequence is copied together
          with a shallow copy of its ancestors and their attributes. (This will typically be a
          streamed node, to allow navigation within the subtree rooted at the node.) The
          zero-argument form applies the function to the context item.</p>
      </description>
      <see-also name="copy-of" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">some</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="predicate" type="(fn(item(), xs:integer) as xs:boolean?)?" default="fn:boolean#1" desc="The predicate function"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 11 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <description>
        <p>Returns <code>true</code> if at least one item in the input sequence satisfies a supplied
          predicate.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">sort</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence to be sorted"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <arg name="key" type="fn(item()) as xs:anyAtomicType*" default="fn:data#1" desc="The sort key"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7. Signature changed to add <code>$collation</code> argument from
          9.7.0.8.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.7</saxon-edition>
      <description>
        <p>Sorts a supplied sequence, based on the value of a sort key supplied as a function, using
          the supplied collation. Calling the single-argument version of the function is equivalent
          to calling the 3-argument form with <code>fn:default-collation()</code> as the second
          argument and <code>fn:data#1</code> as the third argument: that is, it sorts a sequence of
          items according to the typed value of the items.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">sort-by</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="keys" type="record(key? as (fn(item()) as xs:anyAtomicType*)?, collation? as xs:string?, order? as enum('ascending', 'descending')?)*" desc="The sort key definitions"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Sorts a supplied sequence, based on the value of a number of sort keys supplied as
          functions.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">sort-with</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="comparators" type="(fn(item(), item()) as xs:integer)+" desc="The comparator functions"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Sorts a supplied sequence, according to the order induced by the supplied comparator
          functions.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">starts-with</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="value" type="xs:string?" desc="The containing string"/>
          <arg name="substring" type="xs:string?" desc="The supposed initial part of the string"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Tests whether one string starts with another string.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">starts-with-subsequence</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="subsequence" type="item()*" desc="The subsequence to check for"/>
          <arg name="compare" type="(fn(item(), item()) as xs:boolean?)?" default="fn:deep-equal#2" desc="A comparison function"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 under the previous name
          <code>fn:starts-with-sequence</code> provided that syntax extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Determines whether one sequence starts with another, using a supplied callback function
          to compare items.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">static-base-uri</name>
      <signatures>
        <proto return-type="xs:anyURI?">
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the base URI of the static context.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">stream-available</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="uri" type="xs:string?" desc="The URI of the document"/>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.6.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.8 PE/EE_9.6</saxon-edition>
      <description>
        <p>Determines, as far as possible, whether a document is available for streamed processing
          using <a class="bodylink code" href="/xsl-elements/source-document">xsl:source-document</a>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">string</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="item()?" default="." desc="A node whose string value is required, or an atomic item to be converted to a string"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the string value of the supplied value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">string-join</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="values" type="xs:anyAtomicType*" desc="A sequence of strings to be joined into one"/>
          <arg name="separator" type="xs:string?" default="&#34;&#34;" desc="The separator to be used between adjacent strings"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The single-argument form of this function is specified in XPath 3.0, and is available
          since Saxon 9.3, provided XPath 3.0 is enabled. Note that the default separator is a
          zero-length string, not a single space.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a string created by concatenating all the items in the given sequence (casting
          each item to a string), separated by the given separator.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">string-length</name>
      <signatures>
        <proto return-type="xs:integer">
          <arg name="value" type="xs:anyAtomicType?" default="fn:string(.)" desc="The input string"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the number of characters in a string.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">string-to-codepoints</name>
      <signatures>
        <proto return-type="xs:integer*">
          <arg name="value" type="xs:string?" desc="The input string"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a sequence of integers representing the Unicode codepoints of the characters in
          the supplied string.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">subsequence</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="start" type="xs:numeric" desc="The position of the first item from the input sequence to be included in the result"/>
          <arg name="length" type="xs:numeric?" default="()" desc="The number of items to be included in the result"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns those items in the given sequence from the given starting position to the end of
          the sequence, or <code>$length</code> items if fewer.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">subsequence-where</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="from" type="(fn(item(), xs:integer) as xs:boolean?)?" default="true#0" desc="Predicate function to determine the first item in the subsequence"/>
          <arg name="to" type="(fn(item(), xs:integer) as xs:boolean?)?" default="false#0" desc="Predicate function to determine the last item in the subsequence"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns a contiguous sequence of items from <code>$input</code>, with the start and end
          points located by applying predicates.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">substring</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The input string"/>
          <arg name="start" type="xs:double" desc="The position of the first character of the input string to be included in the result"/>
          <arg name="length" type="xs:double?" default="()" desc="The number of characters to be included in the result"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a substring of a given string starting at the given starting position and
          continuing to the end of the string, or <code>$length</code> characters if shorter.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">substring-after</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The input string"/>
          <arg name="substring" type="xs:string?" desc="A substring of the input string; the function returns the rest of the input string after this substring"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns that part of the given input string that occurs after the first occurrence of the
          string given in <code>$substring</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">substring-before</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The input string"/>
          <arg name="substring" type="xs:string?" desc="A substring of the input string; the function returns the part of the input string before this substring"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns that part of the given input string that occurs before the first occurrence of
          the string given in <code>$substring</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">sum</name>
      <signatures>
        <proto return-type="xs:anyAtomicType?">
          <arg name="values" type="xs:anyAtomicType*" desc="The sequence of values to be totalled"/>
          <arg name="zero" type="xs:anyAtomicType?" default="0" desc="The value to return if the input sequence is empty (default integer zero)"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the total of a sequence of numbers or durations.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">system-properties</name>
      <signatures>
        <proto return-type="map(xs:QName, xs:anyAtomicType)">
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>New in XPath 4.0. Not yet implemented in Saxon.</p>
      </status>
      <saxon-edition platform="NONE">NOT_IMPLEMENTED</saxon-edition>
      <description>
        <p>Returns information about the processor.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">system-property</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="arg" type="xs:string" desc="The name of the system property required"/>
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>As well as the standard system properties defined in the XSLT namespace, SaxonJ will
          return the value of a Java system property (e.g. as set using -X on the Java VM
          invocation) if the name is unprefixed. It does NOT return the values of operating system
          environment variables.</p>
        <p>More specifically, if the argument is a name in no namespace, that is, if the name is
          unprefixed, then the name is taken to refer to a Java system property, and the value of
          that property is returned if it exists. For example, on a Windows platform,
            <code>system-property('file.separator')</code> returns "\". This can be used to obtain
          information from the environment, and is especially useful in conjunction with
            <code>use-when</code> conditional compilation.</p>
        <p>Generally, if <code>system-property()</code> is executed at compile-time, then the
          results pertain to the compile-time environment, but if executed at run-time, the results
          pertain to the run-time environment. For example, the result of
            <code>system-property('xsl:product-version')</code> may be different if a SEF file
          compiled using one Saxon release is executed under another. Evaluation is always at
          compile-time if the function call appears in a static expression (for example in
            <code>[xsl:]use-when</code>). Where the function call appears in a dynamic expression
          (for example in <code>&lt;xsl:if test="...."&gt;</code>), it may be evaluated statically
          if the argument is a string literal, but only if the stylesheet is not being compiled for
          execution in a different target environment. You can force run-time execution by declaring
          the property name as the default value of a stylesheet parameter (for example
            <code>&lt;xsl:param name="p" select="'xsl:product-version'"/&gt;</code>) and invoking
          the function as <code>system-property($p)</code>.</p>
        <p>For some properties, the result is configuration-dependent:</p>
        <ul>
          <li><code>is-schema-aware</code>: returns "yes" if running under Saxon-EE with a license,
            provided schema-awareness has been enabled either by including an
              <code>xsl:import-schema</code> declaration in the stylesheet, or by setting
              <code>isSchemaAware(true)</code> on the <code>XsltCompiler</code> (or <code>-sa</code>
            on the command line).</li>
          <li><code>supports-streaming</code>: returns "yes" if running under Saxon-EE with a
            license, unless the configuration feature <a class="bodylink" href="/configuration/config-features#"/> has been
            set to false.</li>
          <li><code>supports-dynamic-evaluation</code>: returns "yes" unless the configuration
            feature <a class="bodylink" href="/configuration/config-features#"/> has been set to false.</li>
          <li><code>xsd-version</code>: returns the value of the configuration property <a class="bodylink" href="/configuration/config-features#"/>, which defaults to "1.1".</li>
        </ul>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the value of a system property.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">tail</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The sequence whose tail is required"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.3, provided XPath 3.0 is enabled.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns all but the first item in a sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">take-while</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="predicate" type="fn(item(), xs:integer) as xs:boolean?" desc="The predicate function"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns items from the input sequence prior to the first one that fails to satisfy a
          supplied predicate.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">timezone-from-date</name>
      <signatures>
        <proto return-type="xs:dayTimeDuration?">
          <arg name="value" type="xs:date?" desc="The supplied xs:date value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the timezone component of a date value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">timezone-from-dateTime</name>
      <signatures>
        <proto return-type="xs:dayTimeDuration?">
          <arg name="value" type="(xs:dateTime | xs:date | xs:time | xs:gYear | xs:gYearMonth | xs:gMonth | xs:gMonthDay | xs:gDay)?" desc="The supplied xs:dateTime value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the timezone component of a dateTime value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">timezone-from-time</name>
      <signatures>
        <proto return-type="xs:dayTimeDuration?">
          <arg name="value" type="xs:time?" desc="The supplied xs:time value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the timezone component of a time value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">tokenize</name>
      <signatures>
        <proto return-type="xs:string*">
          <arg name="value" type="xs:string?" desc="The input string to be tokenized"/>
          <arg name="pattern" type="xs:string?" default="()" desc="Regular expression matching the separators between tokens"/>
          <arg name="flags" type="xs:string?" default="&#34;&#34;" desc="Flags controlling how the regular expression is interpreted"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon 9.3 introduces support for the <code>q</code> flag, and for XPath 3.0 regular
          expression enhancements, provided XPath 3.0 is enabled.</p>
        <p>Saxon supports extended syntax for the flags argument: see the <a class="bodylink code" href="/functions/fn/matches">matches()</a> function for details.</p>
        <p>The single-argument form of this function specified in XPath 3.1, which is equivalent to
          supplying the second argument as a single space character (x20), is available since Saxon
          9.7.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a sequence of strings formed by breaking the input string at any substring that
          matches the given regular expression.</p>
      </description>
      <see-also namespace="http://www.w3.org/2005/xpath-functions" name="matches"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">trace</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The value to be traced, and to be returned as the function result"/>
          <arg name="label" type="xs:string?" default="()" desc="Label to be included in the trace output"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon by default outputs trace messages to <code>System.err</code>. However, the output
          may be redirected to a <code>TraceListener</code> or to an alternative output
          destination.</p>
        <p>The Saxon implementation outputs the value of each item in a sequence as it is evaluated
          (except when the sequence is empty, in which case it outputs "empty sequence" at the
          start). Atomic values are output by converting them to a string, nodes by calling
            <code>getPath()</code> to generate a path expression to the node. With complex
          expressions the order of evaluation may be rather different from the expected order.</p>
        <p>The trace output is directed to <code>System.err</code>, this may be redirected by using
            <code>2&gt;log.txt</code> on the command line. If a <code>TraceListener</code> has been
          nominated, then instead of writing the output to <code>System.err</code>, the information
          instead results in events being notified to the <code>TraceListener</code>. Note that the
          trace is only output by the <code>TraceListener</code> if the level is 'high'.</p>
        <p>The single-argument form of this function specified in XPath 3.1 is available since Saxon
          9.7.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the value of the first argument after outputting a diagnostic message.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">transform</name>
      <signatures>
        <proto return-type="map(*)">
          <arg name="options" type="map(*)" desc="The input options for the transformation"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7. The input options available are listed in the specification,
          with the additions and caveats noted below.</p>
        <p>The following options are available:</p>
        <ul>
          <li>
            <p><b>source-location</b>. Since 9.8.0.8.</p>
            <p>The top-level option <code>source-location</code> has the same effect as
                <code>source-node</code> except that it supplies the location of a source (lexical
              XML) document rather than a parsed XDM tree. This option is useful if the target
              transformation is streamed; it has been added as an extension to the spec because
              there is no other way of executing a stylesheet that expects a streamed input
              document.</p>
          </li>
          <li><p><b>vendor-options/saxon:configuration</b>. Since 9.8.0.8</p>. <p>The
                <code>vendor-options</code> parameter allows an entry of the form
                <code>"vendor-options": map {QName('http://saxon.sf.net/', 'configuration'):
                $config}</code> where <code>$config</code> is the root node of a configuration file
              expressed as an XML tree. If this option is present, the target transformation is run
              in a different configuration from the calling application, so that settings in the
              configuration file do not affect the environment of the caller. The calling and called
              configurations share the same <code>NamePool</code> and document number pool, so that
              XDM nodes can be safely passed from one environment to the other; however they do not
              share the same schema components, so typed (schema-validated) documents cannot be
              passed.</p>
            <p>Options that can usefully be set in the target configuration file include the URIs
              and locations of schema documents and of XSLT library packages.</p></li>
          <li>
            <p>
              <b>vendor-options/saxon:schema-validation</b>
            </p>
            <p>Validation of source documents may be requested either (a) by supplying a
              configuration file in which the option <code>&lt;global
                schemaValidation="strict"/&gt;</code> has been set, or (b) by setting the option
                <code>"vendor-options": map {QName('http://saxon.sf.net/', 'schema-validation'):
                'strict'}</code>. (The value <code>'lax'</code> can also be used.) Either option
              affects documents supplied using the <code>source-node</code>,
                <code>source-location</code>, or <code>global-context-item</code> options. Setting
              the option in the configuration file also affects documents read using the
                <code>doc()</code> or <code>document()</code> functions. Neither option affects
              documents supplied in the <code>initial-match-selection</code> option, or in any of
              the <code>xxx-params</code> options (such as <code>stylesheet-params</code>).</p>
          </li>
          <li>
            <p><b>vendor-options/saxon:write-result-documents</b>. Since 13.0.</p>
            <p>The vendor option <code>map {QName('http://saxon.sf.net/', 'write-result-documents'):
                true()}</code> may be set to cause <code>xsl:result-document</code> instructions to
              write output directly to filestore, rather than returning them in the
                <code>fn:transform</code> result map. More specifically, if
                <code>fn:transform</code> is called from XSLT, then result documents produced by the
              target stylesheet are handled using the result document handler registered for the
              primary transformation; if it is invoked from XQuery, they are output using the
              default result document handler, which writes to filestore.</p>
            <p>Note that the default value of <code>base-output-uri</code> for the target
              transformation is taken from the current output base URI of the invoking
              transformation, assuming the invocation is from XSLT.</p>
          </li>
        </ul>

        <p>To enable use of XSLT 4.0 features in the called stylesheet, it is not enough simply to
          set <code>xsl:stylesheet/@version="4.0"</code> in the called stylesheet module. Instead,
          you need to do two things:</p>
        <ol>
          <li>
            <p>Ensure that 4.0 is enabled in the calling stylesheet (or query)</p>
          </li>
          <li>
            <p>Use the option <code>xslt-version="4.0"</code> in the options passed to the
                <code>fn:transform</code> call.</p>
          </li>
        </ol>
      </status>
      <saxon-edition>ALL_SINCE_9.8 PE/EE_9.7</saxon-edition>
      <description>
        <p>Invokes a transformation using a dynamically-loaded XSLT stylesheet.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">transitive-closure</name>
      <signatures>
        <proto return-type="gnode()*">
          <arg name="node" type="gnode()?" desc="The input GNode"/>
          <arg name="step" type="fn(gnode()) as gnode()*" desc="The step function used to navigate to other GNodes"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns all the GNodes reachable from a given start GNode by applying a supplied function
          repeatedly.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">translate</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The string to be translated"/>
          <arg name="replace" type="xs:string" desc="Characters to be replaced if they appear in the input string"/>
          <arg name="with" type="xs:string" desc="Characters to be used as the replacement for corresponding characters in the second argument"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a string formed by replacing individual characters that appear in the second
          argument with the characters that appear at the corresponding position in the third
          argument.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">true</name>
      <signatures>
        <proto return-type="xs:boolean">
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Return the boolean value true.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">trunk</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns all but the last item in a sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">type-available</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="name" type="(xs:string | xs:QName)" desc="The name of the required type, as a lexical QName"/>
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The Saxon implementation has a minor restriction: if the argument is known only at
          run-time, then the function tests whether the type exists in the run-time configuration,
          which does not necessarily prove that it was present in the static context.</p>
        <p>In Saxon the <code>type-available()</code> function can be used to check for the
          availability of Java classes. For example
            <code>type-available('jt:java.util.HashMap')</code> returns true, where the prefix
            <code>jt</code> is bound to the URI <code>http://saxon.sf.net/java-type</code>.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns true if a type with the given name is available, false otherwise.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">type-of</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="item()*" desc="The input sequence"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns information about the type of a value, as a string.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">unix-dateTime</name>
      <signatures>
        <proto return-type="xs:dateTimeStamp">
          <arg name="value" type="xs:nonNegativeInteger?" default="0" desc="The input Unix time"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns a dateTime value for a Unix time.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">unordered</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The Saxon implementation currently returns the input sequence unchanged, except where the
          expression used as the argument navigates a reverse axis (for example the ancestor or
          preceding-sibling axis), in which case the presence of the function causes the nodes to be
          returned in document order rather than reverse document order.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a random permutation of its argument.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">unparsed-binary</name>
      <signatures>
        <proto return-type="xs:base64Binary?">
          <arg name="source" type="xs:string?" desc="The URI of the resource to be read"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Reads an external resource (for example, a file) and returns its contents in binary.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">unparsed-entity-public-id</name>
      <signatures>
        <proto return-type="xs:anyURI">
          <arg name="entity-name" type="xs:string" desc="The name of the unparsed entity"/>
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available with all versions of SaxonJ and SaxonC. With SaxonCS, implemented since Saxon 13.0,
          but works only on documents that wrap a DOM <code>XmlDocument</code> tree.</p>
        <p>The <code>XmlDocument</code> implementation used in SaxonCS does not follow the rule that when two entity
          declarations have the same name, only the first is retained; instead, it appears to retain neither.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the public ID of an unparsed entity, given its name.</p>
      </description>
      <see-also namespace="http://www.w3.org/2005/xpath-functions" name="unparsed-entity-uri"/>
      <see-also namespace="http://saxon.sf.net/" name="unparsed-entities"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">unparsed-entity-uri</name>
      <signatures>
        <proto return-type="xs:anyURI">
          <arg name="entity-name" type="xs:string" desc="The name of the unparsed entity"/>
          <in-spec>xslt20</in-spec>
          <in-spec>xslt30</in-spec>
          <in-spec>xslt40</in-spec>s
        </proto>
      </signatures>
      <status>
        <p>Available with all versions of SaxonJ and SaxonC. With SaxonCS, implemented since Saxon 13.0,
          but works only on documents that wrap a DOM <code>XmlDocument</code> tree.</p>
        <p>The <code>XmlDocument</code> implementation used in SaxonCS does not follow the rule that when two entity
          declarations have the same name, only the first is retained; instead, it appears to retain neither.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the system ID of an unparsed entity, given its name.</p>
      </description>
      <see-also namespace="http://www.w3.org/2005/xpath-functions" name="unparsed-entity-public-id"/>
      <see-also namespace="http://saxon.sf.net/" name="unparsed-entities"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">unparsed-text</name>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="source" type="xs:string?" desc="The URI of the text file to be read"/>
          <arg name="options" type="(xs:string | map(*))?" default="{}" desc="The encoding to be assumed for the text file"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt20</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The Saxon implementation is by default not deterministic: if the function is called twice
          with the same argument, it will read the external file twice, and may return different
          results if it has changed. If stable results are required, this can be achieved (from 9.8)
          by setting the configuration option <a class="bodylink" href="/configuration/config-features#STABLE_UNPARSED_TEXT">STABLE_UNPARSED_TEXT</a>.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns the contents of an external text file, given its URI. The function attempts to
          infer the encoding. First it looks in the HTTP headers if available. Then it examines the
          start of the file looking first for a byte-order-mark, and failing that for an XML
          declaration. If none of this works, it assumes the encoding is UTF-8.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">unparsed-text-available</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="source" type="xs:string?" desc="The URI of the text file to be read"/>
          <arg name="options" type="(xs:string | map(*))?" default="{}" desc="The encoding to be assumed for the text file"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt20</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The Saxon implementation is by default not deterministic: if the function is called twice
          with the same argument, it will read the external file twice, and may return different
          results if it has changed. If stable results are required, this can be achieved (from 9.8)
          by setting the configuration option <code>Feature.STABLE_UNPARSED_TEXT</code>.</p>
        <p>The default implementation is inefficient: if a call on
            <code>unparsed-text-available()</code> is followed by a call on
            <code>unparsed-text()</code> to read the same file, the file will be read twice. This is
          avoided if the <a class="bodylink" href="/configuration/config-features#STABLE_UNPARSED_TEXT">STABLE_UNPARSED_TEXT</a> option is set, but at the
          cost of keeping the text in memory for the entire query or transformation. </p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Determines whether the corresponding call on <a class="bodylink code" href="/functions/fn/unparsed-text">unparsed-text()</a> with the same arguments would
          succeed. </p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">unparsed-text-lines</name>
      <signatures>
        <proto return-type="xs:string*">
          <arg name="source" type="xs:string?" desc="The uri of the text file to be read"/>
          <arg name="options" type="(xs:string | map(*))?" default="{}" desc="The encoding to be assumed for the text file"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.4, provided XPath 3.0 is enabled.</p>
        <p>The Saxon implementation is by default not deterministic: if the function is called twice
          with the same argument, it will read the external file twice, and may return different
          results if it has changed. If stable results are required, this can be achieved (from 9.8)
          by setting the configuration property <a class="bodylink" href="/configuration/config-features#STABLE_UNPARSED_TEXT">STABLE_UNPARSED_TEXT</a>.
          This makes the function much less efficient, since the entire file has to be read into
          memory and retained in memory just in case the same file is read again. </p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Equivalent to calling <a class="bodylink code" href="/functions/fn/unparsed-text">unparsed-text()</a> and splitting the result at newline boundaries.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">upper-case</name>
      <signatures>
        <proto return-type="xs:string">
          <arg name="value" type="xs:string?" desc="The string to be converted to upper-case"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Converts a string to upper case.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">uri-collection</name>
      <signatures>
        <proto return-type="xs:anyURI*">
          <arg name="source" type="xs:string?" default="()" desc="The collection URI"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.3.</p>
        <p>The mechanisms for interpreting collection URIs are essentially the same as for the <a class="bodylink code" href="/functions/fn/collection">collection()</a> function, except
          that the <code>CollectionFinder</code> (if used) must return URIs rather than returning
          parsed document nodes, or other collection items, directly. For more information see <a class="bodylink" href="/sourcedocs/collections">Collections</a>.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Returns a sequence of <code>xs:anyURI</code> values representing the URIs in a URI
          collection (either the default collection or a named collection).</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">void</name>
      <signatures>
        <proto return-type="empty-sequence()">
          <arg name="input" type="item()*" default="()" desc="The input sequence"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
        <p>The Saxon implementation always evaluates the <code>$input</code> argument eagerly,
          making it useful to force evaluation of an expression that has side-effects.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Absorbs the argument.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">while-do</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input value"/>
          <arg name="predicate" type="fn(item()*, xs:integer) as xs:boolean?" desc="The predicate function"/>
          <arg name="action" type="fn(item()*, xs:integer) as item()*" desc="The function to be applied to the value iteratively"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Processes a supplied value repeatedly, continuing while some condition remains true, and
          returning the first value that does not satisfy the condition.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">xml-to-json</name>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="node" type="node()?" desc="The input XML tree"/>
          <arg name="options" type="map(*)?" default="{}" desc="Used to control the way in which the conversion takes place"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7. The only option recognized is
            <code>'indent':true()|false()</code>. For full details see the specification.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
      <description>
        <p>Converts an XML tree, whose format corresponds to the XML representation of JSON defined
          in the specification, into a string conforming to the JSON grammar.</p>
      </description>
      <see-also name="json-to-xml" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions">xsd-validator</name>
      <signatures>
        <proto return-type="function((document-node(*) | element() | attribute())?) as record(is-valid as xs:boolean, typed-node? as node(), error-details? as record(*)*)">
          <arg name="options" type="map(*)?" default="{}" desc="Options map providing details of an XSD schema"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Given an XSD schema, delivers a function item that can be invoked to validate a document
          or element node against this schema.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">year-from-date</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:date?" desc="The input date value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the year component of a date value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">year-from-dateTime</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="(xs:dateTime | xs:date | xs:time | xs:gYear | xs:gYearMonth | xs:gMonth | xs:gMonthDay | xs:gDay)?" desc="The input dateTime value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the year component of a dateTime value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">years-from-duration</name>
      <signatures>
        <proto return-type="xs:integer?">
          <arg name="value" type="xs:duration?" desc="The input duration value"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Extracts the years component of a duration value.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions">zero-or-one</name>
      <signatures>
        <proto return-type="item()?">
          <arg name="input" type="item()*" desc="The input sequence to be tested"/>
          <in-spec>xpath20</in-spec>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Tests whether a given sequence contains zero or one items; fails if it contains multiple
          items.</p>
      </description>
    </function>

  </section>


  <section id="math" title="Namespace math">
    <h1>Namespace math</h1>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">acos</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The supplied angle in radians"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.3; available whether or not support for XPath 3.0 is enabled.
          Saxon also (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/acos">math:acos()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the arc cosine of the argument, the result being in the range zero to
            +<code>π</code> radians.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">asin</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The supplied angle in radians"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.3; available whether or not support for XPath 3.0 is enabled.
          Saxon also (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/asin">math:asin()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the arc sine of the argument, the result being in the range -<code>π</code>/2 to
            +<code>π</code>/2 radians.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">atan</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The supplied angle in radians"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.3; available whether or not XPath 3.0 is enabled. Saxon also
          (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/atan">math:atan()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the arc tangent of the argument, the result being in the range -<code>π</code>/2
          to +<code>π</code>/2 radians.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">atan2</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="y" type="xs:double" desc="The supplied angle in radians"/>
          <arg name="x" type="xs:double" desc="The supplied angle in radians"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.4; available whether or not XPath 3.0 is enabled. Saxon also
          (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/atan2">math:atan2()</a> in namespace
            <code>http://exslt.org/math</code>.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p> Returns the angle in radians subtended at the origin by the point on a plane with
          coordinates (x, y) and the positive x-axis, the result being in the range -<code>π</code>
          to +<code>π</code>. (Note the order of arguments <i>(y, x)</i>. There are some maths
          libraries that implement an <code>atan2</code> function with the arguments in the order
            <i>(x, y)</i>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">cos</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="radians" type="xs:double?" desc="The supplied angle in radians"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.3; available whether or not support for XPath 3.0 is enabled.
          Saxon also (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/cos">math:cos()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the cosine of the argument, expressed in radians.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">cosh</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The input number"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the hyperbolic cosine of the argument.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">e</name>
      <signatures>
        <proto return-type="xs:double">
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns an approximation to the mathematical constant <code>e</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">exp</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The input number"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.4; available whether or not XPath 3.0 is enabled. Saxon also
          (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/exp">math:exp()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns <code>e</code> to the power of <code>$value</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">exp10</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The input number"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.4; available whether or not XPath 3.0 is enabled.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns 10 to the power of <code>$value</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">log</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The input number"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.4; available whether or not XPath 3.0 is enabled. Saxon also
          (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/log">math:log()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the natural logarithm of <code>$value</code>. </p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">log10</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The input number"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.4; available whether or not XPath 3.0 is enabled.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the base-10 logarithm of <code>$value</code>. </p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">pi</name>
      <signatures>
        <proto return-type="xs:double">
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.3; available whether or not XPath 3.0 is enabled.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns an approximation to the mathematical constant <code>π</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">pow</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="x" type="xs:double?" desc="The input number"/>
          <arg name="y" type="xs:numeric" desc="The power to which the number is to be raised"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.4; available whether or not XPath 3.0 is enabled.</p>
        <p>Saxon also (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/power">math:power()</a> in namespace
            <code>http://exslt.org/math</code>.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns <code>$x</code> raised to the power of <code>$y</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">sin</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="radians" type="xs:double?" desc="The supplied angle in radians"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.3; available whether or not XPath 3.0 is enabled. Saxon also
          (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/sin">math:sin()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the sine of the argument, expressed in radians.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">sinh</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The input number"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the hyperbolic sine of the argument.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">sqrt</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The input number"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.3; available whether or not XPath 3.0 is enabled. Saxon also
          (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/sqrt">math:sqrt()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the non-negative square root of the argument.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">tan</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="radians" type="xs:double?" desc="The supplied angle in radians"/>
          <in-spec>xpath30</in-spec>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Implemented since Saxon 9.3; available whether or not XPath 3.0 is enabled. Saxon also
          (for compatibility) implements the function <a class="bodylink code" href="/functions/exslt-math/tan">math:tan()</a> in namespace
            <code>http://exslt.org/math</code>. </p>
      </status>
      <saxon-edition>ALL_SINCE_9.6</saxon-edition>
      <description>
        <p>Returns the tangent of the argument, expressed in radians.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/math">tanh</name>
      <signatures>
        <proto return-type="xs:double?">
          <arg name="value" type="xs:double?" desc="The input number"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the hyperbolic tangent of the argument.</p>
      </description>
    </function>

  </section>
  <section id="map" title="Namespace map">
    <h1>Namespace map</h1>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">build</name>
      <signatures>
        <proto return-type="map(*)">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="key" type="(fn($item as item(), $position as xs:integer) as xs:anyAtomicType*)?" default="fn:identity#1" desc="Function to compute map keys"/>
          <arg name="value" type="(fn($item as item(), $position as xs:integer) as item()*)?" default="fn:identity#1" desc="Function to compute map values"/>
          <arg name="options" type="map(*)?" default="{}" desc="Options map"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. An earlier version of the function was available
          since Saxon 12.0 provided that syntax extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 13 12_EXPERIMENTAL</saxon-edition>
      <description>
        <p>Returns a map that typically contains one entry for each item in a supplied input
          sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">contains</name>
      <description>
        <p>Tests whether a particular key is present in a map. Returns true if the candidate key is
          present in the map, otherwise false.</p>
      </description>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="map" type="map(*)" desc="The input map"/>
          <arg name="key" type="xs:anyAtomicType" desc="The candidate key"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available as defined in XSLT 3.0 since Saxon 9.4; in XSLT, XPath, and XQuery, whether or
          not 3.0 is available.</p>
        <p>XPath 3.1 version implemented since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">empty</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="map" type="map(*)" desc="The input map"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns <code>true</code> if the supplied map contains no entries.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">entries</name>
      <signatures>
        <proto return-type="map(*)*">
          <arg name="map" type="map(*)" desc="The input map"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 11 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <description>
        <p>Returns a sequence containing all the key-value pairs present in a map (in entry order), each
          represented as a single-entry map.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">entry</name>
      <description>
        <p>Creates a map with a single entry. Used in conjunction with <code>map:merge</code> to
          create maps with multiple entries.</p>
      </description>
      <signatures>
        <proto return-type="map(*)">
          <arg name="key" type="xs:anyAtomicType" desc="The key"/>
          <arg name="value" type="item()*" desc="The corresponding value"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available as defined in XSLT 3.0 since Saxon 9.4; in XSLT, XPath, and XQuery, whether or
          not 3.0 is available.</p>
        <p>XPath 3.1 version implemented since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.7</saxon-edition>
      <see-also name="merge" namespace="http://www.w3.org/2005/xpath-functions/map"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">filter</name>
      <signatures>
        <proto return-type="map(*)">
          <arg name="map" type="map(*)" desc="The input map"/>
          <arg name="predicate" type="fn($key as xs:anyAtomicType, $value as item()*, $position as xs:integer) as xs:boolean?" desc="The function used to filter the input map"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Selects entries from a map, returning a new map.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">find</name>
      <description>
        <p>Searches the supplied input sequence (and any contained maps and arrays) for a map entry
          with the supplied key, and returns an array containing the corresponding values.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="key" type="xs:anyAtomicType" desc="The key"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.0.10.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">for-each</name>
      <description>
        <p>Processes every key/value pair in a map by applying the given function, returning the
          results as a sequence in entry order.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="map" type="map(*)" desc="The input map"/>
          <arg name="action" type="fn($key as xs:anyAtomicType, $value as item()*, $position as xs:integer) as item()*" desc="The function to be applied"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE from Saxon 10; in Saxon-PE/EE since 9.6.</p>
        <p>Available as defined in XSLT 3.0 since Saxon 9.6, replacing the previously available
          function <code>map:for-each-entry</code> (which was available since Saxon 9.4). Available
          in XSLT, XPath, and XQuery, whether or not 3.0 is available.</p>
        <p>XPath 3.1 version implemented since Saxon 9.7.</p>
        <p class="qt4">From XPath 4.0, the entries in a map are ordered (previously order was not
          significant). Since Saxon 13.0, map order is preserved whether or not XPath 4.0 features are
          enabled, so this function always now returns the results in entry order.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.6</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">get</name>
      <description>
        <p>Gets an entry from a map. Returns the value associated with the given key if present, or
          the empty sequence otherwise.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="map" type="map(*)" desc="The input map"/>
          <arg name="key" type="xs:anyAtomicType" desc="The candidate key"/>
          <arg name="default" type="item()*" default="()"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available as defined in XSLT 3.0 since Saxon 9.4; in XSLT, XPath, and XQuery, whether or
          not 3.0 is available.</p>
        <p>XPath 3.1 version implemented since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">items</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="map" type="map(*)" desc="The input map"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns a sequence containing all the values present in a map, in entry order.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">keys</name>
      <description>
        <p>Returns a sequence containing all the keys present in a map, in entry order.</p>
      </description>
      <signatures>
        <proto return-type="xs:anyAtomicType*">
          <arg name="map" type="map(*)" desc="The map whose keys are required"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available as defined in XSLT 3.0 since Saxon 9.4; in XSLT, XPath, and XQuery, whether or
          not 3.0 is available.</p>
        <p>XPath 3.1 version implemented since Saxon 9.7.</p>
        <p class="qt4">From XPath 4.0, the entries in a map are ordered (previously order was not
          significant). Since Saxon 13.0, map order is preserved whether or not XPath 4.0 features are
          enabled, so this function always now returns the results in entry order.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.7</saxon-edition>
    </function>
    
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">merge</name>
      <description>
        <p>Creates a new map that combines entries from a number of existing maps. There is one
          entry in the new map for each distinct key present in the union of the input maps; the way
          duplicate keys are handled is determined by the supplied <code>$options</code>.</p>
        
        <div class="warning">
          <p><b>WARNING:</b> Since 9.7.0.8, the changes in the W3C Specification introduce a
            significant change to the default behaviour of the function when there are duplicate
            keys. Previously (up to and including 9.7.0.7), the associated value for each key in the
            new map was taken from the <b>last</b> map in the input sequence containing that key.
            From 9.7.0.8, the default behaviour is to take the value from the <b>first</b> map
            containing that key.</p>
        </div>
      </description>
      <signatures>
        <proto return-type="map(*)">
          <arg name="maps" type="map(*)*" desc="The input maps"/>
          <arg name="options" type="map(*)?" default="{}" desc="Used to control the way in which merging takes place"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>From Saxon 10 thru 12, several vendor-defined options were recognized: <code>saxon:on-duplicates</code>,
          <code>saxon:key-type</code>, <code>saxon:final</code>. In Saxon 13, only the options
          defined in the QT4.0 specification are recognized: specifically, the <code>duplicates</code> option.</p>
        
      </status>
      <saxon-edition>ALL_SINCE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">put</name>
      <description>
        <p>Creates a map that adds a single entry to an existing map, or replaces a single entry
          (with the specified key) in an existing map.</p>
      </description>
      <signatures>
        <proto return-type="map(*)">
          <arg name="map" type="map(*)" desc="The input map"/>
          <arg name="key" type="xs:anyAtomicType" desc="The key to be added or replaced"/>
          <arg name="value" type="item()*" desc="The new associated value for the specified key"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available as defined in XSLT 3.0 since Saxon 9.6; in XSLT, XPath, and XQuery, whether or
          not 3.0 is available.</p>
        <p>XPath 3.1 version implemented since Saxon 9.7.</p>
        <p>The function is defined to return a new map, leaving the existing map unchanged. Saxon
          meets this requirement without the overhead of creating a complete copy of the map every
          time an entry is added. This is achieved using an internal data structure called a
            <i>trie</i>; this is a tree-like data structure, and when a new entry is added, some new
          nodes (including a new root) are added to this tree, but most of the existing nodes and
          their subtrees can be reused without change. In effect the cost of adding an entry is
          constant, independent of the size of the map.</p>
        <p>Performance may suffer if there is a need to check the types of all the keys and values
          against a required type (e.g. an <code>as="map(xs:integer, xs:string)"</code> attribute on
            <code>xsl:variable</code>). Saxon uses various techniques to avoid inspecting every
          entry in the map when this happens, but it cannot always be avoided.</p>
        <p>The data structures used for maps in Saxon 13 have been changed completely to reflect the
        fact that in QT 4.0, maps retain order information.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">remove</name>
      <description>
        <p>Removes entries from a map. Returns a new map based on the supplied map, minus any
          entries whose key matches one of the supplied keys. The supplied map is unchanged.</p>
      </description>
      <signatures>
        <proto return-type="map(*)">
          <arg name="map" type="map(*)" desc="The input map"/>
          <arg name="keys" type="xs:anyAtomicType*" desc="The keys to be removed"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available as defined in XSLT 3.0 since Saxon 9.4; in XSLT, XPath, and XQuery, whether or
          not 3.0 is available.</p>
        <p>XPath 3.1 version implemented since Saxon 9.7.</p>
        <p>Since 9.7.0.6, the behaviour changed (following a W3C Specification change) to allow
          multiple items to be removed in a single call.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/map">size</name>
      <description>
        <p>Returns the number of entries (key/value pairs) in the supplied map.</p>
      </description>
      <signatures>
        <proto return-type="xs:integer">
          <arg name="map" type="map(*)" desc="The input map"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
          <in-spec>xslt30</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available as defined in XSLT 3.0 since Saxon 9.6; in XSLT, XPath, and XQuery, whether or
          not 3.0 is available.</p>
        <p>XPath 3.1 version implemented since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL_SINCE_9.7</saxon-edition>
    </function>

  </section>
  <section id="array" title="Namespace array">
    <h1>Namespace array</h1>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">append</name>
      <description>
        <p>Returns an array containing all the members of a supplied array, plus one additional
          member at the end.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="member" type="item()*" desc="The new member"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">build</name>
      <signatures>
        <proto return-type="array(*)">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="action" type="(fn(item(), xs:integer) as item()*)?" default="fn:identity#1" desc="The function to be applied to each member of the input sequence"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns an array obtained by evaluating the supplied function once for each item in the
          input sequence.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">empty</name>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="array" type="array(*)" desc="The input array"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns <code>true</code> if the supplied array contains no members.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">filter</name>
      <description>
        <p>Returns an array containing those members of the <code>$array</code> for which
          <code>$predicate</code> returns true.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="predicate" type="fn(item()*, xs:integer) as xs:boolean?" desc="The function used to filter the input array"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE from Saxon 10; in Saxon-PE/EE since 9.7.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">flatten</name>
      <description>
        <p>Replaces any array appearing in a supplied sequence with the members of the array,
          recursively.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">fold-left</name>
      <description>
        <p>Evaluates the supplied function cumulatively on successive values of the supplied
          array.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="init" type="item()*" desc="The zero for the function"/>
          <arg name="action" type="fn(item()*, item()*) as item()*" desc="The function to be applied to each member of the input array"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE from Saxon 10; in Saxon-PE/EE since 9.7.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">fold-right</name>
      <description>
        <p>Evaluates the supplied function cumulatively on successive values of the supplied
          array.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="init" type="item()*" desc="The zero for the function"/>
          <arg name="action" type="fn(item()*, item()*) as item()*" desc="The function to be applied to each member of the input array"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE from Saxon 10; in Saxon-PE/EE since 9.7.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">foot</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns the last member of an array.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">for-each</name>
      <description>
        <p>Returns an array whose size is the same as <code>array:size($array)</code>, in which each
          member is computed by applying <code>$action</code> to the corresponding member of
            <code>$array</code>.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="action" type="fn(item()*, xs:integer) as item()*" desc="The function to be applied to each member of the input array"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE from Saxon 10; in Saxon-PE/EE since 9.7.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">for-each-pair</name>
      <description>
        <p>Returns an array obtained by evaluating the supplied function once for each pair of
          members at the same position in the two supplied arrays.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array1" type="array(*)" desc="The input array"/>
          <arg name="array2" type="array(*)" desc="The input array"/>
          <arg name="action" type="fn(item()*, item()*, xs:integer) as item()*" desc="The function to be applied to each member of the input array"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE from Saxon 10; in Saxon-PE/EE since 9.7.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">get</name>
      <description>
        <p>Returns the value at the specified position in the supplied array (counting from 1).</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="position" type="xs:integer" desc="The specified position"/>
          <in-spec>xpath31</in-spec>
        </proto>
        <proto return-type="item()*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="position" type="xs:integer" desc="The specified position"/>
          <arg name="default" type="item()*"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
        <p class="qt4">XPath 4.0 introduces a 3-argument form of this function in which a default
          value can be supplied that is returned when <code>$position</code> is out of bounds,
          rather than this producing an error. This is implemented since Saxon 13.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">head</name>
      <description>
        <p>Returns the first member of an array, that is <code>$array(1)</code>.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">index-of</name>
      <signatures>
        <proto return-type="xs:integer*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="target" type="item()*" desc="The target value"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns a sequence of positive integers giving the positions within the array
            <code>$array</code> of members that are equal to <code>$target</code>.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">index-where</name>
      <signatures>
        <proto return-type="xs:integer*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="predicate" type="fn(item()*, xs:integer) as xs:boolean?" desc="The predicate function"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns the positions in an input array of members that match a supplied predicate.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">insert-before</name>
      <description>
        <p>Returns an array containing all the members of the supplied array, with one additional
          member at a specified position.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="position" type="xs:integer" desc="The position for the new member"/>
          <arg name="member" type="item()*" desc="The new member"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">items</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Returns the sequence concatenation of the members of an array.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">join</name>
      <description>
        <p>Concatenates the contents of several arrays into a single array.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="arrays" type="array(*)*" desc="The input arrays"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">members</name>
      <signatures>
        <proto return-type="record(value as item()*)*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.2 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Delivers the contents of an array as a sequence of value records. The inverse of the
          <a class="bodylink code" href="/functions/array/of-members">array:of-members</a>
          function.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">of-members</name>
      <signatures>
        <proto return-type="array(*)">
          <arg name="input" type="record(value as item()*)*" desc="A sequence of value records"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.2 under the previous name
          <code>array:of</code> provided that syntax extensions are enabled .</p>
      </status>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Constructs an array from the contents of a sequence of value records. The inverse of the
          <a class="bodylink code" href="/functions/array/members">array:members</a>
          function.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">put</name>
      <description>
        <p>Returns an array containing all the members of a supplied array, except for one member
          which is replaced with a new value.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="position" type="xs:integer" desc="The position of the member to be replaced"/>
          <arg name="member" type="item()*" desc="The new member"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.0.6.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">remove</name>
      <description>
        <p>Returns an array containing all the members of the supplied array, except for the members
          at the specified positions.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="positions" type="xs:integer*" desc="The positions of the members to be removed"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
        <p>Since 9.7.0.6, the behaviour changed (following a W3C Specification change) to allow
          multiple items to be removed in a single call.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">reverse</name>
      <description>
        <p>Returns an array containing all the members of a supplied array, but in reverse
          order.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">size</name>
      <description>
        <p>Returns the number of members in the supplied array.</p>
      </description>
      <signatures>
        <proto return-type="xs:integer">
          <arg name="array" type="array(*)" desc="The input array"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">slice</name>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="start" type="xs:integer?" default="0" desc="The position of the first item from the input array to be included in the result"/>
          <arg name="end" type="xs:integer?" default="0" desc="The position of the last item from the input array to be included in the result"/>
          <arg name="step" type="xs:integer?" default="0" desc="Step between positions to include in the result"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns an array containing selected members of a supplied input array based on their
          position.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">sort</name>
      <description>
        <p>Returns an array containing all the members of the supplied array, sorted according to
          the value of a sort key supplied as a function, using the supplied collation.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="collation" type="xs:string?" default="fn:default-collation()" desc="The collation used for comparing strings"/>
          <arg name="key" type="fn(item()*) as xs:anyAtomicType*" default="fn:data#1" desc="The sort key"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available in Saxon-HE from Saxon 10; in Saxon-PE/EE since 9.7. Signature changed to add
          <code>$collation</code> argument from 9.7.0.8.</p>
      </status>
      <saxon-edition>ALL_SINCE_10 PE/EE_9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">sort-by</name>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="keys" type="record(key? as (fn(item()*) as xs:anyAtomicType*)?, collation? as xs:string?, order? as enum('ascending', 'descending')?)*" desc="The sort key definitions"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Sorts a supplied array, based on the value of a number of sort keys supplied as
          functions.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">sort-with</name>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="comparators" type="(fn(item()*, item()*) as xs:integer)+" desc="The comparator functions"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Sorts a supplied array, according to the order induced by the supplied comparator
          functions.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">split</name>
      <signatures>
        <proto return-type="array(*)*">
          <arg name="array" type="array(*)" desc="The input array"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>PE/EE 13</saxon-edition>
      <description>
        <p>Delivers the contents of an array as a sequence of single-member arrays.</p>
      </description>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">subarray</name>
      <description>
        <p>Returns an array containing all members from a supplied array starting at a supplied
          position, up to a specified length.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <arg name="start" type="xs:integer" desc="The starting position"/>
          <arg name="length" type="xs:integer?" default="()" desc="The specified length"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">tail</name>
      <description>
        <p>Returns an array containing all members except the first from a supplied array.</p>
      </description>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <in-spec>xpath31</in-spec>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7.</p>
      </status>
      <saxon-edition>ALL 9.7</saxon-edition>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4">
      <name namespace="http://www.w3.org/2005/xpath-functions/array">trunk</name>
      <signatures>
        <proto return-type="array(*)">
          <arg name="array" type="array(*)" desc="The input array"/>
          <in-spec>xpath40</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13 in XPath 4.0. Available since Saxon 12.0 provided that syntax
          extensions are enabled.</p>
      </status>
      <saxon-edition>PE/EE 12</saxon-edition>
      <description>
        <p>Returns an array containing all members except the last from a supplied array.</p>
      </description>
    </function>


  </section>
  <section id="saxon" title="Namespace saxon">
    <h1>Namespace saxon</h1>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">adjust-to-civil-time</name>
      <description>
        <p>Converts an <code>xs:dateTime</code> to the local civil time in a named timezone.</p>
      </description>
      <signatures>
        <proto return-type="xs:dateTime?">
          <arg name="in" type="xs:dateTime?" desc="The date/time to be adjusted"/>
          <arg name="tz" type="xs:string" desc="The Olson timezone name, e.g. 'America/Santiago'"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.2.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>If the input is an empty sequence, the result is an empty sequence.</p>

          <p>Otherwise the input <code>dateTime</code> is adjusted to a <code>dateTime</code> in the
            civil timezone named in the second argument. This uses Olson timezone names, for example
              <code>America/New_York</code> or <code>Europe/Paris</code>. For example,</p>
          <ul>
            <li content="para">
              <code>adjust-to-civil-time(xs:dateTime('2008-01-10T12:00:00Z'),
                'America/New_York')</code> returns <code>2008-01-10T07:00:00-05:00</code>
            </li>
            <li content="para">
              <code>adjust-to-civil-time(xs:dateTime('2008-07-10T12:00:00Z'),
                'America/New_York')</code> returns <code>2008-07-10T08:00:00-04:00</code>
            </li>
          </ul>
          <p>If the timezone name is not recognized, the <code>dateTime</code> is adjusted to
            UTC.</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">base64Binary-to-octets</name>
      <description>
        <p>Converts a binary value to a sequence of octets.</p>
      </description>
      <signatures>
        <proto return-type="xs:integer*">
          <arg name="input" type="xs:base64Binary" desc="The binary input value"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes an <code>xs:base64Binary</code> value as input, and returns a
            sequence of integers representing this sequence of octets. The integers will be in the
            range 0-255. </p>
        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="octets-to-base64Binary"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">base64Binary-to-string</name>
      <description>
        <p>Converts a binary value to a string, given its encoding.</p>
      </description>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="input" type="xs:base64Binary?" desc="The binary input value"/>
          <arg name="encoding" type="xs:string" desc="The character encoding"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.5.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes as input a <code>xs:base64Binary</code> value and the name of a
            character encoding (for example <code>UTF8</code>). It interprets the contents of the
              <code>base64Binary</code> value as a sequence of bytes representing a character string
            in a particular encoding, and returns the corresponding string.</p>
          <p>For example, the call <code>saxon:base64Binary-to-string(xs:base64Binary("RGFzc2Vs"),
              "UTF8")</code> returns the string <code>Dassel</code>.</p>
          <p>If the first argument is an empty sequence, the function returns an empty sequence.</p>
        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="string-to-base64Binary"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">characters</name>
      <description>
        <p>Splits a string into a sequence of single-character strings.</p>
      </description>
      <signatures>
        <proto return-type="xs:string*">
          <arg name="input" type="xs:string" desc="The supplied string"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10. Obsolescent, since it is equivalent to the standard 4.0 function fn:characters.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function takes as input an <code>xs:string</code>, and returns a sequence of
            strings, each containing exactly one character.</p>
          <p>For example, the call <code>saxon:characters("hello")</code> returns the sequence
              <code>("h", "e", "l", "l", "o")</code>.</p>
          <p>If the first argument is a zero-length string, the function returns an empty
            sequence.</p>

        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">column-number</name>
      <description>
        <p>Returns the column number of a selected element within the XML document (or external
          entity) that contains it.</p>
      </description>
      <signatures>
        <proto return-type="xs:integer"/>
        <proto return-type="xs:integer?">
          <arg name="node" type="node()?" desc="The node whose column number is required"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function returns the column number of a selected element within the XML document
            (or external entity) that contains it. If the argument is supplied, it must be a node;
            if the argument is omitted, the context item is used, in which case the context item
            must be a node. If line and column numbers are not maintained for the current document,
            the function returns -1.</p>

          <p>The function returns an empty sequence if the argument value is an empty sequence.</p>

          <p>To ensure that line and column numbers are maintained, use the <code>-l</code> (letter
            ell) option on the command line.</p>

          <p>Note that the value returned is dependent on information supplied by the XML parser.
            For an element node, SAX parsers generally report the line and column position of the
            "&gt;" character at the end of the start tag. StAX parsers by contrast report the
            position of the "&lt;" character at the start of the start tag.</p>
          
          <p>From Saxon 13, Saxon maintains location information for text, comment, and processing
          instruction nodes as well as for element nodes. A SAX parser reports the location of the
          end of the node, not the location at the start.</p>
        </div>
      </details>
      <see-also name="system-id" namespace="http://saxon.sf.net/"/>
      <see-also name="line-number" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">compile-query</name>
      <description>
        <p>Compiles an XQuery query.</p>
      </description>
      <signatures>
        <proto return-type="jt:net.sf.saxon.query.XQueryExpression">
          <arg name="query" type="xs:string" desc="The query to be compiled"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.0. The function is obsolescent, replaced by the newer function <a class="bodylink code" href="/functions/saxon/xquery">saxon:xquery()</a>. The function is
          implemented in SaxonCS but with the restriction that the type name
            <code>jt:net.sf.saxon.query.XQueryExpression</code> is not available; the type of the
          result should be declared as <code>item()</code>.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes as input a string containing an XQuery query, and produces as
            output a compiled query suitable for use with the <code>saxon:query()</code> extension
            function.</p>

          <p>The static context for the query (for example, its namespace bindings and its base URI)
            must be defined within its own query prolog. It does not inherit any context values from
            the query or stylesheet in which the <code>saxon:compile-query()</code> function is
            called. The query cannot access variables or functions defined in the containing query
            or stylesheet.</p>

          <p>There are several ways the string containing the query might be constructed. It can be
            built directly as a dynamic string in the calling application. In the case of XSLT, it
            can be read from a file using the <code>unparsed-text()</code> function. It can also be
            generated by calling <code>saxon:serialize()</code> on an XML representation of the
            query, using the serialization method <a href="/extensions/output-extras/method/xquery-method" class="bodylink code">saxon:xquery</a>. </p>

          <p>The compiled query can be evaluated (repeatedly) using the <code>saxon:query()</code>
            extension function.</p>
        </div>
      </details>
      <see-also name="query" namespace="http://saxon.sf.net/"/>
      <see-also name="xquery" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">compile-stylesheet</name>
      <description>
        <p>Creates a compiled stylesheet that can subsequently be used as input to
            <code>saxon:transform()</code>.</p>
      </description>
      <signatures>
        <proto return-type="jt:net.sf.saxon.PreparedStylesheet">
          <arg name="stylesheet" type="document-node()" desc="The document containing the XSLT stylesheet"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.5. This function is obsolescent: it is superseded by the
          fn:transform() function in XPath 3.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes as input a document containing an XSLT stylesheet, and produces as
            output a compiled stylesheet suitable for use with the <code>saxon:transform()</code>
            extension function.</p>

          <p>The document node can be supplied as a call on the <code>doc()</code> function to read
            the stylesheet from filestore (or from a remote URL), or it can be a variable containing
            a stylesheet that has been constructed programmatically. If the document contains any
              <code>xsl:include</code> or <code>xsl:import</code> declarations these will be
            resolved in the usual way (relative to the base URI of the element that contains
            them).</p>
        </div>
      </details>
      <see-also name="transform" namespace="http://saxon.sf.net/"/>
      <see-also name="transform" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>
    
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">compose</name>
      <description>
        <p>Returns a function item that combines the effect of several supplied functions.</p>
      </description>
      <signatures>
        <proto return-type="function(item()*) as item()*">
          <arg name="stylesheet" type="(function(item()*) as item()*)+" desc="A sequence of arity-one function items"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function combines a number of arity-one functions into a single arity-one function.
          The effect of the composed functions is to evaluate the first function with the supplied
          argument value, then to evaluate the second function applied to the result of the first,
          and so on.</p>
          <p>For example, <code>let $f := saxon:compose((is-NaN#1, not#1))</code> binds <code>$f</code> 
            to a function such that <code>$f($x)</code> is true if <code>$x</code> is not NaN. It
          is logically equivalent to <code>fn($x){ is-NaN($x) =&gt; not() }</code>.</p>
          <p>Similarly, <code>let $f := saxon:compose((1 to 3) ! fn{..})</code> binds <code>$f</code> to a function
          that selects the great-grandparent of a node (that is, it applies the parent axis three times).</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">current-mode-name</name>
      <description>
        <p>Returns the name of the current mode.</p>
      </description>
      <signatures>
        <proto return-type="xs:QName?"/>
      </signatures>
      <status>
        <p>Available since Saxon 9.3.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function, designed for use in XSLT, returns the name of the current mode. If there
            is no current mode, or if the current mode is the default (unnamed) mode, it returns an
            empty sequence.</p>

          <p>The function is useful where a template belongs to multiple modes, in that it allows
            the template at run-time to determine in which mode it was activated.</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">decimal-divide</name>
      <description>
        <p>Decimal division with user-specified precision.</p>
      </description>
      <signatures>
        <proto return-type="xs:decimal?">
          <arg name="arg1" type="xs:decimal?" desc="The numerator"/>
          <arg name="arg2" type="xs:decimal?" desc="The denominator"/>
          <arg name="precision" type="xs:integer" desc="The number of digits required in the result"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.0.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function performs a decimal division to a user-specified precision. The value of
            the first argument is divided by the second argument, and the result is returned to the
            number of decimal places indicated by the third argument. Specifically, if the third
            argument is N, then the result will be a multiple of ten to the power of minus N. The
            exact result is rounded towards zero. </p>
          <p>Examples:</p>
          <ul>
            <li>
              <p><code>decimal-divide(100, 30, 2)</code> returns <code>3.33</code></p>
            </li>
            <li>
              <p><code>decimal-divide(100, 30, 4)</code> returns <code>3.3333</code></p>
            </li>
            <li>
              <p><code>decimal-divide(100, 30, 0)</code> returns <code>3</code></p>
            </li>
            <li>
              <p><code>decimal-divide(100, 3, -1)</code> returns <code>30</code></p>
            </li>
            <li>
              <p><code>decimal-divide(100, 700, 6)</code> returns <code>0.142857</code></p>
            </li>
          </ul>
          <p>(The default for decimal division in Saxon using the <code>div</code> operator is to
            return <i>max(18, s1, s2)</i> decimal places in the result, where <i>s1</i> is the scale
            of the first operand and <i>s2</i> the scale of the second.)</p>
          <p>The function returns an empty sequence if either operand is an empty sequence.</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">deep-equal</name>
      <description>
        <p>Compares two sequences, with more control than <a class="bodylink code" href="/functions/fn/deep-equal">fn:deep-equal()</a>.</p>
      </description>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="arg1" type="item()*" desc="The first sequence"/>
          <arg name="arg2" type="item()*" desc="The second sequence"/>
          <arg name="collation" type="xs:string?" desc="The collation used for comparing strings"/>
          <arg name="flags" type="xs:string" desc="Flags controlling the way the comparison is performed."/>
        </proto>
      </signatures>
      <status>
        <p>Introduced in Saxon 8.6.1, with changes (for additional flags) in Saxon 8.7, 9.4, and
          9.5.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function compares two sequences <code>$arg1</code> and <code>$arg2</code> for deep
            equality. The two sequences are supplied in the first two arguments. In the absence of
            any <code>$flags</code>, the function returns the same result as the
              <code>deep-equal()</code> function in the standard XPath library. The
              <code>$flags</code> argument is used to modify the way in which the comparison is
            performed. </p>

          <p>The <code>$collation</code> argument is mandatory. Supply an empty sequence to use the
            default collation.</p>

          <p>The flags argument is a string containing characters acting as flags that cause the
            function to behave differently from the standard <code>fn:deep-equal()</code> function.
            The following flags are defined:</p>
          <table>
            <tbody>
              <tr>
                <td content="para">
                  <code>N</code>
                </td>
                <td content="para">Include namespace nodes in the comparison. For two elements to be
                  deep-equal, they must have the same in-scope namespaces (that is, same prefix and
                  same URI).</td>
              </tr>
              <tr>
                <td content="para">
                  <code>F</code>
                </td>
                <td content="para">Include namespace prefixes in the comparison. For two elements or
                  attributes to be equal, their names must use the same namespace prefix (or
                  none).</td>
              </tr>
              <tr>
                <td content="para">
                  <code>C</code>
                </td>
                <td content="para">Include comment nodes in the comparison. For two element or
                  document nodes to be deep-equal, they must have the same comment node
                  children.</td>
              </tr>
              <tr>
                <td content="para">
                  <code>P</code>
                </td>
                <td content="para">Include processing-instruction nodes in the comparison. For two
                  element or document nodes to be deep-equal, they must have the same
                  processing-instruction node children.</td>
              </tr>
              <tr>
                <td content="para">
                  <code>J</code>
                </td>
                <td content="para">Join adjacent text nodes (for example, nodes either side of an
                  ignored comment).</td>
              </tr>
              <tr>
                <td content="para">
                  <code>S</code>
                </td>
                <td content="para">Compare string values rather than typed values of simple-typed
                  elements and attributes.</td>
              </tr>
              <tr>
                <td content="para">
                  <code>A</code>
                </td>
                <td content="para">Compare type annotations on elements and attributes. The type
                  annotations must match exactly.</td>
              </tr>
              <tr>
                <td content="para">
                  <code>I</code>
                </td>
                <td content="para">Compare the <code>is-ID</code> and <code>is-IDREF</code>
                  properties on elements and attributes.</td>
              </tr>
              <tr>
                <td content="para">
                  <code>w</code>
                </td>
                <td content="para">Exclude whitespace text nodes from the comparison. Any whitespace
                  text node in either tree is ignored (except when determining the typed value of an
                  element annotated with a simple type or a complex type with simple content).</td>
              </tr>
              <tr>
                <td content="para">
                  <code>v</code>
                </td>
                <td content="para">Exclude type variety from the comparison. By default, an element
                  with simple type and an element with complex type are never deep-equal - even if
                  their actual content is identical. Similarly, an element whose content model is
                  empty is never deep-equal to one with an element-only content model, even if both
                  actually have no content. This flag suppresses this check. It is useful when
                  comparing a schema-validated document to an unvalidated document.</td>
              </tr>
              <tr>
                <td content="para">
                  <code>?</code>
                </td>
                <td content="para">Explain reason for a non-match. If the result is not-equal, a
                  warning message explaining the reason will be sent to the
                    <code>ErrorListener</code>. (In general, a sequence of warning messages will be
                  sent, starting with the lowest-level difference and moving up the tree).</td>
              </tr>
            </tbody>
          </table>
        </div>
      </details>
      <see-also namespace="http://www.w3.org/2005/xpath-functions" name="deep-equal"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">discard-document</name>
      <description>
        <p>Marks a document as being eligible for garbage collection.</p>
      </description>
      <signatures>
        <proto return-type="document-node()">
          <arg name="doc" type="document-node()" desc="The document to be dropped from memory"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.0.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function removes a document from Saxon's internal document pool. The document
            remains in memory for the time being, but will be released from memory by the Java
            garbage collector when all references to nodes in the document tree have gone out of
            scope. This has the benefit of releasing memory, but the drawback is that if the same
            document is loaded again during the same transformation, it will be reparsed from the
            source text, and different node identifiers will be allocated. The function returns the
            document node that was supplied as an argument, allowing it to be used in a call such as
              <code>select="saxon:discard-document(document('a.xml'))"</code>. </p>
          <p>When processing a collection, a useful construct is <code>for-each
              select="collection(X)!discard-document(.)"...</code>
          </p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">doc</name>
      <description>
        <p>Fetches and parses an XML document, with supplied parsing options.</p>
      </description>
      <signatures>
        <proto return-type="document-node()">
          <arg name="href" type="xs:string" desc="The URI of the document to be fetched"/>
          <arg name="options" type="map(*)" desc="Parsing options"/>
        </proto>
      </signatures>
      <status>
        <p>Introduced in Saxon 9.8.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function has a similar effect to <code>fn:doc($href)</code>, but allows an extra
            argument to be supplied (in the form of a map) to control the way in which the document
            is parsed. </p>
          <p>The available options are:</p>
          <table>
            <thead>
              <th>Name</th>
              <th>Type</th>
              <th>Values</th>
            </thead>
            <tbody>
              <tr>
                <td>
                  <p>validation</p>
                </td>
                <td>
                  <p>xs:string</p>
                </td>
                <td>
                  <p><code>strict | lax | preserve | strip | skip</code>: controls whether XSD
                    validation is performed.</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>type</p>
                </td>
                <td>
                  <p>xs:QName</p>
                </td>
                <td>
                  <p>Requests validation against a named type.</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>dtd-validation</p>
                </td>
                <td>
                  <p>xs:boolean</p>
                </td>
                <td>
                  <p>Determines whether DTD validation takes place.</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>strip-space</p>
                </td>
                <td>
                  <p>xs:string</p>
                </td>
                <td>
                  <p><code>all | none | package-defined</code>: controls stripping of whitespace
                    text nodes. The values <code>all</code> and <code>none</code> cause stripping of
                    respectively all whitespace text nodes or none; the value
                      <code>package-defined</code> applies only in XSLT, and causes whitespace
                    stripping to follow the rules of the <code>xsl:strip-space</code> and
                      <code>xsl:preserve-space</code> options in the stylesheet. In all cases,
                    whitespace stripping also respects the value of any <code>xml:space</code>
                    attributes encountered, and when validation is enabled, whitespace in
                    element-only content is always stripped.</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>accumulators</p>
                </td>
                <td>
                  <p>xs:QName*</p>
                </td>
                <td>
                  <p>Names the accumulators that are applicable to this document.</p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>use-xsi-schema-location</p>
                </td>
                <td>
                  <p>xs:boolean</p>
                </td>
                <td>
                  <p>Controls whether or not to use the <code>xsi:schemaLocation</code> and
                      <code>xsi:noNamespaceSchemaLocation</code> attributes to locate a schema for
                    validation.</p>
                </td>
              </tr>
            </tbody>
          </table>
          <p>Note: the <code>saxon:doc</code> function was introduced as a target for compiling the
            XSLT 3.0 <code>xsl:source-document</code> instruction when streaming is not in force. It
            is however useful in its own right.</p>
          <p>In the current implementation, the function returns a new document on each call. This
            is not guaranteed, however; future versions may decide to cache the results so that two
            calls with the same arguments return the same node.</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">escape-NCName</name>
      <description>
        <p>Converts any string to a valid NCName, by escaping characters that would otherwise be
          invalid.</p>
      </description>
      <signatures>
        <proto return-type="xs:NCName">
          <arg name="input" type="xs:string" desc="The input string to be converted"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 11.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <details>
        <div>
          <p>If the supplied string is a valid NCName, it is returned unchanged.</p>

          <p>The zero-length string is converted to a single underscore, <code>"_"</code>.</p>

          <p>An underscore is converted to a pair of underscores, <code>"__"</code>.</p>

          <p>A character that would not be valid in an NCName (or, if it is the first character, at
            the start of an NCName) is converted to the form <code>"_XXX_"</code> where
              <code>XXX</code> is the shortest hexadecimal representation of the Unicode codepoint.
            For example, <code>"£"</code> becomes <code>"_a3_"</code>. Lower case is used for digits
            a-f.</p>

          <p>The rules for NCName characters are those in XML 1.0 Fifth Edition (which match the
            rules in XML 1.1).</p>

          <p>For example, <code>saxon:escape-NCName("date of birth")</code> returns
              <code>"date_20_of_20_birth</code>.</p>

          <p>The function is primarily intended for use when converting JSON to XML.</p>

          <p>The reverse conversion is available from the function
              <code>saxon:unescape-NCName</code>.</p>

        </div>
      </details>
      <see-also name="unescape-NCName" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">EQName</name>
      <description>
        <p>Converts a string in the form of an EQName into an <code>xs:QName</code> value.</p>
      </description>
      <signatures>
        <proto return-type="xs:QName()?">
          <arg name="input" type="xs:string?" desc="The string to be converted"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>If the argument value is an empty sequence then the function returns an empty
            sequence.</p>

          <p>If the input is in the form of an <code>NCName</code>, the result is an
              <code>xs:QName</code> value in which the prefix and URI are absent, and the local name
            is the supplied <code>NCName</code>.</p>

          <p>If the input is in the form of a lexical QName (that is,
            <code>prefix:localName</code>), then the prefix is translated to a URI using the
            in-scope namespace bindings from the static context, and the result is an
              <code>xs:QName</code> value having this prefix, URI, and localName. If there is no
            binding for the prefix in the static context, error code <code>FONS0004</code> is
            reported.</p>

          <p>If the input is in the form of a <code>URIQualifiedName</code> (that is,
              <code>Q{uri}localName</code>), then the result is an <code>xs:QName</code> value with
            the specified URI and localName, and with an absent prefix.</p>

          <p>All parts of the supplied name are validated, and error code <code>FOCA0002</code> is
            thrown if invalid. The only constraints on the URI are that it must not contain curly
            braces ("{" or "}").</p>

        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">eval</name>
      <description>
        <p>Evaluates a previously compiled expression.</p>
      </description>
      <signatures>
        <proto return-type="xs:double">
          <arg name="stored-expression" type="jt:net.sf.saxon.functions.Evaluate-PreparedExpression" desc="The compiled expression to be evaluated"/>
          <arg name="param1" type="item()*" desc="The value to be bound to $p1"/>
          <arg name="param2" type="item()*" desc="The value to be bound to $p2"/>
          <arg name="param3" type="item()*" desc="The value to be bound to $p3 ..."/>
        </proto>
      </signatures>
      <status>
        <p>Available since before Saxon 7.2. Dropped in 12.0, but then reinstated in 12.4 for the
          benefit of XQuery users, where the <code>xsl:evaluate</code> instruction is not
          available.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>

          <p>This function returns the result of evaluating the supplied stored expression. A stored
            expression may be obtained as the result of calling the <a class="bodylink code" href="/functions/saxon/expression">saxon:expression</a> function.</p>

          <p>The stored expression is evaluated in the current dynamic context, that is, the context
            node is the current node, and the context position and context size are the same as the
            result of calling <code>position()</code> or <code>last()</code> respectively.</p>

          <p>The second and subsequent arguments to <code>saxon:eval</code> supply values for the
            variables <code>$p1</code>, <code>$p2</code>, etc. within the stored expression. For
            details see <code>saxon:expression</code>.</p>
        </div>
      </details>
      <see-also name="expression" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">evaluate</name>
      <description>
        <p>Allows XPath expressions to be constructed and evaluated dynamically at run-time.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="xpath" type="xs:string" desc="The XPath expression to be evaluated"/>
          <arg name="param1" type="item()*" desc="The value to be bound to $p1"/>
          <arg name="param2" type="item()*" desc="The value to be bound to $p2"/>
          <arg name="param3" type="item()*" desc="The value to be bound to $p3 ..."/>
        </proto>
      </signatures>
      <status>
        <p>Available since before Saxon 7.2. Dropped in 12.0, but then reinstated in 12.4 for the
          benefit of XQuery users, where the <code>xsl:evaluate</code> instruction is not available.
          Note that an <a class="bodylink code" href="/xsl-elements/evaluate">xsl:evaluate</a>
          instruction with similar functionality is available as a standard feature in XSLT 3.0.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>

          <p>The number of arguments is variable (1 or more).</p>

          <p>The supplied string must contain an XPath expression. The result of the function is the
            result of evaluating the XPath expression. This is useful where an expression needs to
            be constructed at run-time or passed to the stylesheet as a parameter, for example where
            a sort key is determined dynamically.</p>

          <p>The static context for the expression includes all the in-scope namespaces, types, and
            functions from the calling stylesheet or query. It does <b>not</b> include any variables
            from the calling environment. The base URI and default function namespace are inherited
            from the calling environment. The default namespace for elements and types is taken from
            the value of the <code>xpath-default-namespace</code> attribute in the stylesheet, if
            present.</p>

          <p>If stylesheet functions are to be called from the expression, they should be declared
            with <code>visibility="public"</code>.</p>

          <p>The expression may contain references to variables <code>$p1</code>, <code>$p2</code>,
            etc., and the values of these variables may be supplied in the second, third, and
            subsequent arguments to the <code>saxon:evaluate()</code> call.</p>

          <p>The function <code>saxon:evaluate(string)</code> is shorthand for
              <code>saxon:eval(saxon:expression(string))</code>. For the rules governing what may
            and may not appear in the expression, see the details of
            <code>saxon:expression</code>.</p>


        </div>
      </details>
      <see-also name="expression" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">expression</name>
      <description>
        <p>Creates a stored expression that can be evaluated repeatedly with different argument
          values and a different dynamic context. </p>
      </description>
      <signatures>
        <proto return-type="jt:net.sf.saxon.functions.Evaluate-PreparedExpression">
          <arg name="string" type="xs:string" desc="The expression to be compiled"/>
        </proto>
        <proto return-type="jt:net.sf.saxon.functions.Evaluate-PreparedExpression">
          <arg name="string" type="xs:string" desc="The expression to be compiled"/>
          <arg name="ns" type="element()" desc="Provides the namespace context"/>
        </proto>
      </signatures>
      <status>
        <p>Available since before Saxon 7.2. Dropped in 12.0, but then reinstated in 12.4 for the
          benefit of XQuery users, where the <code>xsl:evaluate</code> instruction is not
          available.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function creates a stored expression that can be evaluated repeatedly with
            different argument values and a different dynamic context.</p>

          <p>The supplied string must contain an XPath expression. The result of the function is a
              <i>stored expression</i>, which may be supplied as an argument to other extension
            functions such as <a class="bodylink code" href="/functions/saxon/eval">saxon:eval()</a>. The result of the expression will usually depend on the context item.
            The context for the expression includes the namespaces in scope at this point in the
            stylesheet. The expression may contain references to the nine variables
            <code>$p1</code>, <code>$p2</code>, ... <code>$p9</code> only. It may contain calls on
            Java extension functions, including Saxon-defined, EXSLT-defined, and EXPath-defined
            functions, as well as user-defined functions declared within the containing query or
            stylesheet. But it does not allow access to stylesheet variables, or functions defined
            in the XSLT specification such as <code>key()</code> or
            <code>format-number()</code>.</p>

          <p>If stylesheet functions are to be called from the expression, they should be declared
            with <code>visibility="public"</code>.</p>

          <p>
            <i>Use of the <code>current()</code> function is allowed, provided <a class="bodylink code" href="/functions/saxon/evaluate">saxon:evaluate()</a> is
              called from XSLT: the value is the context item at the point where
                <code>saxon:evaluate()</code> or <code>saxon:eval()</code> is called. Use of other
              XSLT-specific functions such as <code>key()</code> or <code>format-number()</code> is
              untested; they might work in some cases and fail in others, possibly in an obscure
              way.</i>
          </p>

          <p>If the second argument is present, its value must be a single element node. The
            in-scope namespace bindings of this element node will be used to resolve any namespace
            prefixes present in the XPath expression. The default namespace for the element is also
            used as the default namespace for elements and types within the XPath expression. In
            addition, standard namespace bindings are automatically available for the prefixes xml,
            xs, xsi, fn, and saxon.</p>

          <p>If the second argument is omitted, then the namespace context for the expression is
            taken from the stylesheet. (This is also the rule used by
            <code>saxon:evaluate()</code>.) If the expression contains namespace prefixes, these are
            interpreted in terms of the namespace declarations in scope at the point where the
              <code>saxon:expression()</code> function is called, not those in scope where the
            stored expression is evaluated.</p>

          <p>The stored expression (if it is to be evaluated using <code>saxon:eval()</code>) may
            contain references to variables named <code>$p1</code>, <code>$p2</code>, ...
              <code>$p9</code>. The values of these variables can be supplied when the expression is
            evaluated using <code>saxon:eval()</code>. The second argument of
              <code>saxon:eval()</code> supplies the value of <code>$p1</code>, the third argument
            supplies the value of <code>$p2</code>, and so on.</p>

          <p>For example, following <code>&lt;xsl:variable name="add" select="saxon:expression('$p1
              + $p2')"/&gt;</code>, the instruction <code>&lt;xsl:value-of select="saxon:eval($add,
              6, 7)"/&gt;</code> will output <code>13</code>.</p>
        </div>
      </details>
      <see-also name="eval" namespace="http://saxon.sf.net/"/>
      <see-also name="evaluate" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">function-annotations</name>
      <description>
        <p>Returns the XQuery function annotations defined on a function item.</p>
      </description>
      <signatures>
        <proto return-type="map(*)*">
          <arg name="fn" type="function(*)" desc="The function item in question"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.8. Obsolescent since Saxon 13: use the standard QT4 function <code>fn:function-annotations</code>
        in preference.</p>
      </status>
      <saxon-edition>PE/EE 9.8</saxon-edition>
      <details>
        <div>
          <p>This function returns the function annotations present on an XQuery function
            declaration. If the function has no annotations, it returns an empty sequence.</p>

          <p>The result sequence contains one item for each function annotation present on the
            supplied function. This information is provided in the form of a map, with two entries.
            The entry with key "name" holds the name of the annotation, as an <code>xs:QName</code>
            value. The entry with key "params" holds the values of the parameters of the annotation,
            as a sequence of atomic items.</p>

          <p>For example, if the function is declared as:</p>

          <pre><code class="language-xquery">declare namespace a="http://a.com/";
declare %a:colour("blue", 3) function local:f() as xs:integer {3};</code></pre>

          <p>then the function call <code>saxon:function-annotations(local:f#0)</code> returns a
            sequence containing a single map of the form:</p>

          <pre><code class="language-xquery">map{"name": QName("http://a.com/", "colour"),
    "params": ("blue", 3)}</code></pre>

          <p>Function annotations are retained (as required by the W3C specification) when a
            function is coerced as a result of type-checking. Annotations are also retained when
            functions are partially applied.</p>

        </div>
      </details>

    </function>
    
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">generate-sequence</name>
      <description>
        <p>Returns a sequence based on a start item and a function that computes the next item.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="start" type="item()" desc="The first item"/>
          <arg name="step" type="fn(item(), xs:integer) as item()?" desc="Function to compute the next item"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 13. Originally proposed as a new standard QT4 function (see PR2350)
        but not (yet) accepted for inclusion in the spec.</p>
      </status>
      <saxon-edition>PE/EE 13</saxon-edition>
      <details>
        <div>
          <p>This function returns a sequence obtained by successive evaluations of the <code>$step</code>
            function. Each call on <code>$step</code> gets two arguments, (a) the current item in the sequence,
            and (b) the 1-based position in the sequence. The first item in the sequence is <code>$start</code>.</p>
          
          <p>Using this function requires care because it can return an infinite sequence. It is evaluated lazily.
            Evaluation terminates either when the <code>$step</code> function returns the empty sequence, or when
            no further items from the result sequence are required.</p>

          <p>For example, the call:</p>
          
          <pre><code class="language-xquery">saxon:generate-sequence(20, fn{.+1}) [1 to 10]</code></pre>
          
          <p>returns the first 10 numbers in the infinite sequence (10, 11, 12, ...).</p>
          
          <p>Similarly, </p>
          
          <pre><code class="language-xquery">(saxon:generate-sequence([1,1], fn{[?2, ?1+?2]}) ?1) [ 1 to $N ]</code></pre>

          <p>generates the first <code>$N</code> numbers in the Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, ...).</p>
          
          <p>These examples rely on lazy evaluation, and on the fact that Saxon recognizes the predicate
          <code>[1 to $N]</code> and will not evaluate more items than are needed to satisfy this predicate.</p>

        </div>
      </details>

    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">get-pseudo-attribute</name>
      <description>
        <p>Parses the contents of a processing instruction.</p>
      </description>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="att" type="xs:string" desc="The name of the pseudo-attribute required"/>
        </proto>
      </signatures>
      <status>
        <p>Available since before Saxon 8.0. Revised in Saxon 10 to follow the W3C rules for the
          xml-stylesheet processing instruction.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>

          <p>This function parses the contents of a processing instruction (supplied as the context
            item) whose content follows the conventional attribute="value" structure (as defined for
            the <code>&lt;?xsl-stylesheet?&gt;</code> processing instruction). The context should be
            a processing instruction node; the function returns the value of the pseudo-attribute
            named in the first argument if it is present, or an empty sequence otherwise.</p>

          <p>If the attribute value contains a sequence of characters in the form of an XML
            character reference, for example <code>&amp;#x0A;</code>, this is parsed and converted
            into the corresponding character.</p>

          <p>The function throws a dynamic error (SXCH0005) if the supplied string does not follow
            the syntax for pseudo-attributes given in <a href="https://www.w3.org/TR/2010/REC-xml-stylesheet-20101028/">Associating Style
              Sheets with XML documents 1.0 (Second Edition)</a>.</p>

          <p>
            <i>Although intended for parsing processing instructions, the function will actually
              parse the string value of the context item whatever it might be.</i>
            <i>Earlier Saxon releases did not throw an error if the input syntax was invalid.</i>
          </p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">group-starting</name>
      <description>
        <p>Splits a sequence of items into a sequence of groups, each represented as an array; a new
          array starts whenever an item is found that matches a condition, which is supplied as a
          function.</p>
      </description>
      <signatures>
        <proto return-type="array(item()*)+">
          <arg name="input" type="item()*" desc="The input sequence to be grouped"/>
          <arg name="condition" type="function(item()) as xs:boolean" desc="The condition determining whether an item starts a new group"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.9.</p>
      </status>
      <saxon-edition>PE/EE 9.9</saxon-edition>
      <details>
        <div>
          <p>Like the <code>xsl:for-each-group/@group-starting-with</code> instruction, this
            function partitions a sequence based on splitting the sequence at any item that matches
            some predicate. The function can sometimes be a useful alternative to the XSLT
            instruction, but it is primarily provided to bring similar functionality for non-XSLT
            environments.</p>

          <p>The function takes two arguments: the first argument is an arbitrary sequence; the
            second is a predicate function that takes a single item as input and returns a boolean.
            This predicate function is applied to each item in the sequence to decide whether it is
            a "matching" or "non-matching" item.</p>

          <p>The result of the <code>saxon:group-starting</code> function is a sequence of arrays.
            The first array (which is always present and may be empty) contains all the items from
            the input sequence that precede the first matching item; subsequent arrays (one per
            matching item, always non-empty) contain a matching item followed by zero or more
            non-matching items.</p>

          <p>So the function call <code>saxon:group-starting(1 to 10, fn{. mod 3 eq 0})</code>
            returns the sequence <code>([1,2], [3,4,5], [6,7,8], [9])</code>.</p>

          <p>Similarly <code>saxon:group-starting(1 to 10, fn{. mod 3 eq 1})</code> returns the
            sequence <code>([], [1,2,3], [4,5,6], [7,8,9])</code>.</p>

          <p>Note that (as with <code>fn:filter()</code> the predicate function must return a
            boolean, or a value that can be converted to a boolean by the function conversion rules.
            Returning a node and relying on the effective boolean value of a node being true does
            not work.</p>

          <p>So the function call <code>saxon:group-starting(following-sibling::*,
              fn{boolean(self::h1)})[1]?*</code> selects the following-sibling elements of the
            context item up to (and excluding) the first <code>h1</code> element. The call on
              <code>boolean()</code> here is necessary.</p>


          <p>The function is pipelined in that it only scans the input to find one group at a time,
            on demand. Each group, however, is materialized as an array in memory.</p>


        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">has-same-nodes</name>
      <description>
        <p>Tests whether two sequences contain the same nodes, in the same order.</p>
      </description>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="arg1" type="node()*" desc="The first sequence"/>
          <arg name="arg2" type="node()*" desc="The second sequence"/>
        </proto>
      </signatures>
      <status>
        <p>Available since before Saxon 8.0.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function returns a boolean that is true if and only if <code>$arg1</code> and
              <code>$arg2</code> contain the same sequence of nodes in the same order. Nodes are
            compared by identity, not by content. Note this is quite different from both the
              "<code>=</code>" operator, which tests whether there is a pair of nodes with the same
            string-value, and also the <a class="bodylink code" href="/functions/fn/deep-equal">fn:deep-equal()</a> function, which compares nodes pairwise but by content.</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">hexBinary-to-octets</name>
      <description>
        <p>Converts a binary value to a sequence of octets.</p>
      </description>
      <signatures>
        <proto return-type="xs:integer*">
          <arg name="input" type="xs:hexBinary" desc="The binary input value"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes an <code>xs:hexBinary</code> value as input, and returns a sequence
            of integers representing this sequence of octets. The integers will be in the range
            0-255.</p>
        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="octets-to-hexBinary"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">hexBinary-to-string</name>
      <description>
        <p>Converts a binary value to a string, given its encoding.</p>
      </description>
      <signatures>
        <proto return-type="xs:string?">
          <arg name="input" type="xs:hexBinary?" desc="The binary input value"/>
          <arg name="encoding" type="xs:string" desc="The character encoding"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.5.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes as input an <code>xs:hexBinary</code> value and the name of a
            character encoding (for example <code>UTF8</code>). It interprets the contents of the
            hexBinary value as a sequence of bytes representing a character string in a particular
            encoding, and returns the corresponding string.</p>
          <p>If the first argument is an empty sequence, the function returns an empty sequence.</p>
        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="string-to-hexBinary"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">in-scope-namespaces</name>
      <description>
        <p>Returns a map from prefixes to namespace URIs giving the in-scope namespace bindings for
          a given element node.</p>
      </description>
      <signatures>
        <proto return-type="map(xs:string, xs:string)">
          <arg name="node" type="node()" desc="The input element"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10. Changed in Saxon 12 to align with the proposed XPath 4.0
          function <code>fn:in-scope-namespaces()</code>: the returned map now always includes an
          entry for the XML namespace.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>If the supplied node is not an element, the function returns the empty sequence.</p>

          <p>In other cases it returns a map from namespace prefixes to namespace URIs, giving all
            the in-scope namespace bindings for the element. This is a more efficient way to obtain
            this information than either the use of the namespace axis, or the XPath 2.0 functions
              <code>in-scope-prefixes</code> and <code>namespace-uri-for-prefix</code>.</p>

          <p>The map includes the default namespace, if there is a binding for the default
            namespace: the relevant entry in the map will have a key that is the zero-length string.
            The map always (from Saxon 12) includes the implicit binding of the "xml" namespace to
            the namespace URI <code>http://www.w3.org/XML/1998/namespace</code>.</p>

        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">in-summer-time</name>
      <description>
        <p>Determines whether a given date/time is in summer-time (daylight savings time).</p>
      </description>
      <signatures>
        <proto return-type="xs:boolean?">
          <arg name="date" type="xs:dateTime" desc="The input date/time"/>
          <arg name="region" type="xs:string" desc="The country code or Olson timezone name"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>The <code>$region</code> argument may either be an ISO two-letter country code (for
            example <code>de</code> or <code>es</code>), or an Olson timezone name (such as
              <code>America/New_York</code> or <code>Europe/Lisbon</code>). The function returns
            true if the given date/time is in summer time (daylight savings time) in that country or
            timezone, as far as can be determined from the Java timezone database. If the
            information is not available the function returns an empty sequence.</p>

          <p>If a country code is specified for a country that spans different timezones with
            different daylight savings rules (for example, the US), then one timezone in that
            country is chosen arbitrarily.</p>

          <p>For reliable results, the supplied date/time should include a timezone. This does not
            need to correspond to the timezone named in the second argument; it is there purely to
            ensure that <code>$date</code> represents a single point in time unambiguously.</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">is-defaulted</name>
      <description>
        <p>Tests whether an attribute node is present in the data model as a result of expansion of
          default or fixed values declared in a schema.</p>
      </description>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="node" type="node()" desc="The attribute node in question"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.7. Not available in SaxonCS.</p>
      </status>
      <saxon-edition platform="J C">EE 9.7</saxon-edition>
      <details>
        <div>
          <p>This function tests whether a supplied attribute node is present as a result of
            expansion of default or fixed values defined in a schema or DTD.</p>

          <p>This information is available only if the options
              <code>EXPAND_ATTRIBUTE_DEFAULTS</code> and <code>MARK_DEFAULTED_ATTRIBUTES</code> are
            both enabled in the <code>Configuration</code>, and if the tree model in use is the
            TinyTree. If these conditions are not satisfied, or if the node supplied is not an
            attribute node, the function returns false.</p>

          <p>In the case of DTD-defined attribute defaults, the function only works if Saxon is
            supplied with the necessary information by the XML parser. Generally this will be the
            case on the Java platform when the input is supplied as a SAXSource or StreamSource and
            DTD validation is requested.</p>

          <p>If the input is an empty sequence, the function returns an empty sequence.</p>

          <p>If running from the command line, use the option
              <code>--markDefaultedAttributes:on</code> to ensure that the information is
            available.</p>

          <p>The function is not available in SaxonCS, because the Microsoft XML parser does not
            make the information available.</p>
        </div>
      </details>
      <see-also name="system-id" namespace="http://saxon.sf.net/"/>
      <see-also name="column-number" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">is-whole-number</name>
      <description>
        <p>Tests whether the input is a whole number.</p>
      </description>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="arg" type="xs:numeric?" desc="The input number"/>
        </proto>
      </signatures>
      <status>
        <p>Available since before Saxon 8.0.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes a number as input and returns true if the number has no fractional
            part, that is, if it is equal to some integer. If an empty sequence is supplied, the
            function returns false.</p>

          <p>
            <i>This function is provided largely because it is used internally by the Saxon
              optimizer.</i>
          </p>

          <p>The following example will return true:</p>
          <pre><code class="language-xquery">saxon:is-whole-number(12e0)</code></pre>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">items-after</name>
      <description>
        <p>Returns the subsequence of the input starting with the item after the first one that
          matches the predicate.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="predicate" type="function(item()) as xs:boolean" desc="Function determining the start condition"/>
        </proto>
      </signatures>
      <status>
        <p>Available from Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function returns a contiguous subsequence of the input sequence, starting with the
            item immediately after the first one that matches the <code>$predicate</code> condition,
            and ending at the end of the input sequence.</p>
          <p>If no item in the input sequence matches the <code>$predicate</code> condition, or if
            the first item to match is the last item in the input, then the result is an empty
            sequence.</p>

          <p>Example: <code>saxon:items-after(1 to 20, function($x){$x mod 10 = 0})</code> returns
            the sequence <code>11 to 20</code>.</p>

          <p>In XSLT, calls on <code>saxon:items-after</code> are streamable provided that the
            function supplied as the predicate is either (a) a reference to a user-declared
            stylesheet function declared with <code>streamability="inspection"</code>, or (b) an
            inline function whose body is grounded and motionless. More specifically, if the
            predicate function satisfies these conditions then the posture and sweep of the function
            call are the same as the posture and sweep of the first argument.</p>

        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="items-before"/>
      <see-also namespace="http://saxon.sf.net/" name="items-from"/>
      <see-also namespace="http://saxon.sf.net/" name="items-until"/>

    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">items-before</name>
      <description>
        <p>Returns the subsequence of the input ending with the item before the first item that
          matches the predicate.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="predicate" type="function(item()) as xs:boolean" desc="Function determining the end condition"/>
        </proto>
      </signatures>
      <status>
        <p>Available from Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function returns a contiguous subsequence of the input sequence, starting at the
            first item in the input, and ending with the item immediately before the first one that
            matches the <code>$predicate</code> condition.</p>
          <p>If no item in the input sequence matches the <code>$predicate</code> condition, the
            entire input sequence is returned.</p>
          <p>If the first item in the input sequence matches the <code>$predicate</code> condition,
            the result is an empty sequence.</p>

          <p>Example: <code>saxon:items-before(1 to 20, function($x){$x mod 10 = 0})</code> returns
            the sequence <code>1 to 9</code>.</p>

          <p>In XSLT, calls on <code>saxon:items-before</code> are streamable provided that the
            function supplied as the predicate is either (a) a reference to a user-declared
            stylesheet function declared with <code>streamability="inspection"</code>, or (b) an
            inline function whose body is grounded and motionless. More specifically, if the
            predicate function satisfies these conditions then the posture and sweep of the function
            call are the same as the posture and sweep of the first argument. Where possible,
            reading and parsing of the source document will be abandoned when an item matching the
            predicate is encountered.</p>

          <p>Example: <code>/*/emp =&gt; saxon:items-from(function($e){$e/@dept='sales'} =&gt;
              saxon:items-before(function($e){$e/@dept='QA'}</code></p>

        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="items-until"/>
      <see-also namespace="http://saxon.sf.net/" name="leading"/>
      <see-also namespace="http://saxon.sf.net/" name="items-after"/>
      <see-also namespace="http://saxon.sf.net/" name="items-from"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">items-from</name>
      <description>
        <p>Returns the subsequence of the input starting with the first item that matches the
          predicate.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="predicate" type="function(item()) as xs:boolean" desc="Function determining the start condition"/>
        </proto>
      </signatures>
      <status>
        <p>Available from Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function returns a contiguous subsequence of the input sequence, starting with the
            first item that matches the <code>$predicate</code> condition, and ending at the end of
            the input sequence.</p>
          <p>If no item in the input sequence matches the <code>$predicate</code> condition, the
            result is an empty sequence.</p>
          <p>If the first item in the input sequence matches the <code>$predicate</code> condition,
            the entire input sequence is returned.</p>

          <p>Example: <code>saxon:items-from(1 to 20, function($x){$x mod 10 = 0})</code> returns
            the sequence <code>10 to 20</code>.</p>

          <p>In XSLT, calls on <code>saxon:items-after</code> are streamable provided that the
            function supplied as the predicate is either (a) a reference to a user-declared
            stylesheet function declared with <code>streamability="inspection"</code>, or (b) an
            inline function whose body is grounded and motionless. More specifically, if the
            predicate function satisfies these conditions then the posture and sweep of the function
            call are the same as the posture and sweep of the first argument.</p>

          <p>Example: <code>/*/emp =&gt; saxon:items-from(function($e){$e/@dept='sales'} =&gt;
              saxon:items-before(function($e){$e/@dept='QA'}</code></p>

        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="items-before"/>
      <see-also namespace="http://saxon.sf.net/" name="items-until"/>
      <see-also namespace="http://saxon.sf.net/" name="items-after"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">items-until</name>
      <description>
        <p>Returns the subsequence of the input ending with the first item that matches the
          predicate.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="predicate" type="function(item()) as xs:boolean" desc="Function determining the end condition"/>
        </proto>
      </signatures>
      <status>
        <p>Available from Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function returns a contiguous subsequence of the input sequence, starting at the
            first item in the input, and ending with the first item that matches the
              <code>$predicate</code> condition.</p>
          <p>If no item in the input sequence matches the <code>$predicate</code> condition, the
            entire input sequence is returned.</p>
          <p>If the first item in the input sequence matches the <code>$predicate</code> condition,
            the result contains that single item.</p>

          <p>Example: <code>saxon:items-until(1 to 20, function($x){$x mod 10 = 0})</code> returns
            the sequence <code>1 to 10</code>.</p>

          <p>In XSLT, calls on <code>saxon:items-until</code> are streamable provided that the
            function supplied as the predicate is either (a) a reference to a user-declared
            stylesheet function declared with <code>streamability="inspection"</code>, or (b) an
            inline function whose body is grounded and motionless. More specifically, if the
            predicate function satisfies these conditions then the posture and sweep of the function
            call are the same as the posture and sweep of the first argument. Where possible,
            reading and parsing of the source document will be abandoned when an item matching the
            predicate is encountered.</p>

        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="items-before"/>
      <see-also namespace="http://saxon.sf.net/" name="leading"/>
      <see-also namespace="http://saxon.sf.net/" name="items-after"/>
      <see-also namespace="http://saxon.sf.net/" name="items-from"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">key-map</name>
      <description>
        <p>Returns a map providing access to the index constructed using <a class="bodylink code" href="/xsl-elements/key">xsl:key</a>.</p>
      </description>
      <signatures>
        <proto return-type="map(xs:string, node()*)">
          <arg name="key" type="xs:string" desc="The name of the key"/>
          <arg name="doc" type="document-node()" desc="The root of the tree"/>
          <arg name="min" type="xs:string?" desc="The low end of the required key range"/>
          <arg name="max" type="xs:string?" desc="The high end of the required key range"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.5. Applicable to XSLT only. Not available in SaxonCS.</p>
      </status>
      <saxon-edition platform="J C">PE/EE 9.5</saxon-edition>
      <details>
        <div>
          <p>To use this function, it is first necessary to declare a key as a range key, which can
            be done using a declaration such as:</p>

          <pre><code class="language-xml">&lt;xsl:key name="k" match="transaction" use="@date" saxon:range-key="yes"/&gt;</code></pre>

          <p>The effect of this declaration is that Saxon builds the index underpinning the key
            using a Java <code>TreeMap</code> rather than a <code>HashMap</code>, making ordered
            traversal possible. At present a key can be declared as a range key only if the keys are
            of type string (or untypedAtomic), and if the Unicode codepoint collation is used. If
            there are several <code>xsl:key</code> elements with the same name, declaring any one of
            them as a range key is sufficient.</p>

          <p>The effect of the <code>saxon:key-map()</code> function is to construct a map
            (actually, a wrapper for the underlying index), in which the entries represent the nodes
            selected by the <code>match</code> pattern of the <code>xsl:key</code> declaration
            within the document identified by the <code>$doc</code> argument. The <code>$min</code>
            and <code>$max</code> arguments restrict the map to those entries whose keys lie between
            the <code>$min</code> and <code>$max</code> values respectively; either argument can be
            set to an empty sequence to indicate an open-ended range of key values.</p>

          <p>In the resulting map, the function <a class="bodylink code" href="/functions/map/keys">map:keys()</a> is guaranteed to return keys in sorted order. (This does not apply,
            however, if new maps are constructed from this map by adding or removing entries or
            combining several maps.)</p>

          <p>The resulting map can be used using all the <a class="bodylink" href="/functions/map">functions</a> available for maps, for example <code>map:get()</code> to get an entry,
              <code>map:keys()</code> to enumerate the key values, <code>map:is-empty()</code> to
            determine if the map is empty, and so on. The maps for several documents can be combined
            into a single map using a construct such as:</p>

          <pre><code class="language-xml">map:merge(collection('dir?select="*.xml')!saxon:key-map('k', ., (), ()))</code></pre>

          <p>Note however that the resulting map will not be sorted.</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">last-modified</name>
      <description>
        <p>Returns the date and time when a file was modified.</p>
      </description>
      <signatures>
        <proto return-type="xs:dateTime">
          <arg name="uri" type="xs:string?" desc="The URI of the required file"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.0; revised in Saxon 9.2. Not available in SaxonCS.</p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <details>
        <div>

          <p>If the argument is an empty sequence, the result is an empty sequence.</p>

          <p>Otherwise the argument must be a valid URI. If it is a relative URI, this will be
            resolved against the base URI from the static context. The function has been tested with
            URIs using the <code>file</code> and <code>http</code> schemes, and is not guaranteed to
            give a result with other URI schemes (or indeed with these, under all
            circumstances).</p>

          <p>The function returns an <code>xs:dateTime</code> value which will usually be in a
            specific timezone. The result can therefore be formatted using the
              <code>format-dateTime()</code> function, or input to arithmetic and comparisons
            against other dates and times.</p>

          <p>If the URI is not syntactically valid, error FODC0005 is thrown. If the resource
            identified by the URI cannot be retrieved, error FODC0002 is thrown. If the resource is
            successfully retrieved but no date/time information is available, the function returns
            an empty sequence.</p>

          <p>Example:</p>
          <pre><code class="language-xml">format-dateTime(saxon:last-modified(resolve-uri('lookup.xml', static-base-uri()))</code></pre>

          <p>This function differs from the EXPath function <code>file:last-modified</code> in that
            it takes a URI rather than a filename as input, and may work for resources other than
            files: for example, HTTP resources, provided the <code>last-modified</code> header is
            present in the HTTP response.</p>

          <p>To find the last-modified date of the file from which a given node was loaded, use
              <code>saxon:last-modified(document-uri($node))</code>. </p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">leading</name>
      <description>
        <p>Returns the items in a sequence up to a selected item.</p>
      </description>
      <signatures>
        <proto return-type="item()">
          <arg name="input" type="item()*" desc="The input sequence"/>
        </proto>
        <proto return-type="item()">
          <arg name="input" type="item()*" desc="The input sequence"/>
          <arg name="test" type="function(*)" desc="Function determining where the sequence should terminate"/>
        </proto>
      </signatures>
      <status>
        <p>Available since before Saxon 8.0. Changed in Saxon 9.5 to take a function rather than an
          expression as the second argument.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function returns a sequence containing all those nodes from <code>$input</code> up
            to and excluding the first one (in order of the input sequence) for which
              <code>$test</code> has an effective boolean value of false.</p>

          <p>The <code>$test</code> argument defaults to the function <code>fn:data#1</code>, that
            is, it atomizes the item.</p>

          <p>The <code>$test</code> function is evaluated for each item in <code>$input</code> in
            turn, with that item supplied as the argument to the function. The result consists of
            that leading sequence of items for which the effective boolean value of the function is
            true.</p>

          <p>For example:</p>
          <pre><code class="language-xml">saxon:leading(following-sibling::*, function($x){exists($x/self::para}))</code></pre>

          <p>where the supplied function tests whether the supplied item is a
              <code>&lt;para&gt;</code> element.</p>

          <p>This will return the <code>&lt;para&gt;</code> elements following the current node,
            stopping at the first element that is not a <code>&lt;para&gt;</code>.</p>

          <aside>Note: this function is quite different from the EXSLT <code>leading()</code>
            function, though both fulfil a similar purpose.</aside>
          <aside>With the introduction of the new family of extension functions
              <code>items-from</code>, <code>items-after</code>, <code>items-before</code>, and
              <code>items-until</code> in Saxon 10, this function becomes redundant. The example
            above can be written saxon:items-before(following-sibling::*,
            function($x){not($x/self::para}))<code/></aside>
        </div>
      </details>
      <see-also name="items-before" namespace="http://saxon.sf.net/"/>
      <see-also name="items-until" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">line-number</name>
      <description>
        <p>Returns the line number of a selected node within the XML document (or external entity)
          that contains it.</p>
      </description>
      <signatures>
        <proto return-type="xs:integer"/>
        <proto return-type="xs:integer?">
          <arg name="node" type="node()?" desc="The node whose line number is required"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function returns the line number of a selected node within the XML document (or
            external entity) that contains it. If the argument is supplied, it must be a node; if
            the argument is omitted, the context item is used, in which case the context item must
            be a node. If line numbers are not maintained for the current document, the function
            returns -1.</p>

          <p>The function returns an empty sequence if the argument value is an empty sequence.</p>

          <p>To ensure that line numbers are maintained, use the <code>-l</code> (letter ell) option
            on the command line.</p>

          <p>Note that the value returned is dependent on information supplied by the XML parser.
            For an element node, SAX parsers generally report the line and column position of the
            "&gt;" character at the end of the start tag. StAX parsers by contrast report the
            position of the "&lt;" character at the start of the start tag.</p>
          
          <p>From Saxon 13, Saxon maintains location information for text, comment, and processing
          instruction nodes as well as for element nodes. A SAX parser reports the location of the
          end of the node, not the location at the start.</p>

          <p>The <code>-l</code> option also causes line numbers to be copied from
            a source document to a result document when the <a class="bodylink code" href="/xsl-elements/copy-of">xsl:copy-of</a> instruction is applied to a document or
            element node. For elements created using other instructions, the line number will
            reflect the position of the instruction in the stylesheet or query that caused the
            element to be created.</p>
        </div>
      </details>
      <see-also name="system-id" namespace="http://saxon.sf.net/"/>
      <see-also name="column-number" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">map-search</name>
      <description>
        <p>Searches recursively through a structure of nested maps and arrays.</p>
      </description>
      <signatures>
        <proto return-type="map(*)*">
          <arg name="input" type="item()*" desc="The input sequence to be searched"/>
          <arg name="key" type="xs:anyAtomicType" desc="The key value to be found"/>
        </proto>
        <proto return-type="map(*)*">
          <arg name="input" type="item()*" desc="The input sequence to be searched"/>
          <arg name="key" type="xs:anyAtomicType" desc="The key value to be found"/>
          <arg name="condition" type="function(item()) as xs:boolean" desc="Predicate that the found entry must satisfy"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.9. Reimplemented in Saxon 13 to use JNodes.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>The function <code>saxon:map-search</code> is similar to <a class="bodylink code" href="/functions/map/find">map:find</a>, in that it searches recursively through
            nested maps and arrays, but is more versatile. It differs from <code>map:find</code> in
            two main respects:</p>
          <ol>
            <li>Whereas <code>map:find</code> only takes as input the key value to look for,
              <code>saxon:map-search</code> also takes a function that can be used to test the
              associated value. </li>
            <li>Whereas <code>map:find</code> returns the value associated with the specified key,
              <code>saxon:map-search</code> returns a JNode, which contains much more information
              about where the match was found.</li>
          </ol>
          <p>In more detail:</p>
          <p>The function <code>saxon:map-search</code> searches the
            sequence supplied as <code>$input</code> looking for map entries whose key is the same
            key as <code>$key</code>. When such an entry is found, the associated value is passed to
            the supplied <code>$condition</code> function. If the <code>$condition</code> function
            returns true, or if there is no <code>$condition</code>, then an item is added to the
            returned value of the function: so the returned value is a sequence containing one item
            for each search "hit". The actual item representing a hit is a JNode, allowing use of 
            axes such as the parent and ancestor axes to navigate from the returned JNode to related
            nodes in the tree that was searched.</p>
          <p>The search processes the <code>$input</code> sequence using the following
            recursively-defined rules:</p>
          <ul>
            <li>To process a sequence, process each of its items in order.</li>
            <li>Each array or map in the <code>$input</code> sequence is marked as a pedigree
              root.</li>
            <li>To process an item that is an array, then process each of the array's members in
              order (each member is, in general, a sequence).</li>
            <li>To process an item that is a map, then for each key-value entry (K, V) in the map
              (in entry order) perform both of the following steps, in order: 
              <ul>
                <li>If K is the same key as <code>$key</code>, then add a new map to the result
                  sequence (with entries "key", "value", and "map" as described above).</li>
                <li>Process V (which is, in general, a sequence).</li>
              </ul>
            </li>
            <li>To process an item that is neither a map nor an array, do nothing. (Such items are
              ignored).</li>
          </ul> 
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">message-count</name>
      <description>
        <p>Returns a count of the number of messages that have been output using
            <code>xsl:message</code>.</p>
      </description>
      <signatures>
        <proto return-type="xs:integer">
          <arg name="errCode" type="xs:QName?" desc="The error code associated with the messages"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.8.</p>
      </status>
      <saxon-edition>PE/EE 9.8</saxon-edition>
      <details>
        <div>
          <p>If the <code>$errCode</code> argument is set to an empty sequence, the function returns
            the total number of times that the <code>xsl:message</code> instruction has been
            executed, during the current transformation.</p>
          <p>If the <code>$errCode</code> argument is set to a QName, the function returns the total
            number of times that the <code>xsl:message</code> instruction has been executed, during
            the current transformation, with that QName as the error code value.</p>
          <p>Because this function relies on <code>xsl:message</code> having side-effects, the
            result is not always guaranteed predictable.</p>

          <p>Typical use cases include not outputting further messages after a certain threshold has
            been reached, or terminating execution after a certain threshold has been reached.</p>

          <p>The function can also be used for diagnostic instrumentation, for example counting how
            many times a particular method has been executed (the "error code", of course, can be
            any QName and does not need to represent an actual error). </p>

          <p>The counters maintained by <code>xsl:message</code> are also available on completion of
            the transformation through the Java method
            <code>Controller.getMessageCounters()</code>.</p>

        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">namespace-node</name>
      <description>
        <p>Creates a namespace node.</p>
      </description>
      <signatures>
        <proto return-type="namespace-node()">
          <arg name="prefix" type="xs:string" desc="The namespace prefix"/>
          <arg name="uri" type="xs:string" desc="The namespace URI"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.1. This extension is obsolescent, as the functionality is
          available from Saxon 9.2 onwards using the syntax appearing in the <a class="bodylink" href="http://www.w3.org/TR/xquery-30/#id-computed-namespaces">XQuery 3.0
            specification</a>.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function creates a new parentless namespace node. The first argument gives the
            name of the namespace node (that is, the namespace prefix), while the second gives the
            namespace URI. The prefix may be <code>""</code> to create a default namespace;
            otherwise it must be a valid NCName. The URI must not be the empty string.</p>

          <p>The function serves the same role in XQuery as the <code>xsl:namespace</code>
            instruction in XSLT 2.0: it allows a namespace in the result document to be computed
            dynamically.</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">new-attribute</name>
      <description>
        <p>Returns a new attribute node, with given name and content.</p>
      </description>
      <signatures>
        <proto return-type="attribute()">
          <arg name="name" type="union(xs:QName, xs:string)" desc="The name of the new attribute"/>
          <arg name="content" type="xs:string?" desc="The content of the new attribute"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function constructs a new parentless attribute node.</p>

          <p>The name of the attribute may be supplied in a number of ways:</p>

          <ul>
            <li>The first argument may be an <code>xs:QName</code>, in which case the attribute's
              name will have the prefix, namespace URI, and local name supplied in this QName.</li>
            <li>The first argument may be an <code>xs:string</code>, that conforms to the rules for
              a valid <code>xs:NCName</code>. The attribute's name will have this local part, with
              no namespace URI or prefix.</li>
            <li>The first argument may be an <code>xs:string</code> in the format
                <code>Q{uri}local</code>. The attribute's local name and namespace URI will be taken
              from this value, and will have a system-allocated prefix.</li>
            <li>The first argument may be an <code>xs:string</code> in the format
                <code>prefix:local</code>. In this case the the prefix must be declared in the
              static context of the function call, and the element's name will use this prefix and
              local name, together with the namespace URI associated with this prefix in the static
              context.</li>
          </ul>

          <p>If the attribute name has a URI but no prefix, then the system will allocate an
            arbitrary prefix. If the attribute name has a prefix but no URI, then the prefix will be
            ignored.</p>

          <p>The content of the attribute node (that is, the string value of the node) is formed by
            evaluating the second argument. If this is an empty sequence, the string value will be a
            zero-length string.</p>

          <p>The type annotation of the new element node will be <code>xs:untypedAtomic</code>.</p>

          <p>The function imposes rules preventing the misuse of reserved names such as "xml" and
            "xmlns", in the same way as the <code>xsl:attribute</code> instruction in XSLT, or the
            attribute constructor expression in XQuery. The error codes used are those defined in
            XSLT 3.0.</p>

          <p>If the function is called twice with the same arguments, it is unpredictable whether it
            returns the same attribute node or different attribute nodes from the two
            invocations.</p>

          <aside>The XSLT/XQuery rules for constructing simple content do not apply. The value must
            be supplied as a string, or as a value that is converted to a string by virtue of the
            function conversion rules.</aside>

          <p>Notes:</p>

          <ol>
            <li>
              <p>These rules are similar to the XQuery rules for the <code>element {...}</code>
                expression. However, there are some differences. Most notably, the XSLT rules allow
                multiple attribute nodes with the same name to appear in the content sequence (the
                last one wins). Furthermore, the error codes used for invalid conditions (such as
                the presence of maps or functions or conflicting namespace nodes in the content) are
                those given in the XSLT 3.0 specification.</p>
            </li>
            <li>
              <p>The XSLT/XQuery rules for constructing simple content do not apply. The value must
                be supplied as a string, or as a value that is converted to a string by virtue of
                the function conversion rules.</p>
            </li>
            <li>
              <p>Since the declared type of the first argument is namespace sensitive, error
                  <code>XPTY0117</code> will be raised if an untyped atomic item (or an untyped
                node) is supplied as the actual argument. Conversion to a string should therefore be
                done explicitly. For example, to convert the element <code>&lt;prop name="x"
                  value="y"/&gt;</code> to the attribute node <code>x="y"</code>, use
                  <code>saxon:new-attribute(string(@name), string(@value))</code></p>
            </li>
          </ol>

        </div>
      </details>
      <see-also name="new-document" namespace="http://saxon.sf.net/"/>
      <see-also name="new-element" namespace="http://saxon.sf.net/"/>
      <see-also name="new-text" namespace="http://saxon.sf.net/"/>
      <see-also name="new-comment" namespace="http://saxon.sf.net/"/>
      <see-also name="new-processing-instruction" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">new-comment</name>
      <description>
        <p>Returns a new comment node, with given content.</p>
      </description>
      <signatures>
        <proto return-type="text()">
          <arg name="content" type="xs:string?" desc="The content of the new comment node"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function constructs a new parentless comment node.</p>

          <p>The content of the comment (that is, the string value of the node) is formed by
            evaluating the first argument. If this is an empty sequence, the string value will be a
            zero-length string.</p>

          <p>If the function is called twice with the same arguments, it is unpredictable whether it
            returns the same node or different nodes from the two invocations.</p>

          <p>If the content contains the substring "--", or if it ends in "-", this is handled in
            the same way as the <code>xsl:comment</code> instruction; the value is fixed by
            inserting spaces.</p>

          <aside>The XSLT/XQuery rules for constructing simple content do not apply. The value must
            be supplied as a string, or as a value that is converted to a string by virtue of the
            function conversion rules.</aside>

        </div>
      </details>
      <see-also name="new-attribute" namespace="http://saxon.sf.net/"/>
      <see-also name="new-document" namespace="http://saxon.sf.net/"/>
      <see-also name="new-element" namespace="http://saxon.sf.net/"/>
      <see-also name="new-processing-instruction" namespace="http://saxon.sf.net/"/>
      <see-also name="new-text" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">new-document</name>
      <description>
        <p>Returns a new document node, with given content.</p>
      </description>
      <signatures>
        <proto return-type="document-node()">
          <arg name="content" type="item()*" desc="The content of the new document"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function constructs a new document node.</p>

          <p>The content of the document node (that is, the children of the node) is formed by
            evaluating the first argument, and applying the rules given in the XSLT 3.0
            specification section 5.7.1, <i>Constructing Complex Content</i>.</p>

          <p>The base URI of the new document node is taken from the static base URI of the calling
            expression.</p>

          <aside>Note: these rules are almost identical to the XQuery rules for the <code>document
              {...}</code> expression. However, the error codes used for invalid conditions (such as
            the presence of attributes, namespace nodes, maps or functions in the content) are those
            given in the XSLT 3.0 specification.</aside>

          <p>If the function is called twice with the same arguments, it is unpredictable whether it
            returns the same document node or different document nodes from the two invocations.</p>

          <p>It is not required that the resulting document should satisfy the XML rules for a
            well-formed document; specifically, the node may contain multiple element and text nodes
            among its children.</p>

        </div>
      </details>
      <see-also name="new-element" namespace="http://saxon.sf.net/"/>
      <see-also name="new-attribute" namespace="http://saxon.sf.net/"/>
      <see-also name="new-text" namespace="http://saxon.sf.net/"/>
      <see-also name="new-comment" namespace="http://saxon.sf.net/"/>
      <see-also name="new-processing-instruction" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">new-element</name>
      <description>
        <p>Returns a new element node, with given name and content.</p>
      </description>
      <signatures>
        <proto return-type="document-node()">
          <arg name="name" type="union(xs:QName, xs:string)" desc="The name of the new element"/>
          <arg name="content" type="item()*" desc="The content of the new element"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function constructs a new parentless element node.</p>

          <p>The name of the element node is determined by the first argument. This may be supplied
            either as an instance of either <code>xs:string</code> or <code>xs:QName</code>.</p>

          <p>The name of the element may be supplied in a number of ways:</p>

          <ul>
            <li>The first argument may be an <code>xs:QName</code>, in which case the element's name
              will have the prefix, namespace URI, and local name supplied in this QName.</li>
            <li>The first argument may be an <code>xs:string</code>, that conforms to the rules for
              a valid <code>xs:NCName</code>. The element's name will have this local part, with no
              namespace URI or prefix.</li>
            <li>The first argument may be an <code>xs:string</code> in the format
                <code>Q{uri}local</code>. The element's local name and namespace URI will be taken
              from this value, and the name will have no prefix (that is, the URI will be the
              default namespace).</li>
            <li>The first argument may be an <code>xs:string</code> in the format
                <code>prefix:local</code>. In this case the the prefix must be declared in the
              static context of the function call, and the element's name will use this prefix and
              local name, together with the namespace URI associated with this prefix in the static
              context.</li>
          </ul>

          <p>The content of the element node (that is, the children of the node) is formed by
            evaluating the second argument, and applying the rules given in the XSLT 3.0
            specification section 5.7.1, <i>Constructing Complex Content</i>.</p>

          <p>The base URI of the new element node is taken from the static base URI of the calling
            expression.</p>

          <p>The type annotation of the new element node will be <code>xs:untyped</code>.</p>

          <p>Namespace fixup is applied to the new element as described in the XSLT 3.0
            specification to ensure that all namespaces used in element and attribute names are
            properly declared.</p>

          <p>If the function is called twice with the same arguments, it is unpredictable whether it
            returns the same element node or different element nodes from the two invocations.</p>

          <p>Notes:</p>

          <ol>
            <li>
              <p>These rules are similar to the XQuery rules for the <code>element {...}</code>
                expression. However, there are some differences. Most notably, the XSLT rules allow
                multiple attribute nodes with the same name to appear in the content sequence (the
                last one wins). Furthermore, the error codes used for invalid conditions (such as
                the presence of maps or functions or conflicting namespace nodes in the content) are
                those given in the XSLT 3.0 specification.</p>
            </li>
            <li>
              <p>Any attribute nodes in the content sequence become attributes of the constructed
                element; they are not atomized to form text nodes.</p>
            </li>
            <li>
              <p>Since the declared type of the first argument is namespace sensitive, error
                  <code>XPTY0117</code> will be raised if an untyped atomic item (or an untyped
                node) is supplied as the actual argument. Conversion to a string should therefore be
                done explicitly. For example, to convert <code>&lt;prop name="x"
                  value="y"/&gt;</code> to <code>&lt;x&gt;y&lt;/x&gt;</code>, use
                  <code>saxon:new-element(string(@name), string(@value))</code></p>
            </li>
            <li>
              <p>Supplying a simple NCName as the first argument means the element will be in no
                namespace. The default namespace for elements is <b>NOT</b> used. </p>
            </li>
          </ol>


        </div>
      </details>
      <see-also name="new-element" namespace="http://saxon.sf.net/"/>
      <see-also name="new-attribute" namespace="http://saxon.sf.net/"/>
      <see-also name="new-text" namespace="http://saxon.sf.net/"/>
      <see-also name="new-comment" namespace="http://saxon.sf.net/"/>
      <see-also name="new-processing-instruction" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">new-processing-instruction</name>
      <description>
        <p>Returns a new processing instruction node, with given name and content.</p>
      </description>
      <signatures>
        <proto return-type="processing-instruction()">
          <arg name="name" type="xs:string" desc="The name of the new processing instruction"/>
          <arg name="content" type="xs:string?" desc="The content of the new processing instruction"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function constructs a new parentless processing instruction node.</p>

          <p>The name of the processing instruction is determined by the first argument. This must
            be an instance of <code>xs:string</code> that conforms to the rules for an
              <code>xs:NCName</code>; it must not match the name "xml" in a case-blind
            comparison.</p>


          <p>The content of the processing instruction (that is, the string value of the node) is
            formed by evaluating the second argument. If this is an empty sequence, the string value
            will be a zero-length string.</p>

          <p>Any substring of the string value that matches <code>?&gt;</code> is replaced by
              <code>? &gt;</code> (that is, a space is inserted).</p>


          <p>If the function is called twice with the same arguments, it is unpredictable whether it
            returns the same node or different nodes from the two invocations.</p>

          <aside>The XSLT/XQuery rules for constructing simple content do not apply. The value must
            be supplied as a string, or as a value that is converted to a string by virtue of the
            function conversion rules.</aside>

        </div>
      </details>
      <see-also name="new-document" namespace="http://saxon.sf.net/"/>
      <see-also name="new-element" namespace="http://saxon.sf.net/"/>
      <see-also name="new-text" namespace="http://saxon.sf.net/"/>
      <see-also name="new-comment" namespace="http://saxon.sf.net/"/>
      <see-also name="new-attribute" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">new-text</name>
      <description>
        <p>Returns a new text node, with given content.</p>
      </description>
      <signatures>
        <proto return-type="text()">
          <arg name="content" type="xs:string?" desc="The content of the new text node"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function constructs a new parentless text node.</p>

          <p>The content of the text node (that is, the string value of the node) is formed by
            evaluating the second argument. If this is an empty sequence, the string value will be a
            zero-length string.</p>

          <p>If the function is called twice with the same arguments, it is unpredictable whether it
            returns the same node or different nodes from the two invocations.</p>

          <aside>The XSLT/XQuery rules for constructing simple content do not apply. The value must
            be supplied as a string, or as a value that is converted to a string by virtue of the
            function conversion rules.</aside>

        </div>
      </details>
      <see-also name="new-attribute" namespace="http://saxon.sf.net/"/>
      <see-also name="new-document" namespace="http://saxon.sf.net/"/>
      <see-also name="new-element" namespace="http://saxon.sf.net/"/>
      <see-also name="new-comment" namespace="http://saxon.sf.net/"/>
      <see-also name="new-processing-instruction" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">object-map</name>
      <description>
        <p>Converts a Java external object to a map, giving access to the instance methods of the
          object as dynamic functions.</p>
      </description>
      <signatures>
        <proto return-type="map(xs:string, function(*))">
          <arg name="object" type="jt:java.lang.Object" desc="The supplied external object"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.9. Not available in SaxonCS.</p>
      </status>
      <saxon-edition platform="J C">PE/EE 9.9</saxon-edition>
      <details>
        <div>

          <p>The map returned by the function is as follows:</p>

          <ul>
            <li>There is one entry named "this" whose value is a zero-arity function that returns
                <code>$object</code>.</li>

            <li>For each non-static public method defined on the object's class, provided the name
              of the method is unique, there will be an entry whose key is the method name, and
              whose value is a (dynamic) function corresponding to the method. The arguments
              expected by the function correspond to the arguments declared for the method, and the
              result returned by the function similarly corresponds to the result of the
              method.</li>

            <li>For each non-static public method defined on the object's class, provided the
              combination of the method's name and arity is unique, there will be an entry whose key
              has the form <code>MMM_N</code> where <code>MMM</code> is the method name, and
                <code>N</code> is the arity: for example if the object were an instance of
                <code>java.lang.String</code>, there would be an entry with key <code>split_1</code>
              and another with key <code>split_2</code> corresponding to the two versions of the
                <code>String.split()</code> method. There would be no entry for
                <code>replace_2</code> because there are two arity-2 methods named
                <code>replace</code>.</li>
          </ul>

          <p>The type conversions for the arguments and return values of the dynamic functions work
            in the same way as for other reflexive extension functions: see <a class="bodylink" href="/extensibility/extension-functions-J/reflexive-functions/converting-args">Converting arguments</a>. The <code>void=this</code> convention is used: that is, a
            Java method whose declared return type is <code>void</code> is translated to a function
            that returns the target object as its result, to make it easier to write code that uses
            function chaining. </p>

          <p>This function is called implicitly when an external object appears as the left-hand
            operand of the lookup operator "?". This means that, for example,
              <code>Q{java:java.util.Locale}new("en")?getDisplayLanguage_0()</code> returns the
            string <code>"English"</code>. </p>

          <p>For more complex use cases, the function can be called explicitly. For example, this
            query:</p>
          <pre><code class="language-xquery">declare namespace StreamSource = "java:javax.xml.transform.stream.StreamSource";
declare namespace map = "http://www.w3.org/2005/xpath-functions/map";
StreamSource:new() =&gt; saxon:object-map() =&gt; map:keys() =&gt; sort()</code></pre>

          <p>produces:</p>

          <samp>"equals", "equals_1", "getClass", "getClass_0", "getInputStream",
            "getInputStream_0", "getPublicId", "getPublicId_0", "getReader", "getReader_0",
            "getSystemId", "getSystemId_0", "hashCode", "hashCode_0", "notify", "notifyAll",
            "notifyAll_0", "notify_0", "setInputStream", "setInputStream_1", "setPublicId",
            "setPublicId_1", "setReader", "setReader_1", "this", "toString", "toString_0", "wait_0",
            "wait_1", "wait_2"</samp>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">octets-to-base64Binary</name>
      <description>
        <p>Converts a sequence of octets to a base64Binary value.</p>
      </description>
      <signatures>
        <proto return-type="xs:base64Binary">
          <arg name="octets" type="xs:integer*" desc="The sequence of octets"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes a sequence of integers as input, and treats them as octets. The
            integers must therefore all be in the range 0-255. The result of the function is the
              <code>xs:base62Binary</code> value representing this sequence of octets.</p>
        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="base64Binary-to-octets"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">octets-to-hexBinary</name>
      <description>
        <p>Converts a sequence of octets to a hexBinary value.</p>
      </description>
      <signatures>
        <proto return-type="xs:hexBinary">
          <arg name="octets" type="xs:integer*" desc="The sequence of octets"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes a sequence of integers as input, and treats them as octets. The
            integers must therefore all be in the range 0-255. The result of the function is the
              <code>xs:hexBinary</code> value representing this sequence of octets.</p>
        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="hexBinary-to-octets"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">parse</name>
      <description>
        <p>Parses XML supplied as a string.</p>
      </description>
      <signatures>
        <proto return-type="document-node()">
          <arg name="xml" type="xs:string" desc="The XML to be parsed"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 7.1. This function is obsolescent. The XPath 3.0 function <a href="/functions/fn/parse-xml" class="bodylink code">fn:parse-xml()</a> should be used
          in preference.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes a single argument, a string containing the source text of a
            well-formed XML document. It returns the document node (root node) that results from
            parsing this text. It throws an error if the text is not well-formed XML. Applications
            should not rely on the identity of the returned document node (at present, if the
            function is called twice with the same arguments, it returns a new document node each
            time, but this may change in future).</p>

          <p>This function is useful where one XML document is embedded inside another using CDATA,
            or as an alternative way of passing an XML document as a parameter to a stylesheet.</p>

          <p>A dynamic error is reported if the supplied string is not well-formed (and
            namespace-well-formed) XML. An XML declaration may be included, but is not required: if
            it is present, the encoding declaration will be ignored, since the document is supplied
            in character form rather than in binary.</p>

          <p>The XML parser that is used will be the one nominated to the Saxon
              <code>Configuration</code> as the parser for source documents. Validation against
            schemas or DTDs, and whitespace stripping, will take place according the settings in the
              <code>Configuration</code> object; if called from XSLT, the
              <code>xsl:strip-space</code> and <code>xsl:preserve-space</code> settings in the
            stylesheet are also taken into account.</p>
        </div>
      </details>
      <see-also namespace="http://www.w3.org/2005/xpath-functions" name="parse-xml"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">parse-dateTime</name>
      <description>
        <p>Interprets a string representing a date and/or time in a user-defined format.</p>
      </description>
      <signatures>
        <proto return-type="union(xs:dateTime, xs:date, xs:time, xs:gYear, xs:gYearMonth, xs:gMonth, xs:gMonthDay, xs:gDay)?">
          <arg name="input" type="xs:string?" desc="The input date/time"/>
          <arg name="format" type="xs:string" desc="The format used to parse the date and time"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10. Not available in SaxonCS.</p>
      </status>
      <saxon-edition platform="J C">PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>If the <code>$input</code> argument is an empty sequence, the result is an empty
            sequence.</p>
          <p>The <code>$format</code> argument is a pattern representing the format of the date/time
            supplied in the <code>$input</code> argument. The pattern follows the rules of the Java
              <code>DateTimeFormatter</code> class. Here are some simple examples:</p>

          <table>
            <thead>
              <tr>
                <th>
                  <code>$input</code>
                </th>
                <th>
                  <code>$format</code>
                </th>
                <th>Result</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>
                  <code>9/23/2018</code>
                </td>
                <td>
                  <code>M/d/yyyy</code>
                </td>
                <td>
                  <code>xs:date('2018-09-23')</code>
                </td>
              </tr>
              <tr>
                <td>
                  <code>23/9/2018</code>
                </td>
                <td>
                  <code>d/M/yyyy</code>
                </td>
                <td>
                  <code>xs:date('2018-09-23')</code>
                </td>
              </tr>
              <tr>
                <td>
                  <code>10:14 Sep 23, 2012</code>
                </td>
                <td>
                  <code>HH:mm MMM dd, yyyy</code>
                </td>
                <td>
                  <code>xs:dateTime('2012-09-23T10:14:00')</code>
                </td>
              </tr>
              <tr>
                <td>
                  <code>2018-03-31T14:20Z</code>
                </td>
                <td>
                  <code>yyyy-MM-dd'T'HH:mmX</code>
                </td>
                <td>
                  <code>xs:dateTime('2018-03-31T14:20:00Z')</code>
                </td>
              </tr>
              <tr>
                <td>
                  <code>8.42</code>
                </td>
                <td>
                  <code>h.mm</code>
                </td>
                <td>
                  <code>xs:time('08:42:00')</code>
                </td>
              </tr>
              <tr>
                <td>
                  <code>2018-03-31T14:20</code>
                </td>
                <td>
                  <code>yyyy-MM-dd'T'HH:mm</code>
                </td>
                <td>
                  <code>xs:dateTime('2018-03-31T14:20:00')</code>
                </td>
              </tr>
            </tbody>
          </table>

          <p>The locale used for parsing names of months is the system default locale.</p>

          <p>Parsing is case-independent and is "smart" in the terminology of Java's
              <code>ResolverStyle</code>.</p>

          <p>A dynamic error is raised if the pattern is invalid, or if the input cannot be parsed
            according to the rules of the pattern.</p>

          <p>The return type depends on the components actually present in the supplied value, and
            is the first of the following that apply:</p>
          <ul>
            <li>If year, month, day, hour, and minute are all present, then <code>xs:dateTime</code>
              (the seconds value defaults to zero).</li>
            <li>If year, month, day are all present, then <code>xs:date</code>.</li>
            <li>If hour and minute are both present, then <code>xs:time</code> (the seconds value
              defaults to zero).</li>
            <li>If year and month are both present, then <code>xs:gYearMonth</code>.</li>
            <li>If year is present, then <code>xs:gYear</code>.</li>
            <li>If month and day are both present, then <code>xs:gMonthDay</code>.</li>
            <li>If month is present, then <code>xs:gMonth</code>.</li>
            <li>Otherwise, empty sequence.</li>
          </ul>

          <p>If no timezone offset is specified, the result will have no timezone component.</p>

          <aside>The Java <code>DateTimeFormatter</code> class can be surprisingly inflexible when
            handling fractional seconds in "smart" mode. When using the "S" component in a pattern,
            the number of fraction digits in the input value should match the number of "S"
            characters in the pattern. For example <code>saxon:parse-dateTime("12-40:21.123",
              "HH-mm:ss.SSS")</code> works, but if the seconds fraction is given as two digits or
            four digits, it reports an error. With other fields it seems that the number of
            characters in the pattern must be less than or equal to the number in the input value:
              <code>H</code> accepts the hour as one or two digits, but <code>HH</code> requires two
            digits (or more).</aside>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">print-stack</name>
      <description>
        <p>Returns a formatted string giving information about the current calling stack.</p>
      </description>
      <signatures>
        <proto return-type="xs:string"/>
      </signatures>
      <status>
        <p>Available since Saxon 9.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes no arguments. It returns a string whose value is a formatted
            representation of the current state of the execution stack. This is suitable for display
            using <a class="bodylink code" href="/xsl-elements/message">xsl:message</a> or the <a class="bodylink code" href="/functions/fn/trace">trace()</a> function, or it can be
            inserted as a comment into the result document.</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">query</name>
      <description>
        <p>Evaluates an XQuery query compiled using <code>saxon:compile-query()</code>.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="name" type="jt:net.sf.saxon.query.XQueryExpression?" desc="The compiled query to be evaluated"/>
        </proto>
        <proto return-type="item()*">
          <arg name="name" type="jt:net.sf.saxon.query.XQueryExpression?" desc="The compiled query to be evaluated"/>
          <arg name="context-item" type="item()?" desc="The context item for the evaluation"/>
        </proto>
        <proto return-type="item()*">
          <arg name="name" type="jt:net.sf.saxon.query.XQueryExpression?" desc="The compiled query to be evaluated"/>
          <arg name="context-item" type="item()?" desc="The context item for the evaluation"/>
          <arg name="params" type="node()*" desc="Parameters (external variables)"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.0. The function is obsolescent, replaced by the newer function <a class="bodylink code" href="/functions/saxon/xquery">saxon:xquery()</a>. The function is
          implemented in SaxonCS but with the restriction that the type name
            <code>jt:net.sf.saxon.query.XQueryExpression</code> is not available; the type of the
          result should be declared as <code>item()</code>.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes as input a compiled XQuery query, and runs the query, returning the
            result of evaluating the query. The first argument will generally be the result of
            calling the <a class="bodylink code" href="/functions/saxon/compile-query">saxon:compile-query()</a> extension function.</p>

          <p>If the first argument is an empty sequence, the result is an empty sequence.</p>

          <p>If only one argument is supplied, the context item for evaluating the query will be the
            same as the context item in the environment where the function is called, that is, the
            implicit second argument is <code>"."</code>. If there is no context item, however, no
            failure occurs unless the query attempts to reference the context item.</p>

          <p>If the second argument is present it can be any item, which is used as the context item
            for the query. It can also be the empty sequence, in which case the query runs with no
            context item.</p>

          <p>If the optional third argument is present, it is used to supply parameters (external
            variables) to the query. The value is a sequence of nodes. Each node must be an element
            node, attribute node, or document node; supplying a document node is equivalent to
            supplying all its element children. The name of the node must match an external variable
            name declared in the query prolog, and the atomized value of the node is used as the
            value of the parameter. If this is <code>untypedAtomic</code> then it is converted to
            the required type declared in the query.</p>

          <p>The compiled stylesheet can be used repeatedly with different inputs.</p>

          <p>Here is an example of how to use the function from XQuery:</p>
          <pre><code class="language-xquery">declare namespace saxon = "http://saxon.sf.net/"; 
            
&lt;out&gt;{ 
let $q1 := "declare variable $x external; declare variable $y external; &lt;z&gt;{$x + $y + .}&lt;/z&amp;&gt;" 
    return saxon:query(saxon:compile-query($q1), 4, (&lt;x&gt;3&lt;/x&gt;, &lt;y&gt;2&lt;/y&gt;)) 
}&lt;/out&gt;</code></pre>

          <p>The result of the query is a sequence containing the single integer 9.</p>
        </div>
      </details>
      <see-also name="compile-query" namespace="http://saxon.sf.net/"/>
      <see-also name="xquery" namespace="http://saxon.sf.net/"/>
    </function>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">replace-with</name>
      <description>
        <p>Uses a regular expression to perform string replacement; substrings that match the regex
          are converted to their replacement strings by calling a user-supplied function.</p>
      </description>
      <signatures>
        <proto return-type="xs:string">
          <arg name="in" type="xs:string?" desc="The input string"/>
          <arg name="regex" type="xs:string" desc="The regular expression"/>
          <arg name="replacer" type="function(xs:string) as xs:string" desc="User-supplied function, which is called to convert the matching             substrings into their replacements"/>
        </proto>
        <proto return-type="xs:string">
          <arg name="in" type="xs:string?" desc="The input string"/>
          <arg name="regex" type="xs:string" desc="The regular expression"/>
          <arg name="replacer" type="function(xs:string) as xs:string" desc="User-supplied function, which is called to convert the matching             substrings into their replacements"/>
          <arg name="flags" type="xs:string" desc="Regular expression flags"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 10. In 12.4 the function becomes obsolescent, since the
          functionality has been absorbed into the standard 4.0 <a class="bodylink code" href="/functions/fn/replace">fn:replace()</a> function.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function is similar to the <code>fn:replace</code> function, but instead of
            supplying a replacement string, the caller supplies a callback function which will be
            invoked to calculate a replacement for each matching substring in the input.</p>

          <p>The string returned by the callback function is inserted "as is" into the result
            string; "$" and "\" are not recognized as special characters.</p>

          <p>For example:</p>

          <ul>
            <li>
              <p><code>replace-with("Registration: abc123", "[a-z]{3}[0-9]{3}", upper-case#1)</code>
                returns <code>"Registration: ABC123"</code>.</p>
            </li>
            <li>
              <p><code>replace-with("Part 2 Chapter 5", "[0-9]+",
                  function($in){string(number($in)+1)}</code> returns <code>"Part 3 Chapter
                  6"</code>.</p>
            </li>
            <li>
              <pre><code class="language-xquery">saxon:replace-with('ALPHA_x002F_OMEGA', '_x[0-9A-F]{4}_',
  function($s) {$s =&gt; substring(3, 4)
  =&gt; bin:hex()
  =&gt; bin:unpack-unsigned-integer(0,2)
  =&gt; codepoints-to-string()})</code></pre>
              <p>outputs <code>ALPHA/OMEGA</code> (this handles a convention sometimes used to
                encode special characters in XML element and attribute names). This example uses
                functions from the EXPath Binary module.</p>
            </li>
          </ul>

          <p>The regular expression must not be one that matches a zero-length string.</p>

          <p>Note: the callback function does not have access to captured groups within the matched
            substring, only to the matched substring as a whole. For access to captured groups, use
            the 4.0 version of <code>fn:replace()</code>.</p>
        </div>
      </details>

    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">schema</name>
      <description>
        <p>Returns information about the schema.</p>
      </description>
      <signatures>
        <proto return-type="function(*)?"/>
        <proto return-type="function(*)?">
          <arg name="kind" type="xs:string" desc="The kind of component required"/>
          <arg name="name" type="xs:QName" desc="The name of the component required"/>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>EE 9.5</saxon-edition>
      <details>
        <div>
          <p>In a non-schema-aware configuration, both functions return the empty sequence.</p>

          <p>In a schema-aware configuration, the first function returns the schema component
            representing the "schema as a whole", that is, the schema components from all the schema
            documents that have been loaded into the <a class="javalink" href="net.sf.saxon.Configuration">Configuration</a>. The second function returns a
            specific named schema component, for example an element declaration.</p>

          <p>With the two-argument function, the first argument must be one of "type definition",
            "attribute declaration", "element declaration", "attribute group definition", "model
            group definition", "notation declaration", or "identity-constraint definition"; the
            second argument is the QName identifying the component by its target namespace and local
            name properties.</p>

          <p>The returned schema component is represented as a function. This function accepts a
            property name as a string argument, and returns the value of the property. The value of
            the property may be a simple value such as a boolean or a string, or it may be a
            sequence of such values. In some cases the value of a property is another schema
            component; this will be returned as a function item, which can be dynamically invoked to
            determine its properties, and so on. ('Property records' in the schema component model
            are represented in exactly the same way as schema components.)</p>

          <p>The model is faithful to the specification of the schema component model as it appears
            in the XSD 1.1 specification from W3C. There are a few small variations:</p>

          <ol>
            <li>
              <p>Saxon currently does not provide access to annotations (they are discarded at
                schema processing time)</p>
            </li>
            <li>
              <p>One or two other properties are not fully implemented, for example,
                  <code>{context}</code> and <code>{fundamental facets}</code></p>
            </li>
            <li>
              <p>The types available directly from the Schema do not include built-in types</p>
            </li>
            <li>
              <p>Saxon represents multiple patterns and assertions of a simple type as multiple
                facet objects rather than a single facet object</p>
            </li>
            <li>
              <p>There's one property that's hard to represent directly in the XDM data model: the
                value of the enumeration facet is a sequence of sequences. So Saxon is currently
                exposing the enumeration values as string values rather than typed values.</p>
            </li>
          </ol>

          <p>Every component has an additional property <code>class</code> which tells you what kind
            of schema component it is. This is particularly necessary for the components
            representing facets, where the class is the only way of telling, for example, whether
            you have a <code>minInclusive</code> or a <code>maxExclusive</code> facet.</p>

          <p>Most components have an additional property <code>implementation</code> whose value is
            the wrapped Java object representing the component in Saxon's implementation. For
            example, for an element declaration the <code>implementation</code> property returns an
            object of Java type <a class="javalink" href="com.saxonica.ee.schema.ElementDecl">com.saxonica.ee.schema.ElementDecl</a> whose methods can be used using the normal
            facilities for reflexive extension functions.</p>

          <p>The complete list of properties is given in the tables below:</p>

          <h3>Assertion</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Assertion"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.Assertion</td>
                <td>Java object</td>
              </tr>
              <tr>
                <td>test</td>
                <td>XPath Property Record</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>Attribute declaration</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Attribute Declaration"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.AttributeDecl</td>
                <td/>
              </tr>
              <tr>
                <td>name</td>
                <td>string</td>
                <td>Local name of the attribute</td>
              </tr>
              <tr>
                <td>target namespace</td>
                <td>string</td>
                <td>Namespace URI of the attribute</td>
              </tr>
              <tr>
                <td>type definition</td>
                <td>Simple Type or Complex Type</td>
                <td/>
              </tr>
              <tr>
                <td>scope</td>
                <td>A function with properties ("class":"Scope", "variety": "global" or "local",
                  "parent": the containing Complex Type or Attribute Group)</td>
                <td/>
              </tr>
              <tr>
                <td>value constraint</td>
                <td>If present, a function with properties ("class": "Value Constraint", "variety":
                  "fixed" or "default", "value": atomic item, "lexical form": string</td>
                <td/>
              </tr>
              <tr>
                <td>inheritable</td>
                <td>boolean</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>Attribute group declaration</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Attribute Group Definition"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.AttributeGroupDecl</td>
                <td/>
              </tr>
              <tr>
                <td>name</td>
                <td>string</td>
                <td>Local name of the attribute group</td>
              </tr>
              <tr>
                <td>target namespace</td>
                <td>string</td>
                <td>Namespace URI of the attribute group</td>
              </tr>
              <tr>
                <td>attribute uses</td>
                <td>Sequence of (Attribute Use)</td>
                <td/>
              </tr>
              <tr>
                <td>attribute wildcard</td>
                <td>Optional Attribute Wildcard</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>Attribute use</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Attribute Use"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.AttributeUse</td>
                <td/>
              </tr>
              <tr>
                <td>required</td>
                <td>boolean</td>
                <td>true if the attribute is required, false if optional</td>
              </tr>
              <tr>
                <td>value constraint</td>
                <td>See Attribute Declaration</td>
                <td/>
              </tr>
              <tr>
                <td>inheritable</td>
                <td>boolean</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>Attribute wildcard</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Wildcard"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.Wildcard</td>
                <td/>
              </tr>
              <tr>
                <td>namespace constraint</td>
                <td>function with properties ("class": "Namespace Constraint", "variety":
                  "any"|"enumeration"|"not", "namespaces": sequence of xs:anyURI, "disallowed
                  names": list containing QNames and/or the strings "defined" and
                  "definedSiblings"</td>
                <td/>
              </tr>
              <tr>
                <td>process contents</td>
                <td>string ("strict"|"lax"|"skip")</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>Complex type</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Complex Type"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.ComplexType (or a subtype such as
                  UserComplexType)</td>
                <td/>
              </tr>
              <tr>
                <td>name</td>
                <td>string</td>
                <td>Local name of the type (empty if anonymous)</td>
              </tr>
              <tr>
                <td>target namespace</td>
                <td>string</td>
                <td>Namespace URI of the type (empty if anonymous)</td>
              </tr>
              <tr>
                <td>base type definition</td>
                <td>Complex Type Definition</td>
                <td/>
              </tr>
              <tr>
                <td>final</td>
                <td>Sequence of strings ("restriction"|"extension")</td>
                <td/>
              </tr>
              <tr>
                <td>context</td>
                <td>Empty sequence (not implemented)</td>
                <td/>
              </tr>
              <tr>
                <td>derivation method</td>
                <td>string ("restriction"|"extension")</td>
                <td/>
              </tr>
              <tr>
                <td>abstract</td>
                <td>boolean</td>
                <td/>
              </tr>
              <tr>
                <td>attribute uses</td>
                <td>Sequence of Attribute Use</td>
                <td/>
              </tr>
              <tr>
                <td>attribute wildcard</td>
                <td>Optional Attribute Wildcard</td>
                <td/>
              </tr>
              <tr>
                <td>content type</td>
                <td>function with properties: ("class":"Content Type", "variety":string
                  ("element-only"|"empty"|"mixed"|"simple"), particle: optional Particle, "open
                  content": function with properties ("class":"Open Content", "mode": string
                  ("interleave"|"suffix"), "wildcard": Wildcard), "simple type definition": Simple
                  Type)</td>
                <td/>
              </tr>
              <tr>
                <td>prohibited substitutions</td>
                <td>Sequence of strings ("restriction"|"extension")</td>
                <td/>
              </tr>
              <tr>
                <td>assertions</td>
                <td>Sequence of Assertion</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>Element declaration</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Complex Type"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.ComplexType (or a subtype such as
                  UserComplexType)</td>
                <td/>
              </tr>
              <tr>
                <td>name</td>
                <td>string</td>
                <td>Local name of the type (empty if anonymous)</td>
              </tr>
              <tr>
                <td>target namespace</td>
                <td>string</td>
                <td>Namespace URI of the type (empty if anonymous)</td>
              </tr>
              <tr>
                <td>type definition</td>
                <td>Simple Type or Complex Type</td>
                <td/>
              </tr>
              <tr>
                <td>type table</td>
                <td>function with properties ("class":"Type Table", "alternatives": sequence of Type
                  Alternative, "default type definition": Simple Type or Complex Type)</td>
                <td/>
              </tr>
              <tr>
                <td>scope</td>
                <td>function with properties ("class":"Scope", "variety": ("global"|"local"),
                  "parent": optional Complex Type)</td>
                <td/>
              </tr>
              <tr>
                <td>value constraint</td>
                <td>see Attribute Declaration</td>
                <td/>
              </tr>
              <tr>
                <td>nillable</td>
                <td>boolean</td>
                <td/>
              </tr>
              <tr>
                <td>identity-constraint definitions</td>
                <td>Sequence of Identity Constraint</td>
                <td/>
              </tr>
              <tr>
                <td>substitution group affiliations</td>
                <td>Sequence of Element Declaration</td>
                <td/>
              </tr>
              <tr>
                <td>substitution group exclusions</td>
                <td>Sequence of strings ("restriction"|"extension")</td>
                <td/>
              </tr>
              <tr>
                <td>disallowed substitutions</td>
                <td>Sequence of strings ("restriction"|"extension"|"substitution")</td>
                <td/>
              </tr>
              <tr>
                <td>abstract</td>
                <td>boolean</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>Element wildcard</h3>

          <p>Properties are the same as for <i>Attribute Wildcard</i></p>

          <h3>Facet</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>The name of the facet, for example "minLength" or "enumeration"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>A subclass of java:com.saxonica.ee.schema.Facet</td>
                <td/>
              </tr>
              <tr>
                <td>value</td>
                <td>depends on facet</td>
                <td>The value of the facet</td>
              </tr>
              <tr>
                <td>fixed</td>
                <td>boolean</td>
                <td/>
              </tr>
              <tr>
                <td>typed-value</td>
                <td>For the enumeration facet only, array(xs:anyAtomicType*)</td>
                <td>An array containing the enumeration values, each of which may in general be a
                  sequence of atomic items. (Note: for the enumeration facet, the "value" property
                  is a sequence of strings, regardless of the actual type)</td>
              </tr>
            </tbody>
          </table>

          <h3>Identity constraint</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Identity-Constraint Definition"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.IdentityConstraint (or a subclass)</td>
                <td/>
              </tr>
              <tr>
                <td>name</td>
                <td>string</td>
                <td>Local name of the constraint</td>
              </tr>
              <tr>
                <td>target namespace</td>
                <td>string</td>
                <td>Namespace URI of the constraint</td>
              </tr>
              <tr>
                <td>identity-constraint category</td>
                <td>string ("key"|"unique"|"keyRef")</td>
                <td/>
              </tr>
              <tr>
                <td>selector</td>
                <td>XPath Property Record</td>
                <td/>
              </tr>
              <tr>
                <td>fields</td>
                <td>Sequence of XPath Property Record</td>
                <td/>
              </tr>
              <tr>
                <td>referenced key</td>
                <td>(For keyRef only): Identity Constraint</td>
                <td>The corresponding key constraint</td>
              </tr>
            </tbody>
          </table>

          <h3>Model group</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Model Group"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.ModelGroup</td>
                <td/>
              </tr>
              <tr>
                <td>compositor</td>
                <td>string ("sequence"|"choice"|"all")</td>
                <td/>
              </tr>
              <tr>
                <td>particles</td>
                <td>Sequence of Particle</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>Model group definition</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Model Group Definition"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.ModelGroupDefinition</td>
                <td/>
              </tr>
              <tr>
                <td>name</td>
                <td>string</td>
                <td>Local name of the model group</td>
              </tr>
              <tr>
                <td>target namespace</td>
                <td>string</td>
                <td>Namespace URI of the model group</td>
              </tr>
              <tr>
                <td>model group</td>
                <td>Model Group</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>Notation</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Notation Declaration"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.Notation</td>
                <td/>
              </tr>
              <tr>
                <td>name</td>
                <td>string</td>
                <td>Local name of the notation</td>
              </tr>
              <tr>
                <td>target namespace</td>
                <td>string</td>
                <td>Namespace URI of the notation</td>
              </tr>
              <tr>
                <td>system identifier</td>
                <td>anyURI</td>
                <td/>
              </tr>
              <tr>
                <td>public identifier</td>
                <td>string</td>
                <td/>
              </tr>

            </tbody>
          </table>

          <h3>Particle</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Particle"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.Particle or a subtype</td>
                <td/>
              </tr>
              <tr>
                <td>min occurs</td>
                <td>integer</td>
                <td/>
              </tr>
              <tr>
                <td>max occurs</td>
                <td>integer, or string("unbounded")</td>
                <td/>
              </tr>
              <tr>
                <td>term</td>
                <td>Element Declaration, Element Wildcard, or ModelGroup</td>
                <td/>
              </tr>

            </tbody>
          </table>

          <h3>Simple type</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Simple Type Definition"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.SimpleType or a subclass</td>
                <td/>
              </tr>
              <tr>
                <td>name</td>
                <td>string</td>
                <td>Local name of the type (empty if anonymous)</td>
              </tr>
              <tr>
                <td>target namespace</td>
                <td>string</td>
                <td>Namespace URI of the type (empty if anonymous)</td>
              </tr>
              <tr>
                <td>final</td>
                <td>Sequence of string("restriction"|"extension"|"list"|"union")</td>
                <td/>
              </tr>
              <tr>
                <td>context</td>
                <td>containing component</td>
                <td/>
              </tr>
              <tr>
                <td>base type definition</td>
                <td>Simple Type</td>
                <td/>
              </tr>
              <tr>
                <td>facets</td>
                <td>Sequence of Facet</td>
                <td/>
              </tr>
              <tr>
                <td>fundamental facets</td>
                <td>Empty sequence (not implemented)</td>
                <td/>
              </tr>
              <tr>
                <td>variety</td>
                <td>string ("atomic"|"list"|"union")</td>
                <td/>
              </tr>
              <tr>
                <td>primitive type definition</td>
                <td>Simple Type</td>
                <td/>
              </tr>
              <tr>
                <td>item type definition</td>
                <td>(for list types only) Simple Type</td>
                <td/>
              </tr>
              <tr>
                <td>member type definitions</td>
                <td>(for union types only) Sequence of Simple Type</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>Type alternative</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>class</td>
                <td>string</td>
                <td>"Type Alternative"</td>
              </tr>
              <tr>
                <td>implementation</td>
                <td>java:com.saxonica.ee.schema.TypeAlternative</td>
                <td/>
              </tr>
              <tr>
                <td>test</td>
                <td>XPath Property Record</td>
                <td/>
              </tr>
              <tr>
                <td>type definition</td>
                <td>Simple Type or Complex Type</td>
                <td/>
              </tr>
            </tbody>
          </table>

          <h3>XPath property record</h3>

          <table class="setWidth">
            <thead>
              <tr>
                <th>Property name</th>
                <th>Type</th>
                <th>Value</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>namespace bindings</td>
                <td>Sequence of functions with properties ("prefix": string, "namespace":
                  anyURI)</td>
                <td/>
              </tr>
              <tr>
                <td>default namespace</td>
                <td>anyURI</td>
                <td/>
              </tr>
              <tr>
                <td>base URI</td>
                <td>anyURI</td>
                <td>The static base URI of the XPath expression</td>
              </tr>
              <tr>
                <td>expression</td>
                <td>string</td>
                <td>The XPath expression as a string</td>
              </tr>
            </tbody>
          </table>

          <p>Here's a simple example that tests whether a particular element has element-only
            content:</p>

          <pre><code class="language-xquery">let $bookDecl := saxon:schema('element declaration', QName('', 'book')) 
return if ($bookDecl('type definition')('variety') = 'element-only') 
       then ... 
       else ... </code></pre>

        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">send-mail</name>
      <description>
        <p>Sends an email message.</p>
      </description>
      <signatures>
        <proto return-type="xs:boolean">
          <arg name="emailConfig" type="map(*)" desc="The email configuration"/>
          <arg name="subject" type="xs:string" desc="The subject/title of the email"/>
          <arg name="content" type="item()" desc="The body of the email"/>
        </proto>
        <proto return-type="xs:boolean">
          <arg name="emailConfig" type="map(*)" desc="The email configuration"/>
          <arg name="subject" type="xs:string" desc="The subject/title of the email"/>
          <arg name="content" type="item()" desc="The body of the email"/>
          <arg name="attachment" type="item()*" desc="Attachments to the email"/>
        </proto>
      </signatures>
      <status>
        <p>This extension function is not available on SaxonCS or SaxonC.</p>
        <p>Use of this function requires the JavaMail API. The mail.jar must be available on the
          classpath. From Saxon 9.9, the required jar is compiled against version 1.6 (previously,
          this was version 1.4). The jar is not redistributed as part of the Saxon product, but is
          available for download from the <a class="bodylink" href="https://javaee.github.io/javamail/">JavaMail project on GitHub</a>.</p>
        <p>From 9.9, the email configuration option <code>ssl</code> is introduced.</p>
        <p>From 9.8.0.5, the function was upgraded: for details of the changes, see bug 3400. This
          documentation describes the latest version.</p>
      </status>
      <saxon-edition platform="J">PE/EE 9.5</saxon-edition>
      <details>
        <div>
          <p>This function takes four arguments:</p>
          <ol>
            <li content="para">
              <p><code>$emailConfig</code> is a map, which contains configuration options required
                to send an email. The following key-value pairs are accepted:</p>
              <table>
                <thead>
                  <tr>
                    <th>Name</th>
                    <td>Type</td>
                    <td>Required?</td>
                    <td>Description</td>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>
                      <code>smtp-server</code>
                    </td>
                    <td>
                      <code>xs:string</code>
                    </td>
                    <td>yes</td>
                    <td>The mail transfer agent will use the SMTP server specified here by the user
                      to send the email message</td>
                  </tr>
                  <tr>
                    <td>
                      <code>port</code>
                    </td>
                    <td>
                      <code>xs:integer</code>
                    </td>
                    <td>no</td>
                    <td>The port number used by the SMTP server (default 25)</td>
                  </tr>
                  <tr>
                    <td>
                      <code>to</code>
                    </td>
                    <td>
                      <code>xs:string*</code>
                    </td>
                    <td>yes</td>
                    <td>Email addresses of recipients</td>
                  </tr>
                  <tr>
                    <td>
                      <code>cc</code>
                    </td>
                    <td>
                      <code>xs:string*</code>
                    </td>
                    <td>no</td>
                    <td>Email addresses of cc recipients</td>
                  </tr>
                  <tr>
                    <td>
                      <code>bcc</code>
                    </td>
                    <td>
                      <code>xs:string*</code>
                    </td>
                    <td>no</td>
                    <td>Email addresses of bcc recipients</td>
                  </tr>
                  <tr>
                    <td>
                      <code>username</code>
                    </td>
                    <td>
                      <code>xs:string</code>
                    </td>
                    <td>no</td>
                    <td>The username used for authentication with the email server</td>
                  </tr>
                  <tr>
                    <td>
                      <code>password</code>
                    </td>
                    <td>
                      <code>xs:string</code>
                    </td>
                    <td>no</td>
                    <td>The password used for authentication with the email server</td>
                  </tr>
                  <tr>
                    <td>
                      <code>from</code>
                    </td>
                    <td>
                      <code>xs:string</code>
                    </td>
                    <td>no</td>
                    <td>The email address of the sender</td>
                  </tr>
                  <tr>
                    <td>
                      <code>realname</code>
                    </td>
                    <td>
                      <code>xs:string</code>
                    </td>
                    <td>no</td>
                    <td>The personal name of the sender of the email</td>
                  </tr>
                  <tr>
                    <td>
                      <code>html</code>
                    </td>
                    <td>
                      <code>xs:boolean</code>
                    </td>
                    <td>no</td>
                    <td>Indicates whether the email body content should be serialized as HTML or as
                      plain text. The default is <code>false()</code></td>
                  </tr>
                  <tr>
                    <td>
                      <code>ssl</code>
                    </td>
                    <td>
                      <code>xs:boolean</code>
                    </td>
                    <td>no</td>
                    <td>Indicates whether to access mail servers over connections secured using SSL
                      or TLS. This option was introduced in Saxon 9.9.0.1. The default is
                        <code>false()</code>. Please ensure that the required smtp-server name and
                      port number has also been provided for use with the secure connection as
                      specified by the host server.</td>
                  </tr>
                </tbody>
              </table>

              <p>Generally the "option parameter conventions" apply, as defined section 1.5 of the
                W3C <a href="https://www.w3.org/TR/xpath-functions-31/#options" class="bodylink">Functions and Operators specification</a>. However, for backwards compatibility
                reasons, parameters expecting a boolean or an integer can be supplied as a string
                that is castable to the required boolean or integer. </p>

              <p>In addition to the above options, any string-valued parameter whose name begins
                with <code>"mail."</code> is passed unchanged as a property to the Java mail API.
                The value can be any atomic item: it will be converted to a string. For example,
                the option <code>mail.smtp.timeout</code> can be set, as an integer, or
                  <code>mail.debug</code> can be set, as a boolean. Similarly, options can be set to
                select an SSL transport. Any option values supplied in this form take precedence
                over the Saxon-defined options listed above.</p>

              <p>Email addresses appearing in the <code>to</code>, <code>cc</code>, and
                  <code>bcc</code> lists may use the syntax <code>John Smith
                  &lt;john.smith@example.com&gt;</code></p>



            </li>
            <li>
              <p>
                <code>$subject</code> (<code>xs:string</code>) is the subject or title of the
                message. This is a string which the recipient of the email will typically see first,
                and provides a summary of the email content.</p>
            </li>
            <li>
              <p>
                <code>$content</code> (either <code>xs:string</code> or <code>element(html)</code>)
                is an item which makes up the content of the email to be sent. This value presents
                the content as either plain text or html. Anything else is serialized as plain
                text.</p>
            </li>
            <li>
              <p>
                <code>$attachment</code> is a sequence of items. This argument accepts a list of
                files to be attached to the email. The argument is optional - omitting it is
                equivalent to supplying an empty sequence, i.e. no attachments.</p>
            </li>
          </ol>

          <p>The function returns a boolean: <code>true</code> indicates email successfully sent,
              <code>false</code> indicates failure in sending email.</p>
          <p>For example, the function may be used as follows in XSLT. This example constructs a
            variable to hold the mail-client configuration and constructs the content as html:</p>

          <pre><code class="language-xml">&lt;xsl:variable name="mailSetup" select="map{'to':'recipient@example.com', 'from':'sender@example.com', 
    'smtp-server':'smtp.example.com', 'username':'user@example.com', 'password':'pass'}"/&gt;
&lt;xsl:variable name="html"&gt;
    &lt;html&gt;
        &lt;body&gt;
            &lt;h1&gt;Saxonica Email&lt;/h1&gt;
            &lt;p&gt;Test email&lt;/p&gt;
        &lt;/body&gt;
    &lt;/html&gt;
&lt;/xsl:variable&gt;
  
&lt;xsl:value-of select="saxon:send-mail($mailSetup, 'Test email' , $html, ())"/&gt;</code></pre>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">serialize</name>
      <description>
        <p>Returns the serialization of a node, that is its representation in XML angle-bracket
          form.</p>
      </description>
      <signatures>
        <proto return-type="xs:string">
          <arg name="node" type="node()" desc="The node to be serialized"/>
          <arg name="format" type="xs:string" desc="The name of an xsl:output declaration"/>
        </proto>
        <proto return-type="xs:string">
          <arg name="node" type="node()" desc="The node to be serialized"/>
          <arg name="format" type="element(xsl:output)" desc="An element node whose content has the form of an xsl:output declaration"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 7.1. The function is obsolescent; the standard <a href="/functions/fn/serialize" class="bodylink code">fn:serialize()</a> function in
          XPath 3.0 should be used in preference.</p>
        <p>Changes made in response to bug 3815 remove the requirement that the output format name
          be supplied as a string literal.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes two arguments: the first is a node (generally a document or element
            node) to be serialized. The second argument defines the serialization properties. The
            second argument takes several possible forms:</p>
          <ul>
            <li content="para">When called within an XSLT stylesheet, the second argument may be the
              name of an <code>xsl:output</code> element in the stylesheet.</li>
            <li content="para">In non-XSLT environments, the second argument may be the name of the
              output method (xml, html, xhtml, text), written as a string literal. In this case the
              other serialization parameters are defaulted.</li>
            <li content="para">In all environments, the second argument may be an
                <code>xsl:output</code> element conforming to the rules defined in the XSLT
              specification. This element may be constructed dynamically, and may therefore be used
              to decide all the serialization properties dynamically.</li>
          </ul>

          <p>For example, the function may be used as follows in XQuery:</p>
          <pre><code class="language-xquery">declare namespace saxon="http://saxon.sf.net/"; 
declare namespace xsl="http://www.w3.org/1999/XSL/Transform"; 

&lt;out&gt;{ 
let $x := &lt;a&gt;&lt;b/&gt;&lt;c&gt;content&lt;/c&gt;&lt;?pi?&gt;&lt;!--comment--&gt;&lt;/a&gt;
return saxon:serialize($x, &lt;xsl:output method="xml" 
                                 omit-xml-declaration="yes"
                                 indent="yes" 
                                 saxon:indent-spaces="1"/&gt;) 
}&lt;/out&gt;</code></pre>

          <p>The function serializes the specified document, or the subtree rooted at the specified
            element, according to the parameters specified, and returns the serialized document as a
            string.</p>

          <p>This function is useful where the stylesheet or query wants to manipulate the
            serialized output, for example by embedding it as CDATA inside another XML document, or
            prefixing it with a DOCTYPE declaration, or inserting it into a non-XML output file.</p>

          <p>Note that because the output is a string, the encoding parameter has no effect on the
            actual encoding, though it does affect what is written to the XML declaration.</p>
        </div>
      </details>
      <see-also namespace="http://www.w3.org/2005/xpath-functions" name="serialize"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">slice</name>
      <description>
        <p>Selects items from a sequence based on their position.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="seq" type="item()*" desc="The sequence to be filtered"/>
          <arg name="positions" type="xs:integer*" desc="The positions of the items to be selected"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 11. The function is likely to become superseded by the proposed
          XPath 4.0 function <code>fn:slice()</code>, which has a slightly different specification.
          All the functionality except for the use of negative positions (to count from the end) is
          already available using the XPath 4.0 function <code>fn:items-at()</code>, and other
          common use cases can be achieved using, for example, <code>fn:foot()</code> and
            <code>fn:trunk()</code>.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <details>
        <div>
          <p>For each integer <code>$i</code> in the value of <code>$positions</code>, in order, the
            function returns:</p>
          <ul>
            <li><code>$seq[$i]</code> if the integer is between 1 and the length of
                <code>$seq</code> (inclusive)</li>
            <li><code>$seq[count($seq)-$i+1]</code> if the integer is negative and its absolute
              value is between 1 and the length of <code>$seq</code> (inclusive)</li>
            <li>an empty sequence if the integer is zero, or if its absolute value exceeds the
              length of <code>$seq</code></li>
          </ul>
          <p>For example:</p>
          <ul>
            <li><code>saxon:slice(10 to 20, 5)</code> returns <code>14</code></li>
            <li><code>saxon:slice(10 to 20, 5 to 6)</code> returns <code>(14, 15)</code></li>
            <li><code>saxon:slice(10 to 20, (5, 3, 1))</code> returns <code>(14, 12, 10)</code></li>
            <li><code>saxon:slice(10 to 20, -1)</code> returns <code>20</code></li>
            <li><code>saxon:slice(10 to 20, -3 to -1)</code> returns <code>(18, 19, 20)</code></li>
            <li><code>saxon:slice(10 to 20, 0)</code> returns <code>()</code></li>
            <li><code>saxon:slice(10 to 20, -2 to +2)</code> returns <code>(19, 20, 10,
              11)</code></li>
          </ul>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">stream</name>
      <description>
        <p>Processes an input document using streaming, that is, without allocating memory to
          contain the entire document.</p>
      </description>
      <signatures>
        <proto return-type="item()*">
          <arg name="input" type="item()*" desc="The input to be streamed"/>
        </proto>
      </signatures>
      <status>
        <p>Available since before Saxon 8.0. Obsolescent in XSLT, since the <a href="/xsl-elements/source-document" class="bodylink code">xsl:source-document</a>
          instruction with attribute <code>streamable="yes"</code> provides equivalent
          functionality; but still useful in XQuery.</p>
        <p>Changed in 9.6 so that the function delivers snapshots of the selected nodes rather than
          copies: that is, the delivered nodes include copies of the ancestors and their attributes,
          as well as the attributes and descendants of the selected node.</p>
        <p>Changed in 9.7 to compile into a call on the XSLT 3.0 <code>xsl:source-document</code>
          instruction, which leads to minor changes in functionality; most notably, the argument
          expression must now call the <code>doc()</code> function, and not
          <code>document()</code>.</p>
      </status>
      <saxon-edition>EE</saxon-edition>
      <details>
        <div>
          <p>Conceptually, this function returns a copy of its input. The intent, however, is to
            evaluate the supplied argument in "streaming mode", which allows an input document to be
            processed without building a tree represention of the whole document in memory. This
            allows much larger documents to be processed using Saxon than would otherwise be the
            case.</p>

          <p>When there is a requirement to stream documents other than the principal input, this
            can be achieved in XQuery using the <code>saxon:stream</code> extension function, which
            enables burst-mode streaming by reading a source document and delivering a sequence of
            element nodes representing selected elements within that document. For example:</p>

          <pre><code class="language-xquery">for $e in saxon:stream(doc('employees.xml')/*/employee) return &lt;sal&gt;{$e/salary}&lt;/sal&gt;</code></pre>

          <p>This example returns a sequence of <code>&lt;sal&gt;</code> elements. The result of the
              <code>saxon:stream</code> call is a sequence of <code>&lt;employee&gt;</code>
            elements. Each <code>&lt;employee&gt;</code> element is linked to copies of: its
            attributes and namespaces; its descendants and their attributes; its ancestors and their
            attributes. But the siblings of the selected node, and of its ancestors, are missing,
            and any attempt to select them will return an empty sequence. This means it is not
            possible to navigate from one <code>&lt;employee&gt;</code> element to others in the
            file; in fact, only one of them actually exists in memory at any one time.</p>

          <p>The function <code>saxon:stream</code> may be regarded as a pseudo-function.
            Conceptually, it takes the set of nodes supplied in its argument, and makes a snapshot
            of each one (in the sense of the XSLT 3.0 <a class="bodylink code" href="/functions/fn/snapshot">fn:snapshot()</a> function). The resulting sequence of
            nodes will usually be processed by an expression such as an XQuery FLWOR expression,
            which handles the nodes one at a time. The actual implementation of
              <code>saxon:stream</code>, however, is rather different, in that it changes the way in
            which its argument is evaluated: instead of the <code>doc()</code> function building a
            tree in the normal way, the path expression
              <code>doc('employees.xml')/*/employee)</code> is evaluated in streamed mode - which
            means that it must conform to a subset of the XPath syntax which Saxon can evaluate in
            streamed mode. For more information, see <a class="bodylink" href="/streaming/streamed-query">Streaming in XQuery</a>.</p>

          <p>The facility should not be used if the source document is read more than once in the
            course of the query/transformation. There are two reasons for this: firstly, if it is
            read more than once then performance will be better if the document is read into memory;
            and secondly, when this optimization is used, there is no guarantee that the
              <code>doc()</code> function will be stable, that is, that it will return the same
            results when called repeatedly with the same URI.</p>

          <p>A call of the form <code>saxon:stream(doc(D)/PATH[PREDICATE])</code> is translated into
            the XSLT 3.0 construct <code>&lt;xsl:source-document streamable="yes"
              href="D"&gt;&lt;xsl:sequence
              select="snapshot(PATH[PREDICATE])"/&gt;&lt;/xsl:source-document&gt;</code> and is
            allowed only if that construct is guaranteed-streamable according to the XSLT 3.0 rules.
            This means that the predicate, if present, must be motionless (it cannot call
              <code>position()</code>, explicitly or implicitly, and it cannot navigate downwards
            from the node being tested, either explicitly using the child or descendant axis, or
            implicitly by getting the string value or typed value of the node).</p>


          <p>If the path expression cannot be evaluated in streaming mode, execution fails, unless
            the configuration option <a class="bodylink" href="/configuration/config-features#STREAMING_FALLBACK">STREAMING_FALLBACK</a> is set, in which
            case it is executed in non-streaming mode (that is, the result is simply the result of
            evaluating the argument to the function).</p>

          <p>For further details see <a href="/streaming">Streaming XML documents</a>.</p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">string-to-base64Binary</name>
      <description>
        <p>Encodes a string to an <code>xs:base64Binary</code> value, using a given encoding.</p>
      </description>
      <signatures>
        <proto return-type="xs:base64Binary?">
          <arg name="in" type="xs:string?" desc="The input string"/>
          <arg name="encoding" type="xs:string" desc="The encoding of the input string"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.4.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>

          <p>This function takes as input a string and the name of a character encoding (for example
              <code>UTF8</code>). It encodes the contents of the string value as a sequence of bytes
            using a particular encoding, and returns the <code>xs:base64Binary</code> representation
            of this sequence of bytes.</p>

          <p>For example, the call <code>saxon:string-to-base64Binary("Dassel", "UTF8")</code>
            returns the <code>xs:base64Binary</code> value whose lexical representation is
              <code>"RGFzc2Vs"</code>.</p>
          <p>If the first argument is an empty sequence, the function returns an empty sequence.</p>
        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="base64Binary-to-string"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">string-to-hexBinary</name>
      <description>
        <p>Encodes a string to an <code>xs:hexBinary</code> value, using a given encoding.</p>
      </description>
      <signatures>
        <proto return-type="xs:hexBinary?">
          <arg name="in" type="xs:string?" desc="The input string"/>
          <arg name="encoding" type="xs:string" desc="The encoding of the input string"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.4.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes as input a string and the name of a character encoding (for example
              <code>UTF8</code>). It encodes the contents of the string value as a sequence of bytes
            using a particular encoding, and returns the <code>xs:hexBinary</code> representation of
            this sequence of bytes.</p>
        </div>
      </details>
      <see-also namespace="http://saxon.sf.net/" name="hexBinary-to-string"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">string-to-utf8</name>
      <description>
        <p>Returns the UTF-8 encoding of a string.</p>
      </description>
      <signatures>
        <proto return-type="xs:integer*">
          <arg name="name" type="xs:string" desc="The input string"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes a string as input, and returns a sequence of integers representing
            the octets in the UTF8 encoding of the string. The integers are all in the range 0-255.
          </p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">system-id</name>
      <description>
        <p>Returns the system ID of the source document containing the context node.</p>
      </description>
      <signatures>
        <proto return-type="xs:string"/>
      </signatures>
      <status>
        <p>Available since before Saxon 8.0.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This returns the system identifier (URI) of the entity in the source document that
            contains the context node. There are no arguments.</p>

          <p>Note: the system identifier will often be the same as the base URI. It may also be the
            same as the document URI. However, there are cases where all three may be different. In
            the case of a document constructed from a JAXP Source, the system identifier is the
            value supplied in the <code>setSystemId()</code> method. In other cases it will
            generally be the same as the base URI of the document node at the root of the tree. </p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">transform</name>
      <description>
        <p>Executes an XSLT transformation.</p>
      </description>
      <signatures>
        <proto return-type="document-node()?">
          <arg name="stylesheet" type="jt:net.sf.saxon.PreparedStylesheet" desc="The compiled stylesheet"/>
          <arg name="source" type="node()" desc="The source document to be transformed"/>
        </proto>
        <proto return-type="document-node()?">
          <arg name="stylesheet" type="jt:net.sf.saxon.PreparedStylesheet" desc="The compiled stylesheet"/>
          <arg name="source" type="node()" desc="The source document to be transformed"/>
          <arg name="params" type="item()*" desc="Parameters to the transformation"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 8.5. Changed in Saxon 9.5 to allow the parameters to be supplied as
          a map. This function is obsolescent: it is superseded by <code>fn:transform()</code> in
          XPath 3.1.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes as input a compiled XSLT stylesheet, and uses it to transform a
            source document into a result document. The first argument will generally be the result
            of calling the <a class="bodylink code" href="/functions/saxon/compile-stylesheet">saxon:compile-stylesheet()</a> extension function. The second argument can be any
            node (usually a document node or element node), either read from external filestore
            using the <a class="bodylink code" href="/functions/fn/doc">doc()</a> or <a class="bodylink code" href="/functions/fn/document">document()</a> function, or
            constructed programmatically.</p>

          <p>The function is available both in XQuery and in XSLT. It can thus be used for example
            in XQuery to pre-process the input using a stylesheet, or to post-process the output
            using a stylesheet. It can also be used to chain multiple XSLT transformations
            together.</p>

          <p>The compiled stylesheet can be used repeatedly to transform multiple source
            documents.</p>

          <p>If the optional third argument is present, it is used to supply parameters to the
            transformation. There are two ways to supply parameters:</p>

          <ul>
            <li>
              <p>The old way: The parameters are supplied as a sequence of nodes. Each node must be
                an element node, attribute node, or document node; supplying a document node is
                equivalent to supplying all its element children. The name of the node must match
                the parameter name declared in an <a class="bodylink code" href="/xsl-elements/param">xsl:param</a> element in the stylesheet, and the
                atomized value of the node is used as the value of the parameter. If this is
                  <code>untypedAtomic</code> then it is converted to the required type declared in
                the stylesheet.</p>
            </li>
            <li>
              <p>The new way (from Saxon 9.5) is as a map. The keys in the map may be strings
                (representing the name of a parameter in no namespace), or <code>xs:QName</code>
                values, allowing the parameter name to be in a namespace. The values are the
                corresponding parameter values. With the new way of supplying parameters, the
                parameter may take any value (with the old way it is restricted to atomic
                values.)</p>
            </li>
          </ul>

          <p>The stylesheet may contain calls on <a class="bodylink code" href="/xsl-elements/result-document">xsl:result-document</a>. This allows the output
            of the stylesheet to be serialized directly to filestore rather than being returned to
            the calling transformation or query.</p>

          <p>If the stylesheet produces no principal output document (typically because it sends all
            its output to secondary result documents) then the call on
              <code>saxon:transform()</code> returns an empty sequence.</p>

          <p>Here is an example of how to use the function from XQuery:</p>
          <pre><code class="language-xquery">let $results := 
   &lt;customers&gt;{ //customer[location="Scotland"] }&lt;/customers&gt; 
let $rendition := saxon:compile-stylesheet(doc('show-customers.xsl')) 
return saxon:transform($rendition, $results)</code></pre>

          <p>The following example uses XSLT's ability to create multiple output files:</p>
          <pre><code class="language-xquery">let $splitter := saxon:compile-stylesheet( 
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                     version="2.0"&gt; 
    &lt;xsl:template match="customer"&gt; 
      &lt;xsl:result-document href="{{@id}}.xml"&gt; 
        &lt;xsl:copy-of select="."/&gt; 
      &lt;/xsl:result-document&gt; 
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;) 
let $results := 
  document { 
    &lt;customers&gt;{ //customer[location="Scotland"] }&lt;/customers&gt; 
  } 
return saxon:transform($splitter, $results)</code></pre>

          <p>Note (a) the need to double the curly braces to ensure that the contained expression is
            expanded when the stylesheet is executed by XSLT, not when it is created by XQuery, and
            (b) the fact that the stylesheet and source document are supplied as document nodes, not
            element nodes.</p>
        </div>
      </details>
      <see-also name="compile-stylesheet" namespace="http://saxon.sf.net/"/>
      <see-also name="transform" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">timestamp</name>
      <description>
        <p>Returns an <code>xs:dateTimeStamp</code> value representing the instant in time at which
          the function is called.</p>
      </description>
      <signatures>
        <proto return-type="xs:dateTimeStamp"/>
      </signatures>
      <status>
        <p>Available since Saxon 9.8. Changed in 9.9 to call
            <code>java.time.ZonedDateTime.now()</code>.</p>
      </status>
      <saxon-edition>PE/EE 9.8</saxon-edition>
      <details>
        <div>
          <p>The function returns an <code>xs:dateTimeStamp</code> value representing (as far as
            possible) the instant at which the function is called. This differs from
              <code>fn:current-dateTime()</code> in that successive calls return different values.
            This enables the result to be used for performance instrumentation.</p>

          <aside>
            <p><code>xs:dateTimeStamp</code> is a derived data type defined in XSD 1.1: it
              represents an <code>xs:dateTime</code> in which the timezone is always present.</p>
          </aside>

          <p>The precision of the result depends on the platform. The <code>xs:dateTime</code>
            implementation (and <code>java.time.ZonedDateTime</code> on which it depends) is capable
            of representing nanosecond precision, but some platforms only return millisecond
            precision.</p>

          <p>The timezone in the result is the default timezone for the Java platform, which is
            generally taken from the underlying operating system. This will usually be the same as
            the value of <code>implicit-timezone()</code>, except that the timezone may change in
            successive calls as a result of daylight savings time changes.</p>

          <p>Saxon attempts to avoid aggressive optimization of calls to this function, so for
            example a call will not be lifted out of a loop. However, order of execution is not
            guaranteed, so there may still be surprises. If the result is bound to a variable, for
            example, the variable may be inlined or lazily evaluated, which means the timestamp will
            show the time at which the variable is evaluated, not the time at which it is
            declared.</p>

          <p>If the value is to be used for measuring execution time, the following code is
            suggested:</p>
          <pre><code class="language-xml">&lt;xsl:variable name="start" select="saxon:timestamp()" as="xs:dateTimeStamp"/&gt;
&lt;!-- force evaluation --&gt;
&lt;xsl:if test="$start eq xs:dateTime('1900-01-01T00:00:00')"&gt;&lt;x/&gt;&lt;/xsl:if&gt;
&lt;!-- code under test goes here --&gt;
&lt;xsl:message expand-text="yes"&gt;Execution time: {(saxon:timestamp() - $start) div
xs:duration('PT0.001S')}ms &lt;/xsl:message&gt;</code></pre>
          <p>
            <em>(Saxon's optimizer will pre-evaluate the constant expressions at compile time, so
              these do not add run-time overhead.)</em>
          </p>
        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">tunnel-params</name>
      <description>
        <p>Returns a map containing the values of all tunnel parameters available in the current
          template.</p>
      </description>
      <signatures>
        <proto return-type="map(xs:QName, item()*)"/>
      </signatures>
      <status>
        <p>Available since Saxon 10.</p>
      </status>
      <saxon-edition>PE/EE 10</saxon-edition>
      <details>
        <div>
          <p>This function returns a map containing the values of all tunnel parameters available in
            the current template, whether they are declared in the template or not.</p>

          <p>The key in the map is the parameter name, as an <code>xs:QName</code> value; the
            corresponding value is the value of the parameter.</p>

          <p>The function is useful for diagnostics, to determine what parameters would be available
            if they were declared in the template. It may also on occasions be useful to determine
            at run-time whether a parameter is available, without an explicit declaration.</p>

        </div>
      </details>

    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">type</name>
      <description>
        <p>Returns information about the type annotation of a node or atomic item.</p>
      </description>
      <signatures>
        <proto return-type="function(*)?">
          <arg name="item" type="item()?" desc="The item whose type information is required"/>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>EE 9.5</saxon-edition>
      <details>
        <div>
          <p>The information is returned in the same form as information from the <a class="bodylink code" href="/functions/saxon/schema">saxon:schema()</a> function. That
            is, it returns a function item representing the simple or complex type component, whose
            properties can be obtained by calling the function. For example,
              <code>saxon:type($node)('name')</code> returns the local name of the type, and
              <code>saxon:type($node)('namespace')</code> returns the corresponding namespace URI.
            If it is a simple type, then <code>saxon:type($node)('variety')</code> might return
              <code>list</code>, in which case <code>saxon:type($node)('itemType')</code> would
            return the item type of the list, again as a function item.</p>
          <p>If an empty sequence is supplied, an empty sequence is returned.</p>
        </div>
      </details>
      <see-also name="schema" namespace="http://saxon.sf.net/"/>
      <see-also name="type-annotation" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">type-annotation</name>
      <description>
        <p>Returns the name of the type annotation of a node or atomic item.</p>
      </description>
      <signatures>
        <proto return-type="xs:QName?">
          <arg name="item" type="item()?" desc="The item whose type is required"/>
        </proto>
      </signatures>
      <status>
        <p>Available since around Saxon 8.0(?). The newer <a href="/functions/saxon/type" class="bodylink code">saxon:type()</a> function provides more information.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function takes an item as argument.</p>

          <p>If the argument is an element or attribute node, the function returns the type
            annotation of the node, as a QName. If the type is anonymous, this will be a
            system-generated internal name.</p>

          <p>If the argument is a document node, the function returns <code>xs:anyType</code> if the
            document has been schema-validated, or <code>xs:untyped</code> otherwise.</p>

          <p>For a text node, the function returns <code>xs:untypedAtomic</code>, and for comment,
            processing-instruction, and namespace nodes, it returns <code>xs:string</code>.</p>

          <p>If the argument is an atomic item, the function returns the type label of the atomic
            value, again as a QName.</p>

          <p>If the argument is an empty sequence, the function returns an empty sequence.</p>

          <p>The prefix of the returned QName should not be treated as significant.</p>
        </div>
      </details>
      <see-also name="type" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">unescape-NCName</name>
      <description>
        <p>Reverses the escaping performed by the <code>saxon:escape-NCName</code> function.</p>
      </description>
      <signatures>
        <proto return-type="xs:string">
          <arg name="input" type="xs:NCName" desc="The escaped string to be converted back to its original form"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 11.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <details>
        <div>
          <p>If the supplied string is valid according to the escaping rules of the
              <code>saxon:escape-NCName</code> function, then the original string is returned.</p>

          <p>For example:</p>

          <ul>
            <li><code>saxon:unescape-NCName(xs:NCName("_"))</code> returns <code>""</code></li>
            <li><code>saxon:unescape-NCName(xs:NCName("__"))</code> returns <code>"_"</code></li>
            <li><code>saxon:unescape-NCName(xs:NCName("phone_20_number"))</code> returns
                <code>"phone number"</code></li>
          </ul>

          <p>If the string is invalid according to these rules, a dynamic error is raised
            (FORG0001).</p>

          <p>Hex digits a-f may be uppercase or lowercase, and leading zeroes are accepted in hex
            codepoint values.</p>



        </div>
      </details>
      <see-also name="escape-NCName" namespace="http://saxon.sf.net/"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">unindexed</name>
      <description>
        <p>A pseudo-function that tells the optimizer to avoid indexing a filter expression.</p>
      </description>
      <signatures>
        <proto return-type="xs:string">
          <arg name="input" type="item()*" desc="The expression to be evaluated without indexing"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 11.</p>
      </status>
      <saxon-edition>EE 11</saxon-edition>
      <details>
        <div>
          <p>The function returns the value of its argument unchanged.</p>

          <p>The reason for calling this function is that it signals to the optimizer that the
            argument expression (which will typically be a filter expression) should not result in
            construction of an index.</p>

          <p>For example, Saxon would normally build an index to evaluate an expression such as
              <code>//person[@ssn=$ssn]</code>. But there are cases where this is not the best
            strategy, for example:</p>

          <ul>
            <li>If the expression will only be evaluated once.</li>
            <li>If impure extension functions are used to modify the data between evaluations.</li>
            <li>If the set of nodes selected by <code>//person</code> is small.</li>
            <li>If most of the nodes selected by <code>//person</code> have the same value for
                <code>@ssn</code>.</li>
          </ul>

          <p>Writing <code>saxon:unindexed(//person[@ssn=$ssn])</code> delivers the same result, but
            using a serial search of the data.</p>

        </div>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">unparsed-entities</name>
      <description>
        <p>Returns a list of the names of the unparsed entities declared within a document.</p>
      </description>
      <signatures>
        <proto return-type="xs:string*">
          <arg name="doc" type="document-node()" desc="The containing document"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 9.1. With SaxonCS, available since Saxon 13.0,
          but works only on documents that wrap a DOM <code>XmlDocument</code> tree.</p>
        <p>The <code>XmlDocument</code> implementation used in SaxonCS does not follow the rule that when two entity
         declarations have the same name, only the first is retained; instead, it appears to retain neither.</p>
      </status>
      <saxon-edition>PE/EE</saxon-edition>
      <details>
        <div>
          <p>This function returns a list of the names of the unparsed entities declared with the
            document node supplied as <code>$doc</code>. These names can then be used as arguments
            to the standard XSLT functions <a class="bodylink code" href="/functions/fn/unparsed-entity-uri">unparsed-entity-uri()</a> and <a class="bodylink code" href="/functions/fn/unparsed-entity-public-id">unparsed-entity-public-id()</a> to determine the system and public identifiers of the
            unparsed entity.</p>
        </div>
      </details>
      <see-also namespace="http://www.w3.org/2005/xpath-functions" name="unparsed-entity-uri"/>
      <see-also namespace="http://www.w3.org/2005/xpath-functions" name="unparsed-entity-public-id"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">validate</name>
      <description>
        <p>Performs validation of a node against schema definitions.</p>
      </description>
      <signatures>
        <proto return-type="map(xs:string, item()*)?">
          <arg name="node" type="node()?" desc="The node to be validated"/>
        </proto>
        <proto return-type="map(xs:string, item()*)?">
          <arg name="node" type="node()?" desc="The node to be validated"/>
          <arg name="options" type="map(xs:string, item()*)" desc="Validation options"/>
        </proto>
        <proto return-type="map(xs:string, item()*)?">
          <arg name="node" type="node()?" desc="The node to be validated"/>
          <arg name="options" type="map(xs:string, item()*)" desc="Validation options"/>
          <arg name="params" type="map(xs:string, item()*)" desc="Validation parameters"/>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition>EE 9.5</saxon-edition>
      <details>
        <div>
          <p>The <code>saxon:validate()</code> extension function performs validation of a node
            against schema definitions, providing more control over the validation process than is
            available with standard XSLT and XQuery interfaces. For example, it allows validation
            parameters to be supplied, and it returns detailed information about the validation
            errors that were found (if any).</p>

          <p>The first argument must be a document, element, or attribute node (the node to be
            validated). If an empty sequence is supplied, the function returns the empty
            sequence.</p>

          <p>If the second and/or third arguments are omitted, the effect is the same as if empty
            maps were supplied for these arguments.</p>

          <p>The second argument, <code>$options</code>, gives options for how the validation is to
            be performed. The entries that are recognized in this map are:</p>

          <ol>
            <li>
              <p>
                <code>buildTree</code>: which if present must have the value <code>true()</code> or
                  <code>false()</code> or <code>()</code> (default is <code>()</code>). The value
                  <code>()</code> means that the tree that results from validation is returned if
                validation succeeds, and is not returned if validation fails. Setting this option to
                  <code>false()</code> means that it will not be returned in either case. Setting it
                to <code>true()</code> means that the tree will be returned even if validation is
                unsuccessful. Note that in this case type annotations in the returned tree are
                unreliable. Note also that references to nodes in the returned error list relate to
                node in the input tree, not the result tree.</p>
            </li>

            <li>
              <p>
                <code>processContents</code>: which must have the value <code>strict</code> or
                  <code>lax</code> (default is <code>strict</code>). Indicates whether validation is
                strict or lax, according to the element name of the root element. The value is
                ignored if the <code>type</code> option is present.</p>
            </li>

            <li>
              <p>
                <code>type</code>: whose value must be an <code>xs:QName</code>, being the name of a
                simple or complex type that is present in the schema at run-time; if present, this
                provides the name of the type against which the supplied node should be
                validated.</p>
            </li>

            <li>
              <p>
                <code>expandDefaults</code>: which must have the value <code>true()</code> or
                  <code>false()</code> (default is <code>true()</code>). Indicates whether the
                expansions of absent attributes and empty elements that have a schema-defined
                default value will be present in the returned tree.</p>
            </li>
          </ol>

          <p>The third argument, <code>$params</code>, gives values of schema parameters declared
            using the <code>saxon:param</code> XSD extension (see <a class="bodylink" href="/schema-processing/extensions11/parameterizing-schemas">Parameterizing
              schemas</a>). The keys must be <code>xs:QName</code> values corresponding to the names
            of declared parameters, and the corresponding values are the values to be used for the
            parameters.</p>

          <p>The schema used for validation consists of all the schema components already present in
            the configuration, plus any additional schema components loaded using the
              <code>xsi:schemaLocation</code> and <code>xsi:noNamespaceSchemaLocation</code>
            attributes in the instance being validated. The schema components present in the
            configuration include the following:</p>

          <ul>
            <li>
              <p>Schema documents loaded using <code>&lt;xsl:import-schema&gt;</code> declarations
                in the stylesheet.</p>
            </li>
            <li>
              <p>Schema documents loaded using the <code>-xsd</code> option on the command line.</p>
            </li>
            <li>
              <p>Schema documents loaded during the validation of previous instance documents, by
                virtue of their <code>xsi:schemaLocation</code> and
                  <code>xsi:noNamespaceSchemaLocation</code> attributes.</p>
            </li>
            <li>
              <p>Schema documents loaded using explicit API calls, for example to the s9api
                  <code>SchemaManager</code> class.</p>
            </li>
          </ul>

          <p>The result of the function is a map. If validation succeeds, the map will contain two
            entries: "node" is the validated node, and "valid" is the boolean value true. If
            validation fails, the map will contain two entries: "valid" is the boolean value false,
            and "errors" is a list of error objects representing the validation errors that were
            found. Each error object is itself a map, with the following optional entries (all
            entries except <code>message</code> are optional, and will be present only if
            information is available):</p>

          <ol>
            <li>
              <p>
                <code>message</code>: A human-readable error message, as a string.</p>
            </li>
            <li>
              <p>
                <code>code</code>: An error code, as an <code>xs:QName</code>.</p>
            </li>
            <li>
              <p>
                <code>specPart</code>, <code>constraint</code>, <code>clause</code>: references to
                the XSD constraint that was violated, in the form of the XSD specification part
                number (1 or 2), the name of the constraint (e.g. "cvc-identity-constraint"), and
                the clause number within the constraint (e.g. "4.2.1").</p>
            </li>
            <li>
              <p>
                <code>node</code>, <code>path</code>, <code>lineNumber</code>,
                  <code>columnNumber</code>, <code>systemId</code>, <code>publicId</code>:
                information about the location of the error within the document or subtree being
                validated.</p>
            </li>
          </ol>

        </div>
      </details>
    </function>
    
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/">xquery</name>
      <description>
        <p>Compiles an XQuery query, delivering a function item that can be called to execute the
          query.</p>
      </description>
      <signatures>
        <proto return-type="function(item()?, map(xs:QName, item()*) as item()*">
          <arg name="query" type="xs:string" desc="The query to be evaluated"/>
        </proto>
      </signatures>
      <status>
        <p>Available since Saxon 11. The function is available both in XQuery and in XSLT.</p>
      </status>
      <saxon-edition>PE/EE 11</saxon-edition>
      <details>
        <div>
          <p>This function takes as input an XQuery query, and returns a function item, which can be
            evaluated to run the query.</p>

          <p>The returned function takes two arguments:</p>

          <ol>
            <li>The context item for execution of the query. The argument may be set to an empty
              sequence if no context item is required.</li>
            <li>A map containing values of parameters (external variables) for the query. The keys
              are <code>xs:QName</code>s representing the parameter names; the corresponding values
              are arbitrary values for the parameters.</li>
          </ol>


          <p>Here is an example of how to use the function from XQuery:</p>
          <pre><code class="language-xquery">declare namespace saxon = "http://saxon.sf.net/"; 
            
&lt;out&gt;{ 
   let $q1 := "declare variable $x external; declare variable $y external; &lt;z&gt;{$x + $y + .}&lt;/z&gt;" 
   let $qry := saxon:xquery($q1)
   return $qry(4, map{xs:QName('x'): 3, xs:QName('y'): 2})
}&lt;/out&gt;</code></pre>

          <p>The result of the query is a sequence containing the single integer 9.</p>
        </div>
      </details>
      <see-also name="compile-query" namespace="http://saxon.sf.net/"/>
      <see-also name="query" namespace="http://saxon.sf.net/"/>
    </function>

  </section>
  <section id="exslt-common" title="Namespace exslt-common">
    <h1>Namespace exslt-common</h1>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/common">node-set</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="arg" type="item()*" desc="The input to be 'converted'"/>
          <in-spec>exslt-common</in-spec>
        </proto>
      </signatures>
      <status>
        <p>This function is retained in Saxon for backwards compatibility as it is widely used in
          XSLT 1.0 stylesheets, however it is simply a no-op, because the restrictions on use of
          node-sets that made it necessary have disappeared. The input can be any sequence, and it
          is returned unchanged. This differs from some implementations of the
            <code>node-set()</code> function which, for example, did the equivalent of
            <code>parse-xml()</code> if supplied with a string as input.</p>
      </status>
      <saxon-edition>ALL</saxon-edition>
      <description>
        <p>Originally defined as an EXSLT extension to XSLT 1.0, to convert a result-tree-fragment
          to a node-set.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/common">object-type</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="arg" type="item()*" desc="The value whose type is required"/>
          <in-spec>exslt-common</in-spec>
        </proto>
      </signatures>
      <status>
        <p>This function is retained in Saxon for backwards compatibility because it is encountered
          in XSLT 1.0 stylesheets, however it has not caught up with the richness of the new types
          introduced in XPath 2.0 and XPath 3.0. The input can be any sequence, and the output is a
          string representation of the item type of the sequence (ignoring the cardinality). If the
          input corresponds to one of the XPath 1.0 types <code>node-set</code>,
          <code>string</code>, <code>boolean</code>, or <code>number</code>, then the result is one
          of those four strings (number covers integer, decimal, float, and double); otherwise it is
          a string representation of the actual item type of the input.</p>
      </status>
      <saxon-edition platform="J C">ALL</saxon-edition>
      <description>
        <p>Originally defined as an EXSLT extension to XSLT 1.0, to determine the type of a
          value.</p>
      </description>
      <see-also name="type" namespace="http://saxon.sf.net/"/>
      <see-also name="type-annotation" namespace="http://saxon.sf.net/"/>
    </function>

  </section>
  <section id="exslt-dates-and-times" title="Namespace exslt-dates-and-times">
    <h1>Namespace exslt-dates-and-times</h1>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">add</name>
      <signatures>
        <proto return-type="string">
          <arg name="date-time" type="string" desc="The input date/time"/>
          <arg name="duration" type="string" desc="The input duration"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the date/time resulting from adding a duration to a date/time.</p>
      </description>
      <status>
        <p>The specifications of the EXSLT date-and-time handling functions have little to say about
          timezones. Saxon generally handles inputs with or without a timezone, and uses the XPath
          2.0 concept of implicit timezone to interpret the meaning of dates/times without a
          timezone. The current date and time used by EXSLT functions is the same as that used by
          the XPath 2.0 <a class="bodylink code" href="/functions/fn/current-dateTime">current-dateTime()</a> function.</p>
      </status>
      <see-also name="add-duration" namespace="http://exslt.org/dates-and-times"/>
      <see-also name="sum" namespace="http://exslt.org/dates-and-times"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">add-duration</name>
      <signatures>
        <proto return-type="string">
          <arg name="duration1" type="string" desc="First input duration"/>
          <arg name="duration2" type="string" desc="Second input duration"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the duration resulting from adding two durations together.</p>
      </description>
      <see-also name="add" namespace="http://exslt.org/dates-and-times"/>
      <see-also name="sum" namespace="http://exslt.org/dates-and-times"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">date</name>
      <signatures>
        <proto return-type="string">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the date specified in the date/time string given as the argument. If no argument
          is given, then the current local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as a
          default argument.</p>
      </description>
      <see-also name="time" namespace="http://exslt.org/dates-and-times"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">date-time</name>
      <signatures>
        <proto return-type="string">
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the current date and time as a date/time string.</p>
      </description>
      <see-also name="current-dateTime" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">day-abbreviation</name>
      <signatures>
        <proto return-type="string">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the abbreviation of the day of the week of a date. If no argument is given, then
          the current local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. The result is a three-letter English day abbreviation: one of 'Sun',
          'Mon', 'Tue', 'Wed', 'Thu' or 'Fri'. </p>
      </description>
      <status>
        <p>The specifications of the EXSLT date-and-time handling functions have little to say about
          timezones. Saxon generally handles inputs with or without a timezone, and uses the XPath
          2.0 concept of implicit timezone to interpret the meaning of dates/times without a
          timezone. The current date and time used by EXSLT functions is the same as that used by
          the XPath 2.0 <a class="bodylink code" href="/functions/fn/current-dateTime">current-dateTime()</a> function.</p>
      </status>
      <see-also name="day-name" namespace="http://exslt.org/dates-and-times"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">day-in-month</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the day of a date as a number. If no argument is given, then the current local
          date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. </p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">day-in-week</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the day of the week given in a date as a number. If no argument is given, then
          the current local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. The numbering of days of the week starts at 1 for Sunday, 2 for Monday
          and so on up to 7 for Saturday. </p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">day-in-year</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the day of a date in a year as a number. If no argument is given, then the
          current local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. </p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">day-name</name>
      <signatures>
        <proto return-type="string">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the full name of the day of the week of a date. If no argument is given, then the
          current local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. The result is an English day name: one of 'Sunday', 'Monday', 'Tuesday',
          'Wednesday', 'Thursday' or 'Friday'. </p>
      </description>
      <see-also name="day-abbreviation" namespace="http://exslt.org/dates-and-times"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">day-of-week-in-month</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the day-of-the-week in a month of a date as a number (e.g. 3 for the 3rd Tuesday
          in May). If no argument is given, then the current local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the default argument. </p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">difference</name>
      <signatures>
        <proto return-type="string">
          <arg name="start" type="string" desc="The first input date/time"/>
          <arg name="end" type="string" desc="The second input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the duration between the first date and the second date. If the first date occurs
          before the second date, then the result is a positive duration; if it occurs after the
          second date, the result is a negative duration. </p>
      </description>
      <status>
        <p>The specifications of the EXSLT date-and-time handling functions have little to say about
          timezones. Saxon generally handles inputs with or without a timezone, and uses the XPath
          2.0 concept of implicit timezone to interpret the meaning of dates/times without a
          timezone. The current date and time used by EXSLT functions is the same as that used by
          the XPath 2.0 <a class="bodylink code" href="/functions/fn/current-dateTime">current-dateTime()</a> function.</p>
      </status>
      <see-also name="add-duration" namespace="http://exslt.org/dates-and-times"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">duration</name>
      <signatures>
        <proto return-type="string">
          <arg name="seconds" type="number?" desc="The input number"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns a duration string representing the number of seconds specified by the argument
          string. If no argument is given, then the result of calling <a class="bodylink code" href="/functions/exslt-dates-and-times/seconds">date:seconds</a> without any arguments
          is used as a default argument. </p>
      </description>
    </function>

    
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">hour-in-day</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date-time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the hour of the day as a number. If no argument is given, then the current local
          date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. </p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">leap-year</name>
      <signatures>
        <proto return-type="boolean">
          <arg name="date-time" type="string?" desc="The input date-time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns true if the year given in a date is a leap year. If no argument is given, then
          the current local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. </p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">minute-in-hour</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date-time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the minute of the hour as a number. If no argument is given, then the current
          local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. </p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">month-abbreviation</name>
      <signatures>
        <proto return-type="string">
          <arg name="date-time" type="string?" desc="The input date-time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the abbreviation of the month of a date. If no argument is given, then the
          current local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. The result is a three-letter English month abbreviation: one of 'Jan',
          'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov' or 'Dec'. </p>
      </description>
      <see-also name="month-name" namespace="http://exslt.org/dates-and-times"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">month-in-year</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date-time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the month of a date as a number. If no argument is given, then the current local
          date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. </p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">month-name</name>
      <signatures>
        <proto return-type="string">
          <arg name="date-time" type="string?" desc="The input date-time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the full name of the month of a date. If no argument is given, then the current
          local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. The result is an English month name: one of 'January', 'February',
          'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November' or
          'December'. </p>
      </description>
      <see-also name="month-abbreviation" namespace="http://exslt.org/dates-and-times"/>
    </function>

    
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">second-in-minute</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date-time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the second of the minute as a number. If no argument is given, then the current
          local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument. </p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">seconds</name>
      <signatures>
        <proto return-type="number">
          <arg name="input" type="string?" desc="The input string (a date/time or duration)"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the number of seconds specified by the argument string (a date/time or duration).
          If the argument is a date/time then the function returns the time difference in seconds
          between the date/time and <code>1970-01-01T00:00:00Z</code>. If no argument is given, then
          the current local date/time is used as the default argument, and so the function returns
          the number of seconds since 1 Jan 1970. A duration argument (in days, hours, minutes, and
          seconds) is converted into seconds.</p>
      </description>
      <status>
        <p>The specifications of the EXSLT date-and-time handling functions have little to say about
          timezones. Saxon generally handles inputs with or without a timezone, and uses the XPath
          2.0 concept of implicit timezone to interpret the meaning of dates/times without a
          timezone. The current date and time used by EXSLT functions is the same as that used by
          the XPath 2.0 <a class="bodylink code" href="/functions/fn/current-dateTime">current-dateTime()</a> function.</p>
      </status>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">sum</name>
      <signatures>
        <proto return-type="string">
          <arg name="nodes" type="item()*" desc="The input node-set"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Adds a set of durations together. The string values of the nodes in the node set passed
          as an argument are interpreted as durations and added together as if using the <a class="bodylink code" href="/functions/exslt-dates-and-times/add-duration">date:add-duration</a> function. </p>
      </description>
      <see-also name="add" namespace="http://exslt.org/dates-and-times"/>
      <see-also name="add-duration" namespace="http://exslt.org/dates-and-times"/>
      <see-also name="sum" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">time</name>
      <signatures>
        <proto return-type="string">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the time specified in the date/time string given as the argument. If no argument
          is given, then the current local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument.</p>
      </description>
      <see-also name="date" namespace="http://exslt.org/dates-and-times"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">week-in-month</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the week in a month of a date as a number. If no argument is given, then the
          current local date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument.</p>
      </description>
      <details>
        <p>For the purposes of numbering, the first day of the month is in week 1 and new weeks
          begin on a Monday (so the first and last weeks in a month will often have less than 7 days
          in them).</p>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">week-in-year</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the week of the year as a number. If no argument is given, then the current local
          date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument.</p>
      </description>
      <details>
        <p> For the purposes of numbering, counting follows ISO 8601: week 1 in a year is the week
          containing the first Thursday of the year, with new weeks beginning on a Monday. </p>
      </details>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/dates-and-times">year</name>
      <signatures>
        <proto return-type="number">
          <arg name="date-time" type="string?" desc="The input date/time"/>
          <in-spec>exslt-dates-and-times</in-spec>
        </proto>
      </signatures>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the year of a date as a number. If no argument is given, then the current local
          date/time, as returned by <a class="bodylink code" href="/functions/exslt-dates-and-times/date-time">date:date-time</a> is used as the
          default argument.</p>
      </description>
    </function>

  </section>

  <section id="exslt-math" title="Namespace exslt-math">
    <h1>Namespace exslt-math</h1>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">abs</name>
      <signatures>
        <proto return-type="numeric">
          <arg name="arg" type="numeric" desc="The input value"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/fn/abs">fn:abs()</a>. </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the absolute value of a given number. Returns the same type as the supplied
          argument.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">acos</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="arg" type="xs:double" desc="The supplied angle in radians"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/math/acos">math:acos()</a> in namespace <code>http://www.w3.org/2005/xpath-functions/math</code>.
        </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the arc cosine of the argument, the result being in the range zero to
            +<code>π</code> radians.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">asin</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="arg" type="xs:double" desc="The supplied angle in radians"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/math/asin">math:asin()</a> in namespace <code>http://www.w3.org/2005/xpath-functions/math</code>.
        </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the arc sine of the argument, the result being in the range -<code>π</code>/2 to
            +<code>π</code>/2 radians.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">atan</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="arg" type="xs:double" desc="The supplied angle in radians"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/math/atan">math:atan()</a> in namespace <code>http://www.w3.org/2005/xpath-functions/math</code>.
        </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the arc tangent of the argument, the result being in the range -<code>π</code>/2
          to +<code>π</code>/2 radians.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">atan2</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="y" type="xs:double" desc="The supplied angle in radians"/>
          <arg name="x" type="xs:double" desc="The supplied angle in radians"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/math/atan2">math:atan2()</a> in namespace
          <code>http://www.w3.org/2005/xpath-functions/math</code>.</p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p> Returns the angle in radians subtended at the origin by the point on a plane with
          coordinates (x, y) and the positive x-axis, the result being in the range -<code>π</code>
          to +<code>π</code>. (Note the order of arguments <i>(y, x)</i>. There are some maths
          libraries that implement an <code>atan2</code> function with the arguments in the order
            <i>(x, y)</i>.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">constant</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="name" type="xs:string" desc="The constant required"/>
          <arg name="precision" type="xs:integer" desc="The required precision"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The implementation starts with a decimal string representation of the constant, truncates
          this to the required precision, then parses the result as a double.</p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Delivers the value of one of the named constants <code>PI</code>, <code>E</code>,
            <code>SQRRT2</code>, <code>LN2</code>, <code>LN10</code>, <code>LOG2E</code>,
            <code>SQRT1_2</code>.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">cos</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="θ" type="xs:double" desc="The supplied angle in radians"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/math/cos">math:cos()</a> in namespace <code>http://www.w3.org/2005/xpath-functions/math</code>.
        </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the cosine of the argument, expressed in radians.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">exp</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="arg" type="xs:double" desc="The input number"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/math/exp">math:exp()</a> in namespace <code>http://www.w3.org/2005/xpath-functions/math</code>.
        </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns <code>e</code> to the power of <code>$arg</code>.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">highest</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="node-set" type="item()*" desc="The input numbers"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the nodes in the node set whose value is the maximum value for the node set.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">log</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="arg" type="xs:double" desc="The input number"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/math/log">math:log()</a> in namespace <code>http://www.w3.org/2005/xpath-functions/math</code>.
        </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the natural logarithm of <code>$arg</code>. </p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">lowest</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="node-set" type="item()*" desc="The input numbers"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status-ok/>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the nodes in the node set whose value is the minimum value for the node set.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">max</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="arg" type="xs:anyAtomicType*" desc="The input sequence"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/fn/max">fn:max()</a>. </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the highest value in a sequence of comparable items.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">min</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="arg" type="xs:anyAtomicType*" desc="The input sequence"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/fn/min">fn:min()</a>. </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the lowest value in a sequence of comparable items.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">power</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="arg1" type="xs:double" desc="The input number"/>
          <arg name="arg2" type="numeric" desc="The power to which the number is to be raised"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The function <code>math:power()</code> has been extended from the EXSLT definition to
          handle numeric data types other than <code>xs:double</code>. The result will now be an
            <code>xs:integer</code> if the first argument is an <code>xs:integer</code> and the
          second argument is a non-negative <code>xs:integer</code>. Otherwise, the result will be
          an <code>xs:decimal</code> if the first argument is an <code>xs:decimal</code> or
            <code>xs:integer</code>, and the second argument is a whole number (a number of any data
          type that is equal to some integer). In other cases the arguments are converted to
            <code>xs:double</code> and the result is an <code>xs:double</code>. Saxon also
          implements the function <a class="bodylink code" href="/functions/math/pow">math:pow()</a>
          in namespace <code>http://www.w3.org/2005/xpath-functions/math</code>.</p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns <code>$arg1</code> raised to the power of <code>$arg2</code>.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">random</name>
      <signatures>
        <proto return-type="xs:number">
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The function is implemented, but it doesn't work well: since it is not a pure function,
          Saxon sometimes optimizes it so that successive calls all return the same value. The <a class="bodylink code" href="/functions/exslt-random/random-sequence">random:random-sequence()</a> function is preferable.</p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns a random number from 0 to 1.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">sin</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="θ" type="xs:double"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/math/sin">math:sin()</a> in namespace <code>http://www.w3.org/2005/xpath-functions/math</code>.
        </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the sine of the argument, expressed in radians.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">sqrt</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="arg" type="xs:double"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/math/sqrt">math:sqrt()</a> in namespace <code>http://www.w3.org/2005/xpath-functions/math</code>.
        </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the non-negative square root of the argument.</p>
      </description>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/math">tan</name>
      <signatures>
        <proto return-type="xs:double">
          <arg name="θ" type="xs:double" desc="The supplied angle in radians"/>
          <in-spec>exslt-math</in-spec>
        </proto>
      </signatures>
      <status>
        <p>Saxon also implements the function <a class="bodylink code" href="/functions/math/tan">math:tan()</a> in namespace <code>http://www.w3.org/2005/xpath-functions/math</code>.
        </p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Returns the tangent of the argument, expressed in radians.</p>
      </description>
    </function>

  </section>
  <section id="exslt-random" title="Namespace exslt-random">
    <h1>Namespace exslt-random</h1>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/random">random-sequence</name>
      <signatures>
        <proto return-type="xs:double*">
          <arg name="count" type="xs:integer" desc="The number of items required"/>
          <arg name="seed" type="xs:double" desc="Random number seed"/>
          <in-spec>exslt-random</in-spec>
        </proto>
      </signatures>
      <status>
        <p>The implementation is deterministic: if called twice with the same seed, it will deliver
          the same sequence. This property can be useful or a nuisance; if you want a different
          sequence each time, use something like <code>seconds-from-dateTime()</code> as a seed. The
          numbers are computed on demand, so there is no harm in setting the first argument to a
          very high number. It can be useful to use the function in conjunction with
            <code>xsl:iterate</code>, since this allows early exit.</p>
        <p>Saxon also offers the EXSLT <a class="bodylink code" href="/functions/exslt-math/random">math:random()</a> function to compute a single random number, but this is not very
          useful because it will often be optimized out of a loop, resulting in the same number
          being chosen each time.</p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <description>
        <p>Delivers a sequence of random numbers between zero and one.</p>
      </description>
    </function>

  </section>
  <section id="exslt-sets" title="Namespace exslt-sets">
    <h1>Namespace exslt-sets</h1>
    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/sets">difference</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="nodes1" type="item()*" desc="First node set"/>
          <arg name="nodes2" type="item()*" desc="Second node set"/>
          <in-spec>exslt-sets</in-spec>
        </proto>
      </signatures>
      <description>
        <p>Returns the difference between two node sets - those nodes that are in the node set
          passed as the first argument that are not in the node set passed as the second
          argument.</p>
      </description>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/sets">distinct</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="node-set" type="item()*" desc="The node set"/>
          <in-spec>exslt-sets</in-spec>
        </proto>
      </signatures>
      <description>
        <p>Returns a subset of the nodes contained in the node-set. Specifically, it selects a node
          N if there is no node in the node-set that has the same string value as N, and that
          precedes N in document order.</p>
      </description>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
      <see-also name="distinct-values" namespace="http://www.w3.org/2005/xpath-functions"/>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/sets">has-same-node</name>
      <signatures>
        <proto return-type="boolean">
          <arg name="nodes1" type="item()*" desc="First node set"/>
          <arg name="nodes2" type="item()*" desc="Second node set"/>
          <in-spec>exslt-sets</in-spec>
        </proto>
      </signatures>
      <description>
        <p>Returns true if the node set passed as the first argument shares any nodes with the node
          set passed as the second argument. If there are no nodes that are in both node sets, then
          it returns false. </p>
      </description>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/sets">intersection</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="nodes1" type="item()*" desc="First node set"/>
          <arg name="nodes2" type="item()*" desc="Second node set"/>
          <in-spec>exslt-sets</in-spec>
        </proto>
      </signatures>
      <description>
        <p>Returns a node set comprising the nodes that are within both the node sets passed as
          arguments to it. </p>
      </description>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/sets">leading</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="nodes1" type="item()*" desc="First node set, in document order"/>
          <arg name="nodes2" type="item()*" desc="Second node set, in document order"/>
          <in-spec>exslt-sets</in-spec>
        </proto>
      </signatures>
      <description>
        <p>Returns the nodes in the node set passed as the first argument that precede, in document
          order, the first node in the node set passed as the second argument. If the second node
          set is empty, then the first node set is returned. </p>
      </description>
      <status>
        <p>Saxon does not implement the EXSLT rule "If the first node in the second node set is not
          contained in the first node set, then an empty node set is returned." This rule prevents a
          pipelined implementation. Saxon returns all nodes that precede the first node of the
          second node-set in document order, whether or not the two node-sets intersect.</p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
    </function>

    <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://exslt.org/sets">trailing</name>
      <signatures>
        <proto return-type="item()*">
          <arg name="nodes1" type="item()*" desc="First node set, in document order"/>
          <arg name="nodes2" type="item()*" desc="Second node set, in document order"/>
          <in-spec>exslt-sets</in-spec>
        </proto>
      </signatures>
      <description>
        <p>Returns the nodes in the node set passed as the first argument that follow, in document
          order, the first node in the node set passed as the second argument. If the second node
          set is empty, then the first node set is returned. </p>
      </description>
      <status>
        <p>Saxon does not implement the EXSLT rule "If the first node in the second node set is not
          contained in the first node set, then an empty node set is returned." This rule prevents a
          pipelined implementation. Saxon returns all nodes that follow the first node of the second
          node-set in document order, whether or not the two node-sets intersect.</p>
      </status>
      <saxon-edition platform="J C">PE/EE</saxon-edition>
    </function>

  </section>

  <section id="expath-archive" title="Namespace expath-archive" xml:base="functions/EXPath/functions-archive.xml"><h1>Namespace expath-archive</h1><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">create</name><signatures>
      <proto return-type="xs:base64Binary"><arg name="entries" type="xs:string*" desc="The names of the entries required"/><arg name="new" type="xs:base64Binary*" desc="Sequence of binary data for the required entries"/><in-spec>expath-archive</in-spec></proto>
      <proto return-type="xs:base64Binary"><arg name="entries" type="xs:string*" desc="The names of the entries required"/><arg name="new" type="xs:base64Binary*" desc="Sequence of binary data for the required entries"/><arg name="options" type="element(arch:options)" desc="Options for the created archive"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns a new archive with each of the given entries in <code>$entries</code> set to the
        corresponding values in the sequence <code>$new</code>.</p></description><status>
      <p xmlns="">Only the two argument form is implemented. The specification is not finalised regarding
        using element and attribute options to control archive manipulation. If you are using XPath
        3.0+, then we suggest using the map-based equivalent function <a class="bodylink" href="../create-map">arch:create-map()</a>, which is much more likely to be stable.</p>
    </status><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">create-map</name><signatures>
      <proto return-type="xs:base64Binary"><arg name="entries" type="map(xs:string,map(xs:string,item()*))" desc="The names of the entries required"/><in-spec>expath-archive</in-spec></proto>
      <proto return-type="xs:base64Binary"><arg name="entries" type="map(xs:string,map(xs:string,item()*))" desc="The names of the entries required"/><arg name="options" type="map(xs:string,item()*)" desc="Options for the created archive"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns a new archive with each of the given entries named as a key in
          <code>$entries</code> set to the corresponding value in
          <code>$entries($key)('content')</code>.</p></description><status>
      <p xmlns="">Both signatures are supported since 9.8.0.5.</p>
      <p xmlns="">The entries are keyed by the (string) 'pathname' e.g. <code>mimetype</code> or
          <code>net/sf/saxon/licence.xml</code>. Each entry is a map
          (<code>map(xs:string,item()?)</code>) with the following key/value pairs:</p>
      <table xmlns="">
        <thead>
          <th>Key</th>
          <th/>
          <th>Type</th>
          <th>Values</th>
          <th>Meaning</th>
        </thead>
        <tbody>
          <tr>
            <td>content</td>
            <td>required</td>
            <td>xs:base64Binary</td>
            <td/>
            <td>The actual content of the entry</td>
          </tr>
          <tr>
            <td>compression</td>
            <td>optional</td>
            <td>xs:string</td>
            <td><code>stored</code>|<code>deflate</code></td>
            <td>The compression method to use for this entry with two possible
                    values:<dl><dt><code>stored</code></dt><dd>No compression (used for example with
                  the <em>mimetype</em> entry in an
                  EPUB3)</dd><dt><code>deflate</code></dt><dd>normal lossless zip
                compression</dd></dl>The default is <code>deflate</code>.</td>
          </tr>
          <tr>
            <td>position</td>
            <td>optional</td>
            <td>xs:integer</td>
            <td>
              <code>1</code>
            </td>
            <td>This entry must be placed <em>first</em> in the archive. This enables for example
              the <em>mimetype</em> entry in EPUB3 to be placed as required, as the first within the
              archive. It is an error if more than one entry makes such a declaration.</td>
          </tr>
        </tbody>
      </table>
      <p xmlns="">In the two-argument form <code>$options</code> provides a default set of options for each
        entry - currently the only meaningful key is <code>compression</code> with values as given
        above. </p>
    </status><xpath>3.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">delete</name><signatures>
      <proto return-type="xs:base64Binary"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="xs:string*" desc="The names of the entries required"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns an archive with the given entries deleted.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">delete-map</name><signatures>
      <proto return-type="xs:base64Binary"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="map(xs:string,item()*)" desc="The names of the entries required"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns an archive with the given entries deleted.</p></description><xpath>3.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">entries</name><signatures>
      <proto return-type="element(arch:entry)*"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns the set of entry descriptors for all the entries found within the archive. </p></description><status>
      <p xmlns="">The specification is not finalised regarding using element and attribute options to control
        archive manipulation. If you are using XPath 3.0+, then we suggest using the map-based
        equivalent function <a class="bodylink" href="../entries-map">arch:entries-map()</a>, which
        is much more likely to be stable.</p>
    </status><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">entries-map</name><signatures>
      <proto return-type="map(xs:string,map(xs:string,item()*))"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><in-spec>expath-archive</in-spec></proto>
      <proto return-type="map(xs:string,map(xs:string,item()*))"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="return-content" type="xs:boolean" desc="Content is returned for the entries when true()"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns the entry descriptors for all the entries found within the archive as a map,
        optionally each with their content.</p></description><xpath>3.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">entry-names</name><signatures>
      <proto return-type="xs:string*"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns the entry names for all the entries found within the archive as a sequence of
        string values in the order in which they appear in the archive.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">extract-binary</name><signatures>
      <proto return-type="xs:base64Binary*"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="xs:string*" desc="The names of the entries required"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns the sequence of requested entries from the archive as binary data.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">extract-binary-map</name><signatures>
      <proto return-type="xs:base64Binary*"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="map(xs:string,item()*)" desc="The names of the entries required"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns the sequence of requested entries from the archive as binary data.</p></description><xpath>3.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">extract-map</name><signatures>
      <proto return-type="map(xs:string,map(xs:string,item()?))"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="map(xs:string,map(xs:string,item()?))" desc="The names of the entries required"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns a copy of <code>$entries</code> with the content entries set to binary or decoded
        string data for the appropriate entry in the archive.</p></description><xpath>3.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">extract-text</name><signatures>
      <proto return-type="xs:string*"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="xs:string*" desc="The names of the entries required"/><in-spec>expath-archive</in-spec></proto>
      <proto return-type="xs:string*"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="xs:string*" desc="The names of the entries required"/><arg name="encoding" type="xs:string" desc="The encoding to use for decoding or encoding text"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns the sequence of requested entries from the archive as strings. If
          <code>$encoding</code> is specified the strings are decoded appropriately, otherwise UTF-8
        encoding is assumed.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">extract-text-map</name><signatures>
      <proto return-type="xs:string*"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="map(xs:string,map(xs:string,item()?))" desc="The names of the entries required"/><in-spec>expath-archive</in-spec></proto>
      <proto return-type="xs:string*"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="map(xs:string,map(xs:string,item()?))" desc="The names of the entries required"/><arg name="encoding" type="xs:string" desc="The encoding to use for decoding or encoding text"/><in-spec>expath-archive</in-spec></proto>

    </signatures><description><p>Returns the sequence of requested entries from the archive as decoded string data.</p></description><status>
      <p xmlns="">Supported encodings are: <code>UTF-8</code>, <code>UTF-16</code>, <code>ISO-8859-1</code>
        and <code>US-ASCII</code>.</p>
    </status><xpath>3.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">options</name><signatures>
      <proto return-type="element(arch:options)*"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns a description of the type and properties of a given archive. </p></description><status>
      <p xmlns="">The specification is not finalised regarding using element and attribute options to control
        archive manipulation. If you are using XPath 3.0+, then we suggest using the map-based
        equivalent function <a class="bodylink" href="../options-map">arch:options-map()</a>, which
        is much more likely to be stable.</p>
    </status><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">options-map</name><signatures>
      <proto return-type="map(xs:string,item()?)"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns a description of the type and properties of a given archive as a map. </p></description><xpath>3.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">update</name><signatures>
      <proto return-type="xs:base64Binary"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="xs:string*" desc="The names of the entries required"/><arg name="new" type="xs:base64Binary*" desc="Sequence of binary data for the required entries"/><in-spec>expath-archive</in-spec></proto>
      <proto return-type="xs:base64Binary"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="xs:string*" desc="The names of the entries required"/><arg name="new" type="xs:base64Binary*" desc="Sequence of binary data for the required entries"/><arg name="last-modified" type="xs:dateTime" desc="The modification date to be written on the entry"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns an archive with each of the given entries in <code>$entries</code> updated to the
        corresponding values in the sequence <code>$new</code>. If an entry is not found, a new
        entry is added to the end of the archive.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/archive">update-map</name><signatures>
      <proto return-type="xs:base64Binary"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="map(xs:string,map(xs:string,item()*))" desc="The names of the entries required"/><in-spec>expath-archive</in-spec></proto>
      <proto return-type="xs:base64Binary"><arg name="archive" type="xs:base64Binary" desc="The archive to be read or altered"/><arg name="entries" type="map(xs:string,map(xs:string,item()*))" desc="The names of the entries required"/><arg name="default.options" type="map(xs:string,item()*)"/><in-spec>expath-archive</in-spec></proto>
    </signatures><description><p>Returns an archive with each of the given entries in the keys of <code>$entries</code>
        updated to the corresponding values in the <code>$entries($key)('content')</code> and with
        other properties defined by <code>$entries($key)(*)</code>. If an entry is not found, a new
        entry is added to the end of the archive.</p></description><xpath>3.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function></section>
  <section id="expath-binary" title="Namespace expath-binary" xml:base="functions/EXPath/functions-binary.xml"><h1>Namespace expath-binary</h1><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">and</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value1" type="(xs:hexBinary | xs:base64Binary)?" desc="Binary data"/><arg name="value2" type="(xs:hexBinary | xs:base64Binary)?" desc="Binary data"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns the bitwise AND of two binary arguments.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">bin</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value" type="xs:string?" desc="The data written as a string sequence of binary digits"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Constructs a binary value from a string of zeroes and ones (<code>[01]*</code>)</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">decode-string</name><signatures>
            <proto return-type="xs:string?"><arg name="value" type="(xs:hexBinary | xs:base64Binary)?" desc="Input binary data"/><arg name="encoding" type="xs:string?" default="()" desc="The encoding type to be used"/><arg name="offset" type="xs:integer?" default="()" desc="Offset in octets into the input data"/><arg name="size" type="xs:integer?" default="()" desc="Size in octets to operate over"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Decodes a binary value as a string.</p></description><status>
      <p xmlns="">Supported encodings are: <code>UTF-8</code>, <code>UTF-16</code>,
        <code>ISO-8859-1</code> and <code>US-ASCII</code>.</p>
    </status><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">encode-string</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value" type="xs:string?" desc="Input binary data"/><arg name="encoding" type="xs:string?" default="'UTF-8'" desc="The encoding type to be used"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Encodes a string into a binary value using a given encoding.</p></description><status>
      <p xmlns="">Supported encodings are: <code>UTF-8</code>, <code>UTF-16</code>,
        <code>ISO-8859-1</code> and <code>US-ASCII</code>.</p>
    </status><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">find</name><signatures>
            <proto return-type="xs:integer?"><arg name="value" type="(xs:hexBinary | xs:base64Binary)?" desc="Binary data to be searched"/><arg name="offset" type="xs:integer" desc="Offset in octets to start searching from"/><arg name="search" type="(xs:hexBinary | xs:base64Binary)" desc="Binary data to be searched for"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns the position of the first occurrence of <code>$search</code> within
                <code>$value</code>, starting at <code>$offset</code>.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">from-octets</name><signatures>
            <proto return-type="xs:base64Binary"><arg name="values" type="xs:unsignedByte*" desc="The data written as a sequence of per-octet numbers"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Converts a sequence of octets into binary data.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">hex</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value" type="xs:string?" desc="The data written as a string sequence of hexadecimal digits"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Constructs a binary value from a string of hexadecimal digits (<code>[0-9A-Fa-f]*</code>).</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4"><name namespace="http://expath.org/ns/binary">infer-encoding</name><signatures>
            <proto return-type="record(encoding as xs:string, offset as xs:integer)"><arg name="value" type="(xs:hexBinary | xs:base64Binary)" desc="Input binary data"/><arg name="encoding" type="xs:string?" default="()" desc="The encoding type to be used"/><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Examines a binary value that encodes a string, to determine the encoding and the start offset of the content.</p></description><xpath>4.0</xpath><saxon-edition>13 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">insert-before</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value" type="(xs:hexBinary | xs:base64Binary)?" desc="Input binary data"/><arg name="offset" type="xs:integer" desc="Offset in octets into the input data"/><arg name="extra" type="(xs:hexBinary | xs:base64Binary)?" desc="Binary data to be added"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Inserts octets at a given point in a binary value.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">join</name><signatures>
            <proto return-type="xs:base64Binary"><arg name="values" type="(xs:hexBinary | xs:base64Binary)*" desc="The sequence of binary data items to be joined"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Concatenates a sequence of binary values in order.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">length</name><signatures>
            <proto return-type="xs:integer"><arg name="value" type="(xs:hexBinary | xs:base64Binary)" desc="Input binary data"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns the size of a binary value, measured in octets.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">not</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value" type="(xs:hexBinary | xs:base64Binary)?" desc="Input binary data"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns the "bitwise not" of a binary argument.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">octal</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value" type="xs:string?" desc="The data written as a string sequence of octal digits"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Constructs a binary value from a string of octal digits (<code>[0-7]*</code>)</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">or</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value1" type="(xs:hexBinary | xs:base64Binary)?" desc="Binary data"/><arg name="value2" type="(xs:hexBinary | xs:base64Binary)?" desc="Binary data"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns the bitwise OR of two binary values.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">pack-double</name><signatures>
            <proto return-type="xs:base64Binary"><arg name="value" type="xs:double" desc="The value to pack"/><arg name="order" type="enum('least-significant-first', 'little-endian', 'LE',                     'most-significant-first', 'big-endian', 'BE')?" default="'most-significant-first'" desc="The order (most/least significant first) in which to pack or unpack&#xA;        octets"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns the 8-octet binary representation of an <code>xs:double</code> value.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">pack-float</name><signatures>
            <proto return-type="xs:base64Binary"><arg name="value" type="xs:float" desc="The value to pack"/><arg name="order" type="xs:enum('least-significant-first', 'little-endian', 'LE',                     'most-significant-first', 'big-endian', 'BE')?" default="'most-significant-first'" desc="The order (most/least significant first) in which to pack or unpack&#xA;        octets"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns the 4-octet binary representation of a float value.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">pack-integer</name><signatures>
            <proto return-type="xs:base64Binary"><arg name="value" type="xs:integer" desc="The value to pack"/><arg name="size" type="xs:integer" desc="The octet length to pack within"/><arg name="order" type="enum('least-significant-first', 'little-endian', 'LE',                     'most-significant-first', 'big-endian', 'BE')?" default="'most-significant-first'" desc="The order (most/least significant first) in which to pack or unpack&#xA;        octets"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns the <emph>twos-complement</emph> binary representation of an integer value
                as a binary value of a given size.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">pad-left</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value" type="(xs:hexBinary | xs:base64Binary)?" desc="Input binary data"/><arg name="count" type="xs:integer" desc="The number of octets to pad"/><arg name="octet" type="xs:unsigned-byte?" default="0" desc="Octet value to use in the padding"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns a binary value created by padding <code>$value</code> on the left with <code>$count</code>
                occurrences of <code>$octet</code>.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">pad-right</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value" type="(xs:hexBinary | xs:base64Binary)?" desc="Input binary data"/><arg name="count" type="xs:integer" desc="The number of octets to pad"/><arg name="octet" type="xs:unsignedByte?" default="0" desc="Octet value to use in the padding"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns a binary value created by padding <code>$value</code> on the 
                right with <code>$count</code> occurrences of <code>$octet</code>.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">part</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value" type="(xs:hexBinary | xs:base64Binary)?" desc="Input binary data"/><arg name="offset" type="xs:integer" desc="Offset in octets into the input data"/><arg name="size" type="xs:integer?" default="()" desc="Size in octets to operate over"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Selects a specified range of octets from a binary value.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">shift</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value" type="(xs:hexBinary | xs:base64Binary)?" desc="Input binary data"/><arg name="by" type="xs:integer" desc="The number of bit positions to shift left or right"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Shift the bits of a binary value left or right.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">to-octets</name><signatures>
            <proto return-type="xs:unsignedByte*"><arg name="value" type="(xs:hexBinary | xs:base64Binary)" desc="Input binary data"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns binary data as a sequence of integer octets.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">unpack-double</name><signatures>
            <proto return-type="xs:double"><arg name="value" type="(xs:hexBinary | xs:base64Binary)" desc="Input binary data"/><arg name="offset" type="xs:integer" desc="Offset in octets into the input data"/><arg name="order" type="enum('least-significant-first', 'little-endian', 'LE',                     'most-significant-first', 'big-endian', 'BE')?" default="'most-significant-first'" desc="The order (most/least significant first) in which to pack or unpack&#xA;        octets"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Extracts an <code>xs:double</code> value
                held in IEEE format at the given offset in a binary value.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">unpack-float</name><signatures>
            <proto return-type="xs:float"><arg name="value" type="(xs:hexBinary | xs:base64Binary)" desc="Input binary data"/><arg name="offset" type="xs:integer" desc="Offset in octets into the input data"/><arg name="order" type="enum('least-significant-first', 'little-endian', 'LE',                     'most-significant-first', 'big-endian', 'BE')?" default="'most-significant-first'" desc="The order (most/least significant first) in which to pack or unpack&#xA;        octets"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Extract float value stored
                at the particular offset in binary data.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">unpack-integer</name><signatures>
            <proto return-type="xs:integer"><arg name="value" type="(xs:hexBinary | xs:base64Binary)" desc="Input binary data"/><arg name="offset" type="xs:integer" desc="Offset in octets into the input data"/><arg name="size" type="xs:integer" desc="The number of octets to unpack"/><arg name="order" type="enum('least-significant-first', 'little-endian', 'LE',                     'most-significant-first', 'big-endian', 'BE')?" default="'most-significant-first'" desc="The order (most/least significant first) in which to pack or unpack&#xA;        octets"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns a signed integer value represented by the <code>$size</code> octets starting
                from <code>$offset</code> in the input binary value.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">unpack-unsigned-integer</name><signatures>
            <proto return-type="xs:integer"><arg name="value" type="(xs:hexBinary | xs:base64Binary)" desc="Input binary data"/><arg name="offset" type="xs:integer" desc="Offset in octets into the input data"/><arg name="size" type="xs:integer" desc="The number of octets to unpack"/><arg name="order" type="enum('least-significant-first', 'little-endian', 'LE',                     'most-significant-first', 'big-endian', 'BE')?" default="'most-significant-first'" desc="The order (most/least significant first) in which to pack or unpack&#xA;        octets"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns an unsigned integer value represented by the <code>$size</code> octets
                starting from <code>$offset</code> in the input binary representation.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/binary">xor</name><signatures>
            <proto return-type="xs:base64Binary?"><arg name="value1" type="(xs:hexBinary | xs:base64Binary)?" desc="Binary data"/><arg name="value2" type="(xs:hexBinary | xs:base64Binary)?" desc="Binary data"/><in-spec>expath-binary10</in-spec><in-spec>expath-binary40</in-spec></proto>
        </signatures><description><p>Returns the bitwise exclusive-OR of two binary arguments.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function></section>
  <section id="expath-file" title="Namespace expath-file" xml:base="functions/EXPath/functions-file.xml"><h1>Namespace expath-file</h1><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">append</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="file" desc="Path to file"/><arg type="item()*" name="value" desc="Sequence of items to be written"/><arg type="(element(output:serialization-parameters) | map(*))?" default="()" name="options" desc="Control parameters for serialization - semantics similar to fn:serialize()"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Appends a serialized value to a file.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">append-binary</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="file" desc="Path to file"/><arg type="xs:base64Binary" name="value" desc="Base64 binary value to be written"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Appends binary data to a file.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">append-text</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="file" desc="Path to file"/><arg type="xs:string" name="value" desc="String value to be written"/><arg type="xs:string?" default="'UTF-8'" name="encoding" desc="Encoding used for string-binary conversion"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Appends a string to a file.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">append-text-lines</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="file" desc="Path to file"/><arg type="xs:string*" name="lines" desc="Strings to be written"/><arg type="xs:string?" default="'UTF-8'" name="encoding" desc="Encoding used for string-binary conversion"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Appends a sequence of strings to a file, each followed by the operating-system specific
        newline character.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">base-dir</name><signatures>
      <proto return-type="xs:string?"><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the base directory.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">children</name><signatures>
      <proto return-type="xs:string*"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the paths of all files and directories that are located in the given
        directory.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">copy</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="source" desc="The path to the source file/directory"/><arg type="xs:string" name="target" desc="The path to the target file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Copies a file or a directory.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">create-dir</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="dir" desc="Path to the directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Creates a directory.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">create-temp-dir</name><signatures>
      <proto return-type="xs:string"><arg type="xs:string?" default="()" name="prefix" desc="Prefix to be used for the start of a temporary file name"/><arg type="xs:string?" default="()" name="suffix" desc="Suffix to be used for the end of a temporary file name - conventionally of a '.ext'&#xA;        extension form, but need not be"/><arg type="xs:string?" default="()" name="dir" desc="Path to the directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Creates a temporary directory.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">create-temp-file</name><signatures>
      <proto return-type="xs:string"><arg type="xs:string?" default="()" name="prefix" desc="Prefix to be used for the start of a temporary file name"/><arg type="xs:string?" default="()" name="suffix" desc="Suffix to be used for the end of a temporary file name - conventionally of a '.ext'&#xA;        extension form, but need not be"/><arg type="xs:string?" default="()" name="dir" desc="Path to the directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Creates a temporary file.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">current-dir</name><signatures>
      <proto return-type="xs:string"><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the current working directory.</p></description><status>
      <p xmlns="">The EXPath specification says that the current working directory is implementation-defined. The Saxon implementation
        of <code>file:current-dir()</code> effectively invokes <code>file:resolve-path(".")</code>. The <code>file:resolve-path()</code>
        function relies on Java's <code>File.getAbsolutePath()</code>. On Unix systems, this resolves the file name against the
        current directory (as defined by the system property <code>user.dir</code>). On Windows, it is possible for a relative file
        name to include a drive letter, and for each drive to have a different current directory: this affects the handling of
        relative file names in <code>file:resolve-path()</code> and in other functions (such as <code>file:exists()</code>),
        but it is not reflected in the result of <code>file:current-dir()</code>.</p>
      <p xmlns="">For convenience in testing, Saxon recognizes the Java system property <code>expath.base.directory</code> and uses
        this as the current directory if the property exists. Applications should not rely on this feature.
      If the Java system property <code>expath.base.directory</code> is not set, the standard
      system property <code>user.dir</code> is used.</p>
    </status><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">delete</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="path" desc="Path to file/directory"/><arg type="xs:boolean?" default="false()" name="recursive" desc="Determines whether the operation should recurse down though the filesystem tree"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Deletes a file or a directory.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4"><name namespace="http://expath.org/ns/file">descendants</name><signatures>
      <proto return-type="xs:string*"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the paths of all files and directories that are located in the given
        directory and its subdirectories.</p></description><status>
      <p xmlns="">New in EXPath File Module 4.0. Not yet implemented in Saxon.</p>
    </status><xpath>4.0</xpath><saxon-edition platform="NONE">NOT_IMPLEMENTED</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">dir-separator</name><signatures>
      <proto return-type="xs:string"><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the directory separator.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">exists</name><signatures>
      <proto return-type="xs:boolean"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Tests if a file or directory exists.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4"><name namespace="http://expath.org/ns/file">is-absolute</name><signatures>
      <proto return-type="xs:boolean"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Tests if <code>$path</code> is absolute.</p></description><status>
      <p xmlns="">New in EXPath File Module 4.0. Not yet implemented in Saxon.</p>
    </status><xpath>4.0</xpath><saxon-edition platform="NONE">NOT_IMPLEMENTED</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">is-dir</name><signatures>
      <proto return-type="xs:boolean"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Tests if <code>$path</code> points to a directory.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">is-file</name><signatures>
      <proto return-type="xs:boolean"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Tests if <code>$path</code> points to a regular file.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">last-modified</name><signatures>
      <proto return-type="xs:dateTime"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the last modification time of a file or directory.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">line-separator</name><signatures>
      <proto return-type="xs:string"><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the line separator.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">list</name><signatures>
      <proto return-type="xs:string*"><arg type="xs:string" name="dir" desc="Path to the directory"/><arg type="xs:boolean?" default="false()" name="recursive" desc="Determines whether the operation should recurse down though the filesystem tree"/><arg type="xs:string?" default="()" name="pattern" desc="A glob pattern to match/filter file names"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Lists all files and directories in a given directory.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions" class="qt4"><name namespace="http://expath.org/ns/file">list-roots</name><signatures>
      <proto return-type="xs:string*"><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Lists all root directories of the file system.</p></description><status>
      <p xmlns="">New in EXPath File Module 4.0. Not yet implemented in Saxon.</p>
    </status><xpath>4.0</xpath><saxon-edition platform="NONE">NOT_IMPLEMENTED</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">move</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="source" desc="The path to the source file/directory"/><arg type="xs:string" name="target" desc="The path to the target file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Moves a file or a directory.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">name</name><signatures>
      <proto return-type="xs:string"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the name of a file or directory.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">parent</name><signatures>
      <proto return-type="xs:string?"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the path to the parent directory of a given path.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">path-separator</name><signatures>
      <proto return-type="xs:string"><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the path separator.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">path-to-native</name><signatures>
      <proto return-type="xs:string"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Transforms a path to a canonical representation.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">path-to-uri</name><signatures>
      <proto return-type="xs:anyURI"><arg type="xs:string" name="path" desc="Path to file/directory"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Transforms a file system path into a URI.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">read-binary</name><signatures>
      <proto return-type="xs:base64Binary"><arg type="xs:string" name="file" desc="Path to file"/><arg type="xs:integer?" default="0" name="offset" desc="Byte offset into the file for reading or writing"/><arg type="xs:integer?" default="()" name="length" desc="Byte length of data to be returned"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the binary content of a file.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">read-text</name><signatures>
      <proto return-type="xs:string"><arg type="xs:string" name="file" desc="Path to file"/><arg name="options" type="(xs:string | map(*))?" default="()" desc="Options for reading the file. In EXPath 1.0, the argument is a string, providing&#xA;        the encoding to be used for string-binary conversion. From Saxon 13.0, in EXPath 4.0 a&#xA;        map can be provided."/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the content of a file as a string.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">read-text-lines</name><signatures>
      <proto return-type="xs:string*"><arg type="xs:string" name="file" desc="Path to file"/><arg name="options" type="(xs:string | map(*))?" default="()" desc="Options for reading the file. In EXPath 1.0, the argument is a string, providing&#xA;        the encoding to be used for string-binary conversion. From Saxon 13.0, in EXPath 4.0 a&#xA;        map can be provided."/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the contents of a file as a sequence of strings, separated at newline
        boundaries.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">resolve-path</name><signatures>
      <proto return-type="xs:string"><arg type="xs:string" name="path" desc="Path to file/directory"/><arg type="xs:string?" name="base" default="()" desc="Base path. (New in EXPath 4.0. Not yet implemented in Saxon.)"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Transforms a relative path into an absolute operating system path.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">size</name><signatures>
      <proto return-type="xs:integer"><arg type="xs:string" name="path" desc="Path to file/directory"/><arg type="xs:boolean?" default="false()" name="recursive" desc="Determines whether the operation should recurse down though the filesystem&#xA;        tree. (New in EXPath 4.0. Not yet implemented in Saxon.)"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the size of a file or directory.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">temp-dir</name><signatures>
      <proto return-type="xs:string"><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Returns the path to the temporary-file directory.</p></description><xpath>2.0</xpath><saxon-edition>9.6 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">write</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="file" desc="Path to file"/><arg type="item()*" name="value" desc="Sequence of items to be written"/><arg type="(element(output:serialization-parameters) | map(*))?" default="()" name="options" desc="Control parameters for serialization - semantics similar to fn:serialize()"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Writes a serialized value to a file.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">write-binary</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="file" desc="Path to file"/><arg type="xs:base64Binary" name="value" desc="Base64 binary value to be written"/><arg type="xs:integer?" default="0" name="offset" desc="Byte offset into the file for reading or writing"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Writes binary data to a file.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">write-text</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="file" desc="Path to file"/><arg type="xs:string" name="value" desc="String value to be written"/><arg type="xs:string?" default="'UTF-8'" name="encoding" desc="Encoding used for string-binary conversion"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Writes a string to a file.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function><function xmlns="http://www.saxonica.com/ns/doc/functions"><name namespace="http://expath.org/ns/file">write-text-lines</name><signatures>
      <proto return-type="empty-sequence()"><arg type="xs:string" name="file" desc="Path to file"/><arg type="xs:string*" name="values" desc="Strings to be written"/><arg type="xs:string?" default="'UTF-8'" name="encoding" desc="Encoding used for string-binary conversion"/><in-spec>expath-file10</in-spec><in-spec>expath-file40</in-spec></proto>
    </signatures><description><p>Writes strings to a file.</p></description><xpath>2.0</xpath><saxon-edition>9.5 PE/EE</saxon-edition></function></section>
  <section xmlns:doc="http://www.saxonica.com/ns/doc" id="sql" title="Namespace sql" xml:base="functions/sql-functions.xml">
   <h1>Namespace sql</h1>
   <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/sql">connect</name>
      <signatures>
         <proto return-type="javatype:java.sql.Connection">
            <arg name="options" type="map(*)" desc="Database connection parameters"/>
         </proto>
      </signatures>
      <description>
         <p>Returns an external object representing a connection to a SQL database. This object is used as the first
         argument of other functions such as <code>sql:query</code>, <code>sql:insert</code>, etc.</p>
      </description>
      <status>
         <p>Introduced in Saxon 9.9. Designed to supersede the extension instruction <a class="bodylink code" href="/sql-extension/instructions/connect">sql:connect</a>. The <code>saxon-sql-13.#.jar</code> file,
            distributed alongside the main JAR file, must be added to the classpath when these SQL extension functions
            are used. Changed in 10.5 to allow the JDBC driver name to be omitted, and to allow a DataSource
            name to be provided.</p>
      </status>
      <xpath>3.1</xpath>
      <saxon-edition platform="J">9.9 PE/EE</saxon-edition>
      <details>
         <p>Returns an external object representing a connection to a SQL database. This object is used as the first
            argument of other functions such as <code>sql:query</code>, <code>sql:insert</code>, etc.</p>
         <p>The argument is a map, which follows the option parameter conventions. The defined
            options are:</p>
         <table>
            <thead>
               <tr>
                  <th>Keyword</th>
                  <th>Type</th>
                  <th>Value</th>
               </tr>
            </thead>
            <tbody>
               <tr>
                  <td>driver</td>
                  <td><code>xs:string</code></td>
                  <td>The Java class name of the JDBC driver to be used, for example <code>sun.jdbc.odbc.JdbcOdbcDriver</code>.
                  No longer needed (and ignored if specified) from Saxon 10.5.</td>
               </tr>
               <tr>
                  <td>dataSource</td>
                  <td><code>xs:string</code></td>
                  <td>The name of a registered DataSource known to the Java naming service. If supplied, the database
                     URL is ignored. NOTE: since the use of a DataSource typically depends on an execution framework
                  such as an application server, Saxonica has performed only very limited testing of this feature,
                  and user feedback about its functioning in different application environments is welcomed.</td>
               </tr>
               <tr>
                  <td>database</td>
                  <td><code>xs:string</code></td>
                  <td>The name (URL) of the database: naming conventions depend on the driver in use. An example
                     for the Derby database might be <code>jdbc:derby:jar:webdb</code>. For MySQL, it might
                     be <code>jdbc:mysql://localhost:3306/test?user=root&amp;password=secret</code></td>
               </tr>
               <tr>
                  <td>user</td>
                  <td><code>xs:string</code></td>
                  <td>Username to be used for authentication. Not needed if included in the database URL.</td>
               </tr>
               <tr>
                  <td>password</td>
                  <td><code>xs:string</code></td>
                  <td>Password to be used for authentication. Not needed if included in the database URL.</td>
               </tr>
               <tr>
                  <td>autoCommit</td>
                  <td><code>xs:boolean</code></td>
                  <td>Sets or unsets the auto-commit option on the connection that is established</td>
               </tr>
            </tbody>
         </table>
         <p>For example:</p>
         
         <pre><code class="language-xml">&lt;xsl:variable name="connection" select="sql:connect(map{
        'database':'jdbc:mysql://localhost/saxontest',
        'driver':'com.mysql.jdbc.Driver',
        'user':'dbadmin',
        'password':$password,
        'autoCommit':true()})"/&gt;
</code></pre>
         <p>It will often be appropriate to bind the result of the call to a global variable.</p>
         <p>A dynamic error is thrown in the event of any connection failure. Improved diagnostics on the reason
            for failure are output if the configuration option <a class="bodylink" href="/configuration/config-features#TIMING">TIMING</a> is set (<code>-t</code>
            on the command line).</p>
         <p>The connection object acts as a map and it is possible to call methods as dynamic function calls using the entries
            in this map. For example <code>$connection?isClosed()</code> will return a boolean indicating whether
            the connection has been closed.</p>
         <p>For actions that have side-effects, it is recommended to invoke them using the <a class="bodylink code" href="/extensions/instructions/do">saxon:do</a> extension instruction: for example to close the connection use the
            instruction:</p>
         
         <pre><code class="language-xml">&lt;saxon:do action="$connection?close()"/&gt;</code></pre>        
         
         <p>JDBC connections are not thread-safe. It is therefore advisable when using JDBC connections to
            suppress Saxon multi-threading by setting the configuration option <a class="bodylink" href="/configuration/config-features#ALLOW_MULTI_THREADING">ALLOW_MULTI_THREADING</a>
            to false. A warning is issued if this is not done.</p>
         
         <p>Note that the Saxon extension functions make no attempt to validate or verify the SQL statements being
         passed through the interface. In particular, there is no attempt to prevent SQL injection attacks: this is
         entirely the application's responsibility.</p>
      </details>
   </function>
   
   <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/sql">delete</name>
      <signatures>
         <proto return-type="item()?">
            <arg name="connection" type="javatype:java.sql.Connection" desc="A JDBC database connection established using sql:connect"/>
            <arg name="table" type="xs:string" desc="The database table from which rows are to be deleted"/>
            <arg name="predicate" type="xs:string" desc="A SQL predicate identifying the rows to be deleted"/>
         </proto>
      </signatures>
      <description>
         <p>Executes a SQL DELETE statement, returning no result.</p>
      </description>
      <status>
         <p>Introduced in Saxon 9.9. Designed to supersede the extension instruction <a class="bodylink code" href="/sql-extension/instructions/delete">sql:delete</a>. The <code>saxon-sql-13.#.jar</code> file,
            distributed alongside the main JAR file, must be added to the classpath when these SQL extension functions
            are used.</p>
      </status>
      <xpath>3.1</xpath>
      <saxon-edition platform="J">9.9 PE/EE</saxon-edition>
      <details>
         <p>The function executes a SQL DELETE statement, and returns no result.</p>
         
         <p>The statement is constructed simply by concatenating the arguments: <code>DELETE {$table} WHERE {$predicate}</code>.</p>
         
         <p>Although the declared return type is <code>item()?</code>, the function always returns an empty
            sequence. The declared return type is designed to prevent the optimizer making unwarranted assumptions.</p>
         
         <p>Because this function is executed for its side-effects, it is recommended to invoke it using
            the <a class="bodylink code" href="/extensions/instructions/do">saxon:do</a> extension instruction.</p>
         
         <p>Example:</p>
         <pre><code class="language-xml">&lt;saxon:do action="sql:delete($connection, 'book', 'price &gt; 20.00')"/&gt;</code></pre>
      </details>
   </function>
   
   <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/sql">execute</name>
      <signatures>
         <proto return-type="item()?">
            <arg name="connection" type="javatype:java.sql.Connection" desc="A JDBC database connection established using sql:connect"/>
            <arg name="statement" type="xs:string" desc="The SQL statement to be executed"/>
         </proto>
      </signatures>
      <description>
         <p>Executes a SQL statement, returning no result.</p>
      </description>
      <status>
         <p>Introduced in Saxon 9.9. Designed to supersede the extension instruction <a class="bodylink code" href="/sql-extension/instructions/execute">sql:execute</a>. The <code>saxon-sql-13.#.jar</code> file,
            distributed alongside the main JAR file, must be added to the classpath when these SQL extension functions
            are used.</p>
      </status>
      <xpath>3.1</xpath>
      <saxon-edition platform="J">9.9 PE/EE</saxon-edition>
      <details>
         <p>The function executes a SQL statement, and returns no result.</p>
         
         <p>If the statement is <code>COMMIT WORK</code> or <code>ROLLBACK WORK</code> (exactly as written)
         then it is intercepted and translated into a call on <code>$connection?commit()</code>
         or <code>$connection?rollback_0()</code>.</p>
         
         <p>Although the declared return type is <code>item()?</code>, the function always returns an empty
         sequence. The declared return type is designed to prevent the optimizer making unwarranted assumptions.</p>
         
         <p>Because this function is executed for its side-effects, it is recommended to invoke it using
            the <a class="bodylink code" href="/extensions/instructions/do">saxon:do</a> extension instruction.</p>
         
         <p>Example:</p>
         <pre><code class="language-xml">&lt;saxon:do action="sql:execute($connection, 'DROP TABLE book')"/&gt;</code></pre>
      </details>
   </function>
   
   <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/sql">insert</name>
      <signatures>
         <proto return-type="item()?">
            <arg name="connection" type="javatype:java.sql.Connection" desc="A JDBC database connection established using sql:connect"/>
            <arg name="table" type="xs:string" desc="The database table from which rows are to be updated"/>
            <arg name="values" type="map(*)" desc="A map holding values for the new row"/>
         </proto>
      </signatures>
      <description>
         <p>Executes a SQL INSERT statement (adding a new row to a table), returning no result.</p>
      </description>
      <status>
         <p>Introduced in Saxon 9.9. Designed to supersede the extension instruction <a class="bodylink code" href="/sql-extension/instructions/insert">sql:insert</a>. The <code>saxon-sql-13.#.jar</code> file,
            distributed alongside the main JAR file, must be added to the classpath when these SQL extension functions
            are used.</p>
      </status>
      <xpath>3.1</xpath>
      <saxon-edition platform="J">9.9 PE/EE</saxon-edition>
      <details>
         <p>The function executes a SQL INSERT statement (adding a new row to a table), and returns no result.</p>
         
         <p>The <code>$table</code> argument names the database table to be updated. 
            New values for selected columns are taken from the <code>$values</code> map.</p>
         
         <p>The entries in the <code>$values</code> map are (name, value) pairs, where the name is a column
            name in the table being updated, and the value is the value for the column. The value should be
            an appropriate data type for the column (for example, <code>xs:string</code> for a <code>VARCHAR</code>
            column, <code>xs:decimal</code> for a <code>DECIMAL</code> column, etc).</p>
         
         <p>Although the declared return type is <code>item()?</code>, the function always returns an empty
            sequence. The declared return type is designed to prevent the optimizer making unwarranted assumptions.</p>
         
         <p>Because this function is executed for its side-effects, it is recommended to invoke it using
            the <a class="bodylink code" href="/extensions/instructions/do">saxon:do</a> extension instruction.</p>
         
         <p>Example:</p>
         <pre><code class="language-xml">&lt;saxon:do action="sql:insert($connection, 'book', 
   map{'title': TITLE,
       'author': AUTHOR,
       'category': $category,
       'price': PRICE,
       'date': current-date()})"/&gt;
</code></pre>
      </details>
   </function>
   
   <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/sql">prepared-statement</name>
      <signatures>
         <proto return-type="function(*)">
            <arg name="connection" type="javatype:java.sql.Connection" desc="A JDBC database connection established using sql:connect"/>
            <arg name="statement" type="xs:string" desc="A SQL statement, typically containing question marks as place-holders for parameters"/>
         </proto>
      </signatures>
      <description>
         <p>Prepares a SQL statement for execution, returning a function which can be called with parameters to execute the statement,
            returning no result.</p>
      </description>
      <xpath>3.1</xpath>
      <saxon-edition platform="J">9.9 PE/EE</saxon-edition>
      <details>
         <p>The function prepares a SQL statement for execution. The statement will typically be one that does not return
            a result, but which uses question marks as place-holders for parameters, for example <code>INSERT INTO EMP
               VALUES (?, ?, ?)</code>. A call on <code>sql:prepared-statement</code> returns a function which can be
            called with parameters to execute the statement.</p>
         <p>The arity of the returned function (the "invocation function") is equal to the number of 
            question-marks appearing in the source statement.</p>
         <p>The invocation function expects the supplied arguments to be atomic items. The data types of the arguments
            should correspond to the types of the values expected by the SQL statement: for example, <code>xs:string</code>
            for a <code>VARCHAR</code> column, <code>xs:decimal</code> for a SQL decimal, and so on.</p>
         <p>The invocation function always returns an empty sequence, though to avoid over-aggressive optimization, it is
            declared as returning <code>item()?</code>. Because the invocation function is called for its side-effects,
            it is recommended to call it in the <code>action</code> expression of a <a class="bodylink code" href="/extensions/instructions/do">saxon:do</a> instruction.</p>
         
         <p>Example:</p>
         <pre><code class="language-xml">&lt;xsl:variable name="add-book" as="function(*)" 
   select="sql:prepared-statement($connection, 
   'INSERT INTO book (isbn, title, author, category) VALUES (?, ?, ?, ?)')"/&gt;        
&lt;xsl:for-each select="//book"&gt;
   &lt;saxon:do action="$add-book(@isbn, @title, @author, @category)"/&gt;
&lt;/xsl:for-each&gt;
</code></pre>
      </details>
   </function>
   
   <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/sql">prepared-query</name>
      <signatures>
         <proto return-type="function(*)">
            <arg name="connection" type="javatype:java.sql.Connection" desc="A JDBC database connection established using sql:connect"/>
            <arg name="query" type="xs:string" desc="A SQL SELECT statement, typically containing question marks as place-holders for parameters"/>
         </proto>
      </signatures>
      <description>
         <p>Prepares a SQL query for execution, returning a function which can be called with parameters to execute the query.</p>
      </description>
      <xpath>3.1</xpath>
      <saxon-edition platform="J">9.9 PE/EE</saxon-edition>
      <details>
         <p>The function prepares a SQL query for execution. The query will typically be a SQL SELECT statement using question marks
            as place-holders for parameters, for example <code>SELECT * FROM EMP WHERE EMP-ID = ?</code>. A call on
            <code>sql:prepared-query</code> returns a function which can be called with parameters to execute the query.</p>
         <p>The arity of the returned function (the "invocation function") is equal to the number of 
            question-marks appearing in the source query.</p>
         <p>The invocation function expects the supplied arguments to be atomic items. The data types of the arguments
            should correspond to the types of the values expected by the SQL query: for example, <code>xs:string</code>
            for a <code>VARCHAR</code> column, <code>xs:decimal</code> for a SQL decimal, and so on.</p>
         <p>The value returned by the invocation function is a sequence of maps. Each row in the query result is
            represented by one map in this sequence. The map represents a row in the result using a string-valued key
            to represent the column name, and an appropriately-typed atomic item to represent the value of the column.
            A SQL <code>NULL</code> value is represented by an empty sequence.</p>
         <p>Note that the result is a sequence rather than an array. It can be converted to an array (for example,
            for serializing in JSON) using the expression <code>array{$result}</code>.</p>
         <p>Example:</p>
         <pre><code class="language-xml">&lt;xsl:variable name="query" as="function(*)" 
   select="sql:prepared-query($connection, 'SELECT date, title FROM book WHERE author = ?')"/&gt;
        
&lt;out&gt;
   &lt;xsl:for-each select="$selected-authors"&gt;
      &lt;xsl:variable name="result" select="$query(.)" as="map(*)*"/&gt;
      &lt;author name="{.}"&gt;
         &lt;xsl:for-each select="$result"&gt;
            &lt;book date="{?date}" title="{?title}"/&gt;
         &lt;/xsl:for-each&gt;   
      &lt;/author&gt;
   &lt;/xsl:for-each&gt;
&lt;/out&gt;
</code></pre>
      </details>
   </function>
   
   <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/sql">query</name>
      <signatures>
         <proto return-type="map(*)*">
            <arg name="connection" type="javatype:java.sql.Connection" desc="A JDBC database connection established using sql:connect"/>
            <arg name="table" type="xs:string" desc="The name of a table in the database"/>
            <arg name="columns" type="xs:string*" desc="A list of required column names, or '*' to select all columns in the table"/>          
         </proto>
         <proto return-type="map(*)*">
            <arg name="connection" type="javatype:java.sql.Connection" desc="A JDBC database connection established using sql:connect"/>
            <arg name="table" type="xs:string" desc="The name of a table in the database"/>
            <arg name="columns" type="xs:string*" desc="A list of required column names, or '*' to select all columns in the table"/>          
            <arg name="predicate" type="xs:string" desc="A SQL expression suitable for inclusion in the WHERE clause"/>
         </proto>
      </signatures>
      <description>
         <p>Executes a SQL query, returning the result as a map.</p>
      </description>
      <status>
         <p>Introduced in Saxon 9.9. Designed to supersede the extension instruction <a class="bodylink code" href="/sql-extension/instructions/query">sql:query</a>. The <code>saxon-sql-13.#.jar</code> file,
            distributed alongside the main JAR file, must be added to the classpath when these SQL extension functions
            are used.</p>
      </status>
      <xpath>3.1</xpath>
      <saxon-edition platform="J">9.9 PE/EE</saxon-edition>
      <details>
         <p>The function executes a SQL query. For convenience the query is split across three arguments <code>$table</code>,
         <code>$columns</code> and <code>$predicate</code> but the function simply concatenates these together to form
         a SQL query which is then executed.</p>
         
         <p>The 3-argument form of the function retrieves all the rows in a table (the effective predicate is <code>TRUE</code>).</p>
  
         <p>The value returned by the function is a sequence of maps. Each row in the query result is
            represented by one map in this sequence. The map represents a row in the result using a string-valued key
            to represent the column name, and an appropriately-typed atomic item to represent the value of the column.
            A SQL <code>NULL</code> value is represented by an empty sequence.</p>
         <p>Note that the result is a sequence rather than an array. It can be converted to an array (for example,
            for serializing in JSON) using the expression <code>array{$result}</code>.</p>
         <p>Example:</p>
         <pre><code class="language-xml">&lt;out&gt;
   &lt;xsl:for-each select="sql:query($connection, 'book', ('date', 'title'), 
      'author = ''J. K. Rowling''')"&gt;
      &lt;book date="{?date}" title="{?title}"/&gt;
   &lt;/xsl:for-each&gt;
&lt;/out&gt;
</code></pre>
        <p>To avoid problems with nested quotation marks, you could also write:</p>
        <pre><code class="language-xml">&lt;out&gt;
   &lt;xsl:variable name="condition" as="xs:string"&gt;author = 'J. K. Rowling'&lt;/xsl:variable&gt;       
   &lt;xsl:for-each select="sql:query($connection, 'book', ('date', 'title'), $condition)"&gt;
      &lt;book date="{?date}" title="{?title}"/&gt;
   &lt;/xsl:for-each&gt;
&lt;/out&gt;
</code></pre>
      </details>
   </function>
   
   <function xmlns="http://www.saxonica.com/ns/doc/functions">
      <name namespace="http://saxon.sf.net/sql">update</name>
      <signatures>
         <proto return-type="item()?">
            <arg name="connection" type="javatype:java.sql.Connection" desc="A JDBC database connection established using sql:connect"/>
            <arg name="table" type="xs:string" desc="The database table from which rows are to be updated"/>
            <arg name="predicate" type="xs:string" desc="A SQL predicate identifying the rows to be updated"/>
            <arg name="changes" type="map(*)" desc="A map holding new values for the updated rows"/>
         </proto>
      </signatures>
      <description>
         <p>Executes a SQL UPDATE statement, returning no result.</p>
      </description>
      <status>
         <p>Introduced in Saxon 9.9. Designed to supersede the extension instruction <a class="bodylink code" href="/sql-extension/instructions/update">sql:update</a>. The <code>saxon-sql-13.#.jar</code> file,
            distributed alongside the main JAR file, must be added to the classpath when these SQL extension functions
            are used.</p>
      </status>
      <xpath>3.1</xpath>
      <saxon-edition platform="J">9.9 PE/EE</saxon-edition>
      <details>
         <p>The function executes a SQL UPDATE statement, and returns no result.</p>
         
         <p>The <code>$table</code> argument names the database table to be updated, and the
         <code>$predicate</code> argument is a SQL predicate that selects which rows are to be updated. For each
         of these rows, new values for selected columns are taken from the <code>$changes</code> map.</p>
         
         <p>The entries in the <code>$changes</code> map are (name, value) pairs, where the name is a column
         name in the table being updated, and the value is the new value for the column. The value should be
         an appropriate data type for the column (for example, <code>xs:string</code> for a <code>VARCHAR</code>
         column, <code>xs:decimal</code> for a <code>DECIMAL</code> column, etc).</p>
         
         <p>Although the declared return type is <code>item()?</code>, the function always returns an empty
            sequence. The declared return type is designed to prevent the optimizer making unwarranted assumptions.</p>
         
         <p>Because this function is executed for its side-effects, it is recommended to invoke it using
            the <a class="bodylink code" href="/extensions/instructions/do">saxon:do</a> extension instruction.</p>
         
         <p>Example:</p>
         <pre><code class="language-xml">&lt;saxon:do action="sql:update($connection, 'book', 'stock = 0', map{'out-of-print': true()}"/&gt;</code></pre>
      </details>
   </function>
   
 
</section>

</article>