zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #04237
[Merge] lp:~zorba-coders/zorba/fix_test_xquery_1_1 into lp:zorba
Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/fix_test_xquery_1_1 into lp:zorba.
Requested reviews:
Sorin Marian Nasoi (sorin.marian.nasoi)
Matthias Brantner (matthias-brantner)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix_test_xquery_1_1/+merge/90863
Downloaded the latest version of the XQuery 3.0 F&O spec to be used in test xquery_1_1.
--
The attached diff has been truncated due to its size.
https://code.launchpad.net/~zorba-coders/zorba/fix_test_xquery_1_1/+merge/90863
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'test/rbkt/Queries/zorba/spec/XQuery_3.0.html'
--- test/rbkt/Queries/zorba/spec/XQuery_3.0.html 2011-06-24 19:58:33 +0000
+++ test/rbkt/Queries/zorba/spec/XQuery_3.0.html 2012-01-31 13:15:31 +0000
@@ -1,1406 +1,1662 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--XSLT Processor: SAXON 9.1.0.5 from Saxonica SAXON 9.1.0.5--><html xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" lang="EN" xml:lang="EN">
- <head>
- <meta name="generator" content="HTML Tidy for Windows (vers 14 February 2006), see www.w3.org"/>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <title>XPath and XQuery Functions and Operators 3.0</title>
- <style type="text/css">
- /**/ code { font-family: monospace; } div.constraint, div.issue, div.note, div.notice { margin-left: 2em; } div.issue p.title { margin-left: -2em; } ol.enumar { list-style-type: decimal; } ol.enumla { list-style-type: lower-alpha; } ol.enumlr { list-style-type: lower-roman; } ol.enumua { list-style-type: upper-alpha; } ol.enumur { list-style-type: upper-roman; } li p { margin-top: 0.3em; margin-bottom: 0.3em; } sup small { font-style: italic; color: #8F8F8F; } div.exampleInner pre { margin-left: 1em; margin-top: 0em; margin-bottom: 0em} div.exampleOuter {border: 4px double gray; margin: 0em; padding: 0em} div.exampleInner { background-color: #d5dee3; border-top-width: 4px; border-top-style: double; border-top-color: #d3d3d3; border-bottom-width: 4px; border-bottom-style: double; border-bottom-color: #d3d3d3; padding: 4px; margin: 0em } div.exampleWrapper { margin: 4px } div.exampleHeader { font-weight: bold; margin: 4px} div.issue { border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1pt; margin-bottom: 20pt; } th.issue-toc-head { border-bottom-color: black; border-bottom-style: solid; border-bottom-width: 1pt; } div.schemaComp { border: 4px double gray; margin: 0em 1em; padding: 0em; } div.compHeader { margin: 4px; font-weight: bold; } span.schemaComp { background-color: white; color: #A52A2A; } div.compBody { border-top-width: 4px; border-top-style: double; border-top-color: #d3d3d3; padding: 4px; margin: 0em; } div.exampleInner { background-color: #d5dee3; color: black; border-top-width: 4px; border-top-style: double; border-top-color: #d3d3d3; border-bottom-width: 4px; border-bottom-style: double; border-bottom-color: #d3d3d3; padding: 4px; margin-bottom: 4px; } div.issueBody { margin-left: 0.25in; } code.function { font-weight: bold; } code.return-type { font-style: italic; } code.return-varies { font-weight: bold; font-style: italic; } code.type { font-style: italic; } code.as { font-style: normal; } code.arg { } code.strikeout { text-decoration: line-through; } p.table.footnote { font-size: 8pt; } table.casting { font-size: x-small; } table.hierarchy { font-size: x-small; } td.castY { background-color: #7FFF7F; color: black; } td.castN { background-color: #FF7F7F; color: black; } td.castM { background-color: white; color: black; } td.castOther { background-color: yellow; color: black; } span.cancast:hover { background-color: #ffa; color: black; } div.protoref { margin-left: 0.5in; text-indent: -0.5in; } dd.indent { margin-left: 2em; } p.element-syntax { border: solid thin; background-color: #ffccff } p.element-syntax-chg { border: solid thick yellow; background-color: #ffccff } div.proto { border: solid thin; background-color: #ffccff } div.example { border: solid thin; background-color: #40e0d0; padding: 1em } div.example-chg { border: solid thick yellow; background-color: #40e0d0; padding: 1em } span.verb { font: small-caps 100% sans-serif } span.error { font-size: small } span.definition { font: small-caps 100% sans-serif } span.grayed { color: gray } table.small { font-size: x-small; } a.judgment:visited, a.judgment:link { font-family: sans-serif; color: black; text-decoration: none } a.processing:visited, a.processing:link { color: black; text-decoration: none } a.env:visited, a.env:link { color: black; text-decoration: none } /**/
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!--XSLT Processor: SAXON 9.1.0.5 from Saxonica SAXON 9.1.0.5-->
+<html xmlns:xs="http://www.w3.org/2001/XMLSchema" lang="EN" xmlns=
+"http://www.w3.org/1999/xhtml" xml:lang="EN">
+<head>
+<meta name="generator" content=
+"HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 15.6), see www.w3.org" />
+<meta http-equiv="Content-Type" content=
+"text/html; charset=utf-8" />
+<title>XPath and XQuery Functions and Operators 3.0</title>
+
+<style type="text/css">
+/*<![CDATA[*/
+code { font-family: monospace; }
+
+div.constraint,
+div.issue,
+div.note,
+div.notice { margin-left: 2em; }
+
+div.issue
+p.title { margin-left: -2em; }
+
+ol.enumar { list-style-type: decimal; }
+ol.enumla { list-style-type: lower-alpha; }
+ol.enumlr { list-style-type: lower-roman; }
+ol.enumua { list-style-type: upper-alpha; }
+ol.enumur { list-style-type: upper-roman; }
+
+li p { margin-top: 0.3em;
+ margin-bottom: 0.3em; }
+
+sup small { font-style: italic;
+ color: #8F8F8F;
+ }
+
+div.exampleInner pre { margin-left: 1em;
+ margin-top: 0em; margin-bottom: 0em}
+div.exampleOuter {border: 4px double gray;
+ margin: 0em; padding: 0em}
+div.exampleInner { background-color: #d5dee3;
+ border-top-width: 4px;
+ border-top-style: double;
+ border-top-color: #d3d3d3;
+ border-bottom-width: 4px;
+ border-bottom-style: double;
+ border-bottom-color: #d3d3d3;
+ padding: 4px; margin: 0em }
+div.exampleWrapper { margin: 4px }
+div.exampleHeader { font-weight: bold;
+ margin: 4px}
+
+div.issue { border-bottom-color: black;
+ border-bottom-style: solid;
+ border-bottom-width: 1pt;
+ margin-bottom: 20pt;
+}
+
+th.issue-toc-head { border-bottom-color: black;
+ border-bottom-style: solid;
+ border-bottom-width: 1pt;
+}
+
+
+div.schemaComp { border: 4px double gray;
+ margin: 0em 1em;
+ padding: 0em;
+ }
+div.compHeader { margin: 4px;
+ font-weight: bold;
+ }
+span.schemaComp { background-color: white;
+ color: #A52A2A;
+ }
+div.compBody { border-top-width: 4px;
+ border-top-style: double;
+ border-top-color: #d3d3d3;
+ padding: 4px;
+ margin: 0em;
+ }
+
+div.exampleInner { background-color: #d5dee3;
+ color: black;
+ border-top-width: 4px;
+ border-top-style: double;
+ border-top-color: #d3d3d3;
+ border-bottom-width: 4px;
+ border-bottom-style: double;
+ border-bottom-color: #d3d3d3;
+ padding: 4px;
+ margin-bottom: 4px;
+ }
+
+div.issueBody { margin-left: 0.25in;
+ }
+
+code.function { font-weight: bold;
+ }
+code.return-type { font-style: italic;
+ }
+code.return-varies { font-weight: bold;
+ font-style: italic;
+ }
+code.type { font-style: italic;
+ }
+code.as { font-style: normal;
+ }
+code.arg {
+ }
+code.strikeout { text-decoration: line-through;
+ }
+p.table.footnote { font-size: 8pt;
+ }
+
+table.casting { font-size: x-small;
+ }
+table.hierarchy { font-size: x-small;
+ }
+
+td.castY { background-color: #7FFF7F;
+ color: black;
+ }
+
+td.castN { background-color: #FF7F7F;
+ color: black;
+ }
+
+td.castM { background-color: white;
+ color: black;
+ }
+
+td.castOther { background-color: yellow;
+ color: black;
+ }
+
+span.cancast:hover { background-color: #ffa;
+ color: black;
+ }
+
+div.protoref { margin-left: 0.5in;
+ text-indent: -0.5in;
+ }
+
+dd.indent { margin-left: 2em;
+ }
+
+p.element-syntax { border: solid thin; background-color: #ffccff
+ }
+
+p.element-syntax-chg { border: solid thick yellow; background-color: #ffccff
+ }
+
+div.proto { border: solid thin; background-color: #ffccff
+ }
+
+div.example { border: solid thin; background-color: #40e0d0; padding: 1em
+ }
+
+div.example-chg { border: solid thick yellow; background-color: #40e0d0; padding: 1em
+ }
+
+span.verb { font: small-caps 100% sans-serif
+ }
+
+span.error { font-size: small
+ }
+
+span.definition { font: small-caps 100% sans-serif
+ }
+
+span.grayed { color: gray
+ }
+
+
+table.small { font-size: x-small; }
+a.judgment:visited, a.judgment:link { font-family: sans-serif;
+ color: black;
+ text-decoration: none }
+a.processing:visited, a.processing:link { color: black;
+ text-decoration: none }
+a.env:visited, a.env:link { color: black;
+ text-decoration: none }
+/*]]>*/
</style>
- <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD.css"/>
- </head>
- <body>
- <div class="head">
- <p>
- <a href="http://www.w3.org/">
- <img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"/>
- </a>
- </p>
- <h1>
- <a name="title" id="title"/>XPath and XQuery Functions and
+<link rel="stylesheet" type="text/css" href=
+"http://www.w3.org/StyleSheets/TR/W3C-WD.css" />
+</head>
+<body>
+<div class="head">
+<p><a href="http://www.w3.org/"><img src=
+"http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width=
+"72" /></a></p>
+<h1><a name="title" id="title"></a>XPath and XQuery Functions and
Operators 3.0</h1>
- <h2>
- <a name="w3c-doctype" id="w3c-doctype"/>W3C Working Draft 14
-December 2010</h2>
- <dl>
- <dt>This version:</dt>
- <dd>
- <a href="http://www.w3.org/TR/2010/WD-xpath-functions-30-20101214/">http://www.w3.org/TR/2010/WD-xpath-functions-30-20101214/</a>
- </dd>
- <dt>Latest version:</dt>
- <dd>
- <a href="http://www.w3.org/TR/xpath-functions-30/">http://www.w3.org/TR/xpath-functions-30/</a>
- </dd>
- <dt>Previous version:</dt>
- <dd>
- <a href="http://www.w3.org/TR/2009/WD-xpath-functions-11-20091215/">http://www.w3.org/TR/2009/WD-xpath-functions-11-20091215/</a>
- </dd>
- <dt>Editor:</dt>
- <!--xmlspec, match="author"-->
- <dd>Michael Kay (XSL WG), Saxonica <a href="http://www.saxonica.com/"><http://www.saxonica.com/></a>
- </dd>
- </dl>
- <p>See also <a href="http://www.w3.org/2003/03/Translations/byTechnology?technology=xpath-functions">
- <strong>translations</strong>
- </a>.</p>
- <p>This document is also available in these non-normative formats:
-<a href="http://www.w3.org/TR/2010/WD-xpath-functions-30-20101214/xpath-functions-30.xml">
-XML</a> and <a href="http://www.w3.org/TR/2010/WD-xpath-functions-30-20101214/xpath-functions-30-diff.html">Change
+<h2><a name="w3c-doctype" id="w3c-doctype"></a>W3C Working Draft 13
+December 2011</h2>
+<dl>
+<dt>This version:</dt>
+<dd><a href=
+"http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/">http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/</a></dd>
+<dt>Latest version:</dt>
+<dd><a href=
+"http://www.w3.org/TR/xpath-functions-30/">http://www.w3.org/TR/xpath-functions-30/</a></dd>
+<dt>Previous versions:</dt>
+<dd><a href=
+"http://www.w3.org/TR/2011/WD-xpath-functions-30-20110614/">http://www.w3.org/TR/2011/WD-xpath-functions-30-20110614/</a>
+<a href=
+"http://www.w3.org/TR/2010/WD-xpath-functions-30-20101214/">http://www.w3.org/TR/2010/WD-xpath-functions-30-20101214/</a>
+<a href=
+"http://www.w3.org/TR/2009/WD-xpath-functions-11-20091215/">http://www.w3.org/TR/2009/WD-xpath-functions-11-20091215/</a></dd>
+<dt>Editor:</dt>
+<dd>Michael Kay (XSL WG), Saxonica <a href=
+"http://www.saxonica.com/">&lt;http://www.saxonica.com/&gt;</a></dd>
+</dl>
+<p>See also <a href=
+"http://www.w3.org/2003/03/Translations/byTechnology?technology=xpath-functions">
+<strong>translations</strong></a>.</p>
+<p>This document is also available in these non-normative formats:
+<a href=
+"http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/xpath-functions-30.xml">
+XML</a> and&#160;<a href=
+"http://www.w3.org/TR/2011/WD-xpath-functions-30-20111213/xpath-functions-30-diff.html">Change
markings relative to previous Working Draft</a>.</p>
- <p class="copyright">
- <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2010 <a href="http://www.w3.org/">
- <acronym title="World Wide Web Consortium">W3C</acronym>
- </a>
- <sup>®</sup>
-(<a href="http://www.csail.mit.edu/">
- <acronym title="Massachusetts Institute of Technology">MIT</acronym>
- </a>, <a href="http://www.ercim.eu/">
- <acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym>
- </a>,
+<p class="copyright"><a href=
+"http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>&#160;©&#160;2011&#160;<a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
+(<a href="http://www.csail.mit.edu/"><acronym title=
+"Massachusetts Institute of Technology">MIT</acronym></a>, <a href=
+"http://www.ercim.eu/"><acronym title=
+"European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
-W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
-<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
-and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
+W3C <a href=
+"http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+<a href=
+"http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
+and <a href=
+"http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
- </div>
- <hr/>
- <div>
- <h2>
- <a name="abstract" id="abstract"/>Abstract</h2>
- <p>This is a draft for internal review. Change markings are
-relative to the Recommendation of 23 January 2007.</p>
- <p>This document defines constructor functions, operators, and
+</div>
+<hr />
+<div>
+<h2><a name="abstract" id="abstract"></a>Abstract</h2>
+<p>Change markings are relative to the Recommendation of 23 January
+2007.</p>
+<p>This document defines constructor functions, operators, and
functions on the datatypes defined in <a href="#xmlschema-2">[XML
Schema Part 2: Datatypes Second Edition]</a> and the datatypes
defined in <a href="#xpath-datamodel-30">[XQuery and XPath Data
Model (XDM) 3.0]</a>. It also defines functions and operators on
-nodes and node sequences as defined in the <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
-These functions and operators are defined for use in <a href="#xpath-30">[XML Path Language (XPath) 3.0]</a>, <a href="#xquery-30">[XQuery 3.0: An XML Query Language]</a> and <a href="#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a> and other
+nodes and node sequences as defined in the <a href=
+"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
+These functions and operators are defined for use in <a href=
+"#xpath-30">[XML Path Language (XPath) 3.0]</a>, <a href=
+"#xquery-30">[XQuery 3.0: An XML Query Language]</a> and <a href=
+"#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a> and other
related XML standards. The signatures and summaries of functions
-defined in this document are available at: <a href="http://www.w3.org/2005/xpath-functions/">http://www.w3.org/2005/xpath-functions/</a>.</p>
- <p>This is the third version of the specification of this function
+defined in this document are available at: <a href=
+"http://www.w3.org/2005/xpath-functions/">http://www.w3.org/2005/xpath-functions/</a>.</p>
+<p>This is the third version of the specification of this function
library. The first version was included as an intrinsic part of the
<a href="#xpath">[XML Path Language (XPath) Version 1.0]</a>
specification published on 16 November 1999. The second version was
published under the title <em>XQuery 1.0 and XPath 2.0 Functions
-and Operators</em> on 23 January 2007. This third version is the
-first to carry its own version number, which has been set at 3.0 to
-align with version numbering for XPath, XQuery, and XSLT. A
-previous draft of this version of the specification carried the
-version number 1.1.</p>
- </div>
- <div>
- <h2>
- <a name="status" id="status"/>Status of this Document</h2>
- <p>
- <em>This section describes the status of this document at the
+and Operators</em> on 23 January 2007, subsequently revised in a
+second edition published on 14 December 2010. This third version is
+the first to carry its own version number, which has been set at
+3.0 to align with the version numbering for XPath, XQuery, and
+XSLT.</p>
+</div>
+<div>
+<h2><a name="status" id="status"></a>Status of this Document</h2>
+<p><em>This section describes the status of this document at the
time of its publication. Other documents may supersede this
document. A list of current W3C publications and the latest
-revision of this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at
-http://www.w3.org/TR/.</em>
- </p>
- <p>This is one document in a set of seven documents that are being
+revision of this technical report can be found in the <a href=
+"http://www.w3.org/TR/">W3C technical reports index</a> at
+http://www.w3.org/TR/.</em></p>
+<p>This is one document in a set of seven documents that are being
progressed to Recommendation together (XQuery 3.0, XQueryX 3.0,
XSLT 3.0, Data Model 3.0, Functions and Operators 3.0,
Serialization 3.0, XPath 3.0).</p>
- <p>This is a <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#maturity-levels">
-Working Draft</a> as described in the <a href="http://www.w3.org/2005/10/Process-20051014/tr.html">Process
-Document</a>. It has been jointly developed by the W3C <a href="http://www.w3.org/XML/Query/">XML Query Working Group</a> and the
+<p>This is a <a href=
+"http://www.w3.org/2005/10/Process-20051014/tr.html#last-call">Last
+Call Working Draft</a> as described in the <a href=
+"http://www.w3.org/2005/10/Process-20051014/tr.html">Process
+Document</a>. It was jointly developed by the W3C <a href=
+"http://www.w3.org/XML/Query/">XML Query Working Group</a> and the
W3C <a href="http://www.w3.org/Style/XSL/">XSL Working Group</a>,
-each of which is part of the <a href="http://www.w3.org/XML/Activity">XML Activity</a>. The Working
-Groups expect to advance this specification to <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#RecsW3C">Recommendation</a>
+each of which is part of the <a href=
+"http://www.w3.org/XML/Activity">XML Activity</a>. Comments on this
+document will be formally accepted at least through 10 February
+2012. The Working Groups expect to advance this specification to
+<a href=
+"http://www.w3.org/2005/10/Process-20051014/tr.html#RecsW3C">Recommendation</a>
Status.</p>
- <p>This public Working Draft differs from the previous Working
-Draft in two important ways. First, the version number of the
-document has changed from "1.1" to "3.0"; this was done in order to
-align the version numbers of the entire suite of documents of which
-this WD is a part. Second, a number of substantive technical
-changes (as well as many editorial changes) have been made in this
-WD. Please note that this Working Draft of XPath and XQuery
+<p>This Last Call Working Draft makes a number of substantive
+technical changes (as well as many editorial changes), including
+new features, adopted since the previous Working Draft was
+published. Please note that this Working Draft of XPath and XQuery
Functions and Operators 3.0 represents the second version of
-<a href="http://www.w3.org/TR/2007/REC-xpath-datamodel-20070123/">a
+<a href="http://www.w3.org/TR/2010/REC-xpath-functions-20101214/">a
previous W3C Recommendation</a>.</p>
- <p>We particularly solicit feedback on the changes made in this
-document in response to <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=10868">Bugzilla Bug
-#10868</a> (prohibiting the xml namespace in module import, schema
-import, and default namespace declarations).</p>
- <p>A Test Suite has been created for this document. Implementors
-are encouraged to run this test suite and report their results. The
-Test Suite can be found at <a href="http://dev.w3.org/cvsweb/2006/xquery-test-suite/">http://dev.w3.org/cvsweb/2006/xquery-test-suite/</a>.
-An implementation report is available at <a href="http://www.w3.org/XML/Query/test-suite/XQTSReport.html">http://www.w3.org/XML/Query/test-suite/XQTSReport.html</a>.</p>
- <p>This document incorporates changes made against the previous
-publication of the Working Draft of 14 December 2010. Changes to
-this document since the previous publication of the Working Draft
-are detailed in <a href="#changelog">
- <b>F Changes since previous
-Recommendation</b>
- </a>.</p>
- <p>Please report errors in this document using W3C's <a href="http://www.w3.org/Bugs/Public/">public Bugzilla system</a>
-(instructions can be found at <a href="http://www.w3.org/XML/2005/04/qt-bugzilla">http://www.w3.org/XML/2005/04/qt-bugzilla</a>).
+<p>This specification is designed to be referenced normatively from
+other specifications defining a host language for it; it is not
+intended to be implemented outside a host language. The
+implementability of this specification has been tested in the
+context of its normative inclusion in host languages defined by the
+<a href="http://www.w3.org/TR/xquery-30/">XQuery 3.0</a> and XSLT
+3.0 (expected in 2012) specifications; see the <a href=
+"http://dev.w3.org/2011/xquery-30-test-suite/results/XQTSReport.html">
+XQuery 3.0 implementation report</a> (and, in the future, the WGs
+expect that there will also be a member-only XSLT 3.0
+implementation report) for details.</p>
+<p>This document incorporates changes made against the previous
+publication of the Working Draft. Changes to this document since
+the previous publication of the Working Draft are detailed in
+<a href="#changelog"><b>F Changes since previous
+Recommendation</b></a>.</p>
+<p>Please report errors in this document using W3C's <a href=
+"http://www.w3.org/Bugs/Public/">public Bugzilla system</a>
+(instructions can be found at <a href=
+"http://www.w3.org/XML/2005/04/qt-bugzilla">http://www.w3.org/XML/2005/04/qt-bugzilla</a>).
If access to that system is not feasible, you may send your
comments to the W3C XSLT/XPath/XQuery public comments mailing list,
-<a href="mailto:public-qt-comments@xxxxxx">public-qt-comments@xxxxxx</a>.
-It will be very helpful if you include the string “[FO30]†in
-the subject line of your report, whether made in Bugzilla or in
-email. Please use multiple Bugzilla entries (or, if necessary,
-multiple email messages) if you have more than one comment to make.
-Archives of the comments and responses are available at <a href="http://lists.w3.org/Archives/Public/public-qt-comments/">http://lists.w3.org/Archives/Public/public-qt-comments/</a>.</p>
- <p>Publication as a Working Draft does not imply endorsement by the
+<a href=
+"mailto:public-qt-comments@xxxxxx">public-qt-comments@xxxxxx</a>.
+It will be very helpful if you include the string “[FO30]” in the
+subject line of your report, whether made in Bugzilla or in email.
+Please use multiple Bugzilla entries (or, if necessary, multiple
+email messages) if you have more than one comment to make. Archives
+of the comments and responses are available at <a href=
+"http://lists.w3.org/Archives/Public/public-qt-comments/">http://lists.w3.org/Archives/Public/public-qt-comments/</a>.</p>
+<p>Publication as a Working Draft does not imply endorsement by the
W3C Membership. This is a draft document and may be updated,
replaced or obsoleted by other documents at any time. It is
inappropriate to cite this document as other than work in
progress.</p>
- <p>This document was produced by groups operating under the
+<p>This document was produced by groups operating under the
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
-February 2004 W3C Patent Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/18797/status#disclosures">public
+February 2004 W3C Patent Policy</a>. W3C maintains a <a href=
+"http://www.w3.org/2004/01/pp-impl/18797/status#disclosures">public
list of any patent disclosures</a> made in connection with the
deliverables of the XML Query Working Group and also maintains a
-<a href="http://www.w3.org/2004/01/pp-impl/19552/status#disclosures">public
+<a href=
+"http://www.w3.org/2004/01/pp-impl/19552/status#disclosures">public
list of any patent disclosures</a> made in connection with the
deliverables of the XSL Working Group; those pages also include
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains
-<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">
+<a href=
+"http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">
Essential Claim(s)</a> must disclose the information in accordance
-with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">
+with <a href=
+"http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">
section 6 of the W3C Patent Policy</a>.</p>
- </div>
- <div class="toc">
- <h2>
- <a name="quickcontents" id="quickcontents"/>Quick
+</div>
+<div class="toc">
+<h2><a name="quickcontents" id="quickcontents"></a>Quick
Contents</h2>
- <ul>
- <li>
- <p>
- <a href="#func-abs">abs</a> <a href="#func-acos">acos</a>
-<a href="#func-add-dayTimeDurations">add-dayTimeDurations</a>
-<a href="#func-add-dayTimeDuration-to-date">add-dayTimeDuration-to-date</a>
-<a href="#func-add-dayTimeDuration-to-dateTime">add-dayTimeDuration-to-dateTime</a>
-<a href="#func-add-dayTimeDuration-to-time">add-dayTimeDuration-to-time</a>
-<a href="#func-add-yearMonthDurations">add-yearMonthDurations</a>
-<a href="#func-add-yearMonthDuration-to-date">add-yearMonthDuration-to-date</a>
-<a href="#func-add-yearMonthDuration-to-dateTime">add-yearMonthDuration-to-dateTime</a>
-<a href="#func-adjust-dateTime-to-timezone">adjust-dateTime-to-timezone</a>
-<a href="#func-adjust-date-to-timezone">adjust-date-to-timezone</a>
-<a href="#func-adjust-time-to-timezone">adjust-time-to-timezone</a>
-<a href="#func-analyze-string">analyze-string</a> <a href="#func-asin">asin</a> <a href="#func-atan">atan</a> <a href="#func-atan2">atan2</a> <a href="#func-available-environment-variables">available-environment-variables</a>
-<a href="#func-avg">avg</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-base64Binary-equal">base64Binary-equal</a>
-<a href="#func-base-uri">base-uri</a> <a href="#func-boolean">boolean</a> <a href="#func-boolean-equal">boolean-equal</a> <a href="#func-boolean-greater-than">boolean-greater-than</a> <a href="#func-boolean-less-than">boolean-less-than</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-ceiling">ceiling</a> <a href="#func-codepoint-equal">codepoint-equal</a> <a href="#func-codepoints-to-string">codepoints-to-string</a> <a href="#func-collection">collection</a> <a href="#func-compare">compare</a> <a href="#func-concat">concat</a>
-<a href="#func-concatenate">concatenate</a> <a href="#func-contains">contains</a> <a href="#func-cos">cos</a>
-<a href="#func-count">count</a> <a href="#func-current-date">current-date</a> <a href="#func-current-dateTime">current-dateTime</a> <a href="#func-current-time">current-time</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-data">data</a> <a href="#func-date-equal">date-equal</a> <a href="#func-date-greater-than">date-greater-than</a> <a href="#func-date-less-than">date-less-than</a> <a href="#func-dateTime">dateTime</a> <a href="#func-dateTime-equal">dateTime-equal</a> <a href="#func-dateTime-greater-than">dateTime-greater-than</a> <a href="#func-dateTime-less-than">dateTime-less-than</a> <a href="#func-day-from-date">day-from-date</a> <a href="#func-day-from-dateTime">day-from-dateTime</a> <a href="#func-days-from-duration">days-from-duration</a> <a href="#func-dayTimeDuration-greater-than">dayTimeDuration-greater-than</a>
-<a href="#func-dayTimeDuration-less-than">dayTimeDuration-less-than</a>
-<a href="#func-deep-equal">deep-equal</a> <a href="#func-default-collation">default-collation</a> <a href="#func-distinct-values">distinct-values</a> <a href="#func-divide-dayTimeDuration">divide-dayTimeDuration</a> <a href="#func-divide-dayTimeDuration-by-dayTimeDuration">divide-dayTimeDuration-by-dayTimeDuration</a>
-<a href="#func-divide-yearMonthDuration">divide-yearMonthDuration</a>
-<a href="#func-divide-yearMonthDuration-by-yearMonthDuration">divide-yearMonthDuration-by-yearMonthDuration</a>
-<a href="#func-doc">doc</a> <a href="#func-doc-available">doc-available</a> <a href="#func-document-uri">document-uri</a> <a href="#func-duration-equal">duration-equal</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-element-with-id">element-with-id</a> <a href="#func-empty">empty</a> <a href="#func-encode-for-uri">encode-for-uri</a> <a href="#func-ends-with">ends-with</a> <a href="#func-environment-variable">environment-variable</a> <a href="#func-error">error</a> <a href="#func-escape-html-uri">escape-html-uri</a> <a href="#func-exactly-one">exactly-one</a> <a href="#func-except">except</a> <a href="#func-exists">exists</a>
-<a href="#func-exp">exp</a> <a href="#func-exp10">exp10</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-false">false</a> <a href="#func-filter">filter</a> <a href="#func-float">float</a>
-<a href="#func-floor">floor</a> <a href="#func-fold-left">fold-left</a> <a href="#func-fold-right">fold-right</a> <a href="#func-format-date">format-date</a> <a href="#func-format-dateTime">format-dateTime</a> <a href="#func-format-integer">format-integer</a> <a href="#func-format-number">format-number</a> <a href="#func-format-time">format-time</a> <a href="#func-function-arity">function-arity</a> <a href="#func-function-name">function-name</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-gDay-equal">gDay-equal</a> <a href="#func-generate-id">generate-id</a> <a href="#func-gMonthDay-equal">gMonthDay-equal</a> <a href="#func-gMonth-equal">gMonth-equal</a> <a href="#func-gYear-equal">gYear-equal</a> <a href="#func-gYearMonth-equal">gYearMonth-equal</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-has-children">has-children</a> <a href="#func-head">head</a> <a href="#func-hexBinary-equal">hexBinary-equal</a> <a href="#func-hours-from-dateTime">hours-from-dateTime</a> <a href="#func-hours-from-duration">hours-from-duration</a> <a href="#func-hours-from-time">hours-from-time</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-id">id</a> <a href="#func-idref">idref</a>
-<a href="#func-implicit-timezone">implicit-timezone</a> <a href="#func-index-of">index-of</a> <a href="#func-innermost">innermost</a> <a href="#func-in-scope-prefixes">in-scope-prefixes</a> <a href="#func-insert-before">insert-before</a> <a href="#func-intersect">intersect</a> <a href="#func-iri-to-uri">iri-to-uri</a> <a href="#func-is-same-node">is-same-node</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-lang">lang</a> <a href="#func-last">last</a>
-<a href="#func-local-name">local-name</a> <a href="#func-local-name-from-QName">local-name-from-QName</a> <a href="#func-log">log</a> <a href="#func-log10">log10</a> <a href="#func-lower-case">lower-case</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-map">map</a> <a href="#func-map-pairs">map-pairs</a> <a href="#func-matches">matches</a> <a href="#func-max">max</a> <a href="#func-min">min</a> <a href="#func-minutes-from-dateTime">minutes-from-dateTime</a> <a href="#func-minutes-from-duration">minutes-from-duration</a> <a href="#func-minutes-from-time">minutes-from-time</a> <a href="#func-month-from-date">month-from-date</a> <a href="#func-month-from-dateTime">month-from-dateTime</a> <a href="#func-months-from-duration">months-from-duration</a> <a href="#func-multiply-dayTimeDuration">multiply-dayTimeDuration</a>
-<a href="#func-multiply-yearMonthDuration">multiply-yearMonthDuration</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-name">name</a> <a href="#func-namespace-uri">namespace-uri</a> <a href="#func-namespace-uri-for-prefix">namespace-uri-for-prefix</a>
-<a href="#func-namespace-uri-from-QName">namespace-uri-from-QName</a>
-<a href="#func-nilled">nilled</a> <a href="#func-node-after">node-after</a> <a href="#func-node-before">node-before</a> <a href="#func-node-name">node-name</a> <a href="#func-normalize-space">normalize-space</a> <a href="#func-normalize-unicode">normalize-unicode</a> <a href="#func-not">not</a> <a href="#func-NOTATION-equal">NOTATION-equal</a> <a href="#func-number">number</a> <a href="#func-numeric-add">numeric-add</a> <a href="#func-numeric-divide">numeric-divide</a> <a href="#func-numeric-equal">numeric-equal</a> <a href="#func-numeric-greater-than">numeric-greater-than</a> <a href="#func-numeric-integer-divide">numeric-integer-divide</a> <a href="#func-numeric-less-than">numeric-less-than</a> <a href="#func-numeric-mod">numeric-mod</a> <a href="#func-numeric-multiply">numeric-multiply</a> <a href="#func-numeric-subtract">numeric-subtract</a> <a href="#func-numeric-unary-minus">numeric-unary-minus</a> <a href="#func-numeric-unary-plus">numeric-unary-plus</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-one-or-more">one-or-more</a> <a href="#func-outermost">outermost</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-parse-xml">parse-xml</a> <a href="#func-pi">pi</a> <a href="#func-position">position</a> <a href="#func-pow">pow</a> <a href="#func-prefix-from-QName">prefix-from-QName</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-QName">QName</a> <a href="#func-QName-equal">QName-equal</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-remove">remove</a> <a href="#func-replace">replace</a> <a href="#func-resolve-QName">resolve-QName</a> <a href="#func-resolve-uri">resolve-uri</a> <a href="#func-reverse">reverse</a> <a href="#func-root">root</a>
-<a href="#func-round">round</a> <a href="#func-round-half-to-even">round-half-to-even</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-seconds-from-dateTime">seconds-from-dateTime</a>
-<a href="#func-seconds-from-duration">seconds-from-duration</a>
-<a href="#func-seconds-from-time">seconds-from-time</a> <a href="#func-serialize">serialize</a> <a href="#func-sin">sin</a>
-<a href="#func-sqrt">sqrt</a> <a href="#func-starts-with">starts-with</a> <a href="#func-static-base-uri">static-base-uri</a> <a href="#func-string">string</a> <a href="#func-string-join">string-join</a> <a href="#func-string-length">string-length</a> <a href="#func-string-to-codepoints">string-to-codepoints</a> <a href="#func-subsequence">subsequence</a> <a href="#func-substring">substring</a> <a href="#func-substring-after">substring-after</a> <a href="#func-substring-before">substring-before</a> <a href="#func-subtract-dates">subtract-dates</a> <a href="#func-subtract-dateTimes">subtract-dateTimes</a> <a href="#func-subtract-dayTimeDuration-from-date">subtract-dayTimeDuration-from-date</a>
-<a href="#func-subtract-dayTimeDuration-from-dateTime">subtract-dayTimeDuration-from-dateTime</a>
-<a href="#func-subtract-dayTimeDuration-from-time">subtract-dayTimeDuration-from-time</a>
-<a href="#func-subtract-dayTimeDurations">subtract-dayTimeDurations</a>
-<a href="#func-subtract-times">subtract-times</a> <a href="#func-subtract-yearMonthDuration-from-date">subtract-yearMonthDuration-from-date</a>
-<a href="#func-subtract-yearMonthDuration-from-dateTime">subtract-yearMonthDuration-from-dateTime</a>
-<a href="#func-subtract-yearMonthDurations">subtract-yearMonthDurations</a>
-<a href="#func-sum">sum</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-tail">tail</a> <a href="#func-tan">tan</a>
-<a href="#func-time-equal">time-equal</a> <a href="#func-time-greater-than">time-greater-than</a> <a href="#func-time-less-than">time-less-than</a> <a href="#func-timezone-from-date">timezone-from-date</a> <a href="#func-timezone-from-dateTime">timezone-from-dateTime</a> <a href="#func-timezone-from-time">timezone-from-time</a> <a href="#func-to">to</a> <a href="#func-tokenize">tokenize</a> <a href="#func-trace">trace</a> <a href="#func-translate">translate</a>
-<a href="#func-true">true</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-union">union</a> <a href="#func-unordered">unordered</a> <a href="#func-unparsed-text">unparsed-text</a> <a href="#func-unparsed-text-available">unparsed-text-available</a>
-<a href="#func-unparsed-text-lines">unparsed-text-lines</a>
-<a href="#func-upper-case">upper-case</a> <a href="#func-uri-collection">uri-collection</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-year-from-date">year-from-date</a> <a href="#func-year-from-dateTime">year-from-dateTime</a> <a href="#func-yearMonthDuration-greater-than">yearMonthDuration-greater-than</a>
-<a href="#func-yearMonthDuration-less-than">yearMonthDuration-less-than</a>
-<a href="#func-years-from-duration">years-from-duration</a> </p>
- </li>
- <li>
- <p>
- <a href="#func-zero-or-one">zero-or-one</a> </p>
- </li>
- </ul>
- </div>
- <div class="toc">
- <h2>
- <a name="contents" id="contents"/>Table of Contents</h2>
- <p class="toc">1 <a href="#intro">Introduction</a>
- <br/>
- 1.1 <a href="#conformance">Conformance</a>
- <br/>
- 1.2 <a href="#namespace-prefixes">Namespaces and
-prefixes</a>
- <br/>
- 1.3 <a href="#func-overloading">Function overloading</a>
- <br/>
- 1.4 <a href="#func-signatures">Function signatures and
-descriptions</a>
- <br/>
- 1.5 <a href="#datatypes">Type system</a>
- <br/>
- 1.6 <a href="#terminology">Terminology</a>
- <br/>
- 1.6.1 <a href="#character-terminology">Strings, characters,
-and codepoints</a>
- <br/>
- 1.6.2 <a href="#namespace-terminology">Namespaces and
-URIs</a>
- <br/>
- 1.6.3 <a href="#conformance-terminology">Conformance
-terminology</a>
- <br/>
- 1.6.4 <a href="#properties-of-functions">Properties of
-functions</a>
- <br/>
-2 <a href="#accessors">Accessors</a>
- <br/>
- 2.1 <a href="#func-node-name">fn:node-name</a>
- <br/>
- 2.2 <a href="#func-nilled">fn:nilled</a>
- <br/>
- 2.3 <a href="#func-string">fn:string</a>
- <br/>
- 2.4 <a href="#func-data">fn:data</a>
- <br/>
- 2.5 <a href="#func-base-uri">fn:base-uri</a>
- <br/>
- 2.6 <a href="#func-document-uri">fn:document-uri</a>
- <br/>
+<ul>
+<li>
+<p><a href="#func-abs">abs</a>&#160; <a href=
+"#func-math-acos">acos</a>&#160; <a href=
+"#func-add-dayTimeDurations">add-dayTimeDurations</a>&#160;
+<a href="#func-add-dayTimeDuration-to-date">add-dayTimeDuration-to-date</a>&#160;
+<a href=
+"#func-add-dayTimeDuration-to-dateTime">add-dayTimeDuration-to-dateTime</a>&#160;
+<a href=
+"#func-add-dayTimeDuration-to-time">add-dayTimeDuration-to-time</a>&#160;
+<a href=
+"#func-add-yearMonthDurations">add-yearMonthDurations</a>&#160;
+<a href=
+"#func-add-yearMonthDuration-to-date">add-yearMonthDuration-to-date</a>&#160;
+<a href=
+"#func-add-yearMonthDuration-to-dateTime">add-yearMonthDuration-to-dateTime</a>&#160;
+<a href=
+"#func-adjust-dateTime-to-timezone">adjust-dateTime-to-timezone</a>&#160;
+<a href=
+"#func-adjust-date-to-timezone">adjust-date-to-timezone</a>&#160;
+<a href=
+"#func-adjust-time-to-timezone">adjust-time-to-timezone</a>&#160;
+<a href="#func-analyze-string">analyze-string</a>&#160; <a href=
+"#func-math-asin">asin</a>&#160; <a href=
+"#func-math-atan">atan</a>&#160; <a href=
+"#func-math-atan2">atan2</a>&#160; <a href=
+"#func-available-environment-variables">available-environment-variables</a>&#160;
+<a href="#func-avg">avg</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-base64Binary-equal">base64Binary-equal</a>&#160;
+<a href="#func-base-uri">base-uri</a>&#160; <a href=
+"#func-boolean">boolean</a>&#160; <a href=
+"#func-boolean-equal">boolean-equal</a>&#160; <a href=
+"#func-boolean-greater-than">boolean-greater-than</a>&#160;
+<a href="#func-boolean-less-than">boolean-less-than</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-ceiling">ceiling</a>&#160; <a href=
+"#func-codepoint-equal">codepoint-equal</a>&#160; <a href=
+"#func-codepoints-to-string">codepoints-to-string</a>&#160;
+<a href="#func-collection">collection</a>&#160; <a href=
+"#func-compare">compare</a>&#160; <a href=
+"#func-concat">concat</a>&#160; <a href=
+"#func-concatenate">concatenate</a>&#160; <a href=
+"#func-contains">contains</a>&#160; <a href=
+"#func-math-cos">cos</a>&#160; <a href=
+"#func-count">count</a>&#160; <a href=
+"#func-current-date">current-date</a>&#160; <a href=
+"#func-current-dateTime">current-dateTime</a>&#160; <a href=
+"#func-current-time">current-time</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-data">data</a>&#160; <a href=
+"#func-date-equal">date-equal</a>&#160; <a href=
+"#func-date-greater-than">date-greater-than</a>&#160; <a href=
+"#func-date-less-than">date-less-than</a>&#160; <a href=
+"#func-dateTime">dateTime</a>&#160; <a href=
+"#func-dateTime-equal">dateTime-equal</a>&#160; <a href=
+"#func-dateTime-greater-than">dateTime-greater-than</a>&#160;
+<a href="#func-dateTime-less-than">dateTime-less-than</a>&#160;
+<a href="#func-day-from-date">day-from-date</a>&#160; <a href=
+"#func-day-from-dateTime">day-from-dateTime</a>&#160; <a href=
+"#func-days-from-duration">days-from-duration</a>&#160; <a href=
+"#func-dayTimeDuration-greater-than">dayTimeDuration-greater-than</a>&#160;
+<a href=
+"#func-dayTimeDuration-less-than">dayTimeDuration-less-than</a>&#160;
+<a href="#func-deep-equal">deep-equal</a>&#160; <a href=
+"#func-default-collation">default-collation</a>&#160; <a href=
+"#func-distinct-values">distinct-values</a>&#160; <a href=
+"#func-divide-dayTimeDuration">divide-dayTimeDuration</a>&#160;
+<a href=
+"#func-divide-dayTimeDuration-by-dayTimeDuration">divide-dayTimeDuration-by-dayTimeDuration</a>&#160;
+<a href=
+"#func-divide-yearMonthDuration">divide-yearMonthDuration</a>&#160;
+<a href=
+"#func-divide-yearMonthDuration-by-yearMonthDuration">divide-yearMonthDuration-by-yearMonthDuration</a>&#160;
+<a href="#func-doc">doc</a>&#160; <a href=
+"#func-doc-available">doc-available</a>&#160; <a href=
+"#func-document-uri">document-uri</a>&#160; <a href=
+"#func-duration-equal">duration-equal</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-element-with-id">element-with-id</a>&#160;
+<a href="#func-empty">empty</a>&#160; <a href=
+"#func-encode-for-uri">encode-for-uri</a>&#160; <a href=
+"#func-ends-with">ends-with</a>&#160; <a href=
+"#func-environment-variable">environment-variable</a>&#160;
+<a href="#func-error">error</a>&#160; <a href=
+"#func-escape-html-uri">escape-html-uri</a>&#160; <a href=
+"#func-exactly-one">exactly-one</a>&#160; <a href=
+"#func-except">except</a>&#160; <a href=
+"#func-exists">exists</a>&#160; <a href=
+"#func-math-exp">exp</a>&#160; <a href=
+"#func-math-exp10">exp10</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-false">false</a>&#160; <a href=
+"#func-filter">filter</a>&#160; <a href=
+"#func-floor">floor</a>&#160; <a href=
+"#func-fold-left">fold-left</a>&#160; <a href=
+"#func-fold-right">fold-right</a>&#160; <a href=
+"#func-format-date">format-date</a>&#160; <a href=
+"#func-format-dateTime">format-dateTime</a>&#160; <a href=
+"#func-format-integer">format-integer</a>&#160; <a href=
+"#func-format-number">format-number</a>&#160; <a href=
+"#func-format-time">format-time</a>&#160; <a href=
+"#func-function-arity">function-arity</a>&#160; <a href=
+"#func-function-lookup">function-lookup</a>&#160; <a href=
+"#func-function-name">function-name</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-gDay-equal">gDay-equal</a>&#160; <a href=
+"#func-generate-id">generate-id</a>&#160; <a href=
+"#func-gMonthDay-equal">gMonthDay-equal</a>&#160; <a href=
+"#func-gMonth-equal">gMonth-equal</a>&#160; <a href=
+"#func-gYear-equal">gYear-equal</a>&#160; <a href=
+"#func-gYearMonth-equal">gYearMonth-equal</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-has-children">has-children</a>&#160; <a href=
+"#func-head">head</a>&#160; <a href=
+"#func-hexBinary-equal">hexBinary-equal</a>&#160; <a href=
+"#func-hours-from-dateTime">hours-from-dateTime</a>&#160; <a href=
+"#func-hours-from-duration">hours-from-duration</a>&#160; <a href=
+"#func-hours-from-time">hours-from-time</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-id">id</a>&#160; <a href=
+"#func-idref">idref</a>&#160; <a href=
+"#func-implicit-timezone">implicit-timezone</a>&#160; <a href=
+"#func-index-of">index-of</a>&#160; <a href=
+"#func-innermost">innermost</a>&#160; <a href=
+"#func-in-scope-prefixes">in-scope-prefixes</a>&#160; <a href=
+"#func-insert-before">insert-before</a>&#160; <a href=
+"#func-intersect">intersect</a>&#160; <a href=
+"#func-iri-to-uri">iri-to-uri</a>&#160; <a href=
+"#func-is-same-node">is-same-node</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-lang">lang</a>&#160; <a href=
+"#func-last">last</a>&#160; <a href=
+"#func-local-name">local-name</a>&#160; <a href=
+"#func-local-name-from-QName">local-name-from-QName</a>&#160;
+<a href="#func-math-log">log</a>&#160; <a href=
+"#func-math-log10">log10</a>&#160; <a href=
+"#func-lower-case">lower-case</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-map">map</a>&#160; <a href=
+"#func-map-pairs">map-pairs</a>&#160; <a href=
+"#func-matches">matches</a>&#160; <a href="#func-max">max</a>&#160;
+<a href="#func-min">min</a>&#160; <a href=
+"#func-minutes-from-dateTime">minutes-from-dateTime</a>&#160;
+<a href=
+"#func-minutes-from-duration">minutes-from-duration</a>&#160;
+<a href="#func-minutes-from-time">minutes-from-time</a>&#160;
+<a href="#func-month-from-date">month-from-date</a>&#160; <a href=
+"#func-month-from-dateTime">month-from-dateTime</a>&#160; <a href=
+"#func-months-from-duration">months-from-duration</a>&#160;
+<a href="#func-multiply-dayTimeDuration">multiply-dayTimeDuration</a>&#160;
+<a href=
+"#func-multiply-yearMonthDuration">multiply-yearMonthDuration</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-name">name</a>&#160; <a href=
+"#func-namespace-uri">namespace-uri</a>&#160; <a href=
+"#func-namespace-uri-for-prefix">namespace-uri-for-prefix</a>&#160;
+<a href=
+"#func-namespace-uri-from-QName">namespace-uri-from-QName</a>&#160;
+<a href="#func-nilled">nilled</a>&#160; <a href=
+"#func-node-after">node-after</a>&#160; <a href=
+"#func-node-before">node-before</a>&#160; <a href=
+"#func-node-name">node-name</a>&#160; <a href=
+"#func-normalize-space">normalize-space</a>&#160; <a href=
+"#func-normalize-unicode">normalize-unicode</a>&#160; <a href=
+"#func-not">not</a>&#160; <a href=
+"#func-NOTATION-equal">NOTATION-equal</a>&#160; <a href=
+"#func-number">number</a>&#160; <a href=
+"#func-numeric-add">numeric-add</a>&#160; <a href=
+"#func-numeric-divide">numeric-divide</a>&#160; <a href=
+"#func-numeric-equal">numeric-equal</a>&#160; <a href=
+"#func-numeric-greater-than">numeric-greater-than</a>&#160;
+<a href="#func-numeric-integer-divide">numeric-integer-divide</a>&#160;
+<a href="#func-numeric-less-than">numeric-less-than</a>&#160;
+<a href="#func-numeric-mod">numeric-mod</a>&#160; <a href=
+"#func-numeric-multiply">numeric-multiply</a>&#160; <a href=
+"#func-numeric-subtract">numeric-subtract</a>&#160; <a href=
+"#func-numeric-unary-minus">numeric-unary-minus</a>&#160; <a href=
+"#func-numeric-unary-plus">numeric-unary-plus</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-one-or-more">one-or-more</a>&#160; <a href=
+"#func-outermost">outermost</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-parse-xml">parse-xml</a>&#160; <a href=
+"#func-parse-xml-fragment">parse-xml-fragment</a>&#160; <a href=
+"#func-path">path</a>&#160; <a href="#func-math-pi">pi</a>&#160;
+<a href="#func-position">position</a>&#160; <a href=
+"#func-math-pow">pow</a>&#160; <a href=
+"#func-prefix-from-QName">prefix-from-QName</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-QName">QName</a>&#160; <a href=
+"#func-QName-equal">QName-equal</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-remove">remove</a>&#160; <a href=
+"#func-replace">replace</a>&#160; <a href=
+"#func-resolve-QName">resolve-QName</a>&#160; <a href=
+"#func-resolve-uri">resolve-uri</a>&#160; <a href=
+"#func-reverse">reverse</a>&#160; <a href=
+"#func-root">root</a>&#160; <a href="#func-round">round</a>&#160;
+<a href="#func-round-half-to-even">round-half-to-even</a>&#160;</p>
+</li>
+<li>
+<p><a href=
+"#func-seconds-from-dateTime">seconds-from-dateTime</a>&#160;
+<a href=
+"#func-seconds-from-duration">seconds-from-duration</a>&#160;
+<a href="#func-seconds-from-time">seconds-from-time</a>&#160;
+<a href="#func-serialize">serialize</a>&#160; <a href=
+"#func-math-sin">sin</a>&#160; <a href=
+"#func-math-sqrt">sqrt</a>&#160; <a href=
+"#func-starts-with">starts-with</a>&#160; <a href=
+"#func-static-base-uri">static-base-uri</a>&#160; <a href=
+"#func-string">string</a>&#160; <a href=
+"#func-string-join">string-join</a>&#160; <a href=
+"#func-string-length">string-length</a>&#160; <a href=
+"#func-string-to-codepoints">string-to-codepoints</a>&#160;
+<a href="#func-subsequence">subsequence</a>&#160; <a href=
+"#func-substring">substring</a>&#160; <a href=
+"#func-substring-after">substring-after</a>&#160; <a href=
+"#func-substring-before">substring-before</a>&#160; <a href=
+"#func-subtract-dates">subtract-dates</a>&#160; <a href=
+"#func-subtract-dateTimes">subtract-dateTimes</a>&#160; <a href=
+"#func-subtract-dayTimeDuration-from-date">subtract-dayTimeDuration-from-date</a>&#160;
+<a href=
+"#func-subtract-dayTimeDuration-from-dateTime">subtract-dayTimeDuration-from-dateTime</a>&#160;
+<a href=
+"#func-subtract-dayTimeDuration-from-time">subtract-dayTimeDuration-from-time</a>&#160;
+<a href=
+"#func-subtract-dayTimeDurations">subtract-dayTimeDurations</a>&#160;
+<a href="#func-subtract-times">subtract-times</a>&#160; <a href=
+"#func-subtract-yearMonthDuration-from-date">subtract-yearMonthDuration-from-date</a>&#160;
+<a href=
+"#func-subtract-yearMonthDuration-from-dateTime">subtract-yearMonthDuration-from-dateTime</a>&#160;
+<a href=
+"#func-subtract-yearMonthDurations">subtract-yearMonthDurations</a>&#160;
+<a href="#func-sum">sum</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-tail">tail</a>&#160; <a href=
+"#func-math-tan">tan</a>&#160; <a href=
+"#func-time-equal">time-equal</a>&#160; <a href=
+"#func-time-greater-than">time-greater-than</a>&#160; <a href=
+"#func-time-less-than">time-less-than</a>&#160; <a href=
+"#func-timezone-from-date">timezone-from-date</a>&#160; <a href=
+"#func-timezone-from-dateTime">timezone-from-dateTime</a>&#160;
+<a href="#func-timezone-from-time">timezone-from-time</a>&#160;
+<a href="#func-to">to</a>&#160; <a href=
+"#func-tokenize">tokenize</a>&#160; <a href=
+"#func-trace">trace</a>&#160; <a href=
+"#func-translate">translate</a>&#160; <a href=
+"#func-true">true</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-union">union</a>&#160; <a href=
+"#func-unordered">unordered</a>&#160; <a href=
+"#func-unparsed-text">unparsed-text</a>&#160; <a href=
+"#func-unparsed-text-available">unparsed-text-available</a>&#160;
+<a href="#func-unparsed-text-lines">unparsed-text-lines</a>&#160;
+<a href="#func-upper-case">upper-case</a>&#160; <a href=
+"#func-uri-collection">uri-collection</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-year-from-date">year-from-date</a>&#160; <a href=
+"#func-year-from-dateTime">year-from-dateTime</a>&#160; <a href=
+"#func-yearMonthDuration-greater-than">yearMonthDuration-greater-than</a>&#160;
+<a href=
+"#func-yearMonthDuration-less-than">yearMonthDuration-less-than</a>&#160;
+<a href=
+"#func-years-from-duration">years-from-duration</a>&#160;</p>
+</li>
+<li>
+<p><a href="#func-zero-or-one">zero-or-one</a>&#160;</p>
+</li>
+</ul>
+</div>
+<div class="toc">
+<h2><a name="contents" id="contents"></a>Table of Contents</h2>
+<p class="toc">1 <a href="#intro">Introduction</a><br />
+&#160;&#160;&#160;&#160;1.1 <a href=
+"#conformance">Conformance</a><br />
+&#160;&#160;&#160;&#160;1.2 <a href=
+"#namespace-prefixes">Namespaces and prefixes</a><br />
+&#160;&#160;&#160;&#160;1.3 <a href="#func-overloading">Function
+overloading</a><br />
+&#160;&#160;&#160;&#160;1.4 <a href="#func-signatures">Function
+signatures and descriptions</a><br />
+&#160;&#160;&#160;&#160;1.5 <a href="#datatypes">Type
+system</a><br />
+&#160;&#160;&#160;&#160;1.6 <a href=
+"#terminology">Terminology</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1.6.1 <a href=
+"#character-terminology">Strings, characters, and
+codepoints</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1.6.2 <a href=
+"#namespace-terminology">Namespaces and URIs</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1.6.3 <a href=
+"#conformance-terminology">Conformance terminology</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1.6.4 <a href=
+"#properties-of-functions">Properties of functions</a><br />
+2 <a href="#accessors">Accessors</a><br />
+&#160;&#160;&#160;&#160;2.1 <a href=
+"#func-node-name">fn:node-name</a><br />
+&#160;&#160;&#160;&#160;2.2 <a href=
+"#func-nilled">fn:nilled</a><br />
+&#160;&#160;&#160;&#160;2.3 <a href=
+"#func-string">fn:string</a><br />
+&#160;&#160;&#160;&#160;2.4 <a href="#func-data">fn:data</a><br />
+&#160;&#160;&#160;&#160;2.5 <a href=
+"#func-base-uri">fn:base-uri</a><br />
+&#160;&#160;&#160;&#160;2.6 <a href=
+"#func-document-uri">fn:document-uri</a><br />
3 <a href="#errors-and-diagnostics">Errors and
-diagnostics</a>
- <br/>
- 3.1 <a href="#errors">Raising errors</a>
- <br/>
- 3.1.1 <a href="#func-error">fn:error</a>
- <br/>
- 3.2 <a href="#diagnostics">Diagnostic tracing</a>
- <br/>
- 3.2.1 <a href="#func-trace">fn:trace</a>
- <br/>
+diagnostics</a><br />
+&#160;&#160;&#160;&#160;3.1 <a href="#errors">Raising
+errors</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.1.1 <a href=
+"#func-error">fn:error</a><br />
+&#160;&#160;&#160;&#160;3.2 <a href="#diagnostics">Diagnostic
+tracing</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3.2.1 <a href=
+"#func-trace">fn:trace</a><br />
4 <a href="#numeric-functions">Functions and operators on
-numerics</a>
- <br/>
- 4.1 <a href="#numeric-types">Numeric types</a>
- <br/>
- 4.2 <a href="#op.numeric">Arithmetic operators on numeric
-values</a>
- <br/>
- 4.2.1 <a href="#func-numeric-add">op:numeric-add</a>
- <br/>
- 4.2.2 <a href="#func-numeric-subtract">op:numeric-subtract</a>
- <br/>
- 4.2.3 <a href="#func-numeric-multiply">op:numeric-multiply</a>
- <br/>
- 4.2.4 <a href="#func-numeric-divide">op:numeric-divide</a>
- <br/>
- 4.2.5 <a href="#func-numeric-integer-divide">op:numeric-integer-divide</a>
- <br/>
- 4.2.6 <a href="#func-numeric-mod">op:numeric-mod</a>
- <br/>
- 4.2.7 <a href="#func-numeric-unary-plus">op:numeric-unary-plus</a>
- <br/>
- 4.2.8 <a href="#func-numeric-unary-minus">op:numeric-unary-minus</a>
- <br/>
- 4.3 <a href="#comp.numeric">Comparison operators on numeric
-values</a>
- <br/>
- 4.3.1 <a href="#func-numeric-equal">op:numeric-equal</a>
- <br/>
- 4.3.2 <a href="#func-numeric-less-than">op:numeric-less-than</a>
- <br/>
- 4.3.3 <a href="#func-numeric-greater-than">op:numeric-greater-than</a>
- <br/>
- 4.4 <a href="#numeric-value-functions">Functions on numeric
-values</a>
- <br/>
- 4.4.1 <a href="#func-abs">fn:abs</a>
- <br/>
- 4.4.2 <a href="#func-ceiling">fn:ceiling</a>
- <br/>
- 4.4.3 <a href="#func-floor">fn:floor</a>
- <br/>
- 4.4.4 <a href="#func-round">fn:round</a>
- <br/>
- 4.4.5 <a href="#func-round-half-to-even">fn:round-half-to-even</a>
- <br/>
- 4.5 <a href="#formatting-integers">Formatting
-integers</a>
- <br/>
- 4.5.1 <a href="#func-format-integer">fn:format-integer</a>
- <br/>
- 4.6 <a href="#formatting-numbers">Formatting numbers</a>
- <br/>
- 4.6.1 <a href="#defining-decimal-format">Defining a decimal
-format</a>
- <br/>
- 4.6.2 <a href="#func-format-number">fn:format-number</a>
- <br/>
- 4.6.3 <a href="#syntax-of-picture-string">Syntax of the
-picture string</a>
- <br/>
- 4.6.4 <a href="#analysing-picture-string">Analysing the
-picture string</a>
- <br/>
- 4.6.5 <a href="#formatting-the-number">Formatting the
-number</a>
- <br/>
- 4.7 <a href="#trigonometry">Trigonometric and exponential
-functions</a>
- <br/>
- 4.7.1 <a href="#func-pi">math:pi</a>
- <br/>
- 4.7.2 <a href="#func-exp">math:exp</a>
- <br/>
- 4.7.3 <a href="#func-exp10">math:exp10</a>
- <br/>
- 4.7.4 <a href="#func-log">math:log</a>
- <br/>
- 4.7.5 <a href="#func-log10">math:log10</a>
- <br/>
- 4.7.6 <a href="#func-pow">math:pow</a>
- <br/>
- 4.7.7 <a href="#func-sqrt">math:sqrt</a>
- <br/>
- 4.7.8 <a href="#func-sin">math:sin</a>
- <br/>
- 4.7.9 <a href="#func-cos">math:cos</a>
- <br/>
- 4.7.10 <a href="#func-tan">math:tan</a>
- <br/>
- 4.7.11 <a href="#func-asin">math:asin</a>
- <br/>
- 4.7.12 <a href="#func-acos">math:acos</a>
- <br/>
- 4.7.13 <a href="#func-atan">math:atan</a>
- <br/>
- 4.7.14 <a href="#func-atan2">math:atan2</a>
- <br/>
-5 <a href="#string-functions">Functions on strings</a>
- <br/>
- 5.1 <a href="#string-types">String types</a>
- <br/>
- 5.2 <a href="#func-assemble-disassemble-string">Functions to
-assemble and disassemble strings</a>
- <br/>
- 5.2.1 <a href="#func-codepoints-to-string">fn:codepoints-to-string</a>
- <br/>
- 5.2.2 <a href="#func-string-to-codepoints">fn:string-to-codepoints</a>
- <br/>
- 5.3 <a href="#string-compare">Comparison of strings</a>
- <br/>
- 5.3.1 <a href="#collations">Collations</a>
- <br/>
- 5.3.2 <a href="#codepoint-collation">The Unicode Codepoint
-Collation</a>
- <br/>
- 5.3.3 <a href="#choosing-a-collation">Choosing a
-collation</a>
- <br/>
- 5.3.4 <a href="#func-compare">fn:compare</a>
- <br/>
- 5.3.5 <a href="#func-codepoint-equal">fn:codepoint-equal</a>
- <br/>
- 5.4 <a href="#string-value-functions">Functions on string
-values</a>
- <br/>
- 5.4.1 <a href="#func-concat">fn:concat</a>
- <br/>
- 5.4.2 <a href="#func-string-join">fn:string-join</a>
- <br/>
- 5.4.3 <a href="#func-substring">fn:substring</a>
- <br/>
- 5.4.4 <a href="#func-string-length">fn:string-length</a>
- <br/>
- 5.4.5 <a href="#func-normalize-space">fn:normalize-space</a>
- <br/>
- 5.4.6 <a href="#func-normalize-unicode">fn:normalize-unicode</a>
- <br/>
- 5.4.7 <a href="#func-upper-case">fn:upper-case</a>
- <br/>
- 5.4.8 <a href="#func-lower-case">fn:lower-case</a>
- <br/>
- 5.4.9 <a href="#func-translate">fn:translate</a>
- <br/>
- 5.5 <a href="#substring.functions">Functions based on substring
-matching</a>
- <br/>
- 5.5.1 <a href="#func-contains">fn:contains</a>
- <br/>
- 5.5.2 <a href="#func-starts-with">fn:starts-with</a>
- <br/>
- 5.5.3 <a href="#func-ends-with">fn:ends-with</a>
- <br/>
- 5.5.4 <a href="#func-substring-before">fn:substring-before</a>
- <br/>
- 5.5.5 <a href="#func-substring-after">fn:substring-after</a>
- <br/>
- 5.6 <a href="#string.match">String functions that use regular
-expressions</a>
- <br/>
- 5.6.1 <a href="#regex-syntax">Regular expression
-syntax</a>
- <br/>
- 5.6.2 <a href="#func-matches">fn:matches</a>
- <br/>
- 5.6.3 <a href="#func-replace">fn:replace</a>
- <br/>
- 5.6.4 <a href="#func-tokenize">fn:tokenize</a>
- <br/>
- 5.6.5 <a href="#func-analyze-string">fn:analyze-string</a>
- <br/>
+numerics</a><br />
+&#160;&#160;&#160;&#160;4.1 <a href="#numeric-types">Numeric
+types</a><br />
+&#160;&#160;&#160;&#160;4.2 <a href="#op.numeric">Arithmetic
+operators on numeric values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.1 <a href=
+"#func-numeric-add">op:numeric-add</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.2 <a href=
+"#func-numeric-subtract">op:numeric-subtract</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.3 <a href=
+"#func-numeric-multiply">op:numeric-multiply</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.4 <a href=
+"#func-numeric-divide">op:numeric-divide</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.5 <a href=
+"#func-numeric-integer-divide">op:numeric-integer-divide</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.6 <a href=
+"#func-numeric-mod">op:numeric-mod</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.7 <a href=
+"#func-numeric-unary-plus">op:numeric-unary-plus</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.2.8 <a href=
+"#func-numeric-unary-minus">op:numeric-unary-minus</a><br />
+&#160;&#160;&#160;&#160;4.3 <a href="#comp.numeric">Comparison
+operators on numeric values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.3.1 <a href=
+"#func-numeric-equal">op:numeric-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.3.2 <a href=
+"#func-numeric-less-than">op:numeric-less-than</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.3.3 <a href=
+"#func-numeric-greater-than">op:numeric-greater-than</a><br />
+&#160;&#160;&#160;&#160;4.4 <a href=
+"#numeric-value-functions">Functions on numeric values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.4.1 <a href=
+"#func-abs">fn:abs</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.4.2 <a href=
+"#func-ceiling">fn:ceiling</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.4.3 <a href=
+"#func-floor">fn:floor</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.4.4 <a href=
+"#func-round">fn:round</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.4.5 <a href=
+"#func-round-half-to-even">fn:round-half-to-even</a><br />
+&#160;&#160;&#160;&#160;4.5 <a href="#parsing-numbers">Parsing
+numbers</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.5.1 <a href=
+"#func-number">fn:number</a><br />
+&#160;&#160;&#160;&#160;4.6 <a href=
+"#formatting-integers">Formatting integers</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.6.1 <a href=
+"#func-format-integer">fn:format-integer</a><br />
+&#160;&#160;&#160;&#160;4.7 <a href=
+"#formatting-numbers">Formatting numbers</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.7.1 <a href=
+"#defining-decimal-format">Defining a decimal format</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.7.2 <a href=
+"#func-format-number">fn:format-number</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.7.3 <a href=
+"#syntax-of-picture-string">Syntax of the picture string</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.7.4 <a href=
+"#analysing-picture-string">Analysing the picture string</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.7.5 <a href=
+"#formatting-the-number">Formatting the number</a><br />
+&#160;&#160;&#160;&#160;4.8 <a href="#trigonometry">Trigonometric
+and exponential functions</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.1 <a href=
+"#func-math-pi">math:pi</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.2 <a href=
+"#func-math-exp">math:exp</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.3 <a href=
+"#func-math-exp10">math:exp10</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.4 <a href=
+"#func-math-log">math:log</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.5 <a href=
+"#func-math-log10">math:log10</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.6 <a href=
+"#func-math-pow">math:pow</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.7 <a href=
+"#func-math-sqrt">math:sqrt</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.8 <a href=
+"#func-math-sin">math:sin</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.9 <a href=
+"#func-math-cos">math:cos</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.10 <a href=
+"#func-math-tan">math:tan</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.11 <a href=
+"#func-math-asin">math:asin</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.12 <a href=
+"#func-math-acos">math:acos</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.13 <a href=
+"#func-math-atan">math:atan</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4.8.14 <a href=
+"#func-math-atan2">math:atan2</a><br />
+5 <a href="#string-functions">Functions on strings</a><br />
+&#160;&#160;&#160;&#160;5.1 <a href="#string-types">String
+types</a><br />
+&#160;&#160;&#160;&#160;5.2 <a href=
+"#func-assemble-disassemble-string">Functions to assemble and
+disassemble strings</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.1 <a href=
+"#func-codepoints-to-string">fn:codepoints-to-string</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.2.2 <a href=
+"#func-string-to-codepoints">fn:string-to-codepoints</a><br />
+&#160;&#160;&#160;&#160;5.3 <a href="#string-compare">Comparison of
+strings</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.3.1 <a href=
+"#collations">Collations</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.3.2 <a href=
+"#codepoint-collation">The Unicode Codepoint Collation</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.3.3 <a href=
+"#choosing-a-collation">Choosing a collation</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.3.4 <a href=
+"#func-compare">fn:compare</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.3.5 <a href=
+"#func-codepoint-equal">fn:codepoint-equal</a><br />
+&#160;&#160;&#160;&#160;5.4 <a href=
+"#string-value-functions">Functions on string values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.4.1 <a href=
+"#func-concat">fn:concat</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.4.2 <a href=
+"#func-string-join">fn:string-join</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.4.3 <a href=
+"#func-substring">fn:substring</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.4.4 <a href=
+"#func-string-length">fn:string-length</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.4.5 <a href=
+"#func-normalize-space">fn:normalize-space</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.4.6 <a href=
+"#func-normalize-unicode">fn:normalize-unicode</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.4.7 <a href=
+"#func-upper-case">fn:upper-case</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.4.8 <a href=
+"#func-lower-case">fn:lower-case</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.4.9 <a href=
+"#func-translate">fn:translate</a><br />
+&#160;&#160;&#160;&#160;5.5 <a href=
+"#substring.functions">Functions based on substring
+matching</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.5.1 <a href=
+"#func-contains">fn:contains</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.5.2 <a href=
+"#func-starts-with">fn:starts-with</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.5.3 <a href=
+"#func-ends-with">fn:ends-with</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.5.4 <a href=
+"#func-substring-before">fn:substring-before</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.5.5 <a href=
+"#func-substring-after">fn:substring-after</a><br />
+&#160;&#160;&#160;&#160;5.6 <a href="#string.match">String
+functions that use regular expressions</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.6.1 <a href=
+"#regex-syntax">Regular expression syntax</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.6.2 <a href=
+"#func-matches">fn:matches</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.6.3 <a href=
+"#func-replace">fn:replace</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.6.4 <a href=
+"#func-tokenize">fn:tokenize</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;5.6.5 <a href=
+"#func-analyze-string">fn:analyze-string</a><br />
6 <a href="#anyURI-functions">Functions that manipulate
-URIs</a>
- <br/>
- 6.1 <a href="#func-resolve-uri">fn:resolve-uri</a>
- <br/>
- 6.2 <a href="#func-encode-for-uri">fn:encode-for-uri</a>
- <br/>
- 6.3 <a href="#func-iri-to-uri">fn:iri-to-uri</a>
- <br/>
- 6.4 <a href="#func-escape-html-uri">fn:escape-html-uri</a>
- <br/>
+URIs</a><br />
+&#160;&#160;&#160;&#160;6.1 <a href=
+"#func-resolve-uri">fn:resolve-uri</a><br />
+&#160;&#160;&#160;&#160;6.2 <a href=
+"#func-encode-for-uri">fn:encode-for-uri</a><br />
+&#160;&#160;&#160;&#160;6.3 <a href=
+"#func-iri-to-uri">fn:iri-to-uri</a><br />
+&#160;&#160;&#160;&#160;6.4 <a href=
+"#func-escape-html-uri">fn:escape-html-uri</a><br />
7 <a href="#boolean-functions">Functions and operators on Boolean
-values</a>
- <br/>
- 7.1 <a href="#boolean-constructors">Boolean constant
-functions</a>
- <br/>
- 7.1.1 <a href="#func-true">fn:true</a>
- <br/>
- 7.1.2 <a href="#func-false">fn:false</a>
- <br/>
- 7.2 <a href="#op.boolean">Operators on Boolean values</a>
- <br/>
- 7.2.1 <a href="#func-boolean-equal">op:boolean-equal</a>
- <br/>
- 7.2.2 <a href="#func-boolean-less-than">op:boolean-less-than</a>
- <br/>
- 7.2.3 <a href="#func-boolean-greater-than">op:boolean-greater-than</a>
- <br/>
- 7.3 <a href="#boolean-value-functions">Functions on Boolean
-values</a>
- <br/>
- 7.3.1 <a href="#func-boolean">fn:boolean</a>
- <br/>
- 7.3.2 <a href="#func-not">fn:not</a>
- <br/>
+values</a><br />
+&#160;&#160;&#160;&#160;7.1 <a href="#boolean-constructors">Boolean
+constant functions</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.1.1 <a href=
+"#func-true">fn:true</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.1.2 <a href=
+"#func-false">fn:false</a><br />
+&#160;&#160;&#160;&#160;7.2 <a href="#op.boolean">Operators on
+Boolean values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.2.1 <a href=
+"#func-boolean-equal">op:boolean-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.2.2 <a href=
+"#func-boolean-less-than">op:boolean-less-than</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.2.3 <a href=
+"#func-boolean-greater-than">op:boolean-greater-than</a><br />
+&#160;&#160;&#160;&#160;7.3 <a href=
+"#boolean-value-functions">Functions on Boolean values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.3.1 <a href=
+"#func-boolean">fn:boolean</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;7.3.2 <a href=
+"#func-not">fn:not</a><br />
8 <a href="#durations">Functions and operators on
-durations</a>
- <br/>
- 8.1 <a href="#duration-subtypes">Two totally ordered subtypes
-of duration</a>
- <br/>
- 8.1.1 <a href="#dt-yearMonthDuration">xs:yearMonthDuration</a>
- <br/>
- 8.1.2 <a href="#dt-dayTimeDuration">xs:dayTimeDuration</a>
- <br/>
- 8.2 <a href="#comp.duration">Comparison operators on
-durations</a>
- <br/>
- 8.2.1 <a href="#func-yearMonthDuration-less-than">op:yearMonthDuration-less-than</a>
- <br/>
-
- 8.2.2 <a href="#func-yearMonthDuration-greater-than">op:yearMonthDuration-greater-than</a>
- <br/>
-
- 8.2.3 <a href="#func-dayTimeDuration-less-than">op:dayTimeDuration-less-than</a>
- <br/>
-
- 8.2.4 <a href="#func-dayTimeDuration-greater-than">op:dayTimeDuration-greater-than</a>
- <br/>
-
- 8.2.5 <a href="#func-duration-equal">op:duration-equal</a>
- <br/>
- 8.3 <a href="#component-extraction-durations">Component
-extraction functions on durations</a>
- <br/>
- 8.3.1 <a href="#func-years-from-duration">fn:years-from-duration</a>
- <br/>
- 8.3.2 <a href="#func-months-from-duration">fn:months-from-duration</a>
- <br/>
- 8.3.3 <a href="#func-days-from-duration">fn:days-from-duration</a>
- <br/>
- 8.3.4 <a href="#func-hours-from-duration">fn:hours-from-duration</a>
- <br/>
- 8.3.5 <a href="#func-minutes-from-duration">fn:minutes-from-duration</a>
- <br/>
- 8.3.6 <a href="#func-seconds-from-duration">fn:seconds-from-duration</a>
- <br/>
- 8.4 <a href="#duration-arithmetic">Arithmetic operators on
-durations</a>
- <br/>
- 8.4.1 <a href="#func-add-yearMonthDurations">op:add-yearMonthDurations</a>
- <br/>
- 8.4.2 <a href="#func-subtract-yearMonthDurations">op:subtract-yearMonthDurations</a>
- <br/>
-
- 8.4.3 <a href="#func-multiply-yearMonthDuration">op:multiply-yearMonthDuration</a>
- <br/>
-
- 8.4.4 <a href="#func-divide-yearMonthDuration">op:divide-yearMonthDuration</a>
- <br/>
-
- 8.4.5 <a href="#func-divide-yearMonthDuration-by-yearMonthDuration">op:divide-yearMonthDuration-by-yearMonthDuration</a>
- <br/>
-
- 8.4.6 <a href="#func-add-dayTimeDurations">op:add-dayTimeDurations</a>
- <br/>
- 8.4.7 <a href="#func-subtract-dayTimeDurations">op:subtract-dayTimeDurations</a>
- <br/>
-
- 8.4.8 <a href="#func-multiply-dayTimeDuration">op:multiply-dayTimeDuration</a>
- <br/>
-
- 8.4.9 <a href="#func-divide-dayTimeDuration">op:divide-dayTimeDuration</a>
- <br/>
- 8.4.10 <a href="#func-divide-dayTimeDuration-by-dayTimeDuration">op:divide-dayTimeDuration-by-dayTimeDuration</a>
- <br/>
+durations</a><br />
+&#160;&#160;&#160;&#160;8.1 <a href="#duration-subtypes">Two
+totally ordered subtypes of duration</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.1 <a href=
+"#dt-yearMonthDuration">xs:yearMonthDuration</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.1.2 <a href=
+"#dt-dayTimeDuration">xs:dayTimeDuration</a><br />
+&#160;&#160;&#160;&#160;8.2 <a href="#comp.duration">Comparison
+operators on durations</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.2.1 <a href=
+"#func-yearMonthDuration-less-than">op:yearMonthDuration-less-than</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.2.2 <a href=
+"#func-yearMonthDuration-greater-than">op:yearMonthDuration-greater-than</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.2.3 <a href=
+"#func-dayTimeDuration-less-than">op:dayTimeDuration-less-than</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.2.4 <a href=
+"#func-dayTimeDuration-greater-than">op:dayTimeDuration-greater-than</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.2.5 <a href=
+"#func-duration-equal">op:duration-equal</a><br />
+&#160;&#160;&#160;&#160;8.3 <a href=
+"#component-extraction-durations">Component extraction functions on
+durations</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.3.1 <a href=
+"#func-years-from-duration">fn:years-from-duration</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.3.2 <a href=
+"#func-months-from-duration">fn:months-from-duration</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.3.3 <a href=
+"#func-days-from-duration">fn:days-from-duration</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.3.4 <a href=
+"#func-hours-from-duration">fn:hours-from-duration</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.3.5 <a href=
+"#func-minutes-from-duration">fn:minutes-from-duration</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.3.6 <a href=
+"#func-seconds-from-duration">fn:seconds-from-duration</a><br />
+&#160;&#160;&#160;&#160;8.4 <a href=
+"#duration-arithmetic">Arithmetic operators on durations</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.4.1 <a href=
+"#func-add-yearMonthDurations">op:add-yearMonthDurations</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.4.2 <a href=
+"#func-subtract-yearMonthDurations">op:subtract-yearMonthDurations</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.4.3 <a href=
+"#func-multiply-yearMonthDuration">op:multiply-yearMonthDuration</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.4.4 <a href=
+"#func-divide-yearMonthDuration">op:divide-yearMonthDuration</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.4.5 <a href=
+"#func-divide-yearMonthDuration-by-yearMonthDuration">op:divide-yearMonthDuration-by-yearMonthDuration</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.4.6 <a href=
+"#func-add-dayTimeDurations">op:add-dayTimeDurations</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.4.7 <a href=
+"#func-subtract-dayTimeDurations">op:subtract-dayTimeDurations</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.4.8 <a href=
+"#func-multiply-dayTimeDuration">op:multiply-dayTimeDuration</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.4.9 <a href=
+"#func-divide-dayTimeDuration">op:divide-dayTimeDuration</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8.4.10 <a href=
+"#func-divide-dayTimeDuration-by-dayTimeDuration">op:divide-dayTimeDuration-by-dayTimeDuration</a><br />
9 <a href="#dates-times">Functions and operators on dates and
-times</a>
- <br/>
- 9.1 <a href="#date-time-types">Date and time types</a>
- <br/>
- 9.1.1 <a href="#date-time-duration-conformance">Limits and
-precision</a>
- <br/>
- 9.2 <a href="#date-time-values">Date/time datatype
-values</a>
- <br/>
- 9.2.1 <a href="#date-time-lexical-mapping">Examples</a>
- <br/>
- 9.3 <a href="#constructing-dateTime">Constructing a
-dateTime</a>
- <br/>
- 9.3.1 <a href="#func-dateTime">fn:dateTime</a>
- <br/>
- 9.4 <a href="#comp.datetime">Comparison operators on duration,
-date and time values</a>
- <br/>
- 9.4.1 <a href="#func-dateTime-equal">op:dateTime-equal</a>
- <br/>
- 9.4.2 <a href="#func-dateTime-less-than">op:dateTime-less-than</a>
- <br/>
- 9.4.3 <a href="#func-dateTime-greater-than">op:dateTime-greater-than</a>
- <br/>
- 9.4.4 <a href="#func-date-equal">op:date-equal</a>
- <br/>
- 9.4.5 <a href="#func-date-less-than">op:date-less-than</a>
- <br/>
- 9.4.6 <a href="#func-date-greater-than">op:date-greater-than</a>
- <br/>
- 9.4.7 <a href="#func-time-equal">op:time-equal</a>
- <br/>
- 9.4.8 <a href="#func-time-less-than">op:time-less-than</a>
- <br/>
- 9.4.9 <a href="#func-time-greater-than">op:time-greater-than</a>
- <br/>
- 9.4.10 <a href="#func-gYearMonth-equal">op:gYearMonth-equal</a>
- <br/>
- 9.4.11 <a href="#func-gYear-equal">op:gYear-equal</a>
- <br/>
- 9.4.12 <a href="#func-gMonthDay-equal">op:gMonthDay-equal</a>
- <br/>
- 9.4.13 <a href="#func-gMonth-equal">op:gMonth-equal</a>
- <br/>
- 9.4.14 <a href="#func-gDay-equal">op:gDay-equal</a>
- <br/>
- 9.5 <a href="#component-extraction-dateTime">Component
-extraction functions on dates and times</a>
- <br/>
- 9.5.1 <a href="#func-year-from-dateTime">fn:year-from-dateTime</a>
- <br/>
- 9.5.2 <a href="#func-month-from-dateTime">fn:month-from-dateTime</a>
- <br/>
- 9.5.3 <a href="#func-day-from-dateTime">fn:day-from-dateTime</a>
- <br/>
- 9.5.4 <a href="#func-hours-from-dateTime">fn:hours-from-dateTime</a>
- <br/>
- 9.5.5 <a href="#func-minutes-from-dateTime">fn:minutes-from-dateTime</a>
- <br/>
- 9.5.6 <a href="#func-seconds-from-dateTime">fn:seconds-from-dateTime</a>
- <br/>
- 9.5.7 <a href="#func-timezone-from-dateTime">fn:timezone-from-dateTime</a>
- <br/>
- 9.5.8 <a href="#func-year-from-date">fn:year-from-date</a>
- <br/>
- 9.5.9 <a href="#func-month-from-date">fn:month-from-date</a>
- <br/>
- 9.5.10 <a href="#func-day-from-date">fn:day-from-date</a>
- <br/>
- 9.5.11 <a href="#func-timezone-from-date">fn:timezone-from-date</a>
- <br/>
- 9.5.12 <a href="#func-hours-from-time">fn:hours-from-time</a>
- <br/>
- 9.5.13 <a href="#func-minutes-from-time">fn:minutes-from-time</a>
- <br/>
- 9.5.14 <a href="#func-seconds-from-time">fn:seconds-from-time</a>
- <br/>
- 9.5.15 <a href="#func-timezone-from-time">fn:timezone-from-time</a>
- <br/>
- 9.6 <a href="#timezone.functions">Timezone adjustment functions
-on dates and time values</a>
- <br/>
- 9.6.1 <a href="#func-adjust-dateTime-to-timezone">fn:adjust-dateTime-to-timezone</a>
- <br/>
-
- 9.6.2 <a href="#func-adjust-date-to-timezone">fn:adjust-date-to-timezone</a>
- <br/>
-
- 9.6.3 <a href="#func-adjust-time-to-timezone">fn:adjust-time-to-timezone</a>
- <br/>
-
- 9.7 <a href="#dateTime-arithmetic">Arithmetic operators on
-durations, dates and times</a>
- <br/>
- 9.7.1 <a href="#duration-limits">Limits and
-precision</a>
- <br/>
- 9.7.2 <a href="#func-subtract-dateTimes">op:subtract-dateTimes</a>
- <br/>
- 9.7.3 <a href="#func-subtract-dates">op:subtract-dates</a>
- <br/>
- 9.7.4 <a href="#func-subtract-times">op:subtract-times</a>
- <br/>
- 9.7.5 <a href="#func-add-yearMonthDuration-to-dateTime">op:add-yearMonthDuration-to-dateTime</a>
- <br/>
-
- 9.7.6 <a href="#func-add-dayTimeDuration-to-dateTime">op:add-dayTimeDuration-to-dateTime</a>
- <br/>
-
- 9.7.7 <a href="#func-subtract-yearMonthDuration-from-dateTime">op:subtract-yearMonthDuration-from-dateTime</a>
- <br/>
-
- 9.7.8 <a href="#func-subtract-dayTimeDuration-from-dateTime">op:subtract-dayTimeDuration-from-dateTime</a>
- <br/>
-
- 9.7.9 <a href="#func-add-yearMonthDuration-to-date">op:add-yearMonthDuration-to-date</a>
- <br/>
-
- 9.7.10 <a href="#func-add-dayTimeDuration-to-date">op:add-dayTimeDuration-to-date</a>
- <br/>
-
- 9.7.11 <a href="#func-subtract-yearMonthDuration-from-date">op:subtract-yearMonthDuration-from-date</a>
- <br/>
-
- 9.7.12 <a href="#func-subtract-dayTimeDuration-from-date">op:subtract-dayTimeDuration-from-date</a>
- <br/>
-
- 9.7.13 <a href="#func-add-dayTimeDuration-to-time">op:add-dayTimeDuration-to-time</a>
- <br/>
-
- 9.7.14 <a href="#func-subtract-dayTimeDuration-from-time">op:subtract-dayTimeDuration-from-time</a>
- <br/>
-
- 9.8 <a href="#formatting-dates-and-times">Formatting dates and
-times</a>
- <br/>
- 9.8.1 <a href="#func-format-dateTime">fn:format-dateTime</a>
- <br/>
- 9.8.2 <a href="#func-format-date">fn:format-date</a>
- <br/>
- 9.8.3 <a href="#func-format-time">fn:format-time</a>
- <br/>
- 9.8.4 <a href="#rules-for-datetime-formatting">The
-date/time formatting functions</a>
- <br/>
- 9.8.5 <a href="#date-time-examples">Examples of date and
-time formatting</a>
- <br/>
-10 <a href="#QName-funcs">Functions related to QNames</a>
- <br/>
- 10.1 <a href="#QName-constructors">Functions to create a
-QName</a>
- <br/>
- 10.1.1 <a href="#func-resolve-QName">fn:resolve-QName</a>
- <br/>
- 10.1.2 <a href="#func-QName">fn:QName</a>
- <br/>
- 10.2 <a href="#QName-functions">Functions and operators related
-to QNames</a>
- <br/>
- 10.2.1 <a href="#func-QName-equal">op:QName-equal</a>
- <br/>
- 10.2.2 <a href="#func-prefix-from-QName">fn:prefix-from-QName</a>
- <br/>
- 10.2.3 <a href="#func-local-name-from-QName">fn:local-name-from-QName</a>
- <br/>
- 10.2.4 <a href="#func-namespace-uri-from-QName">fn:namespace-uri-from-QName</a>
- <br/>
-
- 10.2.5 <a href="#func-namespace-uri-for-prefix">fn:namespace-uri-for-prefix</a>
- <br/>
-
- 10.2.6 <a href="#func-in-scope-prefixes">fn:in-scope-prefixes</a>
- <br/>
+times</a><br />
+&#160;&#160;&#160;&#160;9.1 <a href="#date-time-types">Date and
+time types</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.1.1 <a href=
+"#date-time-duration-conformance">Limits and precision</a><br />
+&#160;&#160;&#160;&#160;9.2 <a href="#date-time-values">Date/time
+datatype values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.2.1 <a href=
+"#date-time-lexical-mapping">Examples</a><br />
+&#160;&#160;&#160;&#160;9.3 <a href=
+"#constructing-dateTime">Constructing a dateTime</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.3.1 <a href=
+"#func-dateTime">fn:dateTime</a><br />
+&#160;&#160;&#160;&#160;9.4 <a href="#comp.datetime">Comparison
+operators on duration, date and time values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.1 <a href=
+"#func-dateTime-equal">op:dateTime-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.2 <a href=
+"#func-dateTime-less-than">op:dateTime-less-than</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.3 <a href=
+"#func-dateTime-greater-than">op:dateTime-greater-than</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.4 <a href=
+"#func-date-equal">op:date-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.5 <a href=
+"#func-date-less-than">op:date-less-than</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.6 <a href=
+"#func-date-greater-than">op:date-greater-than</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.7 <a href=
+"#func-time-equal">op:time-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.8 <a href=
+"#func-time-less-than">op:time-less-than</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.9 <a href=
+"#func-time-greater-than">op:time-greater-than</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.10 <a href=
+"#func-gYearMonth-equal">op:gYearMonth-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.11 <a href=
+"#func-gYear-equal">op:gYear-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.12 <a href=
+"#func-gMonthDay-equal">op:gMonthDay-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.13 <a href=
+"#func-gMonth-equal">op:gMonth-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.4.14 <a href=
+"#func-gDay-equal">op:gDay-equal</a><br />
+&#160;&#160;&#160;&#160;9.5 <a href=
+"#component-extraction-dateTime">Component extraction functions on
+dates and times</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.1 <a href=
+"#func-year-from-dateTime">fn:year-from-dateTime</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.2 <a href=
+"#func-month-from-dateTime">fn:month-from-dateTime</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.3 <a href=
+"#func-day-from-dateTime">fn:day-from-dateTime</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.4 <a href=
+"#func-hours-from-dateTime">fn:hours-from-dateTime</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.5 <a href=
+"#func-minutes-from-dateTime">fn:minutes-from-dateTime</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.6 <a href=
+"#func-seconds-from-dateTime">fn:seconds-from-dateTime</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.7 <a href=
+"#func-timezone-from-dateTime">fn:timezone-from-dateTime</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.8 <a href=
+"#func-year-from-date">fn:year-from-date</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.9 <a href=
+"#func-month-from-date">fn:month-from-date</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.10 <a href=
+"#func-day-from-date">fn:day-from-date</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.11 <a href=
+"#func-timezone-from-date">fn:timezone-from-date</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.12 <a href=
+"#func-hours-from-time">fn:hours-from-time</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.13 <a href=
+"#func-minutes-from-time">fn:minutes-from-time</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.14 <a href=
+"#func-seconds-from-time">fn:seconds-from-time</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.5.15 <a href=
+"#func-timezone-from-time">fn:timezone-from-time</a><br />
+&#160;&#160;&#160;&#160;9.6 <a href="#timezone.functions">Timezone
+adjustment functions on dates and time values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.6.1 <a href=
+"#func-adjust-dateTime-to-timezone">fn:adjust-dateTime-to-timezone</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.6.2 <a href=
+"#func-adjust-date-to-timezone">fn:adjust-date-to-timezone</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.6.3 <a href=
+"#func-adjust-time-to-timezone">fn:adjust-time-to-timezone</a><br />
+
+&#160;&#160;&#160;&#160;9.7 <a href=
+"#dateTime-arithmetic">Arithmetic operators on durations, dates and
+times</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.1 <a href=
+"#duration-limits">Limits and precision</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.2 <a href=
+"#func-subtract-dateTimes">op:subtract-dateTimes</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.3 <a href=
+"#func-subtract-dates">op:subtract-dates</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.4 <a href=
+"#func-subtract-times">op:subtract-times</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.5 <a href=
+"#func-add-yearMonthDuration-to-dateTime">op:add-yearMonthDuration-to-dateTime</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.6 <a href=
+"#func-add-dayTimeDuration-to-dateTime">op:add-dayTimeDuration-to-dateTime</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.7 <a href=
+"#func-subtract-yearMonthDuration-from-dateTime">op:subtract-yearMonthDuration-from-dateTime</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.8 <a href=
+"#func-subtract-dayTimeDuration-from-dateTime">op:subtract-dayTimeDuration-from-dateTime</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.9 <a href=
+"#func-add-yearMonthDuration-to-date">op:add-yearMonthDuration-to-date</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.10 <a href=
+"#func-add-dayTimeDuration-to-date">op:add-dayTimeDuration-to-date</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.11 <a href=
+"#func-subtract-yearMonthDuration-from-date">op:subtract-yearMonthDuration-from-date</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.12 <a href=
+"#func-subtract-dayTimeDuration-from-date">op:subtract-dayTimeDuration-from-date</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.13 <a href=
+"#func-add-dayTimeDuration-to-time">op:add-dayTimeDuration-to-time</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.7.14 <a href=
+"#func-subtract-dayTimeDuration-from-time">op:subtract-dayTimeDuration-from-time</a><br />
+
+&#160;&#160;&#160;&#160;9.8 <a href=
+"#formatting-dates-and-times">Formatting dates and times</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.8.1 <a href=
+"#func-format-dateTime">fn:format-dateTime</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.8.2 <a href=
+"#func-format-date">fn:format-date</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.8.3 <a href=
+"#func-format-time">fn:format-time</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.8.4 <a href=
+"#rules-for-datetime-formatting">The date/time formatting
+functions</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;9.8.5 <a href=
+"#date-time-examples">Examples of date and time
+formatting</a><br />
+10 <a href="#QName-funcs">Functions related to QNames</a><br />
+&#160;&#160;&#160;&#160;10.1 <a href=
+"#QName-constructors">Functions to create a QName</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;10.1.1 <a href=
+"#func-resolve-QName">fn:resolve-QName</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;10.1.2 <a href=
+"#func-QName">fn:QName</a><br />
+&#160;&#160;&#160;&#160;10.2 <a href="#QName-functions">Functions
+and operators related to QNames</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;10.2.1 <a href=
+"#func-QName-equal">op:QName-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;10.2.2 <a href=
+"#func-prefix-from-QName">fn:prefix-from-QName</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;10.2.3 <a href=
+"#func-local-name-from-QName">fn:local-name-from-QName</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;10.2.4 <a href=
+"#func-namespace-uri-from-QName">fn:namespace-uri-from-QName</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;10.2.5 <a href=
+"#func-namespace-uri-for-prefix">fn:namespace-uri-for-prefix</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;10.2.6 <a href=
+"#func-in-scope-prefixes">fn:in-scope-prefixes</a><br />
11 <a href="#binary-functions">Operators on base64Binary and
-hexBinary</a>
- <br/>
- 11.1 <a href="#binary-value-comparisons">Comparisons of
-base64Binary and hexBinary values</a>
- <br/>
- 11.1.1 <a href="#func-hexBinary-equal">op:hexBinary-equal</a>
- <br/>
- 11.1.2 <a href="#func-base64Binary-equal">op:base64Binary-equal</a>
- <br/>
-12 <a href="#NOTATION-functions">Operators on NOTATION</a>
- <br/>
- 12.1 <a href="#func-NOTATION-equal">op:NOTATION-equal</a>
- <br/>
+hexBinary</a><br />
+&#160;&#160;&#160;&#160;11.1 <a href=
+"#binary-value-comparisons">Comparisons of base64Binary and
+hexBinary values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;11.1.1 <a href=
+"#func-hexBinary-equal">op:hexBinary-equal</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;11.1.2 <a href=
+"#func-base64Binary-equal">op:base64Binary-equal</a><br />
+12 <a href="#NOTATION-functions">Operators on NOTATION</a><br />
+&#160;&#160;&#160;&#160;12.1 <a href=
+"#func-NOTATION-equal">op:NOTATION-equal</a><br />
13 <a href="#node-functions">Functions and operators on
-nodes</a>
- <br/>
- 13.1 <a href="#func-name">fn:name</a>
- <br/>
- 13.2 <a href="#func-local-name">fn:local-name</a>
- <br/>
- 13.3 <a href="#func-namespace-uri">fn:namespace-uri</a>
- <br/>
- 13.4 <a href="#func-number">fn:number</a>
- <br/>
- 13.5 <a href="#func-lang">fn:lang</a>
- <br/>
- 13.6 <a href="#func-is-same-node">op:is-same-node</a>
- <br/>
- 13.7 <a href="#func-node-before">op:node-before</a>
- <br/>
- 13.8 <a href="#func-node-after">op:node-after</a>
- <br/>
- 13.9 <a href="#func-root">fn:root</a>
- <br/>
- 13.10 <a href="#func-has-children">fn:has-children</a>
- <br/>
- 13.11 <a href="#func-innermost">fn:innermost</a>
- <br/>
- 13.12 <a href="#func-outermost">fn:outermost</a>
- <br/>
+nodes</a><br />
+&#160;&#160;&#160;&#160;13.1 <a href="#func-name">fn:name</a><br />
+&#160;&#160;&#160;&#160;13.2 <a href=
+"#func-local-name">fn:local-name</a><br />
+&#160;&#160;&#160;&#160;13.3 <a href=
+"#func-namespace-uri">fn:namespace-uri</a><br />
+&#160;&#160;&#160;&#160;13.4 <a href="#func-lang">fn:lang</a><br />
+&#160;&#160;&#160;&#160;13.5 <a href=
+"#func-is-same-node">op:is-same-node</a><br />
+&#160;&#160;&#160;&#160;13.6 <a href=
+"#func-node-before">op:node-before</a><br />
+&#160;&#160;&#160;&#160;13.7 <a href=
+"#func-node-after">op:node-after</a><br />
+&#160;&#160;&#160;&#160;13.8 <a href="#func-root">fn:root</a><br />
+&#160;&#160;&#160;&#160;13.9 <a href="#func-path">fn:path</a><br />
+&#160;&#160;&#160;&#160;13.10 <a href=
+"#func-has-children">fn:has-children</a><br />
+&#160;&#160;&#160;&#160;13.11 <a href=
+"#func-innermost">fn:innermost</a><br />
+&#160;&#160;&#160;&#160;13.12 <a href=
+"#func-outermost">fn:outermost</a><br />
14 <a href="#sequence-functions">Functions and operators on
-sequences</a>
- <br/>
- 14.1 <a href="#general-seq-funcs">General functions and
-operators on sequences</a>
- <br/>
- 14.1.1 <a href="#func-concatenate">op:concatenate</a>
- <br/>
- 14.1.2 <a href="#func-empty">fn:empty</a>
- <br/>
- 14.1.3 <a href="#func-exists">fn:exists</a>
- <br/>
- 14.1.4 <a href="#func-head">fn:head</a>
- <br/>
- 14.1.5 <a href="#func-tail">fn:tail</a>
- <br/>
- 14.1.6 <a href="#func-insert-before">fn:insert-before</a>
- <br/>
- 14.1.7 <a href="#func-remove">fn:remove</a>
- <br/>
- 14.1.8 <a href="#func-reverse">fn:reverse</a>
- <br/>
- 14.1.9 <a href="#func-subsequence">fn:subsequence</a>
- <br/>
- 14.1.10 <a href="#func-unordered">fn:unordered</a>
- <br/>
- 14.2 <a href="#comparing-sequences">Functions that compare
-values in sequences</a>
- <br/>
- 14.2.1 <a href="#func-distinct-values">fn:distinct-values</a>
- <br/>
- 14.2.2 <a href="#func-index-of">fn:index-of</a>
- <br/>
- 14.2.3 <a href="#func-deep-equal">fn:deep-equal</a>
- <br/>
- 14.3 <a href="#cardinality-functions">Functions that test the
-cardinality of sequences</a>
- <br/>
- 14.3.1 <a href="#func-zero-or-one">fn:zero-or-one</a>
- <br/>
- 14.3.2 <a href="#func-one-or-more">fn:one-or-more</a>
- <br/>
- 14.3.3 <a href="#func-exactly-one">fn:exactly-one</a>
- <br/>
- 14.4 <a href="#union-intersection-except">Union, intersection
-and difference</a>
- <br/>
- 14.4.1 <a href="#func-union">op:union</a>
- <br/>
- 14.4.2 <a href="#func-intersect">op:intersect</a>
- <br/>
- 14.4.3 <a href="#func-except">op:except</a>
- <br/>
- 14.5 <a href="#aggregate-functions">Aggregate
-functions</a>
- <br/>
- 14.5.1 <a href="#func-count">fn:count</a>
- <br/>
- 14.5.2 <a href="#func-avg">fn:avg</a>
- <br/>
- 14.5.3 <a href="#func-max">fn:max</a>
- <br/>
- 14.5.4 <a href="#func-min">fn:min</a>
- <br/>
- 14.5.5 <a href="#func-sum">fn:sum</a>
- <br/>
- 14.6 <a href="#fns-that-generate-sequences">Functions and
-operators that generate sequences</a>
- <br/>
- 14.6.1 <a href="#func-to">op:to</a>
- <br/>
- 14.7 <a href="#fns-on-identifiers">Functions on node
-identifiers</a>
- <br/>
- 14.7.1 <a href="#func-id">fn:id</a>
- <br/>
- 14.7.2 <a href="#func-element-with-id">fn:element-with-id</a>
- <br/>
- 14.7.3 <a href="#func-idref">fn:idref</a>
- <br/>
- 14.7.4 <a href="#func-generate-id">fn:generate-id</a>
- <br/>
- 14.8 <a href="#fns-on-docs">Functions giving access to external
-information</a>
- <br/>
- 14.8.1 <a href="#func-doc">fn:doc</a>
- <br/>
- 14.8.2 <a href="#func-doc-available">fn:doc-available</a>
- <br/>
- 14.8.3 <a href="#func-collection">fn:collection</a>
- <br/>
- 14.8.4 <a href="#func-uri-collection">fn:uri-collection</a>
- <br/>
- 14.8.5 <a href="#func-unparsed-text">fn:unparsed-text</a>
- <br/>
- 14.8.6 <a href="#func-unparsed-text-lines">fn:unparsed-text-lines</a>
- <br/>
- 14.8.7 <a href="#func-unparsed-text-available">fn:unparsed-text-available</a>
- <br/>
-
- 14.8.8 <a href="#func-environment-variable">fn:environment-variable</a>
- <br/>
- 14.8.9 <a href="#func-available-environment-variables">fn:available-environment-variables</a>
- <br/>
-
- 14.9 <a href="#parsing-and-serializing">Parsing and
-serializing</a>
- <br/>
- 14.9.1 <a href="#func-parse-xml">fn:parse-xml</a>
- <br/>
- 14.9.2 <a href="#func-serialize">fn:serialize</a>
- <br/>
-15 <a href="#context">Context functions</a>
- <br/>
- 15.1 <a href="#func-position">fn:position</a>
- <br/>
- 15.2 <a href="#func-last">fn:last</a>
- <br/>
- 15.3 <a href="#func-current-dateTime">fn:current-dateTime</a>
- <br/>
- 15.4 <a href="#func-current-date">fn:current-date</a>
- <br/>
- 15.5 <a href="#func-current-time">fn:current-time</a>
- <br/>
- 15.6 <a href="#func-implicit-timezone">fn:implicit-timezone</a>
- <br/>
- 15.7 <a href="#func-default-collation">fn:default-collation</a>
- <br/>
- 15.8 <a href="#func-static-base-uri">fn:static-base-uri</a>
- <br/>
+sequences</a><br />
+&#160;&#160;&#160;&#160;14.1 <a href="#general-seq-funcs">General
+functions and operators on sequences</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.1.1 <a href=
+"#func-concatenate">op:concatenate</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.1.2 <a href=
+"#func-empty">fn:empty</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.1.3 <a href=
+"#func-exists">fn:exists</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.1.4 <a href=
+"#func-head">fn:head</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.1.5 <a href=
+"#func-tail">fn:tail</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.1.6 <a href=
+"#func-insert-before">fn:insert-before</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.1.7 <a href=
+"#func-remove">fn:remove</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.1.8 <a href=
+"#func-reverse">fn:reverse</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.1.9 <a href=
+"#func-subsequence">fn:subsequence</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.1.10 <a href=
+"#func-unordered">fn:unordered</a><br />
+&#160;&#160;&#160;&#160;14.2 <a href=
+"#comparing-sequences">Functions that compare values in
+sequences</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.2.1 <a href=
+"#func-distinct-values">fn:distinct-values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.2.2 <a href=
+"#func-index-of">fn:index-of</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.2.3 <a href=
+"#func-deep-equal">fn:deep-equal</a><br />
+&#160;&#160;&#160;&#160;14.3 <a href=
+"#cardinality-functions">Functions that test the cardinality of
+sequences</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.3.1 <a href=
+"#func-zero-or-one">fn:zero-or-one</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.3.2 <a href=
+"#func-one-or-more">fn:one-or-more</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.3.3 <a href=
+"#func-exactly-one">fn:exactly-one</a><br />
+&#160;&#160;&#160;&#160;14.4 <a href=
+"#union-intersection-except">Union, intersection and
+difference</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.4.1 <a href=
+"#func-union">op:union</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.4.2 <a href=
+"#func-intersect">op:intersect</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.4.3 <a href=
+"#func-except">op:except</a><br />
+&#160;&#160;&#160;&#160;14.5 <a href=
+"#aggregate-functions">Aggregate functions</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.5.1 <a href=
+"#func-count">fn:count</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.5.2 <a href=
+"#func-avg">fn:avg</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.5.3 <a href=
+"#func-max">fn:max</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.5.4 <a href=
+"#func-min">fn:min</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.5.5 <a href=
+"#func-sum">fn:sum</a><br />
+&#160;&#160;&#160;&#160;14.6 <a href=
+"#fns-that-generate-sequences">Functions and operators that
+generate sequences</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.6.1 <a href=
+"#func-to">op:to</a><br />
+&#160;&#160;&#160;&#160;14.7 <a href=
+"#fns-on-identifiers">Functions on node identifiers</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.7.1 <a href=
+"#func-id">fn:id</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.7.2 <a href=
+"#func-element-with-id">fn:element-with-id</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.7.3 <a href=
+"#func-idref">fn:idref</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.7.4 <a href=
+"#func-generate-id">fn:generate-id</a><br />
+&#160;&#160;&#160;&#160;14.8 <a href="#fns-on-docs">Functions
+giving access to external information</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.8.1 <a href=
+"#func-doc">fn:doc</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.8.2 <a href=
+"#func-doc-available">fn:doc-available</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.8.3 <a href=
+"#func-collection">fn:collection</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.8.4 <a href=
+"#func-uri-collection">fn:uri-collection</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.8.5 <a href=
+"#func-unparsed-text">fn:unparsed-text</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.8.6 <a href=
+"#func-unparsed-text-lines">fn:unparsed-text-lines</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.8.7 <a href=
+"#func-unparsed-text-available">fn:unparsed-text-available</a><br />
+
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.8.8 <a href=
+"#func-environment-variable">fn:environment-variable</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.8.9 <a href=
+"#func-available-environment-variables">fn:available-environment-variables</a><br />
+
+&#160;&#160;&#160;&#160;14.9 <a href=
+"#parsing-and-serializing">Parsing and serializing</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.9.1 <a href=
+"#func-parse-xml">fn:parse-xml</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.9.2 <a href=
+"#func-parse-xml-fragment">fn:parse-xml-fragment</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;14.9.3 <a href=
+"#func-serialize">fn:serialize</a><br />
+15 <a href="#context">Context functions</a><br />
+&#160;&#160;&#160;&#160;15.1 <a href=
+"#func-position">fn:position</a><br />
+&#160;&#160;&#160;&#160;15.2 <a href="#func-last">fn:last</a><br />
+&#160;&#160;&#160;&#160;15.3 <a href=
+"#func-current-dateTime">fn:current-dateTime</a><br />
+&#160;&#160;&#160;&#160;15.4 <a href=
+"#func-current-date">fn:current-date</a><br />
+&#160;&#160;&#160;&#160;15.5 <a href=
+"#func-current-time">fn:current-time</a><br />
+&#160;&#160;&#160;&#160;15.6 <a href=
+"#func-implicit-timezone">fn:implicit-timezone</a><br />
+&#160;&#160;&#160;&#160;15.7 <a href=
+"#func-default-collation">fn:default-collation</a><br />
+&#160;&#160;&#160;&#160;15.8 <a href=
+"#func-static-base-uri">fn:static-base-uri</a><br />
16 <a href="#higher-order-functions">Higher-order
-functions</a>
- <br/>
- 16.1 <a href="#functions-on-functions">Functions on
-functions</a>
- <br/>
- 16.1.1 <a href="#func-function-name">fn:function-name</a>
- <br/>
- 16.1.2 <a href="#func-function-arity">fn:function-arity</a>
- <br/>
- 16.2 <a href="#basic-hofs">Basic higher-order
-functions</a>
- <br/>
- 16.2.1 <a href="#func-map">fn:map</a>
- <br/>
- 16.2.2 <a href="#func-filter">fn:filter</a>
- <br/>
- 16.2.3 <a href="#func-fold-left">fn:fold-left</a>
- <br/>
- 16.2.4 <a href="#func-fold-right">fn:fold-right</a>
- <br/>
- 16.2.5 <a href="#func-map-pairs">fn:map-pairs</a>
- <br/>
-17 <a href="#constructor-functions">Constructor functions</a>
- <br/>
- 17.1 <a href="#constructor-functions-for-xsd-types">Constructor
-functions for XML Schema built-in types</a>
- <br/>
- 17.2 <a href="#constructor-qname-notation">Constructor
-functions for xs:QName and xs:NOTATION</a>
- <br/>
- 17.3 <a href="#constructor-functions-for-user-defined-types">Constructor
-functions for user-defined types</a>
- <br/>
-18 <a href="#casting">Casting</a>
- <br/>
- 18.1 <a href="#casting-from-primitive-to-primitive">Casting
-from primitive types to primitive types</a>
- <br/>
- 18.1.1 <a href="#casting-from-strings">Casting from
-xs:string and xs:untypedAtomic</a>
- <br/>
- 18.1.2 <a href="#casting-to-string">Casting to xs:string
-and xs:untypedAtomic</a>
- <br/>
- 18.1.3 <a href="#casting-to-numerics">Casting to numeric
-types</a>
- <br/>
- 18.1.4 <a href="#casting-to-durations">Casting to duration
-types</a>
- <br/>
- 18.1.5 <a href="#casting-to-datetimes">Casting to date and
-time types</a>
- <br/>
- 18.1.6 <a href="#casting-boolean">Casting to
-xs:boolean</a>
- <br/>
- 18.1.7 <a href="#casting-to-binary">Casting to
-xs:base64Binary and xs:hexBinary</a>
- <br/>
- 18.1.8 <a href="#casting-to-anyuri">Casting to
-xs:anyURI</a>
- <br/>
- 18.1.9 <a href="#casting-to-qname-and-notation">Casting to
-xs:QName and xs:NOTATION</a>
- <br/>
- 18.2 <a href="#casting-to-derived-types">Casting to derived
-types</a>
- <br/>
- 18.3 <a href="#casting-from-derived-to-parent">Casting from
-derived types to parent types</a>
- <br/>
- 18.4 <a href="#casting-within-branch">Casting within a branch
-of the type hierarchy</a>
- <br/>
- 18.4.1 <a href="#casting-to-ENTITY">Casting to
-xs:ENTITY</a>
- <br/>
- 18.5 <a href="#casting-across-hierarchy">Casting across the
-type hierarchy</a>
- <br/>
- 18.6 <a href="#casting-to-union">Casting to union
-types</a>
- <br/>
- </p>
- <h3>
- <a name="appendices" id="appendices"/>Appendices</h3>
- <p class="toc">A <a href="#biblio">References</a>
- <br/>
- A.1 <a href="#normative-biblio">Normative references</a>
- <br/>
- A.2 <a href="#non-normative-biblio">Non-normative
-references</a>
- <br/>
-B <a href="#error-summary">Error summary</a>
- <br/>
+functions</a><br />
+&#160;&#160;&#160;&#160;16.1 <a href=
+"#functions-on-functions">Functions on functions</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;16.1.1 <a href=
+"#func-function-lookup">fn:function-lookup</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;16.1.2 <a href=
+"#func-function-name">fn:function-name</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;16.1.3 <a href=
+"#func-function-arity">fn:function-arity</a><br />
+&#160;&#160;&#160;&#160;16.2 <a href="#basic-hofs">Basic
+higher-order functions</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;16.2.1 <a href=
+"#func-map">fn:map</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;16.2.2 <a href=
+"#func-filter">fn:filter</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;16.2.3 <a href=
+"#func-fold-left">fn:fold-left</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;16.2.4 <a href=
+"#func-fold-right">fn:fold-right</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;16.2.5 <a href=
+"#func-map-pairs">fn:map-pairs</a><br />
+17 <a href="#constructor-functions">Constructor functions</a><br />
+&#160;&#160;&#160;&#160;17.1 <a href=
+"#constructor-functions-for-xsd-types">Constructor functions for
+XML Schema built-in types</a><br />
+&#160;&#160;&#160;&#160;17.2 <a href=
+"#constructor-qname-notation">Constructor functions for xs:QName
+and xs:NOTATION</a><br />
+&#160;&#160;&#160;&#160;17.3 <a href=
+"#constructor-functions-for-user-defined-types">Constructor
+functions for user-defined types</a><br />
+18 <a href="#casting">Casting</a><br />
+&#160;&#160;&#160;&#160;18.1 <a href=
+"#casting-from-primitive-to-primitive">Casting from primitive types
+to primitive types</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.1.1 <a href=
+"#casting-to-string">Casting to xs:string and
+xs:untypedAtomic</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.1.2 <a href=
+"#casting-to-numerics">Casting to numeric types</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.1.3 <a href=
+"#casting-to-durations">Casting to duration types</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.1.4 <a href=
+"#casting-to-datetimes">Casting to date and time types</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.1.5 <a href=
+"#casting-boolean">Casting to xs:boolean</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.1.6 <a href=
+"#casting-to-binary">Casting to xs:base64Binary and
+xs:hexBinary</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.1.7 <a href=
+"#casting-to-anyuri">Casting to xs:anyURI</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.1.8 <a href=
+"#casting-to-qname-and-notation">Casting to xs:QName and
+xs:NOTATION</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.1.9 <a href=
+"#casting-to-ENTITY">Casting to xs:ENTITY</a><br />
+&#160;&#160;&#160;&#160;18.2 <a href=
+"#casting-from-strings">Casting from xs:string and
+xs:untypedAtomic</a><br />
+&#160;&#160;&#160;&#160;18.3 <a href=
+"#casting-non-primitive-types">Casting involving non-primitive
+types</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.3.1 <a href=
+"#casting-to-derived-types">Casting to derived types</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.3.2 <a href=
+"#casting-from-derived-to-parent">Casting from derived types to
+parent types</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.3.3 <a href=
+"#casting-within-branch">Casting within a branch of the type
+hierarchy</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.3.4 <a href=
+"#casting-across-hierarchy">Casting across the type
+hierarchy</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.3.5 <a href=
+"#casting-to-union">Casting to union types</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;18.3.6 <a href=
+"#casting-to-list">Casting to list types</a><br /></p>
+<h3><a name="appendices" id="appendices"></a>Appendices</h3>
+<p class="toc">A <a href="#biblio">References</a><br />
+&#160;&#160;&#160;&#160;A.1 <a href="#normative-biblio">Normative
+references</a><br />
+&#160;&#160;&#160;&#160;A.2 <a href=
+"#non-normative-biblio">Non-normative references</a><br />
+B <a href="#error-summary">Error summary</a><br />
C <a href="#xpath1-compatibility">Compatibility with XPath 1.0</a>
-(Non-Normative)<br/>
+(Non-Normative)<br />
D <a href="#examples">Illustrative user-written functions</a>
-(Non-Normative)<br/>
- D.1 <a href="#if-empty-if-absent">eg:if-empty and
-eg:if-absent</a>
- <br/>
- D.1.1 <a href="#if-empty">eg:if-empty</a>
- <br/>
- D.1.2 <a href="#if-absent">eg:if-absent</a>
- <br/>
- D.2 <a href="#union-intersect-except-on-values">Union,
-intersection and difference on sequences of values</a>
- <br/>
- D.2.1 <a href="#value-union">eg:value-union</a>
- <br/>
- D.2.2 <a href="#value-intersect">eg:value-intersect</a>
- <br/>
- D.2.3 <a href="#value-except">eg:value-except</a>
- <br/>
- D.3 <a href="#index-of-node">eg:index-of-node</a>
- <br/>
- D.4 <a href="#string-pad">eg:string-pad</a>
- <br/>
- D.5 <a href="#func-distinct-nodes-stable">eg:distinct-nodes-stable</a>
- <br/>
- D.6 <a href="#highest-lowest">Finding minima and
-maxima</a>
- <br/>
- D.6.1 <a href="#highest">eg:highest</a>
- <br/>
- D.6.2 <a href="#lowest">eg:lowest</a>
- <br/>
- D.7 <a href="#sorting">Sorting</a>
- <br/>
+(Non-Normative)<br />
+&#160;&#160;&#160;&#160;D.1 <a href=
+"#if-empty-if-absent">eg:if-empty and eg:if-absent</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D.1.1 <a href=
+"#if-empty">eg:if-empty</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D.1.2 <a href=
+"#if-absent">eg:if-absent</a><br />
+&#160;&#160;&#160;&#160;D.2 <a href=
+"#union-intersect-except-on-values">Union, intersection and
+difference on sequences of values</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D.2.1 <a href=
+"#value-union">eg:value-union</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D.2.2 <a href=
+"#value-intersect">eg:value-intersect</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D.2.3 <a href=
+"#value-except">eg:value-except</a><br />
+&#160;&#160;&#160;&#160;D.3 <a href=
+"#index-of-node">eg:index-of-node</a><br />
+&#160;&#160;&#160;&#160;D.4 <a href=
+"#string-pad">eg:string-pad</a><br />
+&#160;&#160;&#160;&#160;D.5 <a href=
+"#func-distinct-nodes-stable">eg:distinct-nodes-stable</a><br />
+&#160;&#160;&#160;&#160;D.6 <a href="#highest-lowest">Finding
+minima and maxima</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D.6.1 <a href=
+"#highest">eg:highest</a><br />
+&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D.6.2 <a href=
+"#lowest">eg:lowest</a><br />
+&#160;&#160;&#160;&#160;D.7 <a href="#sorting">Sorting</a><br />
E <a href="#impl-def">Checklist of implementation-defined
-features</a> (Non-Normative)<br/>
+features</a> (Non-Normative)<br />
F <a href="#changelog">Changes since previous Recommendation</a>
-(Non-Normative)<br/>
- F.1 <a href="#substantive-changes-2009-12-15">Substantive
-changes (15 December 2009)</a>
- <br/>
- F.2 <a href="#substantive-changes-current-draft">Substantive
-changes (current draft)</a>
- <br/>
- F.3 <a href="#incompatibilities">Incompatibilities</a>
- <br/>
- F.4 <a href="#editorial-changes">Editorial changes</a>
- <br/>
+(Non-Normative)<br />
+&#160;&#160;&#160;&#160;F.1 <a href=
+"#substantive-changes-2009-12-15">Substantive changes (15 December
+2009)</a><br />
+&#160;&#160;&#160;&#160;F.2 <a href=
+"#substantive-changes-current-draft">Substantive changes (current
+draft)</a><br />
+&#160;&#160;&#160;&#160;F.3 <a href=
+"#incompatibilities">Incompatibilities</a><br />
+&#160;&#160;&#160;&#160;F.4 <a href="#editorial-changes">Editorial
+changes</a><br />
G <a href="#quickref">Function and Operator Quick Reference</a>
-(Non-Normative)<br/>
- G.1 <a href="#quickref-section">Functions and Operators by
-Section</a>
- <br/>
- G.2 <a href="#quickref-alpha">Functions and Operators
-Alphabetically</a>
- <br/>
- </p>
- </div>
- <hr/>
- <div class="body">
- <div class="div1">
- <h2>
- <a name="intro" id="intro"/>1 Introduction</h2>
- <p>The purpose of this document is to catalog the functions and
+(Non-Normative)<br />
+&#160;&#160;&#160;&#160;G.1 <a href="#quickref-section">Functions
+and Operators by Section</a><br />
+&#160;&#160;&#160;&#160;G.2 <a href="#quickref-alpha">Functions and
+Operators Alphabetically</a><br /></p>
+</div>
+<hr />
+<div class="body">
+<div class="div1">
+<h2><a name="intro" id="intro"></a>1 Introduction</h2>
+<p>The purpose of this document is to catalog the functions and
operators required for XPath 3.0, XQuery 3.0 and XSLT 3.0. The
exact syntax used to call these functions and operators is
specified in <a href="#xpath-30">[XML Path Language (XPath)
3.0]</a>, <a href="#xquery-30">[XQuery 3.0: An XML Query
Language]</a> and <a href="#xslt-30">[XSL Transformations (XSLT)
Version 3.0]</a>.</p>
- <p>This document defines constructor functions and functions that
-take typed values as arguments. Some of the functions define the
-semantics of operators discussed in <a href="#xpath-30">[XML Path
+<p>This document defines constructor functions and functions that
+take typed values as arguments. Some of the functions specify the
+semantics of operators defined in <a href="#xpath-30">[XML Path
Language (XPath) 3.0]</a> and <a href="#xquery-30">[XQuery 3.0: An
XML Query Language]</a>.</p>
- <p>
- <a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
+<p><a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
Edition]</a> defines a number of primitive and derived datatypes,
collectively known as built-in datatypes. This document defines
functions and operations on these datatypes as well as the
-datatypes defined in <a href="http://www.w3.org/TR/xpath-datamodel-30/#types">Section
-Types</a>
- <sup>
- <small>DM30</small>
- </sup> of the <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
-These functions and operations are defined for use in <a href="#xpath-30">[XML Path Language (XPath) 3.0]</a>, <a href="#xquery-30">[XQuery 3.0: An XML Query Language]</a> and <a href="#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a> and related
+datatypes defined in <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#types">Section 2.7 Schema
+Information</a> <sup><small>DM30</small></sup> of the <a href=
+"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
+These functions and operations are defined for use in <a href=
+"#xpath-30">[XML Path Language (XPath) 3.0]</a>, <a href=
+"#xquery-30">[XQuery 3.0: An XML Query Language]</a> and <a href=
+"#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a> and related
XML standards. This document also defines functions and operators
-on nodes and node sequences as defined in the <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
+on nodes and node sequences as defined in the <a href=
+"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
for use in <a href="#xpath-30">[XML Path Language (XPath) 3.0]</a>,
<a href="#xquery-30">[XQuery 3.0: An XML Query Language]</a> and
<a href="#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a> and
other related XML standards.</p>
- <p>
- <a href="#xmlschema11-2">[XML Schema 1.1 Part 2: Datatypes]</a>
+<p><a href="#xmlschema11-2">[XML Schema 1.1 Part 2: Datatypes]</a>
adds to the data types defined in <a href="#xmlschema-2">[XML
Schema Part 2: Datatypes Second Edition]</a>. It introduces a new
-primitive type <code>xs:precisionDecimal</code> which at the time
-of writing is not supported by any functions or operators in this
-specification. It also introduces a new derived type
-<code>xs:dateTimeStamp</code> which is supported, and it
-incorporates as built-in types the two types
-<code>xs:yearMonthDuration</code> and
+derived type <code>xs:dateTimeStamp</code>, and it incorporates as
+built-in types the two types <code>xs:yearMonthDuration</code> and
<code>xs:dayTimeDuration</code> which were previously XDM additions
to the type system. In addition, XSD 1.1 clarifies and updates many
aspects of the definitions of the existing data types: for example,
it extends the value space of <code>xs:double</code> to allow both
-positive and negative zero; it modifies the value space of
+positive and negative zero, and extends the lexical space to allow
+<code>+INF</code>; it modifies the value space of
<code>xs:Name</code> to permit additional Unicode characters; it
allows year zero and disallows leap seconds in
<code>xs:dateTime</code> values; and it allows any character string
to appear as the value of an <code>xs:anyURI</code> item.
Implementations of this specification <strong>may</strong> support
either XSD 1.0 or XSD 1.1 or both.</p>
- <p>References to specific sections of some of the above documents
+<p>References to specific sections of some of the above documents
are indicated by cross-document links in this document. Each such
link consists of a pointer to a specific section followed a
superscript specifying the linked document. The superscripts have
the following meanings: 'XQ' <a href="#xquery-30">[XQuery 3.0: An
XML Query Language]</a>, 'XT' <a href="#xslt-30">[XSL
-Transformations (XSLT) Version 3.0]</a>, 'XP' <a href="#xpath-30">[XML Path Language (XPath) 3.0]</a>, and 'DM' <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM)
+Transformations (XSLT) Version 3.0]</a>, 'XP' <a href=
+"#xpath-30">[XML Path Language (XPath) 3.0]</a>, and 'DM' <a href=
+"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM)
3.0]</a>.</p>
- <div class="div2">
- <h3>
- <a name="conformance" id="conformance"/>1.1 Conformance</h3>
- <p>The Functions and Operators specification is intended primarily
+<div class="div2">
+<h3><a name="conformance" id="conformance"></a>1.1 Conformance</h3>
+<p>The Functions and Operators specification is intended primarily
as a component that can be used by other specifications. Therefore,
Functions and Operators relies on specifications that use it (such
as <a href="#xpath-30">[XML Path Language (XPath) 3.0]</a>,
<a href="#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a> and
<a href="#xquery-30">[XQuery 3.0: An XML Query Language]</a>) to
specify conformance criteria for their respective environments.</p>
- <p>Authors of conformance criteria for the use of the Functions and
+<p>Authors of conformance criteria for the use of the Functions and
Operators should pay particular attention to the following
features:</p>
- <ul>
- <li>
- <p>It is <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> which version of Unicode is supported, but it
+<ul>
+<li>
+<p>It is <a title="implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> which version of Unicode is supported, but it
is recommended that the most recent version of Unicode be used.</p>
- </li>
- <li>
- <p>It is <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> whether the type system is based on XML
-Schema 1.0 or XML Schema 1.1.</p>
- </li>
- <li>
- <p>Support for XML 1.0 and XML 1.1 by the datatypes used in
+</li>
+<li>
+<p>It is <a title="implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> whether the type system is based on XML Schema
+1.0 or XML Schema 1.1.</p>
+</li>
+<li>
+<p>Support for XML 1.0 and XML 1.1 by the datatypes used in
Functions and Operators.</p>
- </li>
- </ul>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>At the time of writing there is a Candidate Recommendation of
+</li>
+</ul>
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>At the time of writing there is a Candidate Recommendation of
XML Schema 1.1 that introduces some new data types including
-<code>xs:precisionDecimal</code> and <code>xs:dateTimeStamp</code>.
-This specification provides some limited support for the latter,
-but does not yet include support for
-<code>xs:precisionDecimal</code>. This is likely to come in a later
-draft of this specification. Furthermore, XSD 1.1 includes the
+<code>xs:dateTimeStamp</code>. Furthermore, XSD 1.1 includes the
option of supporting revised definitions of types such as
<code>xs:NCName</code> based on the rules in XML 1.1 rather than
1.0. The rules affecting support for XSD 1.0 versus XSD 1.1 and XML
1.0 versus XML 1.1 are likely to be refined in later drafts of this
specification.</p>
- </div>
- <p>In this document, text labeled as an example or as a Note is
+</div>
+<p>In this document, text labeled as an example or as a Note is
provided for explanatory purposes and is not normative.</p>
- </div>
- <div class="div2">
- <h3>
- <a name="namespace-prefixes" id="namespace-prefixes"/>1.2
+</div>
+<div class="div2">
+<h3><a name="namespace-prefixes" id="namespace-prefixes"></a>1.2
Namespaces and prefixes</h3>
- <p>The functions and operators discussed in this document are
-contained in one of several namespaces (see <a href="#REC-xml-names">[Namespaces in XML]</a>) and referenced using an
+<p>The functions and operators defined in this document are
+contained in one of several namespaces (see <a href=
+"#REC-xml-names">[Namespaces in XML]</a>) and referenced using an
<code>xs:QName</code>.</p>
- <p>This document uses conventional prefixes to refer to these
+<p>This document uses conventional prefixes to refer to these
namespaces. User-written applications can choose a different prefix
to refer to the namespace, so long as it is bound to the correct
URI. The host language may also define a default namespace for
function calls, in which case function names in that namespace need
not be prefixed at all. In many cases the default namespace will be
<code>http://www.w3.org/2005/xpath-functions</code>, allowing a
-call on the <a href="#func-name">
- <code>fn:name</code>
- </a> function
+call on the <a href="#func-name"><code>fn:name</code></a> function
(for example) to be written as <code>name()</code> rather than
-<a href="#func-name">
- <code>fn:name()</code>
- </a>; in this document,
+<a href="#func-name"><code>fn:name()</code></a>; in this document,
however, all example function calls are explicitly prefixed.</p>
- <p>The URIs of the namespaces and the conventional prefixes
+<p>The URIs of the namespaces and the conventional prefixes
associated with them are:</p>
- <ul>
- <li>
- <p>
- <code>http://www.w3.org/2001/XMLSchema</code> for constructors
+<ul>
+<li>
+<p><code>http://www.w3.org/2001/XMLSchema</code> for constructors
-- associated with <code>xs</code>.</p>
- <p>The datatypes and constructor functions for the built-in
+<p>The section <a href="#constructor-functions"><b>17 Constructor
+functions</b></a> defines constructor functions for the built-in
datatypes defined in <a href="#xmlschema-2">[XML Schema Part 2:
-Datatypes Second Edition]</a> and in <a href="http://www.w3.org/TR/xpath-datamodel-30/#types">Section
-Types</a>
- <sup>
- <small>DM30</small>
- </sup> of <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
-and discussed in <a href="#constructor-functions">
- <b>17 Constructor
-functions</b>
- </a> are in the XML Schema namespace,
-<code>http://www.w3.org/2001/XMLSchema</code>, and named in this
-document using the <code>xs</code> prefix.</p>
- </li>
- <li>
- <p>
- <code>http://www.w3.org/2005/xpath-functions</code> for
-functions — associated with <code>fn</code>.</p>
- <p>The namespace prefix used in this document for most functions
+Datatypes Second Edition]</a> and in <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#types">Section 2.7 Schema
+Information</a> <sup><small>DM30</small></sup> of <a href=
+"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
+These datatypes and the corresponding constructor functions are in
+the XML Schema namespace,
+<code>http://www.w3.org/2001/XMLSchema</code>, and are named in
+this document using the <code>xs</code> prefix.</p>
+</li>
+<li>
+<p><code>http://www.w3.org/2005/xpath-functions</code> for
+functions — associated with <code>fn</code>.</p>
+<p>The namespace prefix used in this document for most functions
that are available to users is <code>fn</code>.</p>
- </li>
- <li>
- <p>
- <code>http://www.w3.org/2005/xpath-functions/math</code> for
-functions — associated with <code>math</code>.</p>
- <p>This namespace is used for some mathematical functions. The
+</li>
+<li>
+<p><code>http://www.w3.org/2005/xpath-functions/math</code> for
+functions — associated with <code>math</code>.</p>
+<p>This namespace is used for some mathematical functions. The
namespace prefix used in this document for these functions is
<code>math</code>. These functions are available to users in
exactly the same way as those in the <code>fn</code> namespace.</p>
- </li>
- <li>
- <p>
- <code>http://www.w3.org/2005/xqt-errors</code> — associated
-with <code>err</code>.</p>
- <p>There are no functions in this namespace; it is used for error
+</li>
+<li>
+<p><code>http://www.w3.org/2005/xqt-errors</code> — associated with
+<code>err</code>.</p>
+<p>There are no functions in this namespace; it is used for error
codes.</p>
- <p>This document uses the prefix <code>err</code> to represent the
+<p>This document uses the prefix <code>err</code> to represent the
namespace URI <code>http://www.w3.org/2005/xqt-errors</code>, which
is the namespace for all XPath and XQuery error codes and messages.
This namespace prefix is not predeclared and its use in this
document is not normative.</p>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>The namespace URI associated with the <code>err</code> prefix is
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>The namespace URI associated with the <code>err</code> prefix is
not expected to change from one version of this document to
another. The contents of this namespace may be extended to allow
additional errors to be returned.</p>
- </div>
- </li>
- <li>
- <p>Functions defined with the <code>op</code> prefix are described
-here to underpin the definitions of the operators in <a href="#xpath-30">[XML Path Language (XPath) 3.0]</a>, <a href="#xquery-30">[XQuery 3.0: An XML Query Language]</a> and <a href="#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a>. These
+</div>
+</li>
+<li>
+<p>Functions defined with the <code>op</code> prefix are described
+here to underpin the definitions of the operators in <a href=
+"#xpath-30">[XML Path Language (XPath) 3.0]</a>, <a href=
+"#xquery-30">[XQuery 3.0: An XML Query Language]</a> and <a href=
+"#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a>. These
functions are not available directly to users, and there is no
requirement that implementations should actually provide these
functions. For this reason, no namespace is associated with the
<code>op</code> prefix. For example, multiplication is generally
associated with the <code>*</code> operator, but it is described as
a function in this document:</p>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-multiply</code>(<code class="arg">$arg1</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>, <code class="arg">$arg2</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">numeric</code>
- </div>
- </div>
- </li>
- </ul>
- </div>
- <div class="div2">
- <h3>
- <a name="func-overloading" id="func-overloading"/>1.3
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:numeric-multiply</code>(<code class=
+"arg">$arg1</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric</code>,
+<code class="arg">$arg2</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric</code></div>
+</div>
+</li>
+</ul>
+</div>
+<div class="div2">
+<h3><a name="func-overloading" id="func-overloading"></a>1.3
Function overloading</h3>
- <p>In general, the specifications named above do not support
+<p>In general, the specifications named above do not support
function overloading in the sense that functions that have multiple
signatures with the same name and the same number of parameters are
not supported. Consequently, there are no such overloaded functions
in this document except for legacy <a href="#xpath">[XML Path
-Language (XPath) Version 1.0]</a> functions such as <a href="#func-string">
- <code>fn:string</code>
- </a>, which accepts a single
+Language (XPath) Version 1.0]</a> functions such as <a href=
+"#func-string"><code>fn:string</code></a>, which accepts a single
parameter of a variety of types. In addition, it should be noted
-that the functions defined in <a href="#numeric-functions">
- <b>4
-Functions and operators on numerics</b>
- </a> that accept
+that the functions defined in <a href="#numeric-functions"><b>4
+Functions and operators on numerics</b></a> that accept
<code>numeric</code> parameters accept arguments of type
<code>xs:integer</code>, <code>xs:decimal</code>,
-<code>xs:float</code> or <code>xs:double</code>. See <a href="#func-signatures">
- <b>1.4 Function signatures and
-descriptions</b>
- </a>. Operators such as "+" may be overloaded. This
+<code>xs:float</code> or <code>xs:double</code>. See <a href=
+"#func-signatures"><b>1.4 Function signatures and
+descriptions</b></a>. Operators such as "+" may be overloaded. This
document does define some functions with more than one signature
with the same name and different number of parameters. User-defined
functions with more than one signature with the same name and
different number of parameters are also supported.</p>
- </div>
- <div class="div2">
- <h3>
- <a name="func-signatures" id="func-signatures"/>1.4 Function
+</div>
+<div class="div2">
+<h3><a name="func-signatures" id="func-signatures"></a>1.4 Function
signatures and descriptions</h3>
- <p>Each function is defined by specifying its signature, a
+<p>Each function is defined by specifying its signature, a
description of the return type and each of the parameters and its
semantics. For many functions, examples are included to illustrate
their use.</p>
- <p>Each function's signature is presented in a form like this:</p>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:function-name</code>(<code class="arg">$parameter-name</code>
- <code class="as"> as </code>
- <code class="type">parameter-type</code>,
-<span class="varargs">...</span>)<code class="as"> as </code>
- <code class="return-type">return-type</code>
- </div>
- </div>
- <p>In this notation, <b>function-name</b>, in bold-face, is the
+<p>Each function's signature is presented in a form like this:</p>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:function-name</code>(<code class=
+"arg">$parameter-name</code><code class=
+"as">&#160;as&#160;</code><code class="type">parameter-type</code>,
+<span class="varargs">...</span>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">return-type</code></div>
+</div>
+<p>In this notation, <b>function-name</b>, in bold-face, is the
name of the function whose signature is being specified. If the
function takes no parameters, then the name is followed by an empty
parameter list: "<code>()</code>"; otherwise, the name is followed
@@ -1408,175 +1664,159 @@
specifies the static type of the parameter, in italics, and a
descriptive, but non-normative, name. If there are two or more
parameter declarations, they are separated by a comma. The
-<em>
- <code>return-type</code>
- </em> , also in italics, specifies the
+<em><code>return-type</code></em> , also in italics, specifies the
static type of the value returned by the function. The dynamic type
of the value returned by the function is the same as its static
type or derived from the static type. All parameter types and
return types are specified using the SequenceType notation defined
-in <a href="http://www.w3.org/TR/xpath-30/#id-sequencetype-syntax">Section
-SequenceType Syntax</a>
- <sup>
- <small>XP30</small>
- </sup>.</p>
- <p>One function, <a href="#func-concat">
- <code>fn:concat</code>
- </a>,
+in <a href=
+"http://www.w3.org/TR/xpath-30/#id-sequencetype-syntax">Section
+2.5.4 SequenceType Syntax</a> <sup><small>XP30</small></sup>.</p>
+<p>One function, <a href="#func-concat"><code>fn:concat</code></a>,
has a variable number of arguments (two or more). More strictly,
-there is an infinite set of functions having the name <a href="#func-concat">
- <code>fn:concat</code>
- </a>, with arity ranging from
+there is an infinite set of functions having the name <a href=
+"#func-concat"><code>fn:concat</code></a>, with arity ranging from
2 to infinity. For this special case, a single function signature
is given, with an ellipsis indicating an indefinite number of
arguments.</p>
- <p>In some cases the word " <code>numeric</code> " is used in
+<p>In some cases the word " <code>numeric</code> " is used in
function signatures as a shorthand to indicate the four numeric
types: <code>xs:integer</code>, <code>xs:decimal</code>,
<code>xs:float</code> and <code>xs:double</code>. For example, a
function with the signature:</p>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:numeric-function</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">...</code>
- </div>
- </div>
- <p>represents the following four function signatures:</p>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:numeric-function</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">xs:integer</code>)<code class="as"> as </code>
- <code class="return-type">...</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:numeric-function</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">xs:decimal</code>)<code class="as"> as </code>
- <code class="return-type">...</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:numeric-function</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">xs:float</code>)<code class="as"> as </code>
- <code class="return-type">...</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:numeric-function</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">xs:double</code>)<code class="as"> as </code>
- <code class="return-type">...</code>
- </div>
- </div>
- <p>For most functions there is an initial paragraph describing what
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:numeric-function</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">...</code></div>
+</div>
+<p>represents the following four function signatures:</p>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:numeric-function</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">xs:integer</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">...</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:numeric-function</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">xs:decimal</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">...</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:numeric-function</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">xs:float</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">...</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:numeric-function</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">xs:double</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">...</code></div>
+</div>
+<p>For most functions there is an initial paragraph describing what
the function does followed by semantic rules. These rules are meant
to be followed in the order that they appear in this document.</p>
- <p>The function name is a <code>QName</code> as defined in <a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
-and must adhere to its syntactic conventions. Following <a href="#xpath">[XML Path Language (XPath) Version 1.0]</a>, function
-names are composed of English words separated by hyphens,"-". If a
-function name contains a <a href="#xmlschema-2">[XML Schema Part 2:
-Datatypes Second Edition]</a> datatype name, it may have
-intercapitalized spelling and is used in the function name as such.
-For example, <a href="#func-timezone-from-dateTime">
- <code>fn:timezone-from-dateTime</code>
- </a>.</p>
- <p>Rules for passing parameters to operators are described in the
+<p>The function name is a <code>QName</code> as defined in <a href=
+"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
+and must adhere to its syntactic conventions. Following the
+precedent set by <a href="#xpath">[XML Path Language (XPath)
+Version 1.0]</a>, function names are generally composed of English
+words separated by hyphens ("-"). If a function name contains a
+<a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
+Edition]</a> datatype name, it may have intercapitalized spelling
+and is used in the function name as such. For example, <a href=
+"#func-timezone-from-dateTime"><code>fn:timezone-from-dateTime</code></a>.</p>
+<p>Rules for passing parameters to operators are described in the
relevant sections of <a href="#xquery-30">[XQuery 3.0: An XML Query
Language]</a> and <a href="#xpath-30">[XML Path Language (XPath)
3.0]</a>. For example, the rules for passing parameters to
-arithmetic operators are described in <a href="http://www.w3.org/TR/xpath-30/#id-arithmetic">Section Arithmetic
-Expressions</a>
- <sup>
- <small>XP30</small>
- </sup>. Specifically, rules
-for parameters of type <code>xs:untypedAtomic</code> and the empty
-sequence are specified in this section.</p>
- <p>As is customary, the parameter type name indicates that the
+arithmetic operators are described in <a href=
+"http://www.w3.org/TR/xpath-30/#id-arithmetic">Section 3.5
+Arithmetic Expressions</a> <sup><small>XP30</small></sup>.
+Specifically, rules for parameters of type
+<code>xs:untypedAtomic</code> and the empty sequence are specified
+in this section.</p>
+<p>As is customary, the parameter type name indicates that the
function or operator accepts arguments of that type, or types
derived from it, in that position. This is called <em>subtype
-substitution</em> (See <a href="http://www.w3.org/TR/xpath-30/#id-sequencetype-matching">Section
-SequenceType Matching</a>
- <sup>
- <small>XP30</small>
- </sup>). In
+substitution</em> (See <a href=
+"http://www.w3.org/TR/xpath-30/#id-sequencetype-matching">Section
+2.5.5 SequenceType Matching</a> <sup><small>XP30</small></sup>). In
addition, numeric type instances and instances of type
<code>xs:anyURI</code> can be promoted to produce an argument of
-the required type. (See <a href="http://www.w3.org/TR/xpath-30/#promotion">Section Type
-Promotion</a>
- <sup>
- <small>XP30</small>
- </sup>).</p>
- <ol class="enumar">
- <li>
- <p>
- <em>Subtype Substitution</em>: A derived type may substitute for
+the required type. (See <a href=
+"http://www.w3.org/TR/xpath-30/#promotion">Section B.1 Type
+Promotion</a> <sup><small>XP30</small></sup>).</p>
+<ol class="enumar">
+<li>
+<p><em>Subtype Substitution</em>: A derived type may substitute for
its base type. In particular, <code>xs:integer</code> may be used
where <code>xs:decimal</code> is expected.</p>
- </li>
- <li>
- <p>
- <em>Numeric Type Promotion</em>: <code>xs:decimal</code> may be
+</li>
+<li>
+<p><em>Numeric Type Promotion</em>: <code>xs:decimal</code> may be
promoted to <code>xs:float</code> or <code>xs:double</code>.
Promotion to <code>xs:double</code> should be done directly, not
via <code>xs:float</code>, to avoid loss of precision.</p>
- </li>
- <li>
- <p>
- <em>anyURI Type Promotion</em>: A value of type
+</li>
+<li>
+<p><em>anyURI Type Promotion</em>: A value of type
<code>xs:anyURI</code> can be promoted to the type
<code>xs:string</code>.</p>
- </li>
- </ol>
- <p>Some functions accept a single value or the empty sequence as an
+</li>
+</ol>
+<p>Some functions accept a single value or the empty sequence as an
argument and some may return a single value or the empty sequence.
This is indicated in the function signature by following the
parameter or return type name with a question mark:
"<code>?</code>", indicating that either a single value or the
empty sequence must appear. See below.</p>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:function-name</code>(<code class="arg">$parameter-name</code>
- <code class="as"> as </code>
- <code class="type">parameter-type?</code>)<code class="as"> as </code>
- <code class="return-type">return-type?</code>
- </div>
- </div>
- <p>Note that this function signature is different from a signature
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:function-name</code>(<code class=
+"arg">$parameter-name</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">parameter-type?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">return-type?</code></div>
+</div>
+<p>Note that this function signature is different from a signature
in which the parameter is omitted. See, for example, the two
-signatures for <a href="#func-string">
- <code>fn:string</code>
- </a>.
+signatures for <a href="#func-string"><code>fn:string</code></a>.
In the first signature, the parameter is omitted and the argument
defaults to the context item, referred to as ".". In the second
signature, the argument must be present but may be the empty
sequence, written as <code>()</code>.</p>
- <p>Some functions accept a sequence of zero or more values as an
+<p>Some functions accept a sequence of zero or more values as an
argument. This is indicated by following the name of the type of
the items in the sequence with <code>*</code>. The sequence may
contain zero or more items of the named type. For example, the
function below accepts a sequence of <code>xs:double</code> and
returns a <code>xs:double</code> or the empty sequence.</p>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:median</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">xs:double*</code>)<code class="as"> as </code>
- <code class="return-type">xs:double?</code>
- </div>
- </div>
- </div>
- <div class="div2">
- <h3>
- <a name="datatypes" id="datatypes"/>1.5 Type system</h3>
- <p>The diagrams below show how nodes, function items, primitive
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:median</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">xs:double*</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:double?</code></div>
+</div>
+</div>
+<div class="div2">
+<h3><a name="datatypes" id="datatypes"></a>1.5 Type system</h3>
+<p>The diagrams below show how nodes, function items, primitive
simple types, and user defined types fit together into a type
system. This type system comprises two distinct hierarchies that
both include the primitive simple types. In the diagrams,
@@ -1587,527 +1827,548 @@
of the other diagrams. Dotted lines represent additional
relationships that follow an evident pattern. The information that
appears in each diagram is recapitulated in tabular form.</p>
- <p>The <code>xs:IDREFS</code>, <code>xs:NMTOKENS</code>, and
+<p>The <code>xs:IDREFS</code>, <code>xs:NMTOKENS</code>, and
<code>xs:ENTITIES</code> types and the <code>user-defined list and
union types</code> are special types in that these types are lists
or unions rather than types derived by extension or
restriction.</p>
- <p>The first diagram and its corresponding table illustrate the
+<p>The first diagram and its corresponding table illustrate the
"item" type hierarchy. In XDM, items include node types, function
types, and built-in atomic types.</p>
- <img src="XPathTypeHierarchy-1-items.png" alt="Type hierarchy graphic, item hierarchy"/>
- <p>In the table, each type whose name is indented is derived from
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>This diagram fails to reveal that the graph of the subtype
+relationship between types is actually a lattice rather than a
+hierarchy. This is particularly evident with function types, and
+with union types: in both cases, a type may be an immediate subtype
+of several other types.</p>
+</div>
+<img src="XPathTypeHierarchy-1-items.png" alt=
+"Type hierarchy graphic, item hierarchy" />
+<p>In the table, each type whose name is indented is derived from
the type whose name appears nearest above it with one less level of
indentation.</p>
- <table class="hierarchy" summary="Type summary" border="0">
- <tbody>
- <tr>
- <td class="castOther" align="left" valign="middle">item</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+<table class="hierarchy" summary="Type summary" border="0">
+<tbody>
+<tr>
+<td class="castOther" align="left" valign="middle">item</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:anyAtomicType</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">node</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">attribute</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">user-defined
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">function(*)</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
+function(item()*) as item()*</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
+function(item()*) as item()</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
+function(item()*) as item()?</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
+function(item()*, item()*) as item()*</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">node</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">attribute</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">user-defined
attribute types</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">comment</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">document</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">user-defined
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">comment</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">document</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">user-defined
document types</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">element</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">user-defined
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">element</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">user-defined
element types</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">namespace</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
processing-instruction</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">text</td>
- </tr>
- </tbody>
- </table>
- <p>The next diagram and table illustrate the "any type" type
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">text</td>
+</tr>
+</tbody>
+</table>
+<p>The next diagram and table illustrate the "any type" type
hierarchy, in which all types are derived from distinguished type
<code>xs:anyType</code>.</p>
- <img src="XPathTypeHierarchy-2-anyTypes.png" alt="Type hierarchy graphic, anyType hierarchy"/>
- <p>In the table, each type whose name is indented is derived from
+<img src="XPathTypeHierarchy-2-anyTypes.png" alt=
+"Type hierarchy graphic, anyType hierarchy" />
+<p>In the table, each type whose name is indented is derived from
the type whose name appears nearest above it with one less level of
indentation.</p>
- <table class="hierarchy" summary="Type summary" border="0">
- <tbody>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:anyType</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">user-defined
+<table class="hierarchy" summary="Type summary" border="0">
+<tbody>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:anyType</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">user-defined
complex types</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:untyped</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:untyped</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:anySimpleType</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">user-defined
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">user-defined
list and union types</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:IDREFS</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:NMTOKENS</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:ENTITIES</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:IDREFS</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:NMTOKENS</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:ENTITIES</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:anyAtomicType</td>
- </tr>
- </tbody>
- </table>
- <p>The final diagram and table show all of the atomic types,
+</tr>
+</tbody>
+</table>
+<p>The final diagram and table show all of the atomic types,
including the primitive simple types and the built-in types derived
from the primitive simple types. This includes all the built-in
datatypes defined in <a href="#xmlschema-2">[XML Schema Part 2:
Datatypes Second Edition]</a> as well as the two totally ordered
-subtypes of duration defined in <a href="#duration-subtypes">
- <b>8.1
-Two totally ordered subtypes of duration</b>
- </a>.</p>
- <img src="XPathTypeHierarchy-3-anyAtomicTypes.png" alt="Type hierarchy graphic, anyAtomicType hierarchy"/>
- <p>In the table, each type whose name is indented is derived from
+subtypes of duration defined in <a href="#duration-subtypes"><b>8.1
+Two totally ordered subtypes of duration</b></a>.</p>
+<img src="XPathTypeHierarchy-3-anyAtomicTypes.png" alt=
+"Type hierarchy graphic, anyAtomicType hierarchy" />
+<p>In the table, each type whose name is indented is derived from
the type whose name appears nearest above it with one less level of
indentation.</p>
- <table class="hierarchy" summary="Type summary" border="0">
- <tbody>
- <tr>
- <td class="castOther" align="left" valign="middle">
+<table class="hierarchy" summary="Type summary" border="0">
+<tbody>
+<tr>
+<td class="castOther" align="left" valign="middle">
xs:untypedAtomic</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:dateTime</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:dateTime</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:dateTimeStamp</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:date</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:time</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:duration</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:date</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:time</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:duration</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:yearMonthDuration</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:dayTimeDuration</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:float</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:double</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">
-xs:precisionDecimal</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:decimal</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:integer</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:float</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:double</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:decimal</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:integer</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:nonPositiveInteger</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:negativeInteger</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:long</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:int</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:short</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:byte</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:long</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:int</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:short</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:byte</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:nonNegativeInteger</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:unsignedLong</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:unsignedInt</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:unsignedShort</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:unsignedByte</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:positiveInteger</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">
xs:gYearMonth</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:gYear</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:gYear</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">
xs:gMonthDay</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:gDay</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:gMonth</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:string</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:gDay</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:gMonth</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:string</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">
xs:normalizedString</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:token</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:language</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:NMTOKEN</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:Name</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:NCName</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:ID</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:IDREF</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:ENTITY</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:boolean</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:token</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:language</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:NMTOKEN</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:Name</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:NCName</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:ID</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:IDREF</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:ENTITY</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:boolean</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">
xs:base64Binary</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">
xs:hexBinary</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:anyURI</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:QName</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:NOTATION</td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="div2">
- <h3>
- <a name="terminology" id="terminology"/>1.6 Terminology</h3>
- <p>The terminology used to describe the functions and operators on
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:anyURI</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:QName</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:NOTATION</td>
+</tr>
+</tbody>
+</table>
+<p>When XSD 1.1 is supported, one additional type needs to be added
+to these diagrams: the type <code>xs:dateTimeStamp</code>, which is
+derived from <code>xs:dateTime</code>.</p>
+</div>
+<div class="div2">
+<h3><a name="terminology" id="terminology"></a>1.6 Terminology</h3>
+<p>The terminology used to describe the functions and operators on
<a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
Edition]</a> is defined in the body of this specification. The
terms defined in this section are used in building those
definitions</p>
- <div class="div3">
- <h4>
- <a name="character-terminology" id="character-terminology"/>1.6.1 Strings, characters, and
+<div class="div3">
+<h4><a name="character-terminology" id=
+"character-terminology"></a>1.6.1 Strings, characters, and
codepoints</h4>
- <p>This document uses the terms <code>string</code>,
+<p>This document uses the terms <code>string</code>,
<code>character</code>, and <code>codepoint</code> with the
following meanings:</p>
- <p>
- <span class="termdef">
- <a name="character" id="character"/>[Definition] A <b>character</b> is an instance of
-the <a href="http://www.w3.org/TR/REC-xml/#NT-Char">Char</a>
- <sup>
- <small>XML</small>
- </sup>
-production of <a href="#REC-xml">[REC-xml]</a>.</span>
- </p>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>This definition excludes Unicode characters in the surrogate
+<p><span class="termdef"><a name="character" id=
+"character"></a>[Definition] A <b>character</b> is an instance of
+the <a href=
+"http://www.w3.org/TR/REC-xml/#NT-Char">Char</a><sup><small>XML</small></sup>
+production of <a href="#REC-xml">[REC-xml]</a>.</span></p>
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>This definition excludes Unicode characters in the surrogate
blocks as well as xFFFE and xFFFF, while including characters with
codepoints greater than xFFFF which some programming languages
treat as two characters. The valid characters are defined by their
codepoints, and include some whose codepoints have not been
assigned by the Unicode consortium to any character.</p>
- </div>
- <p>
- <span class="termdef">
- <a name="string" id="string"/>[Definition] A <b>string</b> is a sequence of zero or
-more <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>characters<span class="arrow">·</span>
- </a>, or equivalently, a value in the value space
-of the <code>xs:string</code> data type.</span>
- </p>
- <p>
- <span class="termdef">
- <a name="codepoint" id="codepoint"/>[Definition] A <b>codepoint</b> is a non-negative
-integer assigned to a <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a> by the Unicode consortium, or reserved for
-future assignment to a character.</span>
- </p>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>The set of codepoints is thus wider than the set of
+</div>
+<p><span class="termdef"><a name="string" id=
+"string"></a>[Definition] A <b>string</b> is a sequence of zero or
+more <a title="character" class="termref" href=
+"#character"><span class="arrow">·</span>characters<span class=
+"arrow">·</span></a>, or equivalently, a value in the value space
+of the <code>xs:string</code> data type.</span></p>
+<p><span class="termdef"><a name="codepoint" id=
+"codepoint"></a>[Definition] A <b>codepoint</b> is a non-negative
+integer assigned to a <a title="character" class="termref" href=
+"#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a> by the Unicode consortium, or reserved for
+future assignment to a character.</span></p>
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>The set of codepoints is thus wider than the set of
characters.</p>
- <p>This specification spells "codepoint" as one word; the Unicode
+<p>This specification spells "codepoint" as one word; the Unicode
specification spells it as "code point". Equivalent terms found in
other specifications are "character number" or "code position". See
<a href="#charmod">[Character Model for the World Wide Web 1.0:
-Fundamentals]</a>
- </p>
- </div>
- <p>Because these terms appear so frequently, they are hyperlinked
+Fundamentals]</a></p>
+</div>
+<p>Because these terms appear so frequently, they are hyperlinked
to the definition only when there is a particular desire to draw
the reader's attention to the definition; the absence of a
hyperlink does not mean that the term is being used in some other
sense.</p>
- <p>It is <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> which version of <a href="#Unicode4">[The
+<p>It is <a title="implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> which version of <a href="#Unicode">[The
Unicode Standard]</a> is supported, but it is recommended that the
most recent version of Unicode be used.</p>
- <p>Unless explicitly stated, the <code>xs:string</code> values
+<p>Unless explicitly stated, the <code>xs:string</code> values
returned by the functions in this document are not normalized in
the sense of <a href="#charmod">[Character Model for the World Wide
Web 1.0: Fundamentals]</a>.</p>
- <div class="note">
- <p class="prefix">
- <b>Notes:</b>
- </p>
- <p>In functions that involve character counting such as <a href="#func-substring">
- <code>fn:substring</code>
- </a>, <a href="#func-string-length">
- <code>fn:string-length</code>
- </a> and
-<a href="#func-translate">
- <code>fn:translate</code>
- </a>, what is
-counted is the number of XML <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>characters<span class="arrow">·</span>
- </a> in the
+<div class="note">
+<p class="prefix"><b>Notes:</b></p>
+<p>In functions that involve character counting such as <a href=
+"#func-substring"><code>fn:substring</code></a>, <a href=
+"#func-string-length"><code>fn:string-length</code></a> and
+<a href="#func-translate"><code>fn:translate</code></a>, what is
+counted is the number of XML <a title="character" class="termref"
+href="#character"><span class=
+"arrow">·</span>characters<span class="arrow">·</span></a> in the
string (or equivalently, the number of Unicode codepoints). Some
implementations may represent a codepoint above xFFFF using two
16-bit values known as a surrogate pair. A surrogate pair counts as
one character, not two.</p>
- </div>
- </div>
- <div class="div3">
- <h4>
- <a name="namespace-terminology" id="namespace-terminology"/>1.6.2 Namespaces and URIs</h4>
- <p>This document uses the phrase "namespace URI" to identify the
+</div>
+</div>
+<div class="div3">
+<h4><a name="namespace-terminology" id=
+"namespace-terminology"></a>1.6.2 Namespaces and URIs</h4>
+<p>This document uses the phrase "namespace URI" to identify the
concept identified in <a href="#REC-xml-names">[Namespaces in
XML]</a> as "namespace name", and the phrase "local name" to
-identify the concept identified in <a href="#REC-xml-names">[Namespaces in XML]</a> as "local part".</p>
- <p>It also uses the term "expanded-QName" defined below.</p>
- <p>
- <span class="termdef">
- <a name="expanded-name" id="expanded-name"/>[Definition] An <b>expanded-QName</b> is a pair
+identify the concept identified in <a href=
+"#REC-xml-names">[Namespaces in XML]</a> as "local part".</p>
+<p>It also uses the term "expanded-QName" defined below.</p>
+<p><span class="termdef"><a name="expanded-name" id=
+"expanded-name"></a>[Definition] An <b>expanded-QName</b> is a pair
of values consisting of a namespace URI and a local name. They
belong to the value space of the <a href="#xmlschema-2">[XML Schema
Part 2: Datatypes Second Edition]</a> datatype
<code>xs:QName</code>. When this document refers to
<code>xs:QName</code> we always mean the value space, i.e. a
namespace URI, local name pair (and not the lexical space referring
-to constructs of the form prefix:local-name).</span>
- </p>
- <p>The term URI is used as follows:</p>
- <p>
- <span class="termdef">
- <a name="dt-uri" id="dt-uri"/>[Definition] Within this specification, the term
+to constructs of the form prefix:local-name).</span></p>
+<p>The term URI is used as follows:</p>
+<p><span class="termdef"><a name="dt-uri" id=
+"dt-uri"></a>[Definition] Within this specification, the term
<b>URI</b> refers to Universal Resource Identifiers as defined in
-<a href="#rfc3986">[RFC 3986]</a> and extended in <a href="#rfc3987">[RFC 3987]</a> with a new name <b>IRI</b>. The term
+<a href="#rfc3986">[RFC 3986]</a> and extended in <a href=
+"#rfc3987">[RFC 3987]</a> with a new name <b>IRI</b>. The term
<b>URI Reference</b>, unless otherwise stated, refers to a string
in the lexical space of the <code>xs:anyURI</code> datatype as
defined in <a href="#xmlschema-2">[XML Schema Part 2: Datatypes
-Second Edition]</a>.</span>
- </p>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>Note that this means, in practice, that where this specification
-requires a "URI Reference", an IRI as defined in <a href="#rfc3987">[RFC 3987]</a> will be accepted, provided that other
+Second Edition]</a>.</span></p>
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>Note that this means, in practice, that where this specification
+requires a "URI Reference", an IRI as defined in <a href=
+"#rfc3987">[RFC 3987]</a> will be accepted, provided that other
relevant specifications also permit an IRI. The term URI has been
retained in preference to IRI to avoid introducing new names for
concepts such as "Base URI" that are defined or referenced across
@@ -2115,204 +2376,183 @@
definition of <code>xs:anyURI</code> is a wider definition than the
definition in <a href="#rfc3987">[RFC 3987]</a>; for example it
does not require non-ASCII characters to be escaped.</p>
- </div>
- </div>
- <div class="div3">
- <h4>
- <a name="conformance-terminology" id="conformance-terminology"/>1.6.3 Conformance terminology</h4>
- <dl>
- <dt class="label">
- <span class="termdef">
- <a name="compatibility" id="compatibility"/>[Definition] <b>for
-compatibility</b>
- </span>
- </dt>
- <dd>
- <p>A feature of this specification included to ensure that
+</div>
+</div>
+<div class="div3">
+<h4><a name="conformance-terminology" id=
+"conformance-terminology"></a>1.6.3 Conformance terminology</h4>
+<dl>
+<dt class="label"><span class="termdef"><a name="compatibility" id=
+"compatibility"></a>[Definition] <b>for
+compatibility</b></span></dt>
+<dd>
+<p>A feature of this specification included to ensure that
implementations that use this feature remain compatible with
-<a href="#xpath">[XML Path Language (XPath) Version 1.0]</a>
- </p>
- </dd>
- <dt class="label">
- <span class="termdef">
- <a name="may" id="may"/>[Definition] <b>may</b>
- </span>
- </dt>
- <dd>
- <p>Conforming documents and processors are permitted to, but need
+<a href="#xpath">[XML Path Language (XPath) Version 1.0]</a></p>
+</dd>
+<dt class="label"><span class="termdef"><a name="may" id=
+"may"></a>[Definition] <b>may</b></span></dt>
+<dd>
+<p>Conforming documents and processors are permitted to, but need
not, behave as described.</p>
- </dd>
- <dt class="label">
- <span class="termdef">
- <a name="must" id="must"/>[Definition] <b>must</b>
- </span>
- </dt>
- <dd>
- <p>Conforming documents and processors are required to behave as
+</dd>
+<dt class="label"><span class="termdef"><a name="must" id=
+"must"></a>[Definition] <b>must</b></span></dt>
+<dd>
+<p>Conforming documents and processors are required to behave as
described; otherwise, they are either non-conformant or else in
error.</p>
- </dd>
- <dt class="label">
- <span class="termdef">
- <a name="implementation-defined" id="implementation-defined"/>[Definition]
-<b>implementation-defined</b>
- </span>
- </dt>
- <dd>
- <p>Possibly differing between implementations, but specified and
+</dd>
+<dt class="label"><span class="termdef"><a name=
+"implementation-defined" id=
+"implementation-defined"></a>[Definition]
+<b>implementation-defined</b></span></dt>
+<dd>
+<p>Possibly differing between implementations, but specified and
documented by the implementor for each particular
implementation.</p>
- </dd>
- <dt class="label">
- <span class="termdef">
- <a name="implementation-dependent" id="implementation-dependent"/>[Definition]
-<b>implementation-dependent</b>
- </span>
- </dt>
- <dd>
- <p>Possibly differing between implementations, but not specified by
+</dd>
+<dt class="label"><span class="termdef"><a name=
+"implementation-dependent" id=
+"implementation-dependent"></a>[Definition]
+<b>implementation-dependent</b></span></dt>
+<dd>
+<p>Possibly differing between implementations, but not specified by
this or other W3C specification, and not required to be specified
by the implementor for any particular implementation.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="properties-of-functions" id="properties-of-functions"/>1.6.4 Properties of functions</h4>
- <p>This section is concerned with the question of whether two calls
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="properties-of-functions" id=
+"properties-of-functions"></a>1.6.4 Properties of functions</h4>
+<p>This section is concerned with the question of whether two calls
on a function, with the same arguments, may produce different
results.</p>
- <p>
- <span class="termdef">
- <a name="execution-scope" id="execution-scope"/>[Definition] Two function calls are said to
+<p><span class="termdef"><a name="execution-scope" id=
+"execution-scope"></a>[Definition] Two function calls are said to
be within the same <b>execution scope</b> if the host environment
defines them as such. In XSLT, any two calls executed during the
same transformation are in the same execution scope. In XQuery, any
two calls executed during the evaluation of a top-level expression
are in the same execution scope. In other contexts, the execution
scope is specified by the host environment that invokes the
-function library.</span>
- </p>
- <p>The following definition explains more precisely what it means
+function library.</span></p>
+<p>The following definition explains more precisely what it means
for two function calls to return the same result:</p>
- <p>
- <span class="termdef">
- <a name="dt-identical" id="dt-identical"/>[Definition]</span> Two values are defined to be
+<p><span class="termdef"><a name="dt-identical" id=
+"dt-identical"></a>[Definition]</span> Two values are defined to be
<b>identical</b> if they contain the same number of items and the
items are pairwise identical. Two items are identical if and only
if one of the following conditions applies:</p>
- <ul>
- <li>
- <p>Both items are atomic values, of precisely the same type, and
+<ul>
+<li>
+<p>Both items are atomic values, of precisely the same type, and
the values are equal as defined using the <code>eq</code> operator,
using the Unicode codepoint collation when comparing strings</p>
- </li>
- <li>
- <p>Both items are nodes, and represent the same node</p>
- </li>
- <li>
- <p>Both items are function items, and have the same name (or
-absence of a name), arity, function signature, and closure</p>
- </li>
- </ul>
- <p>Some functions produce results that depend not only on their
+</li>
+<li>
+<p>Both items are nodes, and represent the same node</p>
+</li>
+<li>
+<p>Both items are function items, and have the same name (or
+absence of a name), arity, function signature, and closure. (Note
+that there is no function or operator defined in the specification
+that tests whether two function items are identical.)</p>
+</li>
+</ul>
+<p>Some functions produce results that depend not only on their
explicit arguments, but also on the static and dynamic context.</p>
- <p>
- <span class="termdef">
- <a name="dt-context-dependent" id="dt-context-dependent"/>[Definition] A function may have the
+<p><span class="termdef"><a name="dt-context-dependent" id=
+"dt-context-dependent"></a>[Definition] A function may have the
property of being <b>context-dependent</b>: the result of such a
function depends on the values of properties in the static and
dynamic evaluation context as well as on the actual supplied
-arguments (if any).</span>
- </p>
- <p>Context-dependent functions fall into a number of
+arguments (if any).</span></p>
+<p><span class="termdef"><a name="dt-context-independent" id=
+"dt-context-independent"></a>[Definition] A function that is not
+<a title="context-dependent" class="termref" href=
+"#dt-context-dependent"><span class=
+"arrow">·</span>context-dependent<span class="arrow">·</span></a>
+is called <b>context-independent</b>.</span></p>
+<p>Functions that are context-dependent cannot be used as literal
+function items, nor can they be partially applied. For example,
+<code>position#0</code> is not valid as a literal function item,
+and <a href="#func-starts-with"><code>fn:starts-with(?, ?,
+"http://example.com/collation")</code></a> is not a valid partial
+function application. In the latter case this is because, in
+theory, the same URI might refer to different collations depending
+on the static context in which the collation URI appears. It is
+possible to circumvent this problem by writing a user-defined
+function as a simple wrapper for a call on <a href=
+"#func-starts-with"><code>fn:starts-with</code></a>, and writing a
+partial application of this user-defined function. In this way the
+static context for the call on <a href=
+"#func-starts-with"><code>fn:starts-with</code></a> is made
+unambiguous.</p>
+<p>Context-dependent functions fall into a number of
categories:</p>
- <ol class="enumar">
- <li>
- <p>The functions <a href="#func-current-date">
- <code>fn:current-date</code>
- </a>, <a href="#func-current-dateTime">
- <code>fn:current-dateTime</code>
- </a>,
-<a href="#func-current-time">
- <code>fn:current-time</code>
- </a>,
-<a href="#func-implicit-timezone">
- <code>fn:implicit-timezone</code>
- </a>,
-<a href="#func-adjust-date-to-timezone">
- <code>fn:adjust-date-to-timezone</code>
- </a>,
-<a href="#func-adjust-dateTime-to-timezone">
- <code>fn:adjust-dateTime-to-timezone</code>
- </a>,
-and <a href="#func-adjust-time-to-timezone">
- <code>fn:adjust-time-to-timezone</code>
- </a>
+<ol class="enumar">
+<li>
+<p>The functions <a href=
+"#func-current-date"><code>fn:current-date</code></a>, <a href=
+"#func-current-dateTime"><code>fn:current-dateTime</code></a>,
+<a href="#func-current-time"><code>fn:current-time</code></a>,
+<a href=
+"#func-implicit-timezone"><code>fn:implicit-timezone</code></a>,
+<a href=
+"#func-adjust-date-to-timezone"><code>fn:adjust-date-to-timezone</code></a>,
+<a href=
+"#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone</code></a>,
+and <a href=
+"#func-adjust-time-to-timezone"><code>fn:adjust-time-to-timezone</code></a>
depend on properties of the dynamic context that are fixed within
-the <a title="execution scope" class="termref" href="#execution-scope">
- <span class="arrow">·</span>execution
-scope<span class="arrow">·</span>
- </a>. The same applies to a
-number of functions in the <code>op:</code> namespace that
-manipulate dates and times and that make use of the implicit
-timezone. These functions will return the same result if called
-repeatedly during a single <a title="execution scope" class="termref" href="#execution-scope">
- <span class="arrow">·</span>execution scope<span class="arrow">·</span>
- </a>.</p>
- </li>
- <li>
- <p>The functions <a href="#func-position">
- <code>fn:position</code>
- </a>, <a href="#func-last">
- <code>fn:last</code>
- </a>, <a href="#func-id">
- <code>fn:id</code>
- </a>, <a href="#func-idref">
- <code>fn:idref</code>
- </a>, <a href="#func-element-with-id">
- <code>fn:element-with-id</code>
- </a>,
-<a href="#func-lang">
- <code>fn:lang</code>
- </a>, <a href="#func-local-name">
- <code>fn:local-name</code>
- </a>, <a href="#func-name">
- <code>fn:name</code>
- </a>, <a href="#func-namespace-uri">
- <code>fn:namespace-uri</code>
- </a>, <a href="#func-normalize-space">
- <code>fn:normalize-space</code>
- </a>,
-<a href="#func-number">
- <code>fn:number</code>
- </a>, <a href="#func-root">
- <code>fn:root</code>
- </a>, <a href="#func-string">
- <code>fn:string</code>
- </a>, and <a href="#func-string-length">
- <code>fn:string-length</code>
- </a> depend on
-the focus. These functions will in general return different results
-on different calls if the focus is different.</p>
- <p>
- <span class="termdef">
- <a name="focus-dependent" id="focus-dependent"/>[Definition] A function is
+the <a title="execution scope" class="termref" href=
+"#execution-scope"><span class="arrow">·</span>execution
+scope<span class="arrow">·</span></a>. The same applies to a number
+of functions in the <code>op:</code> namespace that manipulate
+dates and times and that make use of the implicit timezone. These
+functions will return the same result if called repeatedly during a
+single <a title="execution scope" class="termref" href=
+"#execution-scope"><span class="arrow">·</span>execution
+scope<span class="arrow">·</span></a>.</p>
+</li>
+<li>
+<p>A number of functions including <a href=
+"#func-base-uri"><code>fn:base-uri#0</code></a>, <a href=
+"#func-data"><code>fn:data#0</code></a>, <a href=
+"#func-document-uri"><code>fn:document-uri#0</code></a>, <a href=
+"#func-position"><code>fn:position</code></a>, <a href=
+"#func-last"><code>fn:last</code></a>, <a href=
+"#func-id"><code>fn:id#1</code></a>, <a href=
+"#func-idref"><code>fn:idref#1</code></a>, <a href=
+"#func-element-with-id"><code>fn:element-with-id#1</code></a>,
+<a href="#func-lang"><code>fn:lang#1</code></a>, <a href=
+"#func-local-name"><code>fn:local-name#0</code></a>, <a href=
+"#func-name"><code>fn:name#0</code></a>, <a href=
+"#func-namespace-uri"><code>fn:namespace-uri#0</code></a>, <a href=
+"#func-normalize-space"><code>fn:normalize-space#0</code></a>,
+<a href="#func-number"><code>fn:number#0</code></a>, <a href=
+"#func-root"><code>fn:root#0</code></a>, <a href=
+"#func-string"><code>fn:string#0</code></a>, <a href=
+"#func-string-length"><code>fn:string-length#0</code></a>, and
+<a href="#func-path"><code>fn:path#0</code></a> depend on the
+focus. These functions will in general return different results on
+different calls if the focus is different.</p>
+<p><span class="termdef"><a name="dt-focus-dependent" id=
+"dt-focus-dependent"></a>[Definition] A function is
<b>focus-dependent</b> if its result depends on the focus (that is,
-the context item, position, or size).</span>
- </p>
- <p>Functions that are <b>focus-dependent</b> cannot be used as
-function items. For example the expression <a href="#func-map">
- <code>fn:map($sequence, fn:id#1)</code>
- </a> is not
-allowed, because the function <a href="#func-id">
- <code>fn:id</code>
- </a> is focus-dependent.</p>
- </li>
- <li>
- <p>The function <a href="#func-default-collation">
- <code>fn:default-collation</code>
- </a> and
+the context item, position, or size).</span></p>
+<p><span class="termdef"><a name="dt-focus-independent" id=
+"dt-focus-independent"></a>[Definition] A function that is not
+<a title="focus-dependent" class="termref" href=
+"#dt-focus-dependent"><span class=
+"arrow">·</span>focus-dependent<span class="arrow">·</span></a> is
+called <b>focus-independent</b></span></p>
+</li>
+<li>
+<p>The function <a href=
+"#func-default-collation"><code>fn:default-collation</code></a> and
many string-handling operators and functions depend on the default
collation and the in-scope collations, which are both properties of
the static context. If a particular call of one of these functions
@@ -2322,509 +2562,642 @@
two calls on the function appearing in different places in the
source code) may produce different results even if the explicit
arguments are the same.</p>
- </li>
- <li>
- <p>Functions such as <a href="#func-static-base-uri">
- <code>fn:static-base-uri</code>
- </a>,
-<a href="#func-doc">
- <code>fn:doc</code>
- </a>, and <a href="#func-collection">
- <code>fn:collection</code>
- </a> depend on other
+</li>
+<li>
+<p>Functions such as <a href=
+"#func-static-base-uri"><code>fn:static-base-uri</code></a>,
+<a href="#func-doc"><code>fn:doc</code></a>, and <a href=
+"#func-collection"><code>fn:collection</code></a> depend on other
aspects of the static context. As with functions that depend on
collations, a single call will produce the same results on each
call if the explicit arguments are the same, but two calls
appearing in different places in the source code may produce
different results.</p>
- </li>
- </ol>
- <p>
- <span class="termdef">
- <a name="dt-implicit-arguments" id="dt-implicit-arguments"/>[Definition] For a <a title="context-dependent" class="termref" href="#dt-context-dependent">
- <span class="arrow">·</span>context-dependent<span class="arrow">·</span>
- </a>
+</li>
+</ol>
+<p><span class="termdef"><a name="dt-implicit-arguments" id=
+"dt-implicit-arguments"></a>[Definition] For a <a title=
+"context-dependent" class="termref" href=
+"#dt-context-dependent"><span class=
+"arrow">·</span>context-dependent<span class="arrow">·</span></a>
function, the parts of the context on which it depends are referred
-to as <b>implicit arguments</b>.</span>
- </p>
- <p>
- <span class="termdef">
- <a name="deterministic" id="deterministic"/>[Definition] A function that is guaranteed to
-produce <a title="identical" class="termref" href="#dt-identical">
- <span class="arrow">·</span>identical<span class="arrow">·</span>
- </a> results from repeated calls if the explicit
+to as <b>implicit arguments</b>.</span></p>
+<p><span class="termdef"><a name="dt-deterministic" id=
+"dt-deterministic"></a>[Definition] A function that is guaranteed
+to produce <a title="identical" class="termref" href=
+"#dt-identical"><span class="arrow">·</span>identical<span class=
+"arrow">·</span></a> results from repeated calls if the explicit
and implicit arguments are identical is referred to as
-<b>deterministic</b>.</span>
- </p>
- <p>All functions defined in this specification are <a title="deterministic" class="termref" href="#deterministic">
- <span class="arrow">·</span>deterministic<span class="arrow">·</span>
- </a>
+<b>deterministic</b>.</span></p>
+<p><span class="termdef"><a name="dt-nondeterministic" id=
+"dt-nondeterministic"></a>[Definition] A function that is not
+<a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a> is
+referred to as <b>nondeterministic</b>.</span></p>
+<p>All functions defined in this specification are <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>
unless otherwise stated. Exceptions include the following:</p>
- <ul>
- <li>
- <p>Some functions (such as <a href="#func-distinct-values">
- <code>fn:distinct-values</code>
- </a> and
-<a href="#func-unordered">
- <code>fn:unordered</code>
- </a>) produce
-results in an <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> or <a title="implementation dependent" class="termref" href="#implementation-dependent">
- <span class="arrow">·</span>implementation-dependent<span class="arrow">·</span>
- </a>order. In such cases there is no guarantee
+<ul>
+<li>
+<p>Some functions (such as <a href=
+"#func-distinct-values"><code>fn:distinct-values</code></a> and
+<a href="#func-unordered"><code>fn:unordered</code></a>) produce
+results in an <a title="implementation-defined" class="termref"
+href="#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> or <a title="implementation dependent" class=
+"termref" href="#implementation-dependent"><span class=
+"arrow">·</span>implementation-dependent<span class=
+"arrow">·</span></a> order. In such cases there is no guarantee
that the order of results from different calls will be the same.
These functions are said to be <b>non-deterministic with respect to
ordering</b>.</p>
- </li>
- <li>
- <p>The function <a href="#func-analyze-string">
- <code>fn:analyze-string</code>
- </a>
+</li>
+<li>
+<p>The function <a href=
+"#func-analyze-string"><code>fn:analyze-string</code></a>
constructs an element node to represent its results. There is no
guarantee that repeated calls with the same arguments will return
the same identical node (in the sense of the <code>is</code>
operator). However, if non-identical nodes are returned, their
-content will be the same in the sense of the <a href="#func-deep-equal">
- <code>fn:deep-equal</code>
- </a> function. Such a
+content will be the same in the sense of the <a href=
+"#func-deep-equal"><code>fn:deep-equal</code></a> function. Such a
function is said to be <b>non-deterministic with respect to node
identity</b>.</p>
- </li>
- <li>
- <p>Some functions (such as <a href="#func-doc">
- <code>fn:doc</code>
- </a> and <a href="#func-collection">
- <code>fn:collection</code>
- </a>) create new nodes
+</li>
+<li>
+<p>Some functions (such as <a href=
+"#func-doc"><code>fn:doc</code></a> and <a href=
+"#func-collection"><code>fn:collection</code></a>) create new nodes
by reading external documents. Such functions are guaranteed to be
-<a title="deterministic" class="termref" href="#deterministic">
- <span class="arrow">·</span>deterministic<span class="arrow">·</span>
- </a>
-with the exception that an implementation is allowed to make them
+<a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a> with
+the exception that an implementation is allowed to make them
non-deterministic as a user option.</p>
- </li>
- </ul>
- <p>Where the results of a function are described as being (to a
-greater or lesser extent) <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> or <a title="implementation dependent" class="termref" href="#implementation-dependent">
- <span class="arrow">·</span>implementation-dependent<span class="arrow">·</span>
- </a>, this does not by itself remove the
+</li>
+</ul>
+<p>Where the results of a function are described as being (to a
+greater or lesser extent) <a title="implementation-defined" class=
+"termref" href="#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> or <a title="implementation dependent" class=
+"termref" href="#implementation-dependent"><span class=
+"arrow">·</span>implementation-dependent<span class=
+"arrow">·</span></a>, this does not by itself remove the
requirement that the results should be deterministic: that is, that
repeated calls with the same explicit and implicit arguments
<strong>must</strong> return identical results.</p>
- </div>
- </div>
- </div>
- <div class="div1">
- <h2>
- <a name="accessors" id="accessors"/>2 Accessors</h2>
- <p>Accessors and their semantics are described in <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
+</div>
+</div>
+</div>
+<div class="div1">
+<h2><a name="accessors" id="accessors"></a>2 Accessors</h2>
+<p>Accessors and their semantics are described in <a href=
+"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
Some of these accessors are exposed to the user through the
functions described below.</p>
- <table summary="Function summary" border="1" width="80%">
- <col width="25%" span="1"/>
- <col width="25%" span="1"/>
- <col width="25%" span="1"/>
- <col width="25%" span="1"/>
- <thead>
- <tr>
- <th colspan="1">Function</th>
- <th colspan="1">Accessor</th>
- <th colspan="1">Accepts</th>
- <th colspan="1">Returns</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <a href="#func-node-name">
- <code>fn:node-name</code>
- </a>
- </td>
- <td>
- <code>node-name</code>
- </td>
- <td>an optional node</td>
- <td>zero or one <code>xs:QName</code>
- </td>
- </tr>
- <tr>
- <td>
- <a href="#func-nilled">
- <code>fn:nilled</code>
- </a>
- </td>
- <td>
- <code>nilled</code>
- </td>
- <td>a node</td>
- <td>an optional <code>xs:boolean</code>
- </td>
- </tr>
- <tr>
- <td>
- <a href="#func-string">
- <code>fn:string</code>
- </a>
- </td>
- <td>
- <code>string-value</code>
- </td>
- <td>an optional item or no argument</td>
- <td>
- <code>xs:string</code>
- </td>
- </tr>
- <tr>
- <td>
- <a href="#func-data">
- <code>fn:data</code>
- </a>
- </td>
- <td>
- <code>typed-value</code>
- </td>
- <td>zero or more items</td>
- <td>a sequence of atomic values</td>
- </tr>
- <tr>
- <td>
- <a href="#func-base-uri">
- <code>fn:base-uri</code>
- </a>
- </td>
- <td>
- <code>base-uri</code>
- </td>
- <td>an optional node or no argument</td>
- <td>zero or one <code>xs:anyURI</code>
- </td>
- </tr>
- <tr>
- <td>
- <a href="#func-document-uri">
- <code>fn:document-uri</code>
- </a>
- </td>
- <td>
- <code>document-uri</code>
- </td>
- <td>an optional node</td>
- <td>zero or one <code>xs:anyURI</code>
- </td>
- </tr>
- </tbody>
- </table>
- <div class="div2">
- <h3>
- <a name="func-node-name" id="func-node-name"/>2.1
+<table summary="Function summary" border="1" width="80%">
+<col width="25%" span="1" />
+<col width="25%" span="1" />
+<col width="25%" span="1" />
+<col width="25%" span="1" />
+<thead>
+<tr>
+<th colspan="1">Function</th>
+<th colspan="1">Accessor</th>
+<th colspan="1">Accepts</th>
+<th colspan="1">Returns</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><a href="#func-node-name"><code>fn:node-name</code></a></td>
+<td><code>node-name</code></td>
+<td>an optional node</td>
+<td>zero or one <code>xs:QName</code></td>
+</tr>
+<tr>
+<td><a href="#func-nilled"><code>fn:nilled</code></a></td>
+<td><code>nilled</code></td>
+<td>a node</td>
+<td>an optional <code>xs:boolean</code></td>
+</tr>
+<tr>
+<td><a href="#func-string"><code>fn:string</code></a></td>
+<td><code>string-value</code></td>
+<td>an optional item or no argument</td>
+<td><code>xs:string</code></td>
+</tr>
+<tr>
+<td><a href="#func-data"><code>fn:data</code></a></td>
+<td><code>typed-value</code></td>
+<td>zero or more items</td>
+<td>a sequence of atomic values</td>
+</tr>
+<tr>
+<td><a href="#func-base-uri"><code>fn:base-uri</code></a></td>
+<td><code>base-uri</code></td>
+<td>an optional node or no argument</td>
+<td>zero or one <code>xs:anyURI</code></td>
+</tr>
+<tr>
+<td><a href=
+"#func-document-uri"><code>fn:document-uri</code></a></td>
+<td><code>document-uri</code></td>
+<td>an optional node</td>
+<td>zero or one <code>xs:anyURI</code></td>
+</tr>
+</tbody>
+</table>
+<div class="div2">
+<h3><a name="func-node-name" id="func-node-name"></a>2.1
fn:node-name</h3>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the name of a node, as an <code>xs:QName</code>.</p>
- </dd>
- <dt class="label">Signatures</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:node-name</code>()<code class="as"> as </code>
- <code class="return-type">xs:QName?</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:node-name</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">node()?</code>)<code class="as"> as </code>
- <code class="return-type">xs:QName?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>If the argument is omitted, it defaults to the context item
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the name of a node, as an <code>xs:QName</code>.</p>
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:node-name</code>()<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:QName?</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:node-name</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">node()?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:QName?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>The zero-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-dependent" class="termref" href=
+"#dt-context-dependent"><span class=
+"arrow">·</span>context-dependent<span class="arrow">·</span></a>,
+and <a title="focus-dependent" class="termref" href=
+"#dt-focus-dependent"><span class=
+"arrow">·</span>focus-dependent<span class=
+"arrow">·</span></a>.</p>
+<p>The one-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>If the argument is omitted, it defaults to the context item
(<code>.</code>). The behavior of the function if the argument is
omitted is exactly the same as if the context item had been passed
as the argument.</p>
- <p>If <code>$arg</code> is the empty sequence, the empty sequence
+<p>If <code>$arg</code> is the empty sequence, the empty sequence
is returned.</p>
- <p>Otherwise, the function returns the result of the
-<code>dm:node-name</code> accessor as defined in <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
-(see <a href="http://www.w3.org/TR/xpath-datamodel-30/#dm-node-name">Section
-node-name Accessor</a>
- <sup>
- <small>DM30</small>
- </sup>).</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>For element and attribute nodes, the name of the node is
+<p>Otherwise, the function returns the result of the
+<code>dm:node-name</code> accessor as defined in <a href=
+"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
+(see <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dm-node-name">Section
+5.11 node-name Accessor</a> <sup><small>DM30</small></sup>).</p>
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>The following errors may be raised when <code>$arg</code> is
+omitted: if the context item is <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>
+[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title=
+"err:XPDY0002">err:XPDY0002</a>]<sup><small>XP</small></sup>; if
+the context item is not a node [<a href=
+"http://www.w3.org/TR/xpath20/#ERRXPTY0004" title=
+"err:XPTY0004">err:XPTY0004</a>]<sup><small>XP</small></sup>.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>For element and attribute nodes, the name of the node is
returned as an <code>xs:QName</code>, retaining the prefix,
namespace URI, and local part.</p>
- <p>For processing instructions, the name of the node is returned as
+<p>For processing instructions, the name of the node is returned as
an <code>xs:QName</code> in which the prefix and namespace URI are
-absent.</p>
- <p>For a namespace node, the function returns an empty sequence if
+<a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>.</p>
+<p>For a namespace node, the function returns an empty sequence if
the node represents the default namespace; otherwise it returns an
-<code>xs:QName</code> in which prefix and namespace URI are absent
-and the local part is the the namespace prefix being bound).</p>
- <p>For all other kinds of node, the function returns the empty
+<code>xs:QName</code> in which prefix and namespace URI are
+<a href="http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>
+and the local part is the namespace prefix being bound).</p>
+<p>For all other kinds of node, the function returns the empty
sequence.</p>
- </dd>
- </dl>
- </div>
- <div class="div2">
- <h3>
- <a name="func-nilled" id="func-nilled"/>2.2 fn:nilled</h3>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns true for an element that is <b>nilled</b>.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:nilled</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">node()?</code>)<code class="as"> as </code>
- <code class="return-type">xs:boolean?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>If <code>$arg</code> is the empty sequence, the function returns
+</dd>
+</dl>
+</div>
+<div class="div2">
+<h3><a name="func-nilled" id="func-nilled"></a>2.2 fn:nilled</h3>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns true for an element that is <b>nilled</b>.</p>
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:nilled</code>()<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:boolean</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:nilled</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">node()?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:boolean?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>The zero-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-dependent" class="termref" href=
+"#dt-context-dependent"><span class=
+"arrow">·</span>context-dependent<span class="arrow">·</span></a>,
+and <a title="focus-dependent" class="termref" href=
+"#dt-focus-dependent"><span class=
+"arrow">·</span>focus-dependent<span class=
+"arrow">·</span></a>.</p>
+<p>The one-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>If the argument is omitted, it defaults to the context item
+(<code>.</code>). The behavior of the function if the argument is
+omitted is exactly the same as if the context item had been passed
+as the argument.</p>
+<p>If <code>$arg</code> is the empty sequence, the function returns
the empty sequence.</p>
- <p>Otherwise the function returns the result of the
-<code>dm:nilled</code> accessor as defined in <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
-(see <a href="http://www.w3.org/TR/xpath-datamodel-30/#dm-nilled">Section nilled
-Accessor</a>
- <sup>
- <small>DM30</small>
- </sup>).</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>If <code>$arg</code> is not an element node, the function
+<p>Otherwise the function returns the result of the
+<code>dm:nilled</code> accessor as defined in <a href=
+"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
+(see <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dm-nilled">Section 5.9
+nilled Accessor</a> <sup><small>DM30</small></sup>).</p>
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>The following errors may be raised when <code>$arg</code> is
+omitted: if the context item is <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>
+[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title=
+"err:XPDY0002">err:XPDY0002</a>]<sup><small>XP</small></sup>; if
+the context item is not a node [<a href=
+"http://www.w3.org/TR/xpath20/#ERRXPTY0004" title=
+"err:XPTY0004">err:XPTY0004</a>]<sup><small>XP</small></sup>.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>If <code>$arg</code> is not an element node, the function
returns the empty sequence.</p>
- <p>If <code>$arg</code> is an untyped element node, the function
+<p>If <code>$arg</code> is an untyped element node, the function
returns false.</p>
- <p>In practice, the function returns <code>true</code> only for an
+<p>In practice, the function returns <code>true</code> only for an
element node that has the attribute <code>xsi:nil="true"</code> and
that is successfully validated against a schema that defines the
element to be nillable; the detailed rules, however, are defined in
<a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM)
3.0]</a>.</p>
- </dd>
- </dl>
- </div>
- <div class="div2">
- <h3>
- <a name="func-string" id="func-string"/>2.3 fn:string</h3>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the value of <code>$arg</code> represented as an
+</dd>
+</dl>
+</div>
+<div class="div2">
+<h3><a name="func-string" id="func-string"></a>2.3 fn:string</h3>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the value of <code>$arg</code> represented as an
<code>xs:string</code>.</p>
- </dd>
- <dt class="label">Signatures</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:string</code>()<code class="as"> as </code>
- <code class="return-type">xs:string</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:string</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">item()?</code>)<code class="as"> as </code>
- <code class="return-type">xs:string</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>In the zero-argument version of the function, <code>$arg</code>
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:string</code>()<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:string</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:string</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">item()?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:string</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>The zero-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-dependent" class="termref" href=
+"#dt-context-dependent"><span class=
+"arrow">·</span>context-dependent<span class="arrow">·</span></a>,
+and <a title="focus-dependent" class="termref" href=
+"#dt-focus-dependent"><span class=
+"arrow">·</span>focus-dependent<span class=
+"arrow">·</span></a>.</p>
+<p>The one-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>In the zero-argument version of the function, <code>$arg</code>
defaults to the context item. That is, calling
<code>fn:string()</code> is equivalent to calling
<code>fn:string(.)</code>.</p>
- <p>If <code>$arg</code> is the empty sequence, the function returns
+<p>If <code>$arg</code> is the empty sequence, the function returns
the zero-length string.</p>
- <p>If <code>$arg</code> is a node, the function returns the
+<p>If <code>$arg</code> is a node, the function returns the
string-value of the node, as obtained using the
-<code>dm:string-value</code> accessor defined in <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
-(see <a href="http://www.w3.org/TR/xpath-datamodel-30/#dm-string-value">Section
-string-value Accessor</a>
- <sup>
- <small>DM30</small>
- </sup>).</p>
- <p>If <code>$arg</code> is an atomic value, the function returns
+<code>dm:string-value</code> accessor defined in <a href=
+"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
+(see <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dm-string-value">Section
+5.13 string-value Accessor</a> <sup><small>DM30</small></sup>).</p>
+<p>If <code>$arg</code> is an atomic value, the function returns
the result of the expression <code>$arg cast as xs:string</code>
-(see <a href="#casting">
- <b>18 Casting</b>
- </a>).</p>
- </dd>
- <dt class="label">Error Conditions</dt>
- <dd>
- <p>In the zero-argument version of the function, if the context
-item is absent, error [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
- <small>XP</small>
- </sup> is
-raised.</p>
- <p>If <code>$arg</code> is a function item, error [<a href="#ERRFOTY0014" title="err:FOTY0014">err:FOTY0014</a>] is
-raised.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>string(23)</code> returns
+(see <a href="#casting"><b>18 Casting</b></a>).</p>
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>An error is raised [<a href=
+"http://www.w3.org/TR/xpath20/#ERRXPDY0002" title=
+"err:XPDY0002">err:XPDY0002</a>]<sup><small>XP</small></sup> by the
+zero-argument version of the function if the context item is
+<a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>.</p>
+<p>An error is raised [<a href="#ERRFOTY0014" title=
+"err:FOTY0014">err:FOTY0014</a>] if <code>$arg</code> is a function
+item.</p>
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>string(23)</code> returns
<code>"23"</code>.</p>
- <p>The expression <code>string(false())</code> returns
+<p>The expression <code>string(false())</code> returns
<code>"false"</code>.</p>
- <p>The expression <code>string("Paris")</code> returns
+<p>The expression <code>string("Paris")</code> returns
<code>"Paris"</code>.</p>
- <p>let <code>$para</code> :=</p>
- <div class="exampleInner">
- <pre>
- <para>In a hole in the ground there lived a <term author="Tolkein">hobbit</term>.</para>
-</pre>
- </div>
- <p>The expression <code>string($para)</code> returns <code>"In a
+<p>The expression <code>string(abs#1)</code> raises error
+<code>FOTY0014</code>.</p>
+<p>let <code>$para</code> :=</p>
+<div class="exampleInner">
+<pre>
+&lt;para&gt;In a hole in the ground there lived a &lt;term author="Tolkein"&gt;hobbit&lt;/term&gt;.&lt;/para&gt;
+
+</pre></div>
+<p>The expression <code>string($para)</code> returns <code>"In a
hole in the ground there lived a hobbit."</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div2">
- <h3>
- <a name="func-data" id="func-data"/>2.4 fn:data</h3>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the result of atomizing a sequence, that is, replacing
+</dd>
+</dl>
+</div>
+<div class="div2">
+<h3><a name="func-data" id="func-data"></a>2.4 fn:data</h3>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the result of atomizing a sequence, that is, replacing
all nodes in the sequence by their typed values.</p>
- </dd>
- <dt class="label">Signatures</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:data</code>()<code class="as"> as </code>
- <code class="return-type">xs:anyAtomicType*</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:data</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">item()*</code>)<code class="as"> as </code>
- <code class="return-type">xs:anyAtomicType*</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>If the argument is omitted, it defaults to the context item
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:data</code>()<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:anyAtomicType*</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:data</code>(<code class="arg">$arg</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">item()*</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:anyAtomicType*</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>The zero-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-dependent" class="termref" href=
+"#dt-context-dependent"><span class=
+"arrow">·</span>context-dependent<span class="arrow">·</span></a>,
+and <a title="focus-dependent" class="termref" href=
+"#dt-focus-dependent"><span class=
+"arrow">·</span>focus-dependent<span class=
+"arrow">·</span></a>.</p>
+<p>The one-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>If the argument is omitted, it defaults to the context item
(<code>.</code>). The behavior of the function if the argument is
omitted is exactly the same as if the context item had been passed
as the argument.</p>
- <p>The result of <code>fn:data</code> is the sequence of atomic
+<p>The result of <code>fn:data</code> is the sequence of atomic
values produced by applying the following rules to each item in
<code>$arg</code>:</p>
- <ul>
- <li>
- <p>If the item is an atomic value, it is appended to the result
+<ul>
+<li>
+<p>If the item is an atomic value, it is appended to the result
sequence.</p>
- </li>
- <li>
- <p>If the item is a node, the typed value of the node is appended
+</li>
+<li>
+<p>If the item is a node, the typed value of the node is appended
to the result sequence. The typed value is a sequence of zero or
more atomic values: specifically, the result of the
-<code>dm:typed-value</code> accessor as defined in <a href="#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
-(See <a href="http://www.w3.org/TR/xpath-datamodel-30/#dm-typed-value">Section
-typed-value Accessor</a>
- <sup>
- <small>DM30</small>
- </sup>).</p>
- </li>
- </ul>
- </dd>
- <dt class="label">Error Conditions</dt>
- <dd>
- <p>If an item in the sequence <code>$arg</code> is a node that does
-not have a typed value then an error is raised [<a href="#ERRFOTY0012" title="err:FOTY0012">err:FOTY0012</a>].</p>
- <p>If an item in the sequence <code>$arg</code> is a function item
-then an error is raised [<a href="#ERRFOTY0013" title="err:FOTY0013">err:FOTY0013</a>].</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>The process of applying the <code>fn:data</code> function to a
+<code>dm:typed-value</code> accessor as defined in <a href=
+"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
+(See <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dm-typed-value">Section
+5.15 typed-value Accessor</a> <sup><small>DM30</small></sup>).</p>
+</li>
+</ul>
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>An error is raised [<a href="#ERRFOTY0012" title=
+"err:FOTY0012">err:FOTY0012</a>] if an item in the sequence
+<code>$arg</code> is a node that does not have a typed value.</p>
+<p>An error is raised [<a href="#ERRFOTY0013" title=
+"err:FOTY0013">err:FOTY0013</a>] if an item in the sequence
+<code>$arg</code> is a function item.</p>
+<p>The following errors may be raised when <code>$arg</code> is
+omitted: if the context item is <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>
+[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title=
+"err:XPDY0002">err:XPDY0002</a>]<sup><small>XP</small></sup>; if
+the context item is not a node [<a href=
+"http://www.w3.org/TR/xpath20/#ERRXPTY0004" title=
+"err:XPTY0004">err:XPTY0004</a>]<sup><small>XP</small></sup>.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>The process of applying the <code>fn:data</code> function to a
sequence is referred to as <code>atomization</code>. In many cases
an explicit call on <code>fn:data</code> is not required, because
atomization is invoked implicitly when a node or sequence of nodes
is supplied in a context where an atomic value or sequence of
atomic values is required.</p>
- </dd>
- </dl>
- </div>
- <div class="div2">
- <h3>
- <a name="func-base-uri" id="func-base-uri"/>2.5
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>data(123)</code> returns
+<code>123</code>.</p>
+<p>let <code>$para</code> :=</p>
+<div class="exampleInner">
+<pre>
+&lt;para&gt;In a hole in the ground there lived a &lt;term author="Tolkein"&gt;hobbit&lt;/term&gt;.&lt;/para&gt;
+
+</pre></div>
+<p>The expression <code>data($para)</code> returns
+<code>xs:untypedAtomic("In a hole in the ground there lived a
+hobbit.")</code>.</p>
+<p>The expression <code>data($para/term/@author)</code> returns
+<code>xs:untypedAtomic("Tolkein")</code>.</p>
+<p>The expression <code>data(abs#1)</code> raises error
+<code>FOTY0013</code>.</p>
+</dd>
+</dl>
+</div>
+<div class="div2">
+<h3><a name="func-base-uri" id="func-base-uri"></a>2.5
fn:base-uri</h3>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the base URI of a node.</p>
- </dd>
- <dt class="label">Signatures</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:base-uri</code>()<code class="as"> as </code>
- <code class="return-type">xs:anyURI?</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:base-uri</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">node()?</code>)<code class="as"> as </code>
- <code class="return-type">xs:anyURI?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>The zero-argument version of the function returns the base URI
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the base URI of a node.</p>
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:base-uri</code>()<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:anyURI?</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:base-uri</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">node()?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:anyURI?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>The zero-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-dependent" class="termref" href=
+"#dt-context-dependent"><span class=
+"arrow">·</span>context-dependent<span class="arrow">·</span></a>,
+and <a title="focus-dependent" class="termref" href=
+"#dt-focus-dependent"><span class=
+"arrow">·</span>focus-dependent<span class=
+"arrow">·</span></a>.</p>
+<p>The one-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>The zero-argument version of the function returns the base URI
of the context node: it is equivalent to calling
<code>fn:base-uri(.)</code>. This may result in an error being
-raised: if the context item is absent [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
- <small>XP</small>
- </sup>; if
-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
- <small>XP</small>
- </sup>.</p>
- <p>The single-argument version of the function behaves as
+raised: if the context item is <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>
+[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title=
+"err:XPDY0002">err:XPDY0002</a>]<sup><small>XP</small></sup>; if
+the context item is not a node [<a href=
+"http://www.w3.org/TR/xpath20/#ERRXPTY0004" title=
+"err:XPTY0004">err:XPTY0004</a>]<sup><small>XP</small></sup>.</p>
+<p>The single-argument version of the function behaves as
follows:</p>
- <ol class="enumar">
- <li>If <code>$arg</code> is the empty sequence, the function
+<ol class="enumar">
+<li>If <code>$arg</code> is the empty sequence, the function
returns the empty sequence.</li>
- <li>Otherwise, the function returns the value of the
+<li>Otherwise, the function returns the value of the
<code>dm:base-uri</code> accessor applied to the node
<code>$arg</code>. This accessor is defined, for each kind of node,
-in the XDM specification (See <a href="http://www.w3.org/TR/xpath-datamodel-30/#dm-base-uri">Section
-base-uri Accessor</a>
- <sup>
- <small>DM30</small>
- </sup>).</li>
- </ol>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
+in the XDM specification (See <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dm-base-uri">Section 5.2
+base-uri Accessor</a> <sup><small>DM30</small></sup>).</li>
+</ol>
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
As explained in XDM, document, element and processing-instruction
nodes have a base-uri property which may be empty. The base-uri
property for all other node kinds is the empty sequence. The
@@ -2836,234 +3209,258 @@
is empty, the empty sequence is returned. In the case of namespace
nodes, however, the result is always an empty sequence -- it does
not depend on the base URI of the parent element.</div>
- <p>See also <a href="#func-static-base-uri">
- <code>fn:static-base-uri</code>
- </a>.</p>
- </dd>
- <dt class="label">Error Conditions</dt>
- <dd>
- <p>If <code>$arg</code> is not specified, the following errors may
-be raised: if the context item is absent [<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title="err:XPDY0002">err:XPDY0002</a>]<sup>
- <small>XP</small>
- </sup>; if
-the context item is not a node [<a href="http://www.w3.org/TR/xpath20/#ERRXPTY0004" title="err:XPTY0004">err:XPTY0004</a>]<sup>
- <small>XP</small>
- </sup>.</p>
- </dd>
- </dl>
- </div>
- <div class="div2">
- <h3>
- <a name="func-document-uri" id="func-document-uri"/>2.6
+<p>See also <a href=
+"#func-static-base-uri"><code>fn:static-base-uri</code></a>.</p>
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>If <code>$arg</code> is not specified, the following errors may
+be raised: if the context item is <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>
+[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title=
+"err:XPDY0002">err:XPDY0002</a>]<sup><small>XP</small></sup>; if
+the context item is not a node [<a href=
+"http://www.w3.org/TR/xpath20/#ERRXPTY0004" title=
+"err:XPTY0004">err:XPTY0004</a>]<sup><small>XP</small></sup>.</p>
+</dd>
+</dl>
+</div>
+<div class="div2">
+<h3><a name="func-document-uri" id="func-document-uri"></a>2.6
fn:document-uri</h3>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the URI of a resource where a document can be found, if
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the URI of a resource where a document can be found, if
available.</p>
- </dd>
- <dt class="label">Signatures</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:document-uri</code>()<code class="as"> as </code>
- <code class="return-type">xs:anyURI?</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:document-uri</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">node()?</code>)<code class="as"> as </code>
- <code class="return-type">xs:anyURI?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>If the argument is omitted, it defaults to the context item
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:document-uri</code>()<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:anyURI?</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:document-uri</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">node()?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:anyURI?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>The zero-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-dependent" class="termref" href=
+"#dt-context-dependent"><span class=
+"arrow">·</span>context-dependent<span class="arrow">·</span></a>,
+and <a title="focus-dependent" class="termref" href=
+"#dt-focus-dependent"><span class=
+"arrow">·</span>focus-dependent<span class=
+"arrow">·</span></a>.</p>
+<p>The one-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>If the argument is omitted, it defaults to the context item
(<code>.</code>). The behavior of the function if the argument is
omitted is exactly the same as if the context item had been passed
as the argument.</p>
- <p>If <code>$arg</code> is the empty sequence, the function returns
+<p>If <code>$arg</code> is the empty sequence, the function returns
the empty sequence.</p>
- <p>If <code>$arg</code> is not a document node, the function
+<p>If <code>$arg</code> is not a document node, the function
returns the empty sequence.</p>
- <p>Otherwise, the function returns the value of the
+<p>Otherwise, the function returns the value of the
<code>document-uri</code> accessor applied to <code>$arg</code>, as
defined in <a href="#xpath-datamodel-30">[XQuery and XPath Data
-Model (XDM) 3.0]</a> (See <a href="http://www.w3.org/TR/xpath-datamodel-30/#DocumentNodeAccessors">Section
-Accessors</a>
- <sup>
- <small>DM30</small>
- </sup>).</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>In the case of a document node <code>$D</code> returned by the
-<a href="#func-doc">
- <code>fn:doc</code>
- </a> function, or a document
+Model (XDM) 3.0]</a> (See <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#DocumentNodeAccessors">Section
+6.1.2 Accessors</a> <sup><small>DM30</small></sup>).</p>
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>The following errors may be raised when <code>$arg</code> is
+omitted: if the context item is <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>
+[<a href="http://www.w3.org/TR/xpath20/#ERRXPDY0002" title=
+"err:XPDY0002">err:XPDY0002</a>]<sup><small>XP</small></sup>; if
+the context item is not a node [<a href=
+"http://www.w3.org/TR/xpath20/#ERRXPTY0004" title=
+"err:XPTY0004">err:XPTY0004</a>]<sup><small>XP</small></sup>.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>In the case of a document node <code>$D</code> returned by the
+<a href="#func-doc"><code>fn:doc</code></a> function, or a document
node at the root of a tree containing a node returned by the
-<a href="#func-collection">
- <code>fn:collection</code>
- </a> function,
+<a href="#func-collection"><code>fn:collection</code></a> function,
it will always be true that either <code>fn:document-uri($D)</code>
returns the empty sequence, or that the following expression is
-true: <a href="#func-doc">
- <code>fn:doc(fn:document-uri($D))</code>
- </a> is
-<code>$D</code>. It is implementation-defined whether this
-guarantee also holds for document nodes obtained by other means,
-for example a document node passed as the initial context node of a
-query or transformation.</p>
- </dd>
- </dl>
- </div>
- </div>
- <div class="div1">
- <h2>
- <a name="errors-and-diagnostics" id="errors-and-diagnostics"/>3 Errors and diagnostics</h2>
- <div class="div2">
- <h3>
- <a name="errors" id="errors"/>3.1 Raising errors</h3>
- <p>In this document, as well as in <a href="#xquery-30">[XQuery
+true: <a href=
+"#func-doc"><code>fn:doc(fn:document-uri($D))</code></a> is
+<code>$D</code>. It is <a title="implementation-defined" class=
+"termref" href="#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> whether this guarantee also holds for document
+nodes obtained by other means, for example a document node passed
+as the initial context node of a query or transformation.</p>
+</dd>
+</dl>
+</div>
+</div>
+<div class="div1">
+<h2><a name="errors-and-diagnostics" id=
+"errors-and-diagnostics"></a>3 Errors and diagnostics</h2>
+<div class="div2">
+<h3><a name="errors" id="errors"></a>3.1 Raising errors</h3>
+<p>In this document, as well as in <a href="#xquery-30">[XQuery
3.0: An XML Query Language]</a> and <a href="#xpath-30">[XML Path
Language (XPath) 3.0]</a>, the phrase "an error is raised" is used.
-Raising an error is equivalent to calling the <a href="#func-error">
- <code>fn:error</code>
- </a> function defined in this
+Raising an error is equivalent to calling the <a href=
+"#func-error"><code>fn:error</code></a> function defined in this
section with the provided error code.</p>
- <p>The above phrase is normally accompanied by specification of a
+<p>The above phrase is normally accompanied by specification of a
specific error, to wit: "an error is raised [<em>error code</em>]".
Each error defined in this document is identified by an
<code>xs:QName</code> that is in the
<code>http://www.w3.org/2005/xqt-errors</code> namespace,
represented in this document by the <code>err</code> prefix. It is
this <code>xs:QName</code> that is actually passed as an argument
-to the <a href="#func-error">
- <code>fn:error</code>
- </a> function.
+to the <a href="#func-error"><code>fn:error</code></a> function.
Calling this function raises an error. For a more detailed
-treatment of error handing, see <a href="http://www.w3.org/TR/xpath-30/#id-handling-dynamic">Section
-Handling Dynamic Errors</a>
- <sup>
- <small>XP30</small>
- </sup>.</p>
- <p>The <a href="#func-error">
- <code>fn:error</code>
- </a> function is
+treatment of error handing, see <a href=
+"http://www.w3.org/TR/xpath-30/#id-handling-dynamic">Section 2.3.3
+Handling Dynamic Errors</a> <sup><small>XP30</small></sup>.</p>
+<p>The <a href="#func-error"><code>fn:error</code></a> function is
a general function that may be called as above but may also be
called from <a href="#xquery-30">[XQuery 3.0: An XML Query
Language]</a> or <a href="#xpath-30">[XML Path Language (XPath)
3.0]</a> applications with, for example, an <code>xs:QName</code>
argument.</p>
- <div class="div3">
- <h4>
- <a name="func-error" id="func-error"/>3.1.1 fn:error</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Calling the <code>fn:error</code> function raises an
+<div class="div3">
+<h4><a name="func-error" id="func-error"></a>3.1.1 fn:error</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Calling the <code>fn:error</code> function raises an
application-defined error.</p>
- </dd>
- <dt class="label">Signatures</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:error</code>()<code class="as"> as </code>
- <code class="return-type">none</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:error</code>(<code class="arg">$code</code>
- <code class="as"> as </code>
- <code class="type">xs:QName</code>)<code class="as"> as </code>
- <code class="return-type">none</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:error</code>(<code class="arg">$code</code>
- <code class="as"> as </code>
- <code class="type">xs:QName?</code>, <code class="arg">$description</code>
- <code class="as"> as </code>
- <code class="type">xs:string</code>)<code class="as"> as </code>
- <code class="return-type">none</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
- <tr>
- <td valign="baseline" rowspan="3">
- <code class="function">fn:error</code>(</td>
- <td valign="baseline">
- <code class="arg">$code</code>
- </td>
- <td valign="baseline">
- <code class="as"> as </code>
- <code class="type">xs:QName?</code>,</td>
- </tr>
- <tr>
- <td valign="baseline">
- <code class="arg">$description</code>
- </td>
- <td valign="baseline">
- <code class="as"> as </code>
- <code class="type">xs:string</code>,</td>
- </tr>
- <tr>
- <td valign="baseline">
- <code class="arg">$error-object</code>
- </td>
- <td valign="baseline">
- <code class="as"> as </code>
- <code class="type">item()*</code>)<code class="as"> as </code>
- <code class="return-type">none</code>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>This function never returns a value. Instead it always raises an
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:error</code>()<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">none</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:error</code>(<code class=
+"arg">$code</code><code class=
+"as">&#160;as&#160;</code><code class="type">xs:QName</code>)<code class="as">&#160;as&#160;</code><code class="return-type">none</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:error</code>(<code class=
+"arg">$code</code><code class=
+"as">&#160;as&#160;</code><code class="type">xs:QName?</code>,
+<code class="arg">$description</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">xs:string</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">none</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto">
+<table border="0" cellpadding="0" cellspacing="0" summary=
+"Function/operator prototype">
+<tr>
+<td valign="baseline" rowspan="3"><code class=
+"function">fn:error</code>(</td>
+<td valign="baseline"><code class="arg">$code</code></td>
+<td valign="baseline"><code class=
+"as">&#160;as&#160;</code><code class="type">xs:QName?</code>,</td>
+</tr>
+<tr>
+<td valign="baseline"><code class="arg">$description</code></td>
+<td valign="baseline"><code class=
+"as">&#160;as&#160;</code><code class="type">xs:string</code>,</td>
+</tr>
+<tr>
+<td valign="baseline"><code class="arg">$error-object</code></td>
+<td valign="baseline"><code class=
+"as">&#160;as&#160;</code><code class=
+"type">item()*</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">none</code></td>
+</tr>
+</table>
+</div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="nondeterministic" class="termref"
+href="#dt-nondeterministic"><span class=
+"arrow">·</span>nondeterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>This function never returns a value. Instead it always raises an
error. The effect of the error is identical to the effect of
dynamic errors raised implicitly, for example when an incorrect
argument is supplied to a function.</p>
- <p>The parameters to the <code>fn:error</code> function supply
+<p>The parameters to the <code>fn:error</code> function supply
information that is associated with the error condition and that is
made available to a caller that asks for information about the
error. The error may be caught either by the host language (using a
try/catch construct in XSLT or XQuery, for example), or by the
calling application or external processing environment. The way in
which error information is returned to the external processing
-environment is <a title="implementation dependent" class="termref" href="#implementation-dependent">
- <span class="arrow">·</span>implementation dependent<span class="arrow">·</span>
- </a>
- </p>
- <p>If <code>fn:error</code> is called with no arguments, then its
+environment is <a title="implementation dependent" class="termref"
+href="#implementation-dependent"><span class=
+"arrow">·</span>implementation dependent<span class=
+"arrow">·</span></a></p>
+<p>If <code>fn:error</code> is called with no arguments, then its
behavior is the same as the function call:</p>
- <div class="exampleInner">
- <pre>
+<div class="exampleInner">
+<pre>
fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000'))
-</pre>
- </div>
- <p>If <code>$code</code> is the empty sequence then the effective
+</pre></div>
+<p>If <code>$code</code> is the empty sequence then the effective
value is the <code>xs:QName</code> constructed by:</p>
- <div class="exampleInner">
- <pre>
- fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000')
-</pre>
- </div>
- <p>There are three pieces of information that may be associated
+<div class="exampleInner">
+<pre>
+ fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000')
+</pre></div>
+<p>There are three pieces of information that may be associated
with an error:</p>
- <ul>
- <li>
- <p>The <code>$code</code> is an error code that distinguishes this
+<ul>
+<li>
+<p>The <code>$code</code> is an error code that distinguishes this
error from others. It is an <code>xs:QName</code>; the namespace
URI conventionally identifies the component, subsystem, or
authority responsible for defining the meaning of the error code,
@@ -3071,385 +3468,330 @@
namespace URI <code>http://www.w3.org/2005/xqt-errors</code> is
used for errors defined in this specification; other namespace URIs
may be used for errors defined by the application.</p>
- <p>If the external processing environment expects the error code to
+<p>If the external processing environment expects the error code to
be returned as a URI or a string rather than as an
<code>xs:QName</code>, then an error code with namespace URI
<code>NS</code> and local part <code>LP</code> will be returned in
the form <code>NS#LP</code>. The namespace URI part of the error
code should therefore not include a fragment identifier.</p>
- </li>
- <li>
- <p>The <code>$description</code> is a natural-language description
+</li>
+<li>
+<p>The <code>$description</code> is a natural-language description
of the error condition.</p>
- </li>
- <li>
- <p>The <code>$error-object</code> is an arbitrary value used to
+</li>
+<li>
+<p>The <code>$error-object</code> is an arbitrary value used to
convey additional information about the error, and may be used in
any way the application chooses.</p>
- </li>
- </ul>
- </dd>
- <dt class="label">Error Conditions</dt>
- <dd>
- <p>This function always raises an error.</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>The value of the <code>$description</code> parameter may need to
+</li>
+</ul>
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>This function always raises an error.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>The value of the <code>$description</code> parameter may need to
be localized.</p>
- <p>The type "none" is a special type defined in <a href="#xquery-semantics">[XQuery 1.0 and XPath 2.0 Formal Semantics]</a>
+<p>The type "none" is a special type defined in <a href=
+"#xquery-semantics">[XQuery 1.0 and XPath 2.0 Formal Semantics]</a>
and is not available to the user. It indicates that the function
never returns and ensures that it has the correct static type.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>
- <code>fn:error()</code> returns
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>fn:error()</code> raises error
+<code>FOER0000</code>. <em>(This returns the URI
<code>http://www.w3.org/2005/xqt-errors#FOER0000</code> (or the
corresponding <code>xs:QName</code>) to the external processing
environment, unless the error is caught using a try/catch construct
-in the host language.</p>
- <p>
- <code>fn:error(fn:QName('http://www.example.com/HR',
+in the host language.).</em></p>
+<p>The expression
+<code>fn:error(fn:QName('http://www.example.com/HR',
'myerr:toohighsal'), 'Does not apply because salary is too
-high')</code> returns
-<code>http://www.example.com/HR#toohighsal</code> and the
-<code>xs:string</code>
- <code>"Does not apply because salary is too
+high')</code> raises error <code>myerr:toohighsal</code>. <em>(This
+returns <code>http://www.example.com/HR#toohighsal</code> and the
+<code>xs:string</code> <code>"Does not apply because salary is too
high"</code> (or the corresponding <code>xs:QName</code>) to the
external processing environment, unless the error is caught using a
-try/catch construct in the host language.</p>
- </dd>
- </dl>
- </div>
- </div>
- <div class="div2">
- <h3>
- <a name="diagnostics" id="diagnostics"/>3.2 Diagnostic
+try/catch construct in the host language.).</em></p>
+</dd>
+</dl>
+</div>
+</div>
+<div class="div2">
+<h3><a name="diagnostics" id="diagnostics"></a>3.2 Diagnostic
tracing</h3>
- <div class="div3">
- <h4>
- <a name="func-trace" id="func-trace"/>3.2.1 fn:trace</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Provides an execution trace intended to be used in debugging
+<div class="div3">
+<h4><a name="func-trace" id="func-trace"></a>3.2.1 fn:trace</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Provides an execution trace intended to be used in debugging
queries.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:trace</code>(<code class="arg">$value</code>
- <code class="as"> as </code>
- <code class="type">item()*</code>, <code class="arg">$label</code>
- <code class="as"> as </code>
- <code class="type">xs:string</code>)<code class="as"> as </code>
- <code class="return-type">item()*</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>The function returns the value of <code>$value</code>,
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:trace</code>(<code class=
+"arg">$value</code><code class=
+"as">&#160;as&#160;</code><code class="type">item()*</code>,
+<code class="arg">$label</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">xs:string</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">item()*</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>The function returns the value of <code>$value</code>,
unchanged.</p>
- <p>In addition, the values of <code>$value</code>, converted to an
+<p>In addition, the values of <code>$value</code>, converted to an
<code>xs:string</code>, and <code>$label</code>
- <strong>may</strong> be directed to a trace data set. The
-destination of the trace output is <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a>. The format of the trace output is <a title="implementation dependent" class="termref" href="#implementation-dependent">
- <span class="arrow">·</span>implementation dependent<span class="arrow">·</span>
- </a>. The ordering of output from calls of the
-<code>fn:trace</code> function is <a title="implementation dependent" class="termref" href="#implementation-dependent">
- <span class="arrow">·</span>implementation dependent<span class="arrow">·</span>
- </a>.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>Consider a situation in which a user wants to investigate the
+<strong>may</strong> be directed to a trace data set. The
+destination of the trace output is <a title=
+"implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a>. The format of the trace output is <a title=
+"implementation dependent" class="termref" href=
+"#implementation-dependent"><span class=
+"arrow">·</span>implementation dependent<span class=
+"arrow">·</span></a>. The ordering of output from calls of the
+<code>fn:trace</code> function is <a title=
+"implementation dependent" class="termref" href=
+"#implementation-dependent"><span class=
+"arrow">·</span>implementation dependent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>Consider a situation in which a user wants to investigate the
actual value passed to a function. Assume that in a particular
execution, <code>$v</code> is an <code>xs:decimal</code> with value
<code>124.84</code>. Writing <code>fn:trace($v, 'the value of $v
is:')</code> will put the strings <code>"124.84"</code> and
<code>"the value of $v is:"</code> in the trace data set in
implementation dependent order.</p>
- </dd>
- </dl>
- </div>
- </div>
- </div>
- <div class="div1">
- <h2>
- <a name="numeric-functions" id="numeric-functions"/>4
+</dd>
+</dl>
+</div>
+</div>
+</div>
+<div class="div1">
+<h2><a name="numeric-functions" id="numeric-functions"></a>4
Functions and operators on numerics</h2>
- <p>This section specifies arithmetic operators on the numeric
+<p>This section specifies arithmetic operators on the numeric
datatypes defined in <a href="#xmlschema-2">[XML Schema Part 2:
Datatypes Second Edition]</a>. It uses an approach that permits
lightweight implementation whenever possible.</p>
- <div class="div2">
- <h3>
- <a name="numeric-types" id="numeric-types"/>4.1 Numeric
+<div class="div2">
+<h3><a name="numeric-types" id="numeric-types"></a>4.1 Numeric
types</h3>
- <p>The operators described in this section are defined on the
+<p>The operators described in this section are defined on the
following numeric types. Each type whose name is indented is
derived from the type whose name appears nearest above with one
less level of indentation.</p>
- <table class="hierarchy" summary="Numeric types" border="0" width="288">
- <tbody>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:decimal</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle"/>
- <td class="castOther" align="left" valign="middle">xs:integer</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:float</td>
- </tr>
- <tr>
- <td class="castOther" align="left" valign="middle">xs:double</td>
- </tr>
- </tbody>
- </table>
- <p>They also apply to types derived by restriction from the above
+<table class="hierarchy" summary="Numeric types" border="0" width=
+"288">
+<tbody>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:decimal</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle"></td>
+<td class="castOther" align="left" valign="middle">xs:integer</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:float</td>
+</tr>
+<tr>
+<td class="castOther" align="left" valign="middle">xs:double</td>
+</tr>
+</tbody>
+</table>
+<p>They also apply to types derived by restriction from the above
types.</p>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>This specification uses <a href="#ieee754">[IEEE 754-1985]</a>
-arithmetic for <code>xs:float</code> and <code>xs:double</code>
-values.
-<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
- <span>One
-consequence of this is that some operations result in the value
-<code>NaN</code> (not-a number), which has the unusual property
-that it is not equal to itself. Another consequence is that some
-operations return the value negative zero.</span> This differs from
-<a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
-Edition]</a> which defines <code>NaN</code> as being equal to
-itself and defines only a single zero in the value space. The text
-accompanying several functions defines behavior for both positive
-and negative zero inputs and outputs in the interest of alignment
-with <a href="#ieee754">[IEEE 754-1985]</a>.
-<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
- <span>A
-conformant implementation must respect these semantics. In
-consequence, the expression <code>-0.0e0</code> (which is actually
-a unary minus operator applied to an <code>xs:double</code> value)
-will always return negative zero: see <a href="#func-numeric-unary-minus">
- <b>4.2.8
-op:numeric-unary-minus</b>
- </a>. As a concession to implementations
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>This specification uses <a href="#ieee754-2008">[IEEE
+754-2008]</a> arithmetic for <code>xs:float</code> and
+<code>xs:double</code> values. <span>One consequence of this is
+that some operations result in the value <code>NaN</code> (not-a
+number), which has the unusual property that it is not equal to
+itself. Another consequence is that some operations return the
+value negative zero.</span> This differs from <a href=
+"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
+which defines <code>NaN</code> as being equal to itself and defines
+only a single zero in the value space. The text accompanying
+several functions defines behavior for both positive and negative
+zero inputs and outputs in the interest of alignment with <a href=
+"#ieee754-2008">[IEEE 754-2008]</a>. <span>A conformant
+implementation must respect these semantics. In consequence, the
+expression <code>-0.0e0</code> (which is actually a unary minus
+operator applied to an <code>xs:double</code> value) will always
+return negative zero: see <a href=
+"#func-numeric-unary-minus"><b>4.2.8
+op:numeric-unary-minus</b></a>. As a concession to implementations
that rely on implementations of XSD 1.0, however, when casting from
string to double the lexical form <code>-0</code>
- <strong>may</strong> be converted to positive zero, though negative
-zero is <strong>recommended</strong>.</span>
- </p>
- <p>XML Schema 1.1 introduces support for positive and negative zero
-as distinct values, and also uses the <a href="#ieee754">[IEEE
-754-1985]</a> semantics for comparisons involving
+<strong>may</strong> be converted to positive zero, though negative
+zero is <strong>recommended</strong>.</span></p>
+<p>XML Schema 1.1 introduces support for positive and negative zero
+as distinct values, and also uses the <a href="#ieee754-2008">[IEEE
+754-2008]</a> semantics for comparisons involving
<code>NaN</code>.</p>
- </div>
- </div>
- <div class="div2">
- <h3>
- <a name="op.numeric" id="op.numeric"/>4.2 Arithmetic
+</div>
+</div>
+<div class="div2">
+<h3><a name="op.numeric" id="op.numeric"></a>4.2 Arithmetic
operators on numeric values</h3>
- <p>The following functions define the semantics of arithmetic
+<p>The following functions define the semantics of arithmetic
operators defined in <a href="#xquery-30">[XQuery 3.0: An XML Query
Language]</a> and <a href="#xpath-30">[XML Path Language (XPath)
3.0]</a> on these numeric types.</p>
- <table summary="Operator summary" border="1">
- <thead>
- <tr>
- <th colspan="1">Operators</th>
- <th colspan="1">Meaning</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <a href="#func-numeric-add">
- <code>op:numeric-add</code>
- </a>
- </td>
- <td>Addition</td>
- </tr>
- <tr>
- <td>
- <a href="#func-numeric-subtract">
- <code>op:numeric-subtract</code>
- </a>
- </td>
- <td>Subtraction</td>
- </tr>
- <tr>
- <td>
- <a href="#func-numeric-multiply">
- <code>op:numeric-multiply</code>
- </a>
- </td>
- <td>Multiplication</td>
- </tr>
- <tr>
- <td>
- <a href="#func-numeric-divide">
- <code>op:numeric-divide</code>
- </a>
- </td>
- <td>Division</td>
- </tr>
- <tr>
- <td>
- <a href="#func-numeric-integer-divide">
- <code>op:numeric-integer-divide</code>
- </a>
- </td>
- <td>Integer division</td>
- </tr>
- <tr>
- <td>
- <a href="#func-numeric-mod">
- <code>op:numeric-mod</code>
- </a>
- </td>
- <td>Modulus</td>
- </tr>
- <tr>
- <td>
- <a href="#func-numeric-unary-plus">
- <code>op:numeric-unary-plus</code>
- </a>
- </td>
- <td>Unary plus</td>
- </tr>
- <tr>
- <td>
- <a href="#func-numeric-unary-minus">
- <code>op:numeric-unary-minus</code>
- </a>
- </td>
- <td>Unary minus (negation)</td>
- </tr>
- </tbody>
- </table>
- <p>The parameters and return types for the above operators are the
+<table summary="Operator summary" border="1">
+<thead>
+<tr>
+<th colspan="1">Operators</th>
+<th colspan="1">Meaning</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><a href=
+"#func-numeric-add"><code>op:numeric-add</code></a></td>
+<td>Addition</td>
+</tr>
+<tr>
+<td><a href=
+"#func-numeric-subtract"><code>op:numeric-subtract</code></a></td>
+<td>Subtraction</td>
+</tr>
+<tr>
+<td><a href=
+"#func-numeric-multiply"><code>op:numeric-multiply</code></a></td>
+<td>Multiplication</td>
+</tr>
+<tr>
+<td><a href=
+"#func-numeric-divide"><code>op:numeric-divide</code></a></td>
+<td>Division</td>
+</tr>
+<tr>
+<td><a href=
+"#func-numeric-integer-divide"><code>op:numeric-integer-divide</code></a></td>
+<td>Integer division</td>
+</tr>
+<tr>
+<td><a href=
+"#func-numeric-mod"><code>op:numeric-mod</code></a></td>
+<td>Modulus</td>
+</tr>
+<tr>
+<td><a href=
+"#func-numeric-unary-plus"><code>op:numeric-unary-plus</code></a></td>
+<td>Unary plus</td>
+</tr>
+<tr>
+<td><a href=
+"#func-numeric-unary-minus"><code>op:numeric-unary-minus</code></a></td>
+<td>Unary minus (negation)</td>
+</tr>
+</tbody>
+</table>
+<p>The parameters and return types for the above operators are the
basic numeric types: <code>xs:integer</code>,
<code>xs:decimal</code>, <code>xs:float</code> and
<code>xs:double</code>, and types derived from them. The word "
<code>numeric</code> " in function signatures signifies these four
types. For simplicity, each operator is defined to operate on
operands of the same type and return the same type. The exceptions
-are <a href="#func-numeric-divide">
- <code>op:numeric-divide</code>
- </a>, which
+are <a href=
+"#func-numeric-divide"><code>op:numeric-divide</code></a>, which
returns an <code>xs:decimal</code> if called with two
-<code>xs:integer</code> operands and <a href="#func-numeric-integer-divide">
- <code>op:numeric-integer-divide</code>
- </a>
+<code>xs:integer</code> operands and <a href=
+"#func-numeric-integer-divide"><code>op:numeric-integer-divide</code></a>
which always returns an <code>xs:integer</code>.</p>
- <p>If the two operands are not of the same type, <em>subtype
+<p>If the two operands are not of the same type, <em>subtype
substitution</em> and <em>numeric type promotion</em> are used to
-obtain two operands of the same type. <a href="http://www.w3.org/TR/xpath-30/#promotion">Section Type
-Promotion</a>
- <sup>
- <small>XP30</small>
- </sup> and <a href="http://www.w3.org/TR/xpath-30/#mapping">Section Operator
-Mapping</a>
- <sup>
- <small>XP30</small>
- </sup> describe the semantics of
-these operations in detail.</p>
- <p>The result type of operations depends on their argument
+obtain two operands of the same type. <a href=
+"http://www.w3.org/TR/xpath-30/#promotion">Section B.1 Type
+Promotion</a> <sup><small>XP30</small></sup> and <a href=
+"http://www.w3.org/TR/xpath-30/#mapping">Section B.2 Operator
+Mapping</a> <sup><small>XP30</small></sup> describe the semantics
+of these operations in detail.</p>
+<p>The result type of operations depends on their argument
datatypes and is defined in the following table:</p>
- <table summary="Function/operator summary" border="1">
- <col width="50%" span="1"/>
- <col width="50%" span="1"/>
- <thead>
- <tr>
- <th colspan="1">Operator</th>
- <th colspan="1">Returns</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <code>op:operation(xs:integer, xs:integer)</code>
- </td>
- <td>
- <code>xs:integer</code> (except for <a href="#func-numeric-divide">
- <code>op:numeric-divide(integer,
-integer)</code>
- </a>, which returns <code>xs:decimal</code>)</td>
- </tr>
- <tr>
- <td>
- <code>op:operation(xs:decimal, xs:decimal)</code>
- </td>
- <td>
- <code>xs:decimal</code>
- </td>
- </tr>
- <tr>
- <td>
- <code>op:operation(xs:float, xs:float)</code>
- </td>
- <td>
- <code>xs:float</code>
- </td>
- </tr>
- <tr>
- <td>
- <code>op:operation(xs:double, xs:double)</code>
- </td>
- <td>
- <code>xs:double</code>
- </td>
- </tr>
- <tr>
- <td>
- <code>op:operation(xs:integer)</code>
- </td>
- <td>
- <code>xs:integer</code>
- </td>
- </tr>
- <tr>
- <td>
- <code>op:operation(xs:decimal)</code>
- </td>
- <td>
- <code>xs:decimal</code>
- </td>
- </tr>
- <tr>
- <td>
- <code>op:operation(xs:float)</code>
- </td>
- <td>
- <code>xs:float</code>
- </td>
- </tr>
- <tr>
- <td>
- <code>op:operation(xs:double)</code>
- </td>
- <td>
- <code>xs:double</code>
- </td>
- </tr>
- </tbody>
- </table>
- <p>These rules define any operation on any pair of arithmetic
+<table summary="Function/operator summary" border="1">
+<col width="50%" span="1" />
+<col width="50%" span="1" />
+<thead>
+<tr>
+<th colspan="1">Operator</th>
+<th colspan="1">Returns</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><code>op:operation(xs:integer, xs:integer)</code></td>
+<td><code>xs:integer</code> (except for <a href=
+"#func-numeric-divide"><code>op:numeric-divide(integer,
+integer)</code></a>, which returns <code>xs:decimal</code>)</td>
+</tr>
+<tr>
+<td><code>op:operation(xs:decimal, xs:decimal)</code></td>
+<td><code>xs:decimal</code></td>
+</tr>
+<tr>
+<td><code>op:operation(xs:float, xs:float)</code></td>
+<td><code>xs:float</code></td>
+</tr>
+<tr>
+<td><code>op:operation(xs:double, xs:double)</code></td>
+<td><code>xs:double</code></td>
+</tr>
+<tr>
+<td><code>op:operation(xs:integer)</code></td>
+<td><code>xs:integer</code></td>
+</tr>
+<tr>
+<td><code>op:operation(xs:decimal)</code></td>
+<td><code>xs:decimal</code></td>
+</tr>
+<tr>
+<td><code>op:operation(xs:float)</code></td>
+<td><code>xs:float</code></td>
+</tr>
+<tr>
+<td><code>op:operation(xs:double)</code></td>
+<td><code>xs:double</code></td>
+</tr>
+</tbody>
+</table>
+<p>These rules define any operation on any pair of arithmetic
types. Consider the following example:</p>
- <div class="exampleInner">
- <pre>
- op:operation(xs:int, xs:double) => op:operation(xs:double, xs:double)
-</pre>
- </div>
- <p>For this operation, <code>xs:int</code> must be converted to
+<div class="exampleInner">
+<pre>
+op:operation(xs:int, xs:double) =&gt; op:operation(xs:double, xs:double)
+</pre></div>
+<p>For this operation, <code>xs:int</code> must be converted to
<code>xs:double</code>. This can be done, since by the rules above:
<code>xs:int</code> can be substituted for <code>xs:integer</code>,
<code>xs:integer</code> can be substituted for
@@ -3459,213 +3801,206 @@
<code>xs:decimal</code> is promoted to an <code>xs:double</code>,
it should not be converted to an <code>xs:float</code> and then to
<code>xs:double</code>, as this risks loss of precision.</p>
- <p>As another example, a user may define <code>height</code> as a
+<p>As another example, a user may define <code>height</code> as a
derived type of <code>xs:integer</code> with a minimum value of 20
and a maximum value of 100. He may then derive
<code>fenceHeight</code> using an enumeration to restrict the
permitted set of values to, say, 36, 48 and 60.</p>
- <div class="exampleInner">
- <pre>
- op:operation(fenceHeight, xs:integer) => op:operation(xs:integer, xs:integer)
-</pre>
- </div>
- <p>
- <code>fenceHeight</code> can be substituted for its base type
+<div class="exampleInner">
+<pre>
+op:operation(fenceHeight, xs:integer) =&gt; op:operation(xs:integer, xs:integer)
+</pre></div>
+<p><code>fenceHeight</code> can be substituted for its base type
<code>height</code> and <code>height</code> can be substituted for
its base type <code>xs:integer</code>.</p>
- <p>The basic rules for addition, subtraction, and multiplication of
+<p>The basic rules for addition, subtraction, and multiplication of
ordinary numbers are not set out in this specification; they are
taken as given. In the case of <code>xs:double</code> and
-<code>xs:float</code> the rules are as defined in <a href="#ieee754">[IEEE 754-1985]</a>. The rules for handling division and
-modulus operations, as well as the rules for handling special
-values such as infinity and <code>NaN</code>, and exception
+<code>xs:float</code> the rules are as defined in <a href=
+"#ieee754-2008">[IEEE 754-2008]</a>. The rules for handling
+division and modulus operations, as well as the rules for handling
+special values such as infinity and <code>NaN</code>, and exception
conditions such as overflow and underflow, are described more
explicitly since they are not necessarily obvious.</p>
- <p>On overflow and underflow situations during arithmetic
-operations conforming implementations <a title="must" class="termref" href="#must">
- <span class="arrow">·</span>must<span class="arrow">·</span>
- </a> behave as
-follows:</p>
- <ul>
- <li>
- <p>For <code>xs:float</code> and <code>xs:double</code> operations,
-overflow behavior <a title="must" class="termref" href="#must">
- <span class="arrow">·</span>must<span class="arrow">·</span>
- </a> be conformant with <a href="#ieee754">[IEEE
-754-1985]</a>. This specification allows the following options:</p>
- <ul>
- <li>
- <p>Raising an error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>] via an overflow trap.</p>
- </li>
- <li>
- <p>Returning <code>INF</code> or <code>-INF</code>.</p>
- </li>
- <li>
- <p>Returning the largest (positive or negative) non-infinite
+<p>On overflow and underflow situations during arithmetic
+operations conforming implementations <a title="must" class=
+"termref" href="#must"><span class="arrow">·</span>must<span class=
+"arrow">·</span></a> behave as follows:</p>
+<ul>
+<li>
+<p>For <code>xs:float</code> and <code>xs:double</code> operations,
+overflow behavior <a title="must" class="termref" href=
+"#must"><span class="arrow">·</span>must<span class=
+"arrow">·</span></a> be conformant with <a href=
+"#ieee754-2008">[IEEE 754-2008]</a>. This specification allows the
+following options:</p>
+<ul>
+<li>
+<p>Raising an error [<a href="#ERRFOAR0002" title=
+"err:FOAR0002">err:FOAR0002</a>] via an overflow trap.</p>
+</li>
+<li>
+<p>Returning <code>INF</code> or <code>-INF</code>.</p>
+</li>
+<li>
+<p>Returning the largest (positive or negative) non-infinite
number.</p>
- </li>
- </ul>
- </li>
- <li>
- <p>For <code>xs:float</code> and <code>xs:double</code> operations,
-underflow behavior <a title="must" class="termref" href="#must">
- <span class="arrow">·</span>must<span class="arrow">·</span>
- </a> be conformant with <a href="#ieee754">[IEEE
-754-1985]</a>. This specification allows the following options:</p>
- <ul>
- <li>
- <p>Raising an error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>] via an underflow trap.</p>
- </li>
- <li>
- <p>Returning <code>0.0E0</code> or <code>+/- 2**Emin</code> or a
+</li>
+</ul>
+</li>
+<li>
+<p>For <code>xs:float</code> and <code>xs:double</code> operations,
+underflow behavior <a title="must" class="termref" href=
+"#must"><span class="arrow">·</span>must<span class=
+"arrow">·</span></a> be conformant with <a href=
+"#ieee754-2008">[IEEE 754-2008]</a>. This specification allows the
+following options:</p>
+<ul>
+<li>
+<p>Raising an error [<a href="#ERRFOAR0002" title=
+"err:FOAR0002">err:FOAR0002</a>] via an underflow trap.</p>
+</li>
+<li>
+<p>Returning <code>0.0E0</code> or <code>+/- 2**Emin</code> or a
denormalized value; where <code>Emin</code> is the smallest
possible <code>xs:float</code> or <code>xs:double</code>
exponent.</p>
- </li>
- </ul>
- </li>
- <li>
- <p>For <code>xs:decimal</code> operations, overflow behavior
-<a title="must" class="termref" href="#must">
- <span class="arrow">·</span>must<span class="arrow">·</span>
- </a> raise an
-error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>]. On underflow, <code>0.0</code>
-must be returned.</p>
- </li>
- <li>
- <p>For <code>xs:integer</code> operations, implementations that
-support limited-precision integer operations <a title="must" class="termref" href="#must">
- <span class="arrow">·</span>must<span class="arrow">·</span>
- </a> select from
-the following options:</p>
- <ul>
- <li>
- <p>They <a title="may" class="termref" href="#may">
- <span class="arrow">·</span>may<span class="arrow">·</span>
- </a> choose to
-always raise an error [<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>].</p>
- </li>
- <li>
- <p>They <a title="may" class="termref" href="#may">
- <span class="arrow">·</span>may<span class="arrow">·</span>
- </a> provide an
-<a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> mechanism that allows users to choose between
+</li>
+</ul>
+</li>
+<li>
+<p>For <code>xs:decimal</code> operations, overflow behavior
+<a title="must" class="termref" href="#must"><span class=
+"arrow">·</span>must<span class="arrow">·</span></a> raise an error
+[<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>]. On
+underflow, <code>0.0</code> must be returned.</p>
+</li>
+<li>
+<p>For <code>xs:integer</code> operations, implementations that
+support limited-precision integer operations <a title="must" class=
+"termref" href="#must"><span class="arrow">·</span>must<span class=
+"arrow">·</span></a> select from the following options:</p>
+<ul>
+<li>
+<p>They <a title="may" class="termref" href="#may"><span class=
+"arrow">·</span>may<span class="arrow">·</span></a> choose to
+always raise an error [<a href="#ERRFOAR0002" title=
+"err:FOAR0002">err:FOAR0002</a>].</p>
+</li>
+<li>
+<p>They <a title="may" class="termref" href="#may"><span class=
+"arrow">·</span>may<span class="arrow">·</span></a> provide an
+<a title="implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> mechanism that allows users to choose between
raising an error and returning a result that is modulo the largest
representable integer value. See <a href="#ISO10967">[ISO
10967]</a>.</p>
- </li>
- </ul>
- </li>
- </ul>
- <p>The functions <a href="#func-numeric-add">
- <code>op:numeric-add</code>
- </a>, <a href="#func-numeric-subtract">
- <code>op:numeric-subtract</code>
- </a>,
-<a href="#func-numeric-multiply">
- <code>op:numeric-multiply</code>
- </a>,
-<a href="#func-numeric-divide">
- <code>op:numeric-divide</code>
- </a>,
-<a href="#func-numeric-integer-divide">
- <code>op:numeric-integer-divide</code>
- </a>
-and <a href="#func-numeric-mod">
- <code>op:numeric-mod</code>
- </a> are
+</li>
+</ul>
+</li>
+</ul>
+<p>The functions <a href=
+"#func-numeric-add"><code>op:numeric-add</code></a>, <a href=
+"#func-numeric-subtract"><code>op:numeric-subtract</code></a>,
+<a href=
+"#func-numeric-multiply"><code>op:numeric-multiply</code></a>,
+<a href="#func-numeric-divide"><code>op:numeric-divide</code></a>,
+<a href=
+"#func-numeric-integer-divide"><code>op:numeric-integer-divide</code></a>
+and <a href="#func-numeric-mod"><code>op:numeric-mod</code></a> are
each defined for pairs of numeric operands, each of which has the
same type:<code>xs:integer</code>, <code>xs:decimal</code>,
<code>xs:float</code>, or <code>xs:double</code>. The functions
-<a href="#func-numeric-unary-plus">
- <code>op:numeric-unary-plus</code>
- </a>
-and <a href="#func-numeric-unary-minus">
- <code>op:numeric-unary-minus</code>
- </a>
+<a href=
+"#func-numeric-unary-plus"><code>op:numeric-unary-plus</code></a>
+and <a href=
+"#func-numeric-unary-minus"><code>op:numeric-unary-minus</code></a>
are defined for a single operand whose type is one of those same
numeric types.</p>
- <p>For <code>xs:float</code> and <code>xs:double</code> arguments,
+<p>For <code>xs:float</code> and <code>xs:double</code> arguments,
if either argument is <code>NaN</code>, the result is
<code>NaN</code>.</p>
- <p>For <code>xs:decimal</code> values the number of digits of
-precision returned by the numeric operators is <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a>. If the number of digits in the result
-exceeds the number of digits that the implementation supports, the
-result is truncated or rounded in an <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> manner.</p>
- <p>The <a href="#ieee754-2008">[IEEE 754-2008]</a> specification
+<p>For <code>xs:decimal</code> values the number of digits of
+precision returned by the numeric operators is <a title=
+"implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a>. If the number of digits in the result exceeds
+the number of digits that the implementation supports, the result
+is truncated or rounded in an <a title="implementation-defined"
+class="termref" href="#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> manner.</p>
+<p>The <a href="#ieee754-2008">[IEEE 754-2008]</a> specification
also describes handling of two exception conditions called
<code>divideByZero</code> and <code>invalidOperation</code>. The
IEEE <code>divideByZero</code> exception is raised not only by a
direct attempt to divide by zero, but also by operations such as
<code>log(0)</code>. The IEEE <code>invalidOperation</code>
-exception is raised by attempts to invoke a function on an argument
+exception is raised by attempts to call a function with an argument
that is outside the function's domain (for example,
<code>sqrt(-1)</code> or <code>log(-1)</code>. These IEEE
exceptions do not cause a dynamic error at the application level;
rather they result in the relevant function or operator returning
<code>NaN</code>. The underlying IEEE exception
<strong>may</strong> be notified to the application or to the user
-by some <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> warning condition, but the observable effect
+by some <a title="implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> warning condition, but the observable effect
on an application using the functions and operators defined in this
specification is simply to return <code>NaN</code> with no
error.</p>
- <p>The <a href="#ieee754-2008">[IEEE 754-2008]</a> specification
+<p>The <a href="#ieee754-2008">[IEEE 754-2008]</a> specification
distinguishes two NaN values, a quiet NaN and a signaling NaN.
These two values are not distinguishable in the XDM model: the
value spaces of <code>xs:float</code> and <code>xs:double</code>
each include only a single <code>NaN</code> value. This does not
prevent the implementation distinguishing them internally, and
-triggering different <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> warning conditions, but such distinctions do
+triggering different <a title="implementation-defined" class=
+"termref" href="#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> warning conditions, but such distinctions do
not affect the observable behavior of an application using the
functions and operators defined in this specification.</p>
- <div class="div3">
- <h4>
- <a name="func-numeric-add" id="func-numeric-add"/>4.2.1
+<div class="div3">
+<h4><a name="func-numeric-add" id="func-numeric-add"></a>4.2.1
op:numeric-add</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the arithmetic sum of its operands: (<code>$arg1 +
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the arithmetic sum of its operands: (<code>$arg1 +
$arg2</code>).</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the "+" operator applied to numeric
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the "+" operator applied to numeric
values</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-add</code>(<code class="arg">$arg1</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>, <code class="arg">$arg2</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">numeric</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#op.numeric">
- <b>4.2 Arithmetic
-operators on numeric values</b>
- </a>.</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>For <code>xs:float</code> or <code>xs:double</code> values, if
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-add</code>(<code class=
+"arg">$arg1</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric</code>,
+<code class="arg">$arg2</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#op.numeric"><b>4.2 Arithmetic
+operators on numeric values</b></a>.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>For <code>xs:float</code> or <code>xs:double</code> values, if
one of the operands is a zero or a finite number and the other is
<code>INF</code> or <code>-INF</code>, <code>INF</code> or
<code>-INF</code> is returned. If both operands are
@@ -3673,289 +4008,288 @@
are <code>-INF</code>, <code>-INF</code> is returned. If one of the
operands is <code>INF</code> and the other is <code>-INF</code>,
<code>NaN</code> is returned.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-numeric-subtract" id="func-numeric-subtract"/>4.2.2 op:numeric-subtract</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the arithmetic difference of its operands: (<code>$arg1
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-numeric-subtract" id=
+"func-numeric-subtract"></a>4.2.2 op:numeric-subtract</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the arithmetic difference of its operands: (<code>$arg1
- $arg2</code>).</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the "-" operator applied to numeric
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the "-" operator applied to numeric
values.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-subtract</code>(<code class="arg">$arg1</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>, <code class="arg">$arg2</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">numeric</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#op.numeric">
- <b>4.2 Arithmetic
-operators on numeric values</b>
- </a>.</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>For <code>xs:float</code> or <code>xs:double</code> values, if
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-subtract</code>(<code class=
+"arg">$arg1</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric</code>,
+<code class="arg">$arg2</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#op.numeric"><b>4.2 Arithmetic
+operators on numeric values</b></a>.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>For <code>xs:float</code> or <code>xs:double</code> values, if
one of the operands is a zero or a finite number and the other is
<code>INF</code> or <code>-INF</code>, an infinity of the
appropriate sign is returned. If both operands are <code>INF</code>
or <code>-INF</code>, <code>NaN</code> is returned. If one of the
operands is <code>INF</code> and the other is <code>-INF</code>, an
infinity of the appropriate sign is returned.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-numeric-multiply" id="func-numeric-multiply"/>4.2.3 op:numeric-multiply</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the arithmetic product of its operands: (<code>$arg1 *
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-numeric-multiply" id=
+"func-numeric-multiply"></a>4.2.3 op:numeric-multiply</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the arithmetic product of its operands: (<code>$arg1 *
$arg2</code>).</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the "*" operator applied to numeric
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the "*" operator applied to numeric
values.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-multiply</code>(<code class="arg">$arg1</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>, <code class="arg">$arg2</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">numeric</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#op.numeric">
- <b>4.2 Arithmetic
-operators on numeric values</b>
- </a>.</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>For <code>xs:float</code> or <code>xs:double</code> values, if
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-multiply</code>(<code class=
+"arg">$arg1</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric</code>,
+<code class="arg">$arg2</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#op.numeric"><b>4.2 Arithmetic
+operators on numeric values</b></a>.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>For <code>xs:float</code> or <code>xs:double</code> values, if
one of the operands is a zero and the other is an infinity,
<code>NaN</code> is returned. If one of the operands is a non-zero
number and the other is an infinity, an infinity with the
appropriate sign is returned.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-numeric-divide" id="func-numeric-divide"/>4.2.4 op:numeric-divide</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the arithmetic quotient of its operands: (<code>$arg1
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-numeric-divide" id=
+"func-numeric-divide"></a>4.2.4 op:numeric-divide</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the arithmetic quotient of its operands: (<code>$arg1
div $arg2</code>).</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the "div" operator applied to numeric
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the "div" operator applied to numeric
values.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-divide</code>(<code class="arg">$arg1</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>, <code class="arg">$arg2</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">numeric</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#op.numeric">
- <b>4.2 Arithmetic
-operators on numeric values</b>
- </a>.</p>
- <p>As a special case, if the types of both <code>$arg1</code> and
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-divide</code>(<code class=
+"arg">$arg1</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric</code>,
+<code class="arg">$arg2</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#op.numeric"><b>4.2 Arithmetic
+operators on numeric values</b></a>.</p>
+<p>As a special case, if the types of both <code>$arg1</code> and
<code>$arg2</code> are <code>xs:integer</code>, then the return
type is <code>xs:decimal</code>.</p>
- </dd>
- <dt class="label">Error Conditions</dt>
- <dd>
- <p>For <code>xs:decimal</code> and <code>xs:integer</code>
-operands, if the divisor is (positive or negative) zero, an error
-is raised [<a href="#ERRFOAR0001" title="err:FOAR0001">err:FOAR0001</a>].</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>For <code>xs:float</code> and <code>xs:double</code> operands,
-floating point division is performed as specified in <a href="#ieee754">[IEEE 754-1985]</a>. A positive number divided by
-positive zero returns <code>INF</code>. A negative number divided
-by positive zero returns <code>-INF</code>. Division by negative
-zero returns <code>-INF</code> and <code>INF</code>, respectively.
-Positive or negative zero divided by positive or negative zero
-returns <code>NaN</code>. Also, <code>INF</code> or
-<code>-INF</code> divided by <code>INF</code> or <code>-INF</code>
-returns <code>NaN</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-numeric-integer-divide" id="func-numeric-integer-divide"/>4.2.5
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>An error is raised [<a href="#ERRFOAR0001" title=
+"err:FOAR0001">err:FOAR0001</a>] for <code>xs:decimal</code> and
+<code>xs:integer</code> operands, if the divisor is (positive or
+negative) zero.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>For <code>xs:float</code> and <code>xs:double</code> operands,
+floating point division is performed as specified in <a href=
+"#">[ieee754]</a>. A positive number divided by positive zero
+returns <code>INF</code>. A negative number divided by positive
+zero returns <code>-INF</code>. Division by negative zero returns
+<code>-INF</code> and <code>INF</code>, respectively. Positive or
+negative zero divided by positive or negative zero returns
+<code>NaN</code>. Also, <code>INF</code> or <code>-INF</code>
+divided by <code>INF</code> or <code>-INF</code> returns
+<code>NaN</code>.</p>
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-numeric-integer-divide" id=
+"func-numeric-integer-divide"></a>4.2.5
op:numeric-integer-divide</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Performs an integer division.</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the "idiv" operator applied to numeric
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Performs an integer division.</p>
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the "idiv" operator applied to numeric
values.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-integer-divide</code>(<code class="arg">$arg1</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>, <code class="arg">$arg2</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">xs:integer</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#op.numeric">
- <b>4.2 Arithmetic
-operators on numeric values</b>
- </a>.</p>
- <p>If $arg2 is INF or -INF, and $arg1 is not INF or -INF, then the
-result is zero.</p>
- <p>Otherwise, subject to limits of precision and overflow/underflow
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-integer-divide</code>(<code class=
+"arg">$arg1</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric</code>,
+<code class="arg">$arg2</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:integer</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#op.numeric"><b>4.2 Arithmetic
+operators on numeric values</b></a>.</p>
+<p>If <code>$arg2</code> is <code>INF</code> or <code>-INF</code>,
+and <code>$arg1</code> is not <code>INF</code> or
+<code>-INF</code>, then the result is zero.</p>
+<p>Otherwise, subject to limits of precision and overflow/underflow
conditions, the result is the largest (furthest from zero)
-<code>xs:integer</code> value <code>$N</code> such that <a href="#func-abs">
- <code>fn:abs($N * $arg2) le fn:abs($arg1) and
-fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0)</code>
- </a>.</p>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>The second term in this condition ensures that the result has
+<code>xs:integer</code> value <code>$N</code> such that <a href=
+"#func-abs"><code>fn:abs($N * $arg2) le fn:abs($arg1) and
+fn:compare($N * $arg2, 0) eq fn:compare($arg1, 0)</code></a>.</p>
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>The second term in this condition ensures that the result has
the correct sign.</p>
- </div>
- <p>The implementation may adopt a different algorithm provided that
-it is equivalent to this formulation in all cases where <a title="implementation dependent" class="termref" href="#implementation-dependent">
- <span class="arrow">·</span>implementation-dependent<span class="arrow">·</span>
- </a> or <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> behavior does not affect the outcome, for
+</div>
+<p>The implementation may adopt a different algorithm provided that
+it is equivalent to this formulation in all cases where <a title=
+"implementation dependent" class="termref" href=
+"#implementation-dependent"><span class=
+"arrow">·</span>implementation-dependent<span class=
+"arrow">·</span></a> or <a title="implementation-defined" class=
+"termref" href="#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> behavior does not affect the outcome, for
example, the implementation-defined precision of the result of
<code>xs:decimal</code> division.</p>
- </dd>
- <dt class="label">Error Conditions</dt>
- <dd>
- <p>If the divisor is (positive or negative) zero, then an error is
-raised [<a href="#ERRFOAR0001" title="err:FOAR0001">err:FOAR0001</a>].</p>
- <p>If either operand is <code>NaN</code> or if <code>$arg1</code>
-is <code>INF</code> or <code>-INF</code> then an error is raised
-[<a href="#ERRFOAR0002" title="err:FOAR0002">err:FOAR0002</a>].</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>Except in situations involving errors, loss of precision, or
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>An error is raised [<a href="#ERRFOAR0001" title=
+"err:FOAR0001">err:FOAR0001</a>] if the divisor is (positive or
+negative) zero.</p>
+<p>An error is raised [<a href="#ERRFOAR0002" title=
+"err:FOAR0002">err:FOAR0002</a>] if either operand is
+<code>NaN</code> or if <code>$arg1</code> is <code>INF</code> or
+<code>-INF</code>.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>Except in situations involving errors, loss of precision, or
overflow/underflow, the result of <code>$a idiv $b</code> is the
same as <code>($a div $b) cast as xs:integer</code>.</p>
- <p>The semantics of this function are different from integer
+<p>The semantics of this function are different from integer
division as defined in programming languages such as Java and
C++.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>op:numeric-integer-divide(10,3)</code>
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>op:numeric-integer-divide(10,3)</code>
returns <code>3</code>.</p>
- <p>The expression <code>op:numeric-integer-divide(3,-2)</code>
-returns <code>-1</code>.</p>
- <p>The expression <code>op:numeric-integer-divide(-3,2)</code>
-returns <code>-1</code>.</p>
- <p>The expression <code>op:numeric-integer-divide(-3,-2)</code>
+<p>The expression <code>op:numeric-integer-divide(3,-2)</code>
+returns <code>-1</code>.</p>
+<p>The expression <code>op:numeric-integer-divide(-3,2)</code>
+returns <code>-1</code>.</p>
+<p>The expression <code>op:numeric-integer-divide(-3,-2)</code>
returns <code>1</code>.</p>
- <p>The expression <code>op:numeric-integer-divide(9.0,3)</code>
+<p>The expression <code>op:numeric-integer-divide(9.0,3)</code>
returns <code>3</code>.</p>
- <p>The expression <code>op:numeric-integer-divide(-3.5,3)</code>
+<p>The expression <code>op:numeric-integer-divide(-3.5,3)</code>
returns <code>-1</code>.</p>
- <p>The expression <code>op:numeric-integer-divide(3.0,4)</code>
+<p>The expression <code>op:numeric-integer-divide(3.0,4)</code>
returns <code>0</code>.</p>
- <p>The expression <code>op:numeric-integer-divide(3.1E1,6)</code>
+<p>The expression <code>op:numeric-integer-divide(3.1E1,6)</code>
returns <code>5</code>.</p>
- <p>The expression <code>op:numeric-integer-divide(3.1E1,7)</code>
+<p>The expression <code>op:numeric-integer-divide(3.1E1,7)</code>
returns <code>4</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-numeric-mod" id="func-numeric-mod"/>4.2.6
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-numeric-mod" id="func-numeric-mod"></a>4.2.6
op:numeric-mod</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the remainder resulting from dividing
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the remainder resulting from dividing
<code>$arg1</code>, the dividend, by <code>$arg2</code>, the
divisor.</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the "mod" operator applied to numeric
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the "mod" operator applied to numeric
values.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-mod</code>(<code class="arg">$arg1</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>, <code class="arg">$arg2</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">numeric</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#op.numeric">
- <b>4.2 Arithmetic
-operators on numeric values</b>
- </a>.</p>
- <p>The operation <code>a mod b</code> for operands that are
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-mod</code>(<code class=
+"arg">$arg1</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric</code>,
+<code class="arg">$arg2</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#op.numeric"><b>4.2 Arithmetic
+operators on numeric values</b></a>.</p>
+<p>The operation <code>a mod b</code> for operands that are
<code>xs:integer</code> or <code>xs:decimal</code>, or types
derived from them, produces a result such that <code>(a idiv
b)*b+(a mod b)</code> is equal to <code>a</code> and the magnitude
@@ -3964,130 +4298,135 @@
the negative integer of largest possible magnitude for its type and
the divisor is -1 (the remainder is 0). It follows from this rule
that the sign of the result is the sign of the dividend.</p>
- <p>For <code>xs:float</code> and <code>xs:double</code> operands
+<p>For <code>xs:float</code> and <code>xs:double</code> operands
the following rules apply:</p>
- <ul>
- <li>
- <p>If either operand is <code>NaN</code>, the result is
+<ul>
+<li>
+<p>If either operand is <code>NaN</code>, the result is
<code>NaN</code>.</p>
- </li>
- <li>
- <p>If the dividend is positive or negative infinity, or the divisor
+</li>
+<li>
+<p>If the dividend is positive or negative infinity, or the divisor
is positive or negative zero (0), or both, the result is
<code>NaN</code>.</p>
- </li>
- <li>
- <p>If the dividend is finite and the divisor is an infinity, the
+</li>
+<li>
+<p>If the dividend is finite and the divisor is an infinity, the
result equals the dividend.</p>
- </li>
- <li>
- <p>If the dividend is positive or negative zero and the divisor is
+</li>
+<li>
+<p>If the dividend is positive or negative zero and the divisor is
finite, the result is the same as the dividend.</p>
- </li>
- <li>
- <p>In the remaining cases, where neither positive or negative
+</li>
+<li>
+<p>In the remaining cases, where neither positive or negative
infinity, nor positive or negative zero, nor <code>NaN</code> is
involved, the result obeys <code>(a idiv b)*b+(a mod b)</code> =
<code>a</code>. Division is truncating division, analogous to
-integer division, not <a href="#ieee754">[IEEE 754-1985]</a>
-rounding division i.e. additional digits are truncated, not rounded
-to the required precision.</p>
- </li>
- </ul>
- </dd>
- <dt class="label">Error Conditions</dt>
- <dd>
- <p>For <code>xs:integer</code> and <code>xs:decimal</code>
-operands, if <code>$arg2</code> is zero, then an error is raised
-[<a href="#ERRFOAR0001" title="err:FOAR0001">err:FOAR0001</a>].</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>op:numeric-mod(10,3)</code> returns
+integer division, not <a href="#">[ieee754]</a> rounding division
+i.e. additional digits are truncated, not rounded to the required
+precision.</p>
+</li>
+</ul>
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>An error is raised [<a href="#ERRFOAR0001" title=
+"err:FOAR0001">err:FOAR0001</a>] for <code>xs:integer</code> and
+<code>xs:decimal</code> operands, if <code>$arg2</code> is
+zero.</p>
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>op:numeric-mod(10,3)</code> returns
<code>1</code>.</p>
- <p>The expression <code>op:numeric-mod(6,-2)</code> returns
+<p>The expression <code>op:numeric-mod(6,-2)</code> returns
<code>0</code>.</p>
- <p>The expression <code>op:numeric-mod(4.5,1.2)</code> returns
+<p>The expression <code>op:numeric-mod(4.5,1.2)</code> returns
<code>0.9</code>.</p>
- <p>The expression <code>op:numeric-mod(1.23E2, 0.6E1)</code>
+<p>The expression <code>op:numeric-mod(1.23E2, 0.6E1)</code>
returns <code>3.0E0</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-numeric-unary-plus" id="func-numeric-unary-plus"/>4.2.7 op:numeric-unary-plus</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns its operand with the sign unchanged: (<code>+
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-numeric-unary-plus" id=
+"func-numeric-unary-plus"></a>4.2.7 op:numeric-unary-plus</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns its operand with the sign unchanged: (<code>+
$arg</code>).</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the unary "+" operator applied to
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the unary "+" operator applied to
numeric values.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-unary-plus</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">numeric</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#op.numeric">
- <b>4.2 Arithmetic
-operators on numeric values</b>
- </a>.</p>
- <p>The returned value is equal to <code>$arg</code>, and is an
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-unary-plus</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#op.numeric"><b>4.2 Arithmetic
+operators on numeric values</b></a>.</p>
+<p>The returned value is equal to <code>$arg</code>, and is an
instance of <code>xs:integer</code>, <code>xs:decimal</code>,
<code>xs:double</code>, or <code>xs:float</code> depending on the
type of <code>$arg</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-numeric-unary-minus" id="func-numeric-unary-minus"/>4.2.8 op:numeric-unary-minus</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns its operand with the sign reversed: (<code>-
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>Because function conversion rules are applied in the normal way,
+the unary <code>+</code> can be used to force conversion of an
+untyped node to a number: the result of <code>+@price</code> is the
+same as <code>xs:double(@price)</code> if the type of
+<code>@price</code> is <code>xs:untypedAtomic</code>.</p>
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-numeric-unary-minus" id=
+"func-numeric-unary-minus"></a>4.2.8 op:numeric-unary-minus</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns its operand with the sign reversed: (<code>-
$arg</code>).</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the unary "-" operator applied to
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the unary "-" operator applied to
numeric values.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-unary-minus</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">numeric</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#op.numeric">
- <b>4.2 Arithmetic
-operators on numeric values</b>
- </a>.</p>
- <p>The returned value is an instance of <code>xs:integer</code>,
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-unary-minus</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#op.numeric"><b>4.2 Arithmetic
+operators on numeric values</b></a>.</p>
+<p>The returned value is an instance of <code>xs:integer</code>,
<code>xs:decimal</code>, <code>xs:double</code>, or
<code>xs:float</code> depending on the type of
<code>$arg</code>.</p>
- <p>For <code>xs:integer</code> and <code>xs:decimal</code>
+<p>For <code>xs:integer</code> and <code>xs:decimal</code>
arguments, <code>0</code> and <code>0.0</code> return
<code>0</code> and <code>0.0</code>, respectively. For
<code>xs:float</code> and <code>xs:double</code> arguments,
@@ -4095,505 +4434,497 @@
returns <code>-0.0E0</code> and vice versa. <code>INF</code>
returns <code>-INF</code>. <code>-INF</code> returns
<code>INF</code>.</p>
- </dd>
- </dl>
- </div>
- </div>
- <div class="div2">
- <h3>
- <a name="comp.numeric" id="comp.numeric"/>4.3 Comparison
+</dd>
+</dl>
+</div>
+</div>
+<div class="div2">
+<h3><a name="comp.numeric" id="comp.numeric"></a>4.3 Comparison
operators on numeric values</h3>
- <p>This specification defines the following comparison operators on
+<p>This specification defines the following comparison operators on
numeric values. Comparisons take two arguments of the same type. If
the arguments are of different types, one argument is promoted to
-the type of the other as described above in <a href="#op.numeric">
- <b>4.2 Arithmetic operators on numeric
-values</b>
- </a>. Each comparison operator returns a boolean value.
+the type of the other as described above in <a href=
+"#op.numeric"><b>4.2 Arithmetic operators on numeric
+values</b></a>. Each comparison operator returns a boolean value.
If either, or both, operands are <code>NaN</code>,
<code>false</code> is returned.</p>
- <table summary="Function/operator summary" border="1">
- <thead>
- <tr>
- <th colspan="1">Function</th>
- <th colspan="1">Meaning</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <a href="#func-numeric-equal">
- <code>op:numeric-equal</code>
- </a>
- </td>
- <td>Returns true if and only if the value of <code>$arg1</code> is
+<table summary="Function/operator summary" border="1">
+<thead>
+<tr>
+<th colspan="1">Function</th>
+<th colspan="1">Meaning</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><a href=
+"#func-numeric-equal"><code>op:numeric-equal</code></a></td>
+<td>Returns true if and only if the value of <code>$arg1</code> is
equal to the value of <code>$arg2</code>.</td>
- </tr>
- <tr>
- <td>
- <a href="#func-numeric-less-than">
- <code>op:numeric-less-than</code>
- </a>
- </td>
- <td>Returns <code>true</code> if and only if <code>$arg1</code> is
+</tr>
+<tr>
+<td><a href=
+"#func-numeric-less-than"><code>op:numeric-less-than</code></a></td>
+<td>Returns <code>true</code> if and only if <code>$arg1</code> is
numerically less than <code>$arg2</code>.</td>
- </tr>
- <tr>
- <td>
- <a href="#func-numeric-greater-than">
- <code>op:numeric-greater-than</code>
- </a>
- </td>
- <td>Returns <code>true</code> if and only if <code>$arg1</code> is
+</tr>
+<tr>
+<td><a href=
+"#func-numeric-greater-than"><code>op:numeric-greater-than</code></a></td>
+<td>Returns <code>true</code> if and only if <code>$arg1</code> is
numerically greater than <code>$arg2</code>.</td>
- </tr>
- </tbody>
- </table>
- <div class="div3">
- <h4>
- <a name="func-numeric-equal" id="func-numeric-equal"/>4.3.1
+</tr>
+</tbody>
+</table>
+<div class="div3">
+<h4><a name="func-numeric-equal" id="func-numeric-equal"></a>4.3.1
op:numeric-equal</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns true if and only if the value of <code>$arg1</code> is
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns true if and only if the value of <code>$arg1</code> is
equal to the value of <code>$arg2</code>.</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the "eq" operator on numeric values,
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the "eq" operator on numeric values,
and is also used in defining the semantics of "ne", "le" and
"ge".</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-equal</code>(<code class="arg">$arg1</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>, <code class="arg">$arg2</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">xs:boolean</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#op.numeric">
- <b>4.2 Arithmetic
-operators on numeric values</b>
- </a> and <a href="#comp.numeric">
- <b>4.3 Comparison operators on numeric
-values</b>
- </a>.</p>
- <p>For <code>xs:float</code> and <code>xs:double</code> values,
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-equal</code>(<code class=
+"arg">$arg1</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric</code>,
+<code class="arg">$arg2</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:boolean</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#op.numeric"><b>4.2 Arithmetic
+operators on numeric values</b></a> and <a href=
+"#comp.numeric"><b>4.3 Comparison operators on numeric
+values</b></a>.</p>
+<p>For <code>xs:float</code> and <code>xs:double</code> values,
positive zero and negative zero compare equal. <code>INF</code>
equals <code>INF</code>, and <code>-INF</code> equals
<code>-INF</code>. <code>NaN</code> does not equal itself.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-numeric-less-than" id="func-numeric-less-than"/>4.3.2 op:numeric-less-than</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns <code>true</code> if and only if <code>$arg1</code> is
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-numeric-less-than" id=
+"func-numeric-less-than"></a>4.3.2 op:numeric-less-than</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns <code>true</code> if and only if <code>$arg1</code> is
numerically less than <code>$arg2</code>.</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the "lt" operator on numeric values,
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the "lt" operator on numeric values,
and is also used in defining the semantics of "le".</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-less-than</code>(<code class="arg">$arg1</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>, <code class="arg">$arg2</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">xs:boolean</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#op.numeric">
- <b>4.2 Arithmetic
-operators on numeric values</b>
- </a> and <a href="#comp.numeric">
- <b>4.3 Comparison operators on numeric
-values</b>
- </a>.</p>
- <p>For <code>xs:float</code> and <code>xs:double</code> values,
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-less-than</code>(<code class=
+"arg">$arg1</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric</code>,
+<code class="arg">$arg2</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:boolean</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#op.numeric"><b>4.2 Arithmetic
+operators on numeric values</b></a> and <a href=
+"#comp.numeric"><b>4.3 Comparison operators on numeric
+values</b></a>.</p>
+<p>For <code>xs:float</code> and <code>xs:double</code> values,
positive infinity is greater than all other non-<code>NaN</code>
values; negative infinity is less than all other
non-<code>NaN</code> values. If <code>$arg1</code> or
<code>$arg2</code> is <code>NaN</code>, the function returns
<code>false</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-numeric-greater-than" id="func-numeric-greater-than"/>4.3.3 op:numeric-greater-than</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns <code>true</code> if and only if <code>$arg1</code> is
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-numeric-greater-than" id=
+"func-numeric-greater-than"></a>4.3.3 op:numeric-greater-than</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns <code>true</code> if and only if <code>$arg1</code> is
numerically greater than <code>$arg2</code>.</p>
- </dd>
- <dt class="label">Operator Mapping</dt>
- <dd>
- <p>Defines the semantics of the "gt" operator on numeric values,
+</dd>
+<dt class="label">Operator Mapping</dt>
+<dd>
+<p>Defines the semantics of the "gt" operator on numeric values,
and is also used in defining the semantics of "ge".</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">op:numeric-greater-than</code>(<code class="arg">$arg1</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>, <code class="arg">$arg2</code>
- <code class="as"> as </code>
- <code class="type">numeric</code>)<code class="as"> as </code>
- <code class="return-type">xs:boolean</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>The function call <code>op:numeric-greater-than($A, $B)</code>
-is defined to return the same result as <a href="#func-numeric-less-than">
- <code>op:numeric-less-than($B,
-$A)</code>
- </a>
- </p>
- </dd>
- </dl>
- </div>
- </div>
- <div class="div2">
- <h3>
- <a name="numeric-value-functions" id="numeric-value-functions"/>4.4 Functions on numeric values</h3>
- <p>The following functions are defined on numeric types. Each
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">op:numeric-greater-than</code>(<code class=
+"arg">$arg1</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric</code>,
+<code class="arg">$arg2</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:boolean</code></div>
+</div>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>The function call <code>op:numeric-greater-than($A, $B)</code>
+is defined to return the same result as <a href=
+"#func-numeric-less-than"><code>op:numeric-less-than($B,
+$A)</code></a></p>
+</dd>
+</dl>
+</div>
+</div>
+<div class="div2">
+<h3><a name="numeric-value-functions" id=
+"numeric-value-functions"></a>4.4 Functions on numeric values</h3>
+<p>The following functions are defined on numeric types. Each
function returns a value of the same type as the type of its
argument.</p>
- <ul>
- <li>
- <p>If the argument is the empty sequence, the empty sequence is
+<ul>
+<li>
+<p>If the argument is the empty sequence, the empty sequence is
returned.</p>
- </li>
- <li>
- <p>For <code>xs:float</code> and <code>xs:double</code> arguments,
+</li>
+<li>
+<p>For <code>xs:float</code> and <code>xs:double</code> arguments,
if the argument is "NaN", "NaN" is returned.</p>
- </li>
- <li>
- <p>Except for <a href="#func-abs">
- <code>fn:abs</code>
- </a>, for
+</li>
+<li>
+<p>Except for <a href="#func-abs"><code>fn:abs</code></a>, for
<code>xs:float</code> and <code>xs:double</code> arguments, if the
argument is positive or negative infinity, positive or negative
infinity is returned.</p>
- </li>
- </ul>
- <table summary="Function/operator summary" border="1">
- <thead>
- <tr>
- <th colspan="1">Function</th>
- <th colspan="1">Meaning</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <a href="#func-abs">
- <code>fn:abs</code>
- </a>
- </td>
- <td>Returns the absolute value of <code>$arg</code>.</td>
- </tr>
- <tr>
- <td>
- <a href="#func-ceiling">
- <code>fn:ceiling</code>
- </a>
- </td>
- <td>Rounds <code>$arg</code> upwards to a whole number.</td>
- </tr>
- <tr>
- <td>
- <a href="#func-floor">
- <code>fn:floor</code>
- </a>
- </td>
- <td>Rounds <code>$arg</code> downwards to a whole number.</td>
- </tr>
- <tr>
- <td>
- <a href="#func-round">
- <code>fn:round</code>
- </a>
- </td>
- <td>Rounds a value to a specified number of decimal places,
+</li>
+</ul>
+<table summary="Function/operator summary" border="1">
+<thead>
+<tr>
+<th colspan="1">Function</th>
+<th colspan="1">Meaning</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><a href="#func-abs"><code>fn:abs</code></a></td>
+<td>Returns the absolute value of <code>$arg</code>.</td>
+</tr>
+<tr>
+<td><a href="#func-ceiling"><code>fn:ceiling</code></a></td>
+<td>Rounds <code>$arg</code> upwards to a whole number.</td>
+</tr>
+<tr>
+<td><a href="#func-floor"><code>fn:floor</code></a></td>
+<td>Rounds <code>$arg</code> downwards to a whole number.</td>
+</tr>
+<tr>
+<td><a href="#func-round"><code>fn:round</code></a></td>
+<td>Rounds a value to a specified number of decimal places,
rounding upwards if two such values are equally near.</td>
- </tr>
- <tr>
- <td>
- <a href="#func-round-half-to-even">
- <code>fn:round-half-to-even</code>
- </a>
- </td>
- <td>Rounds a value to a specified number of decimal places,
+</tr>
+<tr>
+<td><a href=
+"#func-round-half-to-even"><code>fn:round-half-to-even</code></a></td>
+<td>Rounds a value to a specified number of decimal places,
rounding to make the last digit even if two such values are equally
near.</td>
- </tr>
- </tbody>
- </table>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>
- <a href="#func-round">
- <code>fn:round</code>
- </a> and <a href="#func-round-half-to-even">
- <code>fn:round-half-to-even</code>
- </a>
+</tr>
+</tbody>
+</table>
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p><a href="#func-round"><code>fn:round</code></a> and <a href=
+"#func-round-half-to-even"><code>fn:round-half-to-even</code></a>
produce the same result in all cases except when the argument is
exactly midway between two values with the required precision.</p>
- <p>Other ways of rounding midway values can be achieved as
+<p>Other ways of rounding midway values can be achieved as
follows:</p>
- <ul>
- <li>
- <p>Towards negative infinity: <code>-fn:round(-$x)</code>
- </p>
- </li>
- <li>
- <p>Away from zero: <a href="#func-round">
- <code>fn:round(fn:abs($x))*fn:compare($x,0)</code>
- </a>
- </p>
- </li>
- <li>
- <p>Towards zero: <a href="#func-abs">
- <code>fn:abs(fn:round(-$x))*-fn:compare($x,0)</code>
- </a>
- </p>
- </li>
- </ul>
- </div>
- <div class="div3">
- <h4>
- <a name="func-abs" id="func-abs"/>4.4.1 fn:abs</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the absolute value of <code>$arg</code>.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:abs</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">numeric?</code>)<code class="as"> as </code>
- <code class="return-type">numeric?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#numeric-value-functions">
- <b>4.4
-Functions on numeric values</b>
- </a>.</p>
- <p>If <code>$arg</code> is negative the function returns
+<ul>
+<li>
+<p>Towards negative infinity: <code>-fn:round(-$x)</code></p>
+</li>
+<li>
+<p>Away from zero: <a href=
+"#func-round"><code>fn:round(fn:abs($x))*fn:compare($x,0)</code></a></p>
+</li>
+<li>
+<p>Towards zero: <a href=
+"#func-abs"><code>fn:abs(fn:round(-$x))*-fn:compare($x,0)</code></a></p>
+</li>
+</ul>
+</div>
+<div class="div3">
+<h4><a name="func-abs" id="func-abs"></a>4.4.1 fn:abs</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the absolute value of <code>$arg</code>.</p>
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:abs</code>(<code class="arg">$arg</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">numeric?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#numeric-value-functions"><b>4.4
+Functions on numeric values</b></a>.</p>
+<p>If <code>$arg</code> is negative the function returns
<code>-$arg</code>, otherwise it returns <code>$arg</code>.</p>
- <p>If the type of <code>$arg</code> is one of the four numeric
+<p>If the type of <code>$arg</code> is one of the four numeric
types <code>xs:float</code>, <code>xs:double</code>,
<code>xs:decimal</code> or <code>xs:integer</code> the type of the
result is the same as the type of <code>$arg</code>. If the type of
<code>$arg</code> is a type derived from one of the numeric types,
the result is an instance of the base numeric type.</p>
- <p>For <code>xs:float</code> and <code>xs:double</code> arguments,
+<p>For <code>xs:float</code> and <code>xs:double</code> arguments,
if the argument is positive zero or negative zero, then positive
zero is returned. If the argument is positive or negative infinity,
positive infinity is returned.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>fn:abs(10.5)</code> returns
-<code>10.5</code>.</p>
- <p>The expression <code>fn:abs(-10.5)</code> returns
-<code>10.5</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-ceiling" id="func-ceiling"/>4.4.2
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>fn:abs(10.5)</code> returns
+<code>10.5</code>.</p>
+<p>The expression <code>fn:abs(-10.5)</code> returns
+<code>10.5</code>.</p>
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-ceiling" id="func-ceiling"></a>4.4.2
fn:ceiling</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Rounds <code>$arg</code> upwards to a whole number.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:ceiling</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">numeric?</code>)<code class="as"> as </code>
- <code class="return-type">numeric?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#numeric-value-functions">
- <b>4.4
-Functions on numeric values</b>
- </a>.</p>
- <p>The function returns the smallest (closest to negative infinity)
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Rounds <code>$arg</code> upwards to a whole number.</p>
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:ceiling</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">numeric?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#numeric-value-functions"><b>4.4
+Functions on numeric values</b></a>.</p>
+<p>The function returns the smallest (closest to negative infinity)
number with no fractional part that is not less than the value of
<code>$arg</code>.</p>
- <p>If the type of <code>$arg</code> is one of the four numeric
+<p>If the type of <code>$arg</code> is one of the four numeric
types <code>xs:float</code>, <code>xs:double</code>,
<code>xs:decimal</code> or <code>xs:integer</code> the type of the
result is the same as the type of <code>$arg</code>. If the type of
<code>$arg</code> is a type derived from one of the numeric types,
the result is an instance of the base numeric type.</p>
- <p>For <code>xs:float</code> and <code>xs:double</code> arguments,
+<p>For <code>xs:float</code> and <code>xs:double</code> arguments,
if the argument is positive zero, then positive zero is returned.
If the argument is negative zero, then negative zero is returned.
If the argument is less than zero and greater than -1, negative
zero is returned.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>fn:ceiling(10.5)</code> returns
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>fn:ceiling(10.5)</code> returns
<code>11</code>.</p>
- <p>The expression <code>fn:ceiling(-10.5)</code> returns
+<p>The expression <code>fn:ceiling(-10.5)</code> returns
<code>-10</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-floor" id="func-floor"/>4.4.3 fn:floor</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Rounds <code>$arg</code> downwards to a whole number.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:floor</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">numeric?</code>)<code class="as"> as </code>
- <code class="return-type">numeric?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#numeric-value-functions">
- <b>4.4
-Functions on numeric values</b>
- </a>.</p>
- <p>The function returns the largest (closest to positive infinity)
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-floor" id="func-floor"></a>4.4.3 fn:floor</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Rounds <code>$arg</code> downwards to a whole number.</p>
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:floor</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">numeric?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#numeric-value-functions"><b>4.4
+Functions on numeric values</b></a>.</p>
+<p>The function returns the largest (closest to positive infinity)
number with no fractional part that is not greater than the value
of <code>$arg</code>.</p>
- <p>If the type of <code>$arg</code> is one of the four numeric
+<p>If the type of <code>$arg</code> is one of the four numeric
types <code>xs:float</code>, <code>xs:double</code>,
<code>xs:decimal</code> or <code>xs:integer</code> the type of the
result is the same as the type of <code>$arg</code>. If the type of
<code>$arg</code> is a type derived from one of the numeric types,
the result is an instance of the base numeric type.</p>
- <p>For <code>xs:float</code> and <code>xs:double</code> arguments,
+<p>For <code>xs:float</code> and <code>xs:double</code> arguments,
if the argument is positive zero, then positive zero is returned.
If the argument is negative zero, then negative zero is
returned.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>fn:floor(10.5)</code> returns
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>fn:floor(10.5)</code> returns
<code>10</code>.</p>
- <p>The expression <code>fn:floor(-10.5)</code> returns
+<p>The expression <code>fn:floor(-10.5)</code> returns
<code>-11</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-round" id="func-round"/>4.4.4 fn:round</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Rounds a value to a specified number of decimal places, rounding
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-round" id="func-round"></a>4.4.4 fn:round</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Rounds a value to a specified number of decimal places, rounding
upwards if two such values are equally near.</p>
- </dd>
- <dt class="label">Signatures</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:round</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">numeric?</code>)<code class="as"> as </code>
- <code class="return-type">numeric?</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:round</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">numeric?</code>, <code class="arg">$precision</code>
- <code class="as"> as </code>
- <code class="type">xs:integer</code>)<code class="as"> as </code>
- <code class="return-type">numeric?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#numeric-value-functions">
- <b>4.4
-Functions on numeric values</b>
- </a>.</p>
- <p>The function returns the nearest (that is, numerically closest)
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:round</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">numeric?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric?</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:round</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">numeric?</code>, <code class=
+"arg">$precision</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">xs:integer</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#numeric-value-functions"><b>4.4
+Functions on numeric values</b></a>.</p>
+<p>The function returns the nearest (that is, numerically closest)
value to <code>$arg</code> that is a multiple of ten to the power
of minus <code>$precision</code>. If two such values are equally
near (for example, if the fractional part in <code>$arg</code> is
exactly .5), the function returns the one that is closest to
positive infinity.</p>
- <p>If the type of <code>$arg</code> is one of the four numeric
+<p>If the type of <code>$arg</code> is one of the four numeric
types <code>xs:float</code>, <code>xs:double</code>,
<code>xs:decimal</code> or <code>xs:integer</code> the type of the
result is the same as the type of <code>$arg</code>. If the type of
<code>$arg</code> is a type derived from one of the numeric types,
the result is an instance of the base numeric type.</p>
- <p>The single-argument version of this function produces the same
+<p>The single-argument version of this function produces the same
result as the two-argument version with <code>$precision=0</code>
(that is, it rounds to a whole number).</p>
- <p>When <code>$arg</code> is of type <code>xs:float</code> and
+<p>When <code>$arg</code> is of type <code>xs:float</code> and
<code>xs:double</code>:</p>
- <ol class="enumar">
- <li>
- <p>If <code>$arg</code> is NaN, positive or negative zero, or
+<ol class="enumar">
+<li>
+<p>If <code>$arg</code> is NaN, positive or negative zero, or
positive or negative infinity, then the result is the same as the
argument.</p>
- </li>
- <li>
- <p>For other values, the argument is cast to
+</li>
+<li>
+<p>For other values, the argument is cast to
<code>xs:decimal</code> using an implementation of
<code>xs:decimal</code> that imposes no limits on the number of
digits that can be represented. The function is applied to this
@@ -4603,118 +4934,127 @@
If the resulting <code>xs:decimal</code> value is zero, then
positive or negative zero is returned according to the sign of
<code>$arg</code>.</p>
- </li>
- </ol>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>This function is typically used with a non-zero
+</li>
+</ol>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>This function is typically used with a non-zero
<code>$precision</code> in financial applications where the
argument is of type <code>xs:decimal</code>. For arguments of type
<code>xs:float</code> and <code>xs:double</code> the results may be
counter-intuitive. For example, consider <code>round(35.425e0,
2)</code>. The result is not 35.43, as might be expected, but
-35.42. This is because the conversion of 35.425e0 to
-<code>xs:decimal</code> produces the decimal value
-35.42499999999..., which is closer to 35.42 than to 35.43.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>fn:round(2.5)</code> returns
+35.42. This is because the <code>xs:double</code> written as
+35.425e0 has an exact value equal to 35.42499999999..., which is
+closer to 35.42 than to 35.43.</p>
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>fn:round(2.5)</code> returns
<code>3.0</code>.</p>
- <p>The expression <code>fn:round(2.4999)</code> returns
+<p>The expression <code>fn:round(2.4999)</code> returns
<code>2.0</code>.</p>
- <p>The expression <code>fn:round(-2.5)</code> returns
+<p>The expression <code>fn:round(-2.5)</code> returns
<code>-2.0</code>. <em>(Not the possible alternative,
-<code>-3</code>).</em>
- </p>
- <p>The expression <code>fn:round(1.125, 2)</code> returns
+<code>-3</code>).</em></p>
+<p>The expression <code>fn:round(1.125, 2)</code> returns
<code>1.13</code>.</p>
- <p>The expression <code>fn:round(8452, -2)</code> returns
+<p>The expression <code>fn:round(8452, -2)</code> returns
<code>8500</code>.</p>
- <p>The expression <code>fn:round(3.1415e0, 2)</code> returns
+<p>The expression <code>fn:round(3.1415e0, 2)</code> returns
<code>3.14e0</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-round-half-to-even" id="func-round-half-to-even"/>4.4.5 fn:round-half-to-even</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Rounds a value to a specified number of decimal places, rounding
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-round-half-to-even" id=
+"func-round-half-to-even"></a>4.4.5 fn:round-half-to-even</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Rounds a value to a specified number of decimal places, rounding
to make the last digit even if two such values are equally
near.</p>
- </dd>
- <dt class="label">Signatures</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:round-half-to-even</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">numeric?</code>)<code class="as"> as </code>
- <code class="return-type">numeric?</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:round-half-to-even</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">numeric?</code>, <code class="arg">$precision</code>
- <code class="as"> as </code>
- <code class="type">xs:integer</code>)<code class="as"> as </code>
- <code class="return-type">numeric?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>General rules: see <a href="#numeric-value-functions">
- <b>4.4
-Functions on numeric values</b>
- </a>.</p>
- <p>The function returns the nearest (that is, numerically closest)
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:round-half-to-even</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">numeric?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric?</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:round-half-to-even</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">numeric?</code>, <code class=
+"arg">$precision</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">xs:integer</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">numeric?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>General rules: see <a href="#numeric-value-functions"><b>4.4
+Functions on numeric values</b></a>.</p>
+<p>The function returns the nearest (that is, numerically closest)
value to <code>$arg</code> that is a multiple of ten to the power
of minus <code>$precision</code>. If two such values are equally
near (e.g. if the fractional part in <code>$arg</code> is exactly
.500...), the function returns the one whose least significant
digit is even.</p>
- <p>If the type of <code>$arg</code> is one of the four numeric
+<p>If the type of <code>$arg</code> is one of the four numeric
types <code>xs:float</code>, <code>xs:double</code>,
<code>xs:decimal</code> or <code>xs:integer</code> the type of the
result is the same as the type of <code>$arg</code>. If the type of
<code>$arg</code> is a type derived from one of the numeric types,
the result is an instance of the base numeric type.</p>
- <p>The first signature of this function produces the same result as
+<p>The first signature of this function produces the same result as
the second signature with <code>$precision=0</code>.</p>
- <p>For arguments of type <code>xs:float</code> and
+<p>For arguments of type <code>xs:float</code> and
<code>xs:double</code>:</p>
- <ol class="enumar">
- <li>
- <p>If the argument is <code>NaN</code>, positive or negative zero,
+<ol class="enumar">
+<li>
+<p>If the argument is <code>NaN</code>, positive or negative zero,
or positive or negative infinity, then the result is the same as
the argument.</p>
- </li>
- <li>
- <p>In all other cases, the argument is cast to
-<code>xs:decimal</code>
- <!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
- <span>using
-an implementation of xs:decimal that imposes no limits on the
-number of digits that can be represented.</span> The function is
-applied to this <code>xs:decimal</code> value, and the resulting
+</li>
+<li>
+<p>In all other cases, the argument is cast to
+<code>xs:decimal</code> <span>using an implementation of xs:decimal
+that imposes no limits on the number of digits that can be
+represented.</span> The function is applied to this
+<code>xs:decimal</code> value, and the resulting
<code>xs:decimal</code> is cast back to <code>xs:float</code> or
<code>xs:double</code> as appropriate to form the function result.
If the resulting <code>xs:decimal</code> value is zero, then
positive or negative zero is returned according to the sign of the
original argument.</p>
- </li>
- </ol>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>This function is typically used in financial applications where
+</li>
+</ol>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>This function is typically used in financial applications where
the argument is of type <code>xs:decimal</code>. For arguments of
type <code>xs:float</code> and <code>xs:double</code> the results
may be counter-intuitive. For example, consider
@@ -4724,111 +5064,243 @@
literal 150.015 to an <code>xs:decimal</code> produces the
<code>xs:decimal</code> value 150.014999389..., which is closer to
150.01 than to 150.02.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>fn:round-half-to-even(0.5)</code> returns
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>fn:round-half-to-even(0.5)</code> returns
<code>0.0</code>.</p>
- <p>The expression <code>fn:round-half-to-even(1.5)</code> returns
-<code>2.0</code>.</p>
- <p>The expression <code>fn:round-half-to-even(2.5)</code> returns
-<code>2.0</code>.</p>
- <p>The expression <code>fn:round-half-to-even(3.567812e+3,
+<p>The expression <code>fn:round-half-to-even(1.5)</code> returns
+<code>2.0</code>.</p>
+<p>The expression <code>fn:round-half-to-even(2.5)</code> returns
+<code>2.0</code>.</p>
+<p>The expression <code>fn:round-half-to-even(3.567812e+3,
2)</code> returns <code>3567.81e0</code>.</p>
- <p>The expression <code>fn:round-half-to-even(4.7564e-3, 2)</code>
+<p>The expression <code>fn:round-half-to-even(4.7564e-3, 2)</code>
returns <code>0.0e0</code>.</p>
- <p>The expression <code>fn:round-half-to-even(35612.25, -2)</code>
+<p>The expression <code>fn:round-half-to-even(35612.25, -2)</code>
returns <code>35600</code>.</p>
- </dd>
- </dl>
- </div>
- </div>
- <div class="div2">
- <h3>
- <a name="formatting-integers" id="formatting-integers"/>4.5
+</dd>
+</dl>
+</div>
+</div>
+<div class="div2">
+<h3><a name="parsing-numbers" id="parsing-numbers"></a>4.5 Parsing
+numbers</h3>
+<p>It is possible to convert strings to values of type
+<code>xs:integer</code>, <code>xs:float</code>,
+<code>xs:decimal</code>, or <code>xs:double</code> using the
+constructor functions described in <a href=
+"#constructor-functions"><b>17 Constructor functions</b></a> or
+using <code>cast</code> expressions as described in <a href=
+"#casting"><b>18 Casting</b></a>.</p>
+<p>In addition the <a href=
+"#func-number"><code>fn:number</code></a> function is available to
+convert strings to values of type <code>xs:double</code>. It
+differs from the <code>xs:double</code> constructor function in
+that any value outside the lexical space of the
+<code>xs:double</code> datatype is converted to the
+<code>xs:double</code> value <code>NaN</code>.</p>
+<div class="div3">
+<h4><a name="func-number" id="func-number"></a>4.5.1 fn:number</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the value indicated by <code>$arg</code> or, if
+<code>$arg</code> is not specified, the context item after
+atomization, converted to an <code>xs:double</code>.</p>
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:number</code>()<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:double</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:number</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">xs:anyAtomicType?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:double</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>The zero-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-dependent" class="termref" href=
+"#dt-context-dependent"><span class=
+"arrow">·</span>context-dependent<span class="arrow">·</span></a>,
+and <a title="focus-dependent" class="termref" href=
+"#dt-focus-dependent"><span class=
+"arrow">·</span>focus-dependent<span class=
+"arrow">·</span></a>.</p>
+<p>The one-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>Calling the zero-argument version of the function is defined to
+give the same result as calling the single-argument version with
+the context item (<code>.</code>). That is,
+<code>fn:number()</code> is equivalent to
+<code>fn:number(.)</code>.</p>
+<p>If <code>$arg</code> is the empty sequence or if
+<code>$arg</code> or the context item cannot be converted to an
+<code>xs:double</code>, the <code>xs:double</code> value
+<code>NaN</code> is returned.</p>
+<p>Otherwise, <code>$arg</code>, or the context item after
+atomization, is converted to an <code>xs:double</code> following
+the rules of <a href="#casting-to-double"><b>18.1.2.2 Casting to
+xs:double</b></a>. If the conversion to <code>xs:double</code>
+fails, the <code>xs:double</code> value <code>NaN</code> is
+returned.</p>
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>An error is raised [<a href=
+"http://www.w3.org/TR/xpath20/#ERRXPDY0002" title=
+"err:XPDY0002">err:XPDY0002</a>]<sup><small>XP</small></sup> if
+<code>$arg</code> is omitted and the context item is <a href=
+"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>XSD 1.1 allows the string <code>+INF</code> as a representation
+of positive infinity; XSD 1.0 does not. It is <a title=
+"implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> whether XSD 1.1 is supported.</p>
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>fn:number($item1/quantity)</code> returns
+<code>5.0e0</code>.</p>
+<p>The expression <code>fn:number($item2/description)</code>
+returns <code>xs:double('NaN')</code>.</p>
+<p>Assume that the context item is the <code>xs:string</code> value
+"<code>15</code>". Then <code>fn:number()</code> returns
+<code>1.5e1</code>.</p>
+</dd>
+</dl>
+</div>
+</div>
+<div class="div2">
+<h3><a name="formatting-integers" id="formatting-integers"></a>4.6
Formatting integers</h3>
- <div class="div3">
- <h4>
- <a name="func-format-integer" id="func-format-integer"/>4.5.1 fn:format-integer</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>formats an integer according to a given picture string, using
+<div class="div3">
+<h4><a name="func-format-integer" id=
+"func-format-integer"></a>4.6.1 fn:format-integer</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Formats an integer according to a given picture string, using
the conventions of a given natural language if specified.</p>
- </dd>
- <dt class="label">Signatures</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:format-integer</code>(<code class="arg">$value</code>
- <code class="as"> as </code>
- <code class="type">xs:integer?</code>, <code class="arg">$picture</code>
- <code class="as"> as </code>
- <code class="type">xs:string</code>)<code class="as"> as </code>
- <code class="return-type">xs:string</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
- <tr>
- <td valign="baseline" rowspan="3">
- <code class="function">fn:format-integer</code>(</td>
- <td valign="baseline">
- <code class="arg">$value</code>
- </td>
- <td valign="baseline">
- <code class="as"> as </code>
- <code class="type">xs:integer?</code>,</td>
- </tr>
- <tr>
- <td valign="baseline">
- <code class="arg">$picture</code>
- </td>
- <td valign="baseline">
- <code class="as"> as </code>
- <code class="type">xs:string</code>,</td>
- </tr>
- <tr>
- <td valign="baseline">
- <code class="arg">$language</code>
- </td>
- <td valign="baseline">
- <code class="as"> as </code>
- <code class="type">xs:string</code>)<code class="as"> as </code>
- <code class="return-type">xs:string</code>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>If <code>$value</code> is an empty sequence, the function
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:format-integer</code>(<code class=
+"arg">$value</code><code class=
+"as">&#160;as&#160;</code><code class="type">xs:integer?</code>,
+<code class="arg">$picture</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">xs:string</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:string</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto">
+<table border="0" cellpadding="0" cellspacing="0" summary=
+"Function/operator prototype">
+<tr>
+<td valign="baseline" rowspan="3"><code class=
+"function">fn:format-integer</code>(</td>
+<td valign="baseline"><code class="arg">$value</code></td>
+<td valign="baseline"><code class=
+"as">&#160;as&#160;</code><code class=
+"type">xs:integer?</code>,</td>
+</tr>
+<tr>
+<td valign="baseline"><code class="arg">$picture</code></td>
+<td valign="baseline"><code class=
+"as">&#160;as&#160;</code><code class="type">xs:string</code>,</td>
+</tr>
+<tr>
+<td valign="baseline"><code class="arg">$language</code></td>
+<td valign="baseline"><code class=
+"as">&#160;as&#160;</code><code class=
+"type">xs:string?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:string</code></td>
+</tr>
+</table>
+</div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>If <code>$value</code> is an empty sequence, the function
returns a zero-length string.</p>
- <p>In all other cases, the <code>$picture</code> argument describes
+<p>In all other cases, the <code>$picture</code> argument describes
the format in which <code>$value</code> is output.</p>
- <p>The rules that follow describe how non-negative numbers are
+<p>The rules that follow describe how non-negative numbers are
output. If the value of <code>$value</code> is negative, the rules
below are applied to the absolute value of <code>$value</code>, and
-the result is prepended with a minus sign.</p>
- <p>A picture consists of a primary format token, followed by an
-optional format modifier.</p>
- <p>The primary format token is one of the following:</p>
- <ul>
- <li>
- <p>A <var>decimal-digit-pattern</var> made up of
+a minus sign is prepended to the result.</p>
+<p>The value of <code>$picture</code> <strong>must</strong> match
+the regular expression:</p>
+<p>
+<code>^((\p{Nd}|#|[^\p{N}\p{L}])+?)(([co](\([^()]\))?)?[at]?)$</code></p>
+<p>The substring that matches the first capturing group in this
+regular expression are referred to as the primary format token. The
+substring that matches the second capturing group (which may be
+empty) is referred to as the format modifier. A picture thus
+consists of a primary format token, followed by an optional format
+modifier.</p>
+<p>The primary format token is classified as one of the
+following:</p>
+<ul>
+<li>
+<p>A <var>decimal-digit-pattern</var> made up of
<var>optional-digit-signs</var>, <var>mandatory-digit-signs</var>,
and <var>grouping-separator-signs</var>.</p>
- <ul>
- <li>
- <p>an <var>optional-digit-sign</var> is the character "#".</p>
- </li>
- <li>
- <p>a <var>mandatory-digit-sign</var> is a <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a> in
+<ul>
+<li>
+<p>The <var>optional-digit-sign</var> is the character "#".</p>
+</li>
+<li>
+<p>A <var>mandatory-digit-sign</var> is a <a title="character"
+class="termref" href="#character"><span class=
+"arrow">·</span>character<span class="arrow">·</span></a> in
Unicode category Nd. All <var>mandatory-digit-signs</var> within
the format token must be from the same digit family, where a digit
family is a sequence of ten consecutive characters in Unicode
@@ -4836,33 +5308,34 @@
token, these digits are interchangeable: a three-digit number may
thus be indicated equivalently by <code>000</code>,
<code>001</code>, or <code>999</code>.</p>
- </li>
- <li>
- <p>a <var>grouping-separator-sign</var> is a non-alphanumeric
-character, that is a <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a> whose Unicode category is other than Nd, Nl,
+</li>
+<li>
+<p>a <var>grouping-separator-sign</var> is a non-alphanumeric
+character, that is a <a title="character" class="termref" href=
+"#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a> whose Unicode category is other than Nd, Nl,
No, Lu, Ll, Lt, Lm or Lo.</p>
- </li>
- </ul>
- <p>There must be at least one <var>mandatory-digit-sign</var>.
-There may be zero or more <var>optional-digit-signs</var>, and (if
-present) these must precede all <var>mandatory-digit-signs</var>.
+</li>
+</ul>
+<p>There <strong>must</strong> be at least one
+<var>mandatory-digit-sign</var>. There may be zero or more
+<var>optional-digit-signs</var>, and (if present) these
+<strong>must</strong> precede all <var>mandatory-digit-signs</var>.
There may be zero or more <var>grouping-separator-signs</var>. A
-<var>grouping-separator-sign</var> must not appear at the start or
-end of the <var>decimal-digit-pattern</var>, nor adjacent to
-another <var>grouping-separator-sign</var>.</p>
- <p>The corresponding output format is a decimal number, using this
+<var>grouping-separator-sign</var> <strong>must not</strong> appear
+at the start or end of the <var>decimal-digit-pattern</var>, nor
+adjacent to another <var>grouping-separator-sign</var>.</p>
+<p>The corresponding output format is a decimal number, using this
digit family, with at least as many digits as there are
<var>mandatory-digit-signs</var> in the format token. Thus, a
format token <code>1</code> generates the sequence <code>0 1 2 ...
10 11 12 ...</code>, and a format token <code>01</code> (or
equivalently, <code>00</code> or <code>99</code>) generates the
sequence <code>00 01 02 ... 09 10 11 12 ... 99 100 101</code>. A
-format token of <code>&#x661;</code> (Arabic-Indic digit one)
-generates the sequence <code>Ù¡</code> then <code>Ù¢</code> then
-<code>Ù£</code> ...</p>
- <p>The <var>grouping-separator-signs</var> are handled as follows.
+format token of <code>&amp;#x661;</code> (Arabic-Indic digit one)
+generates the sequence <code>١</code> then <code>٢</code> then
+<code>٣</code> ...</p>
+<p>The <var>grouping-separator-signs</var> are handled as follows.
The position of grouping separators within the format token,
counting backwards from the last digit, indicates the position of
grouping separators to appear within the formatted number, and the
@@ -4880,7 +5353,7 @@
<code>0'000</code> then the number one million will be formatted as
<code>1'000'000</code>, while the number fifteen will be formatted
as <code>0'015</code>.</p>
- <p>The only purpose of <var>optional-digit-signs</var> is to mark
+<p>The only purpose of <var>optional-digit-signs</var> is to mark
the position of <var>grouping-separator-signs</var>. For example,
if the format token is <code>#'##0</code> then the number one
million will be formatted as <code>1'000'000</code>, while the
@@ -4890,88 +5363,82 @@
number is large enough to require that digit, or (b) the number of
<var>mandatory-digit-signs</var> in the format token requires
insignificant leading zeros to be present.</p>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>Numbers will never be truncated. Given the
-<var>decimal-digit-pattern</var>
- <code>01</code>, the number three
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>Numbers will never be truncated. Given the
+<var>decimal-digit-pattern</var> <code>01</code>, the number three
hundred will be output as <code>300</code>, despite the absence of
any <var>optional-digit-sign</var>.</p>
- </div>
- </li>
- <li>
- <p>A format token <code>A</code> generates the sequence <code>A B C
-... Z AA AB AC...</code>.</p>
- </li>
- <li>
- <p>A format token <code>a</code> generates the sequence <code>a b c
-... z aa ab ac...</code>.</p>
- </li>
- <li>
- <p>A format token <code>i</code> generates the sequence <code>i ii
-iii iv v vi vii viii ix x ...</code>.</p>
- </li>
- <li>
- <p>A format token <code>I</code> generates the sequence <code>I II
-III IV V VI VII VIII IX X ...</code>.</p>
- </li>
- <li>
- <p>A format token <code>w</code> generates numbers written as
-lower-case words, for example in English, <code>one two three four
-...</code>
- </p>
- </li>
- <li>
- <p>A format token <code>W</code> generates numbers written as
-upper-case words, for example in English, <code>ONE TWO THREE FOUR
-...</code>
- </p>
- </li>
- <li>
- <p>A format token <code>Ww</code> generates numbers written as
-title-case words, for example in English, <code>One Two Three Four
-...</code>
- </p>
- </li>
- <li>
- <p>Any other format token indicates a numbering sequence in which
-that token represents the number 1 (one) (but see the note below).
-It is <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> which numbering sequences, additional to
-those listed above, are supported. If an implementation does not
-support a numbering sequence represented by the given token, it
+</div>
+</li>
+<li>
+<p>The format token <code>A</code>, which generates the sequence
+<code>A B C ... Z AA AB AC...</code>.</p>
+</li>
+<li>
+<p>The format token <code>a</code>, which generates the sequence
+<code>a b c ... z aa ab ac...</code>.</p>
+</li>
+<li>
+<p>The format token <code>i</code>, which generates the sequence
+<code>i ii iii iv v vi vii viii ix x ...</code>.</p>
+</li>
+<li>
+<p>The format token <code>I</code>, which generates the sequence
+<code>I II III IV V VI VII VIII IX X ...</code>.</p>
+</li>
+<li>
+<p>The format token <code>w</code>, which generates numbers written
+as lower-case words, for example in English, <code>one two three
+four ...</code></p>
+</li>
+<li>
+<p>The format token <code>W</code>, which generates numbers written
+as upper-case words, for example in English, <code>ONE TWO THREE
+FOUR ...</code></p>
+</li>
+<li>
+<p>The format token <code>Ww</code>, which generates numbers
+written as title-case words, for example in English, <code>One Two
+Three Four ...</code></p>
+</li>
+<li>
+<p>Any other format token, which indicates a numbering sequence in
+which that token represents the number 1 (one) (but see the note
+below). It is <a title="implementation-defined" class="termref"
+href="#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> which numbering sequences, additional to those
+listed above, are supported. If an implementation does not support
+a numbering sequence represented by the given token, it
<strong>must</strong> use a format token of <code>1</code>.</p>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>In some traditional numbering sequences additional signs are
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>In some traditional numbering sequences additional signs are
added to denote that the letters should be interpreted as numbers;
-these are not included in the format token. An example, see also
-the example below, is classical Greek where a <em>dexia keraia</em>
-and sometimes an <em>aristeri keraia</em> is added.</p>
- </div>
- </li>
- </ul>
- <p>For all format tokens other than the first kind above (one that
+these are not included in the format token. An example (see also
+the example below) is classical Greek where a <em>dexia keraia</em>
+(x0374, ʹ) and sometimes an <em>aristeri keraia</em> (x0375, ͵) is
+added.</p>
+</div>
+</li>
+</ul>
+<p>For all format tokens other than the first kind above (one that
consists of decimal digits), there <strong>may</strong> be
-<a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> lower and upper bounds on the range of
-numbers that can be formatted using this format token; indeed, for
-some numbering sequences there may be intrinsic limits. For
-example, the format token <code>&#x2460;</code> (circled digit
-one, â‘ ) has a range of 1 to 20 imposed by the Unicode character
-repertoire. For the numbering sequences described above any upper
-bound imposed by the implementation <strong>must not</strong> be
-less than 1000 (one thousand) and any lower bound must not be
-greater than 1. Numbers that fall outside this range
-<strong>must</strong> be formatted using the format token
-<code>1</code>.</p>
- <p>The above expansions of numbering sequences for format tokens
+<a title="implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> lower and upper bounds on the range of numbers
+that can be formatted using this format token; indeed, for some
+numbering sequences there may be intrinsic limits. For example, the
+format token <code>&amp;#x2460;</code> (circled digit one, ①) has a
+range of 1 to 20 imposed by the Unicode character repertoire. For
+the numbering sequences described above any upper bound imposed by
+the implementation <strong>must not</strong> be less than 1000 (one
+thousand) and any lower bound must not be greater than 1. Numbers
+that fall outside this range <strong>must</strong> be formatted
+using the format token <code>1</code>.</p>
+<p>The above expansions of numbering sequences for format tokens
such as <code>a</code> and <code>i</code> are indicative but not
prescriptive. There are various conventions in use for how
alphabetic sequences continue when the alphabet is exhausted, and
@@ -4982,50 +5449,54 @@
This specification does not prescribe the detail of any sequence
other than those sequences consisting entirely of decimal
digits.</p>
- <p>Many numbering sequences are language-sensitive. This applies
+<p>Many numbering sequences are language-sensitive. This applies
especially to the sequence selected by the tokens <code>w</code>,
<code>W</code> and <code>Ww</code>. It also applies to other
sequences, for example different languages using the Cyrillic
alphabet use different sequences of characters, each starting with
the letter #x410 (Cyrillic capital letter A). In such cases, the
<code>$language</code> argument specifies which language's
-conventions are to be used; it has the same range of values as
-<code>xml:lang</code> (see <a href="#REC-xml">[REC-xml]</a>). If no
-<code>$language</code> argument is specified, the language that is
-used is <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a>. The set of languages for which numbering is
-supported is <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a>. If a language is requested that is not
-supported, the processor uses the language that it would use if the
-<code>$language</code> argument were omitted.</p>
- <p>The format modifier, if present, is one
-<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
- <span>or
-more</span> of the following, in any order:</p>
- <ul>
- <li>
- <p>either <code>c</code> or <code>o</code>, optionally followed by
+conventions are to be used. <span>If the argument is specified, the
+value <strong>should</strong> be a string that is castable to the
+type <code>xs:language</code></span>.</p>
+<p>The set of languages for which numbering is supported is
+<a title="implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a>. If the <code>$language</code> argument is
+absent, or is set to an empty sequence, or is invalid, or is not a
+language supported by the implementation, then the number is
+formatted using a default language; the default language is
+<a title="implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a>.</p>
+<p>The format modifier, if present, is one <span>or more</span> of
+the following, in order:</p>
+<ul>
+<li>
+<p>either <code>c</code> or <code>o</code>, optionally followed by
a sequence of characters enclosed between parentheses, to indicate
cardinal or ordinal numbering respectively, the default being
cardinal numbering</p>
- </li>
- <li>
- <p>either <code>a</code> or <code>t</code> to indicate alphabetic
-or traditional numbering respectively, the default being <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a>.</p>
- </li>
- </ul>
- <p>If the <code>o</code> modifier is present, this indicates a
+</li>
+<li>
+<p>either <code>a</code> or <code>t</code>, to indicate alphabetic
+or traditional numbering respectively, the default being <a title=
+"implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a>.</p>
+</li>
+</ul>
+<p>If the <code>o</code> modifier is present, this indicates a
request to output ordinal numbers rather than cardinal numbers. For
example, in English, when used with the format token
<code>1</code>, this outputs the sequence <code>1st 2nd 3rd 4th
...</code>, and when used with the format token <code>w</code>
outputs the sequence <code>first second third fourth
...</code>.</p>
- <p>In some languages, ordinal numbers vary depending on the
+<p>In some languages, ordinal numbers vary depending on the
grammatical context, for example they may have different genders
and may decline with the noun that they qualify. In such cases the
string appearing in parentheses after the letter <code>o</code> may
@@ -5036,507 +5507,498 @@
required ending, preceded by a hyphen: for example in German,
appropriate values are <code>o(-e)</code>, <code>o(-er)</code>,
<code>o(-es)</code>, <code>o(-en)</code>.</p>
- <p>It is <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a> what combinations of values of the format
+<p>It is <a title="implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a> what combinations of values of the format
token, the language, and the cardinal/ordinal modifier are
supported. If ordinal numbering is not supported for the
combination of the format token, the language, and the string
appearing in parentheses, the request is ignored and cardinal
numbers are generated instead.</p>
- <div class="exampleOuter">
- <div class="exampleHeader">
- <a name="d5e5331" id="d5e5331"/>Example: Ordinal Numbering in Italian</div>
- <p>The specification <code>"1o(-º)"</code> with
+<div class="exampleOuter">
+<div class="exampleHeader"><a name="d5e6102" id=
+"d5e6102"></a>Example: Ordinal Numbering in Italian</div>
+<p>The specification <code>"1o(-º)"</code> with
<code>$language</code> equal to <code>it</code>, if supported,
should produce the sequence:</p>
- <div class="exampleInner">
- <pre>
- 1º 2º 3º 4º ...
-</pre>
- </div>
- <p>The specification <code>"Wwo"</code> with <code>$language</code>
+<div class="exampleInner">
+<pre>
+1º 2º 3º 4º ...
+</pre></div>
+<p>The specification <code>"Wwo"</code> with <code>$language</code>
equal to <code>it</code>, if supported, should produce the
sequence:</p>
- <div class="exampleInner">
- <pre>
- Primo Secondo Terzo Quarto Quinto ...
-</pre>
- </div>
- </div>
- <p>The
-<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
- <span>use
-of the <code>a</code> or <code>t</code> modifier</span>
-disambiguates between numbering sequences that use letters. In many
-languages there are two commonly used numbering sequences that use
-letters. One numbering sequence assigns numeric values to letters
-in alphabetic sequence, and the other assigns numeric values to
-each letter in some other manner traditional in that language. In
-English, these would correspond to the numbering sequences
-specified by the format tokens <code>a</code> and <code>i</code>.
-In some languages, the first member of each sequence is the same,
-and so the format token alone would be ambiguous.
-<!--* This is xmlspec, match="phrase" - - show.diff.markup = 0-->
- <span>In
-the absence of the <code>a</code> or <code>t</code> modifier, the
-default is <a title="implementation-defined" class="termref" href="#implementation-defined">
- <span class="arrow">·</span>implementation-defined<span class="arrow">·</span>
- </a>
- </span>.</p>
- </dd>
- <dt class="label">Error Conditions</dt>
- <dd>
- <p>An error is raised [<a href="#ERRFOFI0001" title="err:FOFI0001">err:FOFI0001</a>] if the <code>$language</code>
-argument is supplied as is not castable to
-<code>xs:language</code>.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>format-integer(123, '0000')</code> returns
+<div class="exampleInner">
+<pre>
+Primo Secondo Terzo Quarto Quinto ...
+</pre></div>
+</div>
+<p>The <span>use of the <code>a</code> or <code>t</code>
+modifier</span> disambiguates between numbering sequences that use
+letters. In many languages there are two commonly used numbering
+sequences that use letters. One numbering sequence assigns numeric
+values to letters in alphabetic sequence, and the other assigns
+numeric values to each letter in some other manner traditional in
+that language. In English, these would correspond to the numbering
+sequences specified by the format tokens <code>a</code> and
+<code>i</code>. In some languages, the first member of each
+sequence is the same, and so the format token alone would be
+ambiguous. <span>In the absence of the <code>a</code> or
+<code>t</code> modifier, the default is <a title=
+"implementation-defined" class="termref" href=
+"#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a></span>.</p>
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>format-integer(123, '0000')</code> returns
<code>"0123"</code>.</p>
- <p>
- <code>format-integer(123, 'w')</code> might return <code>"one
-hundred and twenty-three"</code>
- </p>
- <p>The expression <code>format-integer(21, '1o', 'en')</code>
+<p><code>format-integer(123, 'w')</code> might return <code>"one
+hundred and twenty-three"</code></p>
+<p>The expression <code>format-integer(21, '1o', 'en')</code>
returns <code>"21st"</code>.</p>
- <p>
- <code>format-integer(14, 'Wwo(-e)', 'de')</code> might return
-<code>"Vierzehnte"</code>
- </p>
- <p>The expression <code>format-integer(7, 'a')</code> returns
+<p><code>format-integer(14, 'Wwo(-e)', 'de')</code> might return
+<code>"Vierzehnte"</code></p>
+<p>The expression <code>format-integer(7, 'a')</code> returns
<code>"g"</code>.</p>
- <p>The expression <code>format-integer(57, 'I')</code> returns
+<p>The expression <code>format-integer(57, 'I')</code> returns
<code>"LVII"</code>.</p>
- </dd>
- </dl>
- </div>
- </div>
- <div class="div2">
- <h3>
- <a name="formatting-numbers" id="formatting-numbers"/>4.6
+</dd>
+</dl>
+</div>
+</div>
+<div class="div2">
+<h3><a name="formatting-numbers" id="formatting-numbers"></a>4.7
Formatting numbers</h3>
- <p>This section defines a function for formatting decimal and
+<p>This section defines a function for formatting decimal and
floating point numbers.</p>
- <table summary="Function/operator summary" border="1">
- <thead>
- <tr>
- <th colspan="1">Function</th>
- <th colspan="1">Meaning</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <a href="#func-format-number">
- <code>fn:format-number</code>
- </a>
- </td>
- <td>Returns a string containing a number formatted according to a
+<table summary="Function/operator summary" border="1">
+<thead>
+<tr>
+<th colspan="1">Function</th>
+<th colspan="1">Meaning</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><a href=
+"#func-format-number"><code>fn:format-number</code></a></td>
+<td>Returns a string containing a number formatted according to a
given picture string, taking account of decimal formats specified
in the static context.</td>
- </tr>
- </tbody>
- </table>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>This function can be used to format any numeric quantity,
-including an integer. For integers, however, the <a href="#func-format-integer">
- <code>fn:format-integer</code>
- </a> function
+</tr>
+</tbody>
+</table>
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>This function can be used to format any numeric quantity,
+including an integer. For integers, however, the <a href=
+"#func-format-integer"><code>fn:format-integer</code></a> function
offers additional possibilities. Note also that the picture strings
used by the two functions are not 100% compatible, though they
share some options in common.</p>
- </div>
- <div class="div3">
- <h4>
- <a name="defining-decimal-format" id="defining-decimal-format"/>4.6.1 Defining a decimal format</h4>
- <p>Decimal formats are defined in the static context, and the way
+</div>
+<div class="div3">
+<h4><a name="defining-decimal-format" id=
+"defining-decimal-format"></a>4.7.1 Defining a decimal format</h4>
+<p>Decimal formats are defined in the static context, and the way
they are defined is therefore outside the scope of this
specification. XSLT and XQuery both provide custom syntax for
creating a decimal format.</p>
- <p>The static context provides a set of decimal formats. One of the
+<p>The static context provides a set of decimal formats. One of the
decimal formats is unnamed, the others (if any) are identified by a
QName. There is always an unnamed decimal format available, but its
contents are implementation-defined.</p>
- <p>Each decimal format provides a set of named variables, described
+<p>Each decimal format provides a set of named variables, described
in the following table:</p>
- <table summary="A table [this is bad style]" border="1">
- <thead>
- <tr>
- <th colspan="1">Name</th>
- <th colspan="1">Type</th>
- <th colspan="1">Usage (non-normative)</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td valign="top">decimal-separator-sign</td>
- <td valign="top">A single <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a>
- </td>
- <td valign="top">Defines the character used to represent the
+<table summary="A table [this is bad style]" border="1">
+<thead>
+<tr>
+<th colspan="1">Name</th>
+<th colspan="1">Type</th>
+<th colspan="1">Usage (non-normative)</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td valign="top">decimal-separator-sign</td>
+<td valign="top">A single <a title="character" class="termref"
+href="#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a></td>
+<td valign="top">Defines the character used to represent the
decimal point (typically ".") both in the picture string and in the
formatted number</td>
- </tr>
- <tr>
- <td valign="top">grouping-separator-sign</td>
- <td valign="top">A single <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a>
- </td>
- <td valign="top">Defines the character used to separate groups of
+</tr>
+<tr>
+<td valign="top">grouping-separator-sign</td>
+<td valign="top">A single <a title="character" class="termref"
+href="#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a></td>
+<td valign="top">Defines the character used to separate groups of
digits (typically ",") both in the picture string and in the
formatted number</td>
- </tr>
- <tr>
- <td valign="top">infinity</td>
- <td valign="top">A <a title="string" class="termref" href="#string">
- <span class="arrow">·</span>string<span class="arrow">·</span>
- </a>
- </td>
- <td valign="top">Defines the string used to represent the value
+</tr>
+<tr>
+<td valign="top">infinity</td>
+<td valign="top">A <a title="string" class="termref" href=
+"#string"><span class="arrow">·</span>string<span class=
+"arrow">·</span></a></td>
+<td valign="top">Defines the string used to represent the value
positive or negative infinity in the formatted number (typically
"Infinity")</td>
- </tr>
- <tr>
- <td valign="top">minus-sign</td>
- <td valign="top">A single <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a>
- </td>
- <td valign="top">Defines the character used as a minus sign in the
+</tr>
+<tr>
+<td valign="top">minus-sign</td>
+<td valign="top">A single <a title="character" class="termref"
+href="#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a></td>
+<td valign="top">Defines the character used as a minus sign in the
formatted number if there is no subpicture for formatting negative
numbers (typically "-", x2D)</td>
- </tr>
- <tr>
- <td valign="top">NaN</td>
- <td>valign="top"A <a title="string" class="termref" href="#string">
- <span class="arrow">·</span>string<span class="arrow">·</span>
- </a>
- </td>
- <td valign="top">Defines the string used to represent the value
+</tr>
+<tr>
+<td valign="top">NaN</td>
+<td valign="top">A <a title="string" class="termref" href=
+"#string"><span class="arrow">·</span>string<span class=
+"arrow">·</span></a></td>
+<td valign="top">Defines the string used to represent the value
<code>NaN</code> in the formatted number</td>
- </tr>
- <tr>
- <td valign="top">percent-sign</td>
- <td valign="top">A single <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a>
- </td>
- <td valign="top">Defines the character used as a percent sign
+</tr>
+<tr>
+<td valign="top">percent-sign</td>
+<td valign="top">A single <a title="character" class="termref"
+href="#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a></td>
+<td valign="top">Defines the character used as a percent sign
(typically "%") both in the picture string and in the formatted
number</td>
- </tr>
- <tr>
- <td valign="top">per-mille-sign</td>
- <td valign="top">A single <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a>
- </td>
- <td valign="top">Defines the character used as a per-mille sign
-(typically "‰", x2030) both in the picture string and in the
+</tr>
+<tr>
+<td valign="top">per-mille-sign</td>
+<td valign="top">A single <a title="character" class="termref"
+href="#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a></td>
+<td valign="top">Defines the character used as a per-mille sign
+(typically "‰", x2030) both in the picture string and in the
formatted number</td>
- </tr>
- <tr>
- <td valign="top">mandatory-digit-sign</td>
- <td valign="top">A single <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a>, which
-must be defined in Unicode as a digit</td>
- <td valign="top">Defines the character (typically "0") used in the
+</tr>
+<tr>
+<td valign="top">mandatory-digit-sign</td>
+<td valign="top">A single <a title="character" class="termref"
+href="#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a>, which must be defined in Unicode as a
+digit</td>
+<td valign="top">Defines the character (typically "0") used in the
picture string to represent a mandatory digit, and in the formatted
number to represent the digit zero; by implication, this also
defines the characters used to represent the digits one to
nine.</td>
- </tr>
- <tr>
- <td valign="top">optional-digit-sign</td>
- <td valign="top">A single <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a>
- </td>
- <td valign="top">Defines the character used in the picture string
+</tr>
+<tr>
+<td valign="top">optional-digit-sign</td>
+<td valign="top">A single <a title="character" class="termref"
+href="#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a></td>
+<td valign="top">Defines the character used in the picture string
to represent an optional digit (typically "#")</td>
- </tr>
- <tr>
- <td valign="top">pattern-separator-sign</td>
- <td>valign="top"A single <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a>
- </td>
- <td valign="top">Defines the character used in the picture string
+</tr>
+<tr>
+<td valign="top">pattern-separator-sign</td>
+<td valign="top">A single <a title="character" class="termref"
+href="#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a></td>
+<td valign="top">Defines the character used in the picture string
to separate the positive and negative subpictures (typically
";")</td>
- </tr>
- </tbody>
- </table>
- <p>
- <span class="termdef">
- <a name="dt-decimal-digit-family" id="dt-decimal-digit-family"/>[Definition] The <b>decimal digit
+</tr>
+</tbody>
+</table>
+<p><span class="termdef"><a name="dt-decimal-digit-family" id=
+"dt-decimal-digit-family"></a>[Definition] The <b>decimal digit
family</b> of a decimal format is the sequence of ten digits with
-consecutive Unicode <a title="codepoint" class="termref" href="#codepoint">
- <span class="arrow">·</span>codepoints<span class="arrow">·</span>
- </a> starting with the
-<var>mandatory-digit-sign</var>.</span>
- </p>
- <p>It is a constraint that, for any named or unnamed decimal
-format, the variables representing characters used in a <a title="picture string" class="termref" href="#dt-picture-string">
- <span class="arrow">·</span>picture
-string<span class="arrow">·</span>
- </a> must have distinct values.
+consecutive Unicode <a title="codepoint" class="termref" href=
+"#codepoint"><span class="arrow">·</span>codepoints<span class=
+"arrow">·</span></a> starting with the
+<var>mandatory-digit-sign</var>.</span></p>
+<p>It is a constraint that, for any named or unnamed decimal
+format, the variables representing characters used in a <a title=
+"picture string" class="termref" href=
+"#dt-picture-string"><span class="arrow">·</span>picture
+string<span class="arrow">·</span></a> must have distinct values.
These variables are <var>decimal-separator-sign</var>,
<var>grouping-separator-sign</var>, <var>percent-sign</var>,
<var>per-mille-sign</var>, <var>optional-digit-sign</var>, and
<var>pattern-separator-sign</var>. Furthermore, none of these
-variables may be equal to any <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>character<span class="arrow">·</span>
- </a> in the
-<a title="digit family" class="termref" href="#dt-decimal-digit-family">
- <span class="arrow">·</span>decimal
-digit family<span class="arrow">·</span>
- </a>.</p>
- </div>
- <div class="div3">
- <h4>
- <a name="func-format-number" id="func-format-number"/>4.6.2
+variables may be equal to any <a title="character" class="termref"
+href="#character"><span class="arrow">·</span>character<span class=
+"arrow">·</span></a> in the <a title="digit family" class="termref"
+href="#dt-decimal-digit-family"><span class="arrow">·</span>decimal
+digit family<span class="arrow">·</span></a>.</p>
+</div>
+<div class="div3">
+<h4><a name="func-format-number" id="func-format-number"></a>4.7.2
fn:format-number</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns a string containing a number formatted according to a
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns a string containing a number formatted according to a
given picture string, taking account of decimal formats specified
in the static context.</p>
- </dd>
- <dt class="label">Signatures</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">fn:format-number</code>(<code class="arg">$value</code>
- <code class="as"> as </code>
- <code class="type">numeric?</code>, <code class="arg">$picture</code>
- <code class="as"> as </code>
- <code class="type">xs:string</code>)<code class="as"> as </code>
- <code class="return-type">xs:string</code>
- </div>
- </div>
- <div class="exampleInner">
- <div class="proto">
- <table border="0" cellpadding="0" cellspacing="0" summary="Function/operator prototype">
- <tr>
- <td valign="baseline" rowspan="3">
- <code class="function">fn:format-number</code>(</td>
- <td valign="baseline">
- <code class="arg">$value</code>
- </td>
- <td valign="baseline">
- <code class="as"> as </code>
- <code class="type">numeric?</code>,</td>
- </tr>
- <tr>
- <td valign="baseline">
- <code class="arg">$picture</code>
- </td>
- <td valign="baseline">
- <code class="as"> as </code>
- <code class="type">xs:string</code>,</td>
- </tr>
- <tr>
- <td valign="baseline">
- <code class="arg">$decimal-format-name</code>
- </td>
- <td valign="baseline">
- <code class="as"> as </code>
- <code class="type">xs:string</code>)<code class="as"> as </code>
- <code class="return-type">xs:string</code>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>The function formats <code>$value</code> as a string using the
-<a title="picture string" class="termref" href="#dt-picture-string">
- <span class="arrow">·</span>picture
-string<span class="arrow">·</span>
- </a> specified by the
+</dd>
+<dt class="label">Signatures</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">fn:format-number</code>(<code class=
+"arg">$value</code><code class=
+"as">&#160;as&#160;</code><code class="type">numeric?</code>,
+<code class="arg">$picture</code><code class=
+"as">&#160;as&#160;</code><code class=
+"type">xs:string</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:string</code></div>
+</div>
+<div class="exampleInner">
+<div class="proto">
+<table border="0" cellpadding="0" cellspacing="0" summary=
+"Function/operator prototype">
+<tr>
+<td valign="baseline" rowspan="3"><code class=
+"function">fn:format-number</code>(</td>
+<td valign="baseline"><code class="arg">$value</code></td>
+<td valign="baseline"><code class=
+"as">&#160;as&#160;</code><code class="type">numeric?</code>,</td>
+</tr>
+<tr>
+<td valign="baseline"><code class="arg">$picture</code></td>
+<td valign="baseline"><code class=
+"as">&#160;as&#160;</code><code class="type">xs:string</code>,</td>
+</tr>
+<tr>
+<td valign="baseline"><code class=
+"arg">$decimal-format-name</code></td>
+<td valign="baseline"><code class=
+"as">&#160;as&#160;</code><code class=
+"type">xs:string?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:string</code></td>
+</tr>
+</table>
+</div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>The two-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+<p>The three-argument form of this function is <a title=
+"deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-dependent" class="termref" href=
+"#dt-context-dependent"><span class=
+"arrow">·</span>context-dependent<span class="arrow">·</span></a>,
+and <a title="focus-dependent" class="termref" href=
+"#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class="arrow">·</span></a>.
+It depends on decimal-formats and namespaces.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>The effect of the two-argument form of the function is
+equivalent to calling the three-argument form with an empty
+sequence as the value of the third argument.</p>
+<p>The function formats <code>$value</code> as a string using the
+<a title="picture string" class="termref" href=
+"#dt-picture-string"><span class="arrow">·</span>picture
+string<span class="arrow">·</span></a> specified by the
<code>$picture</code> argument and the decimal-format named by the
<code>$decimal-format-name</code> argument, or the default
decimal-format, if there is no <code>$decimal-format-name</code>
-argument. The syntax of the picture string is described in <a href="#syntax-of-picture-string">
- <b>4.6.3 Syntax of the picture
-string</b>
- </a>.</p>
- <p>The <code>$value</code> argument may be of any numeric data type
+argument. The syntax of the picture string is described in <a href=
+"#syntax-of-picture-string"><b>4.7.3 Syntax of the picture
+string</b></a>.</p>
+<p>The <code>$value</code> argument may be of any numeric data type
(<code>xs:double</code>, <code>xs:float</code>,
<code>xs:decimal</code>, or their subtypes including
<code>xs:integer</code>). Note that if an <code>xs:decimal</code>
is supplied, it is not automatically promoted to an
<code>xs:double</code>, as such promotion can involve a loss of
precision.</p>
- <p>If the supplied value of the <code>$value</code> argument is an
+<p>If the supplied value of the <code>$value</code> argument is an
empty sequence, the function behaves as if the supplied value were
the <code>xs:double</code> value <code>NaN</code>.</p>
- <p>The value of <code>$decimal-format-name</code>
- <strong>must</strong> be a lexical QName, which is expanded using
-the in-scope namespaces from the static context. The default
-namespace is not used (no prefix means no namespace).</p>
- <p>The evaluation of the <code>format-number</code> function takes
-place in two phases, an analysis phase described in <a href="#analysing-picture-string">
- <b>4.6.4 Analysing the picture
-string</b>
- </a> and a formatting phase described in <a href="#formatting-the-number">
- <b>4.6.5 Formatting the
-number</b>
- </a>.</p>
- <p>The analysis phase takes as its inputs the <a title="picture string" class="termref" href="#dt-picture-string">
- <span class="arrow">·</span>picture
-string<span class="arrow">·</span>
- </a> and the variables derived
+<p>The value of <code>$decimal-format-name</code>, <span>if present
+and non-empty,</span> <strong>must</strong> be a lexical QName,
+which is expanded using the <span>statically known
+namespaces</span>. The default namespace is not used (no prefix
+means no namespace).</p>
+<p>The decimal format that is used is the decimal format in the
+static context whose name matches <code>$decimal-format-name</code>
+if supplied, or the default decimal format in the static context
+otherwise.</p>
+<p>The evaluation of the <code>format-number</code> function takes
+place in two phases, an analysis phase described in <a href=
+"#analysing-picture-string"><b>4.7.4 Analysing the picture
+string</b></a> and a formatting phase described in <a href=
+"#formatting-the-number"><b>4.7.5 Formatting the
+number</b></a>.</p>
+<p>The analysis phase takes as its inputs the <a title=
+"picture string" class="termref" href=
+"#dt-picture-string"><span class="arrow">·</span>picture
+string<span class="arrow">·</span></a> and the variables derived
from the relevant decimal format in the static context, and
produces as its output a number of variables with defined values.
The formatting phase takes as its inputs the number to be formatted
and the variables produced by the analysis phase, and produces as
its output a string containing a formatted representation of the
number.</p>
- <p>The result of the function is the formatted string
+<p>The result of the function is the formatted string
representation of the supplied number.</p>
- </dd>
- <dt class="label">Error Conditions</dt>
- <dd>
- <p>An error is raised [<a href="#ERRFODF1280" title="err:FODF1280">err:FODF1280</a>] if the name specified as the
+</dd>
+<dt class="label">Error Conditions</dt>
+<dd>
+<p>An error is raised [<a href="#ERRFODF1280" title=
+"err:FODF1280">err:FODF1280</a>] if the name specified as the
<code>$decimal-format-name</code> argument is not a valid lexical
-QName, or if its prefix has not been declared in an in-scope
-namespace declaration, or if the static context does not contain a
+QName, or if its prefix <span>is not found in the statically known
+namespaces</span>, or if the static context does not contain a
declaration of a decimal-format with a matching expanded QName. If
the processor is able to detect the error statically (for example,
when the argument is supplied as a string literal), then the
processor <strong>may</strong> optionally signal this as a static
error.</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>Numbers will always be formatted with the most significant digit
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>Numbers will always be formatted with the most significant digit
on the left.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="syntax-of-picture-string" id="syntax-of-picture-string"/>4.6.3 Syntax of the picture
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>format-number(12345.6, '#.###,00')</code>
+returns <code>"12.345,00"</code>.</p>
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="syntax-of-picture-string" id=
+"syntax-of-picture-string"></a>4.7.3 Syntax of the picture
string</h4>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>This differs from the <code>format-number</code> function
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>This differs from the <code>format-number</code> function
previously defined in XSLT 2.0 in that any digit can be used in the
picture string to represent a mandatory digit: for example the
picture strings '000', '001', and '999' are equivalent. This is to
align <code>format-number</code> (which previously used '000') with
<code>format-dateTime</code> (which used '001').</p>
- </div>
- <p>
- <span class="termdef">
- <a name="dt-picture-string" id="dt-picture-string"/>[Definition] The formatting of a number is
+</div>
+<p><span class="termdef"><a name="dt-picture-string" id=
+"dt-picture-string"></a>[Definition] The formatting of a number is
controlled by a <b>picture string</b>. The picture string is a
-sequence of <a title="character" class="termref" href="#character">
- <span class="arrow">·</span>characters<span class="arrow">·</span>
- </a>, in which the characters assigned to the
+sequence of <a title="character" class="termref" href=
+"#character"><span class="arrow">·</span>characters<span class=
+"arrow">·</span></a>, in which the characters assigned to the
variables <var>decimal-separator-sign</var>,
<var>grouping-sign</var>, <var>decimal-digit-family</var>,
<var>optional-digit-sign</var> and
<var>pattern-separator-sign</var> are classified as active
characters, and all other characters (including the
<var>percent-sign</var> and <var>per-mille-sign</var>) are
-classified as passive characters.</span>
- </p>
- <p>The <var>integer part</var> of the sub-picture is defined as the
+classified as passive characters.</span></p>
+<p>The <var>integer part</var> of the sub-picture is defined as the
part that appears to the left of the
<var>decimal-separator-sign</var> if there is one, or the entire
sub-picture otherwise. The <var>fractional part</var> of the
sub-picture is defined as the part that appears to the right of the
<var>decimal-separator-sign</var> if there is one; it is a
zero-length string otherwise.</p>
- <p>An error is raised [<a href="#ERRFODF1310" title="err:FODF1310">err:FODF1310</a>] if the <a title="picture string" class="termref" href="#dt-picture-string">
- <span class="arrow">·</span>picture string<span class="arrow">·</span>
- </a>
-does not conform to the following rules. Note that in these rules
-the words "preceded" and "followed" refer to characters anywhere in
-the string, they are not to be read as "immediately preceded" and
+<p>An error is raised [<a href="#ERRFODF1310" title=
+"err:FODF1310">err:FODF1310</a>] if the <a title="picture string"
+class="termref" href="#dt-picture-string"><span class=
+"arrow">·</span>picture string<span class="arrow">·</span></a> does
+not conform to the following rules. Note that in these rules the
+words "preceded" and "followed" refer to characters anywhere in the
+string, they are not to be read as "immediately preceded" and
"immediately followed".</p>
- <ul>
- <li>
- <p>A picture-string consists either of a sub-picture, or of two
+<ul>
+<li>
+<p>A picture-string consists either of a sub-picture, or of two
sub-pictures separated by a <var>pattern-separator-sign</var>. A
picture-string <strong>must not</strong> contain more than one
<var>pattern-separator-sign</var>. If the picture-string contains
two sub-pictures, the first is used for positive values and the
second for negative values.</p>
- </li>
- <li>
- <p>A sub-picture <strong>must not</strong> contain more than one
+</li>
+<li>
+<p>A sub-picture <strong>must not</strong> contain more than one
<var>decimal-separator-sign</var>.</p>
- </li>
- <li>
- <p>A sub-picture <strong>must not</strong> contain more than one
+</li>
+<li>
+<p>A sub-picture <strong>must not</strong> contain more than one
<var>percent-sign</var> or <var>per-mille-sign</var>, and it
<strong>must not</strong> contain one of each.</p>
- </li>
- <li>
- <p>A sub-picture <strong>must</strong> contain at least one
+</li>
+<li>
+<p>A sub-picture <strong>must</strong> contain at least one
character that is an <var>optional-digit-sign</var> or a member of
the <var>decimal-digit-family</var>.</p>
- </li>
- <li>
- <p>A sub-picture <strong>must not</strong> contain a passive
+</li>
+<li>
+<p>A sub-picture <strong>must not</strong> contain a passive
character that is preceded by an active character and that is
followed by another active character.</p>
- </li>
- <li>
- <p>A sub-picture <strong>must not</strong> contain a
+</li>
+<li>
+<p>A sub-picture <strong>must not</strong> contain a
<var>grouping-separator-sign</var> adjacent to a
<var>decimal-separator-sign</var>.</p>
- </li>
- <li>
- <p>The integer part of a sub-picture <strong>must not</strong>
+</li>
+<li>
+<p>The integer part of a sub-picture <strong>must not</strong>
contain a member of the <var>decimal-digit-family</var> that is
followed by an <var>optional-digit-sign</var>. The fractional part
of a sub-picture <strong>must not</strong> contain an
<var>optional-digit-sign</var> that is followed by a member of the
<var>decimal-digit-family</var>.</p>
- </li>
- </ul>
- </div>
- <div class="div3">
- <h4>
- <a name="analysing-picture-string" id="analysing-picture-string"/>4.6.4 Analysing the picture
+</li>
+</ul>
+</div>
+<div class="div3">
+<h4><a name="analysing-picture-string" id=
+"analysing-picture-string"></a>4.7.4 Analysing the picture
string</h4>
- <p>This phase of the algorithm analyses the <a title="picture string" class="termref" href="#dt-picture-string">
- <span class="arrow">·</span>picture
-string<span class="arrow">·</span>
- </a> and the variables from the
+<p>This phase of the algorithm analyses the <a title=
+"picture string" class="termref" href=
+"#dt-picture-string"><span class="arrow">·</span>picture
+string<span class="arrow">·</span></a> and the variables from the
selected decimal format in the static context, and it has the
effect of setting the values of various variables, which are used
in the subsequent formatting phase. These variables are listed
below. Each is shown with its initial setting and its data
type.</p>
- <p>Several variables are associated with each sub-picture. If there
+<p>Several variables are associated with each sub-picture. If there
are two sub-pictures, then these rules are applied to one
sub-picture to obtain the values that apply to positive numbers,
and to the other to obtain the values that apply to negative
numbers. If there is only one sub-picture, then the values for both
cases are derived from this sub-picture.</p>
- <p>The variables are as follows:</p>
- <ul>
- <li>
- <p>The <var>integer-part-grouping-positions</var> is a sequence of
+<p>The variables are as follows:</p>
+<ul>
+<li>
+<p>The <var>integer-part-grouping-positions</var> is a sequence of
integers representing the positions of grouping separators within
the integer part of the sub-picture. For each
<var>grouping-separator-sign</var> that appears within the integer
@@ -5551,36 +6013,34 @@
the case where there is only one number in the list), then the
sequence contains all integer multiples of <var>N</var> as far as
necessary to accommodate the largest possible number.</p>
- </li>
- <li>
- <p>The <var>minimum-integer-part-size</var> is an integer
+</li>
+<li>
+<p>The <var>minimum-integer-part-size</var> is an integer
indicating the minimum number of digits that will appear to the
left of the <var>decimal-separator-sign</var>. It is normally set
to the number of <var>decimal-digit-family</var> characters found
in the integer part of the sub-picture. But if the sub-picture
contains no <var>decimal-digit-family</var> character and no
<var>decimal-separator-sign</var>, it is set to one.</p>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>There is no maximum integer part size. All significant digits in
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>There is no maximum integer part size. All significant digits in
the integer part of the number will be displayed, even if this
exceeds the number of <var>optional-digit-sign</var> and
<var>decimal-digit-family</var> characters in the subpicture.</p>
- </div>
- </li>
- <li>
- <p>The <var>prefix</var> is set to contain all passive characters
+</div>
+</li>
+<li>
+<p>The <var>prefix</var> is set to contain all passive characters
in the sub-picture to the left of the leftmost active character. If
the picture string contains only one sub-picture, the
<var>prefix</var> for the negative sub-picture is set by
concatenating the <var>minus-sign</var> character and the
<var>prefix</var> for the positive sub-picture (if any), in that
order.</p>
- </li>
- <li>
- <p>The <var>fractional-part-grouping-positions</var> is a sequence
+</li>
+<li>
+<p>The <var>fractional-part-grouping-positions</var> is a sequence
of integers representing the positions of grouping separators
within the fractional part of the sub-picture. For each
<var>grouping-separator-sign</var> that appears within the
@@ -5590,77 +6050,76 @@
characters that appear within the fractional part of the
sub-picture and to the left of the
<var>grouping-separator-sign</var>.</p>
- </li>
- <li>
- <p>The <var>minimum-fractional-part-size</var> is set to the number
+</li>
+<li>
+<p>The <var>minimum-fractional-part-size</var> is set to the number
of <var>decimal-digit-family</var> characters found in the
fractional part of the sub-picture.</p>
- </li>
- <li>
- <p>The <var>maximum-fractional-part-size</var> is set to the total
+</li>
+<li>
+<p>The <var>maximum-fractional-part-size</var> is set to the total
number of <var>optional-digit-sign</var> and
<var>decimal-digit-family</var> characters found in the fractional
part of the sub-picture.</p>
- </li>
- <li>
- <p>The <var>suffix</var> is set to contain all passive characters
+</li>
+<li>
+<p>The <var>suffix</var> is set to contain all passive characters
to the right of the rightmost active character in the fractional
part of the sub-picture.</p>
- </li>
- </ul>
- <div class="note">
- <p class="prefix">
- <b>Note:</b>
- </p>
- <p>If there is only one sub-picture, then all variables for
+</li>
+</ul>
+<div class="note">
+<p class="prefix"><b>Note:</b></p>
+<p>If there is only one sub-picture, then all variables for
positive numbers and negative numbers will be the same, except for
<var>prefix</var>: the prefix for negative numbers will be preceded
by the <var>minus-sign</var> character.</p>
- </div>
- </div>
- <div class="div3">
- <h4>
- <a name="formatting-the-number" id="formatting-the-number"/>4.6.5 Formatting the number</h4>
- <p>This section describes the second phase of processing of the
-<code>format-number</code> function. This phase takes as input a
-number to be formatted (referred to as the <em>input number</em>),
-and the variables set up by analysing the decimal format in the
-static context and the <a title="picture string" class="termref" href="#dt-picture-string">
- <span class="arrow">·</span>picture
-string<span class="arrow">·</span>
- </a>, as described above. The
+</div>
+</div>
+<div class="div3">
+<h4><a name="formatting-the-number" id=
+"formatting-the-number"></a>4.7.5 Formatting the number</h4>
+<p>This section describes the second phase of processing of the
+<a href="#func-format-number"><code>fn:format-number</code></a>
+function. This phase takes as input a number to be formatted
+(referred to as the <em>input number</em>), and the variables set
+up by analysing the decimal format in the static context and the
+<a title="picture string" class="termref" href=
+"#dt-picture-string"><span class="arrow">·</span>picture
+string<span class="arrow">·</span></a>, as described above. The
result of this phase is a string, which forms the return value of
-the <code>format-number</code> function.</p>
- <p>The algorithm for this second stage of processing is as
+the <a href="#func-format-number"><code>fn:format-number</code></a>
+function.</p>
+<p>The algorithm for this second stage of processing is as
follows:</p>
- <ol class="enumar">
- <li>
- <p>If the input number is NaN (not a number), the result is the
+<ol class="enumar">
+<li>
+<p>If the input number is NaN (not a number), the result is the
specified <var>NaN-symbol</var> (with no <var>prefix</var> or
<var>suffix</var>).</p>
- </li>
- <li>
- <p>In the rules below, the positive sub-picture and its associated
+</li>
+<li>
+<p>In the rules below, the positive sub-picture and its associated
variables are used if the input number is positive, and the
negative sub-picture and its associated variables are used
otherwise. Negative zero is taken as negative, positive zero as
positive.</p>
- </li>
- <li>
- <p>If the input number is positive or negative infinity, the result
+</li>
+<li>
+<p>If the input number is positive or negative infinity, the result
is the concatenation of the appropriate <var>prefix</var>, the
<var>infinity-symbol</var>, and the appropriate
<var>suffix</var>.</p>
- </li>
- <li>
- <p>If the sub-picture contains a <var>percent-sign</var>, the
+</li>
+<li>
+<p>If the sub-picture contains a <var>percent-sign</var>, the
number is multiplied by 100. If the sub-picture contains a
<var>per-mille-sign</var>, the number is multiplied by 1000. The
resulting number is referred to below as the <var>adjusted
number</var>.</p>
- </li>
- <li>
- <p>The <var>adjusted number</var> is converted (if necessary) to an
+</li>
+<li>
+<p>The <var>adjusted number</var> is converted (if necessary) to an
<code>xs:decimal</code> value, using an implementation of
<code>xs:decimal</code> that imposes no limits on the
<code>totalDigits</code> or <code>fractionDigits</code> facets. If
@@ -5679,14 +6138,15 @@
part. The <var>rounded number</var> is defined to be the result of
converting the <var>adjusted number</var> to an
<code>xs:decimal</code> value, as described above, and then calling
-the function <code>fn:round-half-to-even</code> with this converted
-number as the first argument and the
+the function <a href=
+"#func-round-half-to-even"><code>fn:round-half-to-even</code></a>
+with this converted number as the first argument and the
<code>maximum-fractional-part-size</code> as the second argument,
again with no limits on the <code>totalDigits</code> or
<code>fractionDigits</code> in the result.</p>
- </li>
- <li>
- <p>The absolute value of the <var>rounded number</var> is converted
+</li>
+<li>
+<p>The absolute value of the <var>rounded number</var> is converted
to a string in decimal notation, with no insignificant leading or
trailing zeroes, using the digits in the
<var>decimal-digit-family</var> to represent the ten decimal
@@ -5694,1477 +6154,1588 @@
integer part and the fractional part. (The value zero will at this
stage be represented by a <var>decimal-separator-sign</var> on its
own.)</p>
- </li>
- <li>
- <p>If the number of digits to the left of the
+</li>
+<li>
+<p>If the number of digits to the left of the
<var>decimal-separator-sign</var> is less than
<var>minimum-integer-part-size</var>, leading
<var>zero-digit-sign</var> characters are added to pad out to that
size.</p>
- </li>
- <li>
- <p>If the number of digits to the right of the
+</li>
+<li>
+<p>If the number of digits to the right of the
<var>decimal-separator-sign</var> is less than
<var>minimum-fractional-part-size</var>, trailing
<var>zero-digit-sign</var> characters are added to pad out to that
size.</p>
- </li>
- <li>
- <p>For each integer <var>N</var> in the
+</li>
+<li>
+<p>For each integer <var>N</var> in the
<var>integer-part-grouping-positions</var> list, a
<var>grouping-separator-sign</var> character is inserted into the
string immediately after that digit that appears in the integer
part of the number and has <var>N</var> digits between it and the
<var>decimal-separator-sign</var>, if there is such a digit.</p>
- </li>
- <li>
- <p>For each integer <var>N</var> in the
+</li>
+<li>
+<p>For each integer <var>N</var> in the
<var>fractional-part-grouping-positions</var> list, a
<var>grouping-separator-sign</var> character is inserted into the
string immediately before that digit that appears in the fractional
part of the number and has <var>N</var> digits between it and the
<var>decimal-separator-sign</var>, if there is such a digit.</p>
- </li>
- <li>
- <p>If there is no <var>decimal-separator-sign</var> in the
+</li>
+<li>
+<p>If there is no <var>decimal-separator-sign</var> in the
sub-picture, or if there are no digits to the right of the
<var>decimal-separator-sign</var> character in the string, then the
<var>decimal-separator-sign</var> character is removed from the
string (it will be the rightmost character in the string).</p>
- </li>
- <li>
- <p>The result of the function is the concatenation of the
+</li>
+<li>
+<p>The result of the function is the concatenation of the
appropriate <var>prefix</var>, the string conversion of the number
as obtained above, and the appropriate <var>suffix</var>.</p>
- </li>
- </ol>
- </div>
- </div>
- <div class="div2">
- <h3>
- <a name="trigonometry" id="trigonometry"/>4.7 Trigonometric
+</li>
+</ol>
+</div>
+</div>
+<div class="div2">
+<h3><a name="trigonometry" id="trigonometry"></a>4.8 Trigonometric
and exponential functions</h3>
- <p>The functions in this section perform trigonometric and other
+<p>The functions in this section perform trigonometric and other
mathematical calculations on <code>xs:double</code> values. They
are provided primarily for use in applications performing
geometrical computation, for example when generating SVG
graphics.</p>
- <p>Functions are provided to support the six most commonly used
+<p>Functions are provided to support the six most commonly used
trigonometric calculations: sine, cosine and tangent, and their
inverses arc sine, arc cosine, and arc tangent. Other functions
such as secant, cosecant, and cotangent are not provided because
they are easily computed in terms of these six.</p>
- <p>The functions in this section (with the exception of <a href="#func-pi">
- <code>fn:pi</code>
- </a>) are specified by reference to
-<a href="#ieee754-2008">[IEEE 754-2008]</a>, where they appear as
-<em>Recommended operations</em> in section 9. IEEE defines these
-functions for a variety of floating point formats; this
-specification defines them only for <code>xs:double</code> values.
-The IEEE specification applies with the following caveats:</p>
- <ol class="enumar">
- <li>
- <p>IEEE states that the preferred quantum is language-defined. In
-this specification, it is implementation-defined.</p>
- </li>
- <li>
- <p>IEEE states that certain functions should raise the inexact
+<p>The functions in this section (with the exception of <a href=
+"#func-math-pi"><code>math:pi</code></a>) are specified by
+reference to <a href="#ieee754-2008">[IEEE 754-2008]</a>, where
+they appear as <em>Recommended operations</em> in section 9. IEEE
+defines these functions for a variety of floating point formats;
+this specification defines them only for <code>xs:double</code>
+values. The IEEE specification applies with the following
+caveats:</p>
+<ol class="enumar">
+<li>
+<p>IEEE states that the preferred quantum is language-defined. In
+this specification, it is <a title="implementation-defined" class=
+"termref" href="#implementation-defined"><span class=
+"arrow">·</span>implementation-defined<span class=
+"arrow">·</span></a>.</p>
+</li>
+<li>
+<p>IEEE states that certain functions should raise the inexact
exception if the result is inexact. In this specification, this
exception if it occurs does not result in an error. Any diagnostic
information is outside the scope of this specification.</p>
- </li>
- <li>
- <p>Certain operations (such as taking the square root of a negative
+</li>
+<li>
+<p>Certain operations (such as taking the square root of a negative
number) are defined in IEEE to signal the invalid operation
exception and return a quiet NaN. In this specification, such
operations return <code>NaN</code> and do not raise an error. The
same policy applies to operations (such as taking the logarithm of
zero) that raise a divide-by-zero exception. Any diagnostic
information is outside the scope of this specification.</p>
- </li>
- <li>
- <p>Operations whose mathematical result is greater than the largest
+</li>
+<li>
+<p>Operations whose mathematical result is greater than the largest
finite <code>xs:double</code> value are defined in IEEE to signal
the overflow exception; operations whose mathematical result is
closer to zero than the smallest non-zero <code>xs:double</code>
value are similarly defined in IEEE to signal the underflow
exception. The treatment of these exceptions in this specification
-is defined in <a href="#op.numeric">
- <b>4.2 Arithmetic operators on
-numeric values</b>
- </a>.</p>
- </li>
- </ol>
- <table summary="Function/operator summary" border="1">
- <thead>
- <tr>
- <th colspan="1">Function</th>
- <th colspan="1">Meaning</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <code>math:pi</code>
- </td>
- <td>Returns an approximation to the mathematical constant
-<span style="font-family:Times; font-style:italic">Ï€</span>.</td>
- </tr>
- <tr>
- <td>
- <code>math:exp</code>
- </td>
- <td>Returns the value of <var>e</var>
- <sup>
- <var>x</var>
- </sup>.</td>
- </tr>
- <tr>
- <td>
- <code>math:exp10</code>
- </td>
- <td>Returns the value of
-<code>10</code>
- <sup>
- <var>x</var>
- </sup>.</td>
- </tr>
- <tr>
- <td>
- <code>math:log</code>
- </td>
- <td>Returns the natural logarithm of the argument.</td>
- </tr>
- <tr>
- <td>
- <code>math:log10</code>
- </td>
- <td>Returns the base-ten logarithm of the argument.</td>
- </tr>
- <tr>
- <td>
- <code>math:pow</code>
- </td>
- <td>Returns the result of raising the first argument to the power
+is defined in <a href="#op.numeric"><b>4.2 Arithmetic operators on
+numeric values</b></a>.</p>
+</li>
+</ol>
+<table summary="Function/operator summary" border="1">
+<thead>
+<tr>
+<th colspan="1">Function</th>
+<th colspan="1">Meaning</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><a href="#func-math-pi"><code>math:pi</code></a></td>
+<td>Returns an approximation to the mathematical constant
+<span style="font-family:Times; font-style:italic">π</span>.</td>
+</tr>
+<tr>
+<td><a href="#func-math-exp"><code>math:exp</code></a></td>
+<td>Returns the value of <var>e</var><sup><var>x</var></sup>.</td>
+</tr>
+<tr>
+<td><a href="#func-math-exp10"><code>math:exp10</code></a></td>
+<td>Returns the value of
+<code>10</code><sup><var>x</var></sup>.</td>
+</tr>
+<tr>
+<td><a href="#func-math-log"><code>math:log</code></a></td>
+<td>Returns the natural logarithm of the argument.</td>
+</tr>
+<tr>
+<td><a href="#func-math-log10"><code>math:log10</code></a></td>
+<td>Returns the base-ten logarithm of the argument.</td>
+</tr>
+<tr>
+<td><a href="#func-math-pow"><code>math:pow</code></a></td>
+<td>Returns the result of raising the first argument to the power
of the second.</td>
- </tr>
- <tr>
- <td>
- <code>math:sqrt</code>
- </td>
- <td>Returns the non-negative square root of the argument.</td>
- </tr>
- <tr>
- <td>
- <code>math:sin</code>
- </td>
- <td>Returns the sine of the argument, expressed in radians.</td>
- </tr>
- <tr>
- <td>
- <code>math:cos</code>
- </td>
- <td>Returns the cosine of the argument, expressed in radians.</td>
- </tr>
- <tr>
- <td>
- <code>math:tan</code>
- </td>
- <td>Returns the tangent of the argument, expressed in radians.</td>
- </tr>
- <tr>
- <td>
- <code>math:asin</code>
- </td>
- <td>Returns the arc sine of the argument, the result being in the
-range -<span style="font-family:Times; font-style:italic">Ï€</span>/2 to +<span style="font-family:Times; font-style:italic">Ï€</span>/2 radians.</td>
- </tr>
- <tr>
- <td>
- <code>math:acos</code>
- </td>
- <td>Returns the arc cosine of the argument, the result being in the
-range zero to +<span style="font-family:Times; font-style:italic">Ï€</span> radians.</td>
- </tr>
- <tr>
- <td>
- <code>math:atan</code>
- </td>
- <td>Returns the arc tangent of the argument, the result being in
-the range -<span style="font-family:Times; font-style:italic">Ï€</span>/2 to +<span style="font-family:Times; font-style:italic">Ï€</span>/2 radians.</td>
- </tr>
- <tr>
- <td>
- <code>math:atan2</code>
- </td>
- <td>Returns the angle in radians subtended at the origin by the
+</tr>
+<tr>
+<td><a href="#func-math-sqrt"><code>math:sqrt</code></a></td>
+<td>Returns the non-negative square root of the argument.</td>
+</tr>
+<tr>
+<td><a href="#func-math-sin"><code>math:sin</code></a></td>
+<td>Returns the sine of the argument, expressed in radians.</td>
+</tr>
+<tr>
+<td><a href="#func-math-cos"><code>math:cos</code></a></td>
+<td>Returns the cosine of the argument, expressed in radians.</td>
+</tr>
+<tr>
+<td><a href="#func-math-tan"><code>math:tan</code></a></td>
+<td>Returns the tangent of the argument, expressed in radians.</td>
+</tr>
+<tr>
+<td><a href="#func-math-asin"><code>math:asin</code></a></td>
+<td>Returns the arc sine of the argument, the result being in the
+range -<span style=
+"font-family:Times; font-style:italic">π</span>/2 to +<span style=
+"font-family:Times; font-style:italic">π</span>/2 radians.</td>
+</tr>
+<tr>
+<td><a href="#func-math-acos"><code>math:acos</code></a></td>
+<td>Returns the arc cosine of the argument, the result being in the
+range zero to +<span style=
+"font-family:Times; font-style:italic">π</span> radians.</td>
+</tr>
+<tr>
+<td><a href="#func-math-atan"><code>math:atan</code></a></td>
+<td>Returns the arc tangent of the argument, the result being in
+the range -<span style=
+"font-family:Times; font-style:italic">π</span>/2 to +<span style=
+"font-family:Times; font-style:italic">π</span>/2 radians.</td>
+</tr>
+<tr>
+<td><a href="#func-math-atan2"><code>math:atan2</code></a></td>
+<td>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 -<span style="font-family:Times; font-style:italic">Ï€</span> to +<span style="font-family:Times; font-style:italic">Ï€</span>.</td>
- </tr>
- </tbody>
- </table>
- <div class="div3">
- <h4>
- <a name="func-pi" id="func-pi"/>4.7.1 math:pi</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns an approximation to the mathematical constant
-<span style="font-family:Times; font-style:italic">Ï€</span>.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">math:pi</code>()<code class="as"> as </code>
- <code class="return-type">xs:double</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>This function returns the <code>xs:double</code> value whose
+the result being in the range -<span style=
+"font-family:Times; font-style:italic">π</span> to +<span style=
+"font-family:Times; font-style:italic">π</span>.</td>
+</tr>
+</tbody>
+</table>
+<div class="div3">
+<h4><a name="func-math-pi" id="func-math-pi"></a>4.8.1 math:pi</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns an approximation to the mathematical constant
+<span style="font-family:Times; font-style:italic">π</span>.</p>
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">math:pi</code>()<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:double</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>This function returns the <code>xs:double</code> value whose
lexical representation is 3.141592653589793e0</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>2*math:pi()</code> returns
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>2*math:pi()</code> returns
<code>6.283185307179586e0</code>.</p>
- <p>The expression <code>60 * (math:pi() div 180)</code> converts an
+<p>The expression <code>60 * (math:pi() div 180)</code> converts an
angle of 60 degrees to radians.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-exp" id="func-exp"/>4.7.2 math:exp</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the value of <var>e</var>
- <sup>
- <var>x</var>
- </sup>.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">math:exp</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">xs:double?</code>)<code class="as"> as </code>
- <code class="return-type">xs:double?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>If <code>$arg</code> is the empty sequence, the function returns
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-math-exp" id="func-math-exp"></a>4.8.2
+math:exp</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the value of <var>e</var><sup><var>x</var></sup>.</p>
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">math:exp</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">xs:double?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:double?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>If <code>$arg</code> is the empty sequence, the function returns
the empty sequence.</p>
- <p>Otherwise the result is the the mathematical constant
-<var>e</var> raised to the power of <code>$arg</code>, as defined
-in the <a href="#ieee754-2008">[IEEE 754-2008]</a> specification of
-the <code>exp</code> function applied to 64-bit binary floating
-point values.</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>The treatment of overflow and underflow is defined in <a href="#op.numeric">
- <b>4.2 Arithmetic operators on numeric
-values</b>
- </a>.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>math:exp(())</code> returns
+<p>Otherwise the result is the mathematical constant <var>e</var>
+raised to the power of <code>$arg</code>, as defined in the
+<a href="#ieee754-2008">[IEEE 754-2008]</a> specification of the
+<code>exp</code> function applied to 64-bit binary floating point
+values.</p>
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>The treatment of overflow and underflow is defined in <a href=
+"#op.numeric"><b>4.2 Arithmetic operators on numeric
+values</b></a>.</p>
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>math:exp(())</code> returns
<code>()</code>.</p>
- <p>The expression <code>math:exp(0)</code> returns
+<p>The expression <code>math:exp(0)</code> returns
<code>1.0e0</code>.</p>
- <p>The expression <code>math:exp(1)</code> returns
+<p>The expression <code>math:exp(1)</code> returns
<code>2.7182818284590455e0</code>.</p>
- <p>The expression <code>math:exp(2)</code> returns
+<p>The expression <code>math:exp(2)</code> returns
<code>7.38905609893065e0</code>.</p>
- <p>The expression <code>math:exp(-1)</code> returns
+<p>The expression <code>math:exp(-1)</code> returns
<code>0.36787944117144233e0</code>.</p>
- <p>The expression <code>math:exp(math:pi())</code> returns
+<p>The expression <code>math:exp(math:pi())</code> returns
<code>23.140692632779267e0</code>.</p>
- <p>The expression <code>math:exp(xs:double('NaN'))</code> returns
+<p>The expression <code>math:exp(xs:double('NaN'))</code> returns
<code>xs:double('NaN')</code>.</p>
- <p>The expression <code>math:exp(xs:double('INF'))</code> returns
+<p>The expression <code>math:exp(xs:double('INF'))</code> returns
<code>xs:double('INF')</code>.</p>
- <p>The expression <code>math:exp(xs:double('-INF'))</code> returns
+<p>The expression <code>math:exp(xs:double('-INF'))</code> returns
<code>0.0e0</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-exp10" id="func-exp10"/>4.7.3 math:exp10</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the value of <code>10</code>
- <sup>
- <var>x</var>
- </sup>.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">math:exp10</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">xs:double?</code>)<code class="as"> as </code>
- <code class="return-type">xs:double?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>If <code>$arg</code> is the empty sequence, the function returns
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-math-exp10" id="func-math-exp10"></a>4.8.3
+math:exp10</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the value of <code>10</code><sup><var>x</var></sup>.</p>
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">math:exp10</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">xs:double?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:double?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>If <code>$arg</code> is the empty sequence, the function returns
the empty sequence.</p>
- <p>Otherwise the result is ten raised to the power of
+<p>Otherwise the result is ten raised to the power of
<code>$arg</code>, as defined in the <a href="#ieee754-2008">[IEEE
754-2008]</a> specification of the <code>exp10</code> function
applied to 64-bit binary floating point values.</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>The treatment of overflow and underflow is defined in <a href="#op.numeric">
- <b>4.2 Arithmetic operators on numeric
-values</b>
- </a>.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>math:exp10(())</code> returns
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>The treatment of overflow and underflow is defined in <a href=
+"#op.numeric"><b>4.2 Arithmetic operators on numeric
+values</b></a>.</p>
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>math:exp10(())</code> returns
<code>()</code>.</p>
- <p>The expression <code>math:exp10(0)</code> returns
+<p>The expression <code>math:exp10(0)</code> returns
<code>1.0e0</code>.</p>
- <p>The expression <code>math:exp10(1)</code> returns
+<p>The expression <code>math:exp10(1)</code> returns
<code>1.0e1</code>.</p>
- <p>The expression <code>math:exp10(0.5)</code> returns
+<p>The expression <code>math:exp10(0.5)</code> returns
<code>3.1622776601683795e0</code>.</p>
- <p>The expression <code>math:exp10(-1)</code> returns
+<p>The expression <code>math:exp10(-1)</code> returns
<code>1.0e-1</code>.</p>
- <p>The expression <code>math:exp10(xs:double('NaN'))</code> returns
+<p>The expression <code>math:exp10(xs:double('NaN'))</code> returns
<code>xs:double('NaN')</code>.</p>
- <p>The expression <code>math:exp10(xs:double('INF'))</code> returns
+<p>The expression <code>math:exp10(xs:double('INF'))</code> returns
<code>xs:double('INF')</code>.</p>
- <p>The expression <code>math:exp10(xs:double('-INF'))</code>
+<p>The expression <code>math:exp10(xs:double('-INF'))</code>
returns <code>0.0e0</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-log" id="func-log"/>4.7.4 math:log</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the natural logarithm of the argument.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">math:log</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">xs:double?</code>)<code class="as"> as </code>
- <code class="return-type">xs:double?</code>
- </div>
- </div>
- </dd>
- <dt class="label">Rules</dt>
- <dd>
- <p>If <code>$arg</code> is the empty sequence, the function returns
+</dd>
+</dl>
+</div>
+<div class="div3">
+<h4><a name="func-math-log" id="func-math-log"></a>4.8.4
+math:log</h4>
+<dl>
+<dt class="label">Summary</dt>
+<dd>
+<p>Returns the natural logarithm of the argument.</p>
+</dd>
+<dt class="label">Signature</dt>
+<dd>
+<div class="exampleInner">
+<div class="proto"><code class=
+"function">math:log</code>(<code class=
+"arg">$arg</code><code class="as">&#160;as&#160;</code><code class=
+"type">xs:double?</code>)<code class=
+"as">&#160;as&#160;</code><code class=
+"return-type">xs:double?</code></div>
+</div>
+</dd>
+<dt class="label">Properties</dt>
+<dd>
+<p>This function is <a title="deterministic" class="termref" href=
+"#dt-deterministic"><span class=
+"arrow">·</span>deterministic<span class="arrow">·</span></a>,
+<a title="context-independent" class="termref" href=
+"#dt-context-independent"><span class=
+"arrow">·</span>context-independent<span class=
+"arrow">·</span></a>, and <a title="focus-dependent" class=
+"termref" href="#dt-focus-independent"><span class=
+"arrow">·</span>focus-independent<span class=
+"arrow">·</span></a>.</p>
+</dd>
+<dt class="label">Rules</dt>
+<dd>
+<p>If <code>$arg</code> is the empty sequence, the function returns
the empty sequence.</p>
- <p>Otherwise the result is the natural logarithm of
+<p>Otherwise the result is the natural logarithm of
<code>$arg</code>, as defined in the <a href="#ieee754-2008">[IEEE
754-2008]</a> specification of the <code>log</code> function
applied to 64-bit binary floating point values.</p>
- </dd>
- <dt class="label">Notes</dt>
- <dd>
- <p>The treatment of <code>divideByZero</code> and
-<code>invalidOperation</code> exceptions is defined in <a href="#op.numeric">
- <b>4.2 Arithmetic operators on numeric
-values</b>
- </a>. The effect is that if the argument is less than or
+</dd>
+<dt class="label">Notes</dt>
+<dd>
+<p>The treatment of <code>divideByZero</code> and
+<code>invalidOperation</code> exceptions is defined in <a href=
+"#op.numeric"><b>4.2 Arithmetic operators on numeric
+values</b></a>. The effect is that if the argument is less than or
equal to zero, the result is <code>NaN</code>.</p>
- </dd>
- <dt class="label">Examples</dt>
- <dd>
- <p>The expression <code>math:log(())</code> returns
+</dd>
+<dt class="label">Examples</dt>
+<dd>
+<p>The expression <code>math:log(())</code> returns
<code>()</code>.</p>
- <p>The expression <code>math:log(0)</code> returns
+<p>The expression <code>math:log(0)</code> returns
<code>xs:double('-INF')</code>.</p>
- <p>The expression <code>math:log(math:exp(1))</code> returns
+<p>The expression <code>math:log(math:exp(1))</code> returns
<code>1.0e0</code>.</p>
- <p>The expression <code>math:log(1.0e-3)</code> returns
+<p>The expression <code>math:log(1.0e-3)</code> returns
<code>-6.907755278982137e0</code>.</p>
- <p>The expression <code>math:log(2)</code> returns
+<p>The expression <code>math:log(2)</code> returns
<code>0.6931471805599453e0</code>.</p>
- <p>The expression <code>math:log(-1)</code> returns
-<code>xs:double('NaN')</code>.</p>
- <p>The expression <code>math:log(xs:double('NaN'))</code> returns
-<code>xs:double('NaN')</code>.</p>
- <p>The expression <code>math:log(xs:double('INF'))</code> returns
+<p>The expression <code>math:log(-1)</code> returns
+<code>xs:double('NaN')</code>.</p>
+<p>The expression <code>math:log(xs:double('NaN'))</code> returns
+<code>xs:double('NaN')</code>.</p>
+<p>The expression <code>math:log(xs:double('INF'))</code> returns
<code>xs:double('INF')</code>.</p>
- <p>The expression <code>math:log(xs:double('-INF'))</code> returns
+<p>The expression <code>math:log(xs:double('-INF'))</code> returns
<code>xs:double('NaN')</code>.</p>
- </dd>
- </dl>
- </div>
- <div class="div3">
- <h4>
- <a name="func-log10" id="func-log10"/>4.7.5 math:log10</h4>
- <dl>
- <dt class="label">Summary</dt>
- <dd>
- <p>Returns the base-ten logarithm of the argument.</p>
- </dd>
- <dt class="label">Signature</dt>
- <dd>
- <div class="exampleInner">
- <div class="proto">
- <code class="function">math:log10</code>(<code class="arg">$arg</code>
- <code class="as"> as </code>
- <code class="type">xs:double?</code>)<code class="as"> as </code>
- <c
Follow ups