You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34794 lines
1.4 MiB
34794 lines
1.4 MiB
<!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"></a>XPath and XQuery Functions and
|
|
Operators 3.0</h1>
|
|
<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/"><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/2011/WD-xpath-functions-30-20111213/xpath-functions-30.xml">
|
|
XML</a> and <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> © 2011 <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
|
|
use</a> rules apply.</p>
|
|
</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
|
|
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
|
|
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, 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
|
|
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#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>. 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 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/2010/REC-xpath-functions-20101214/">a
|
|
previous W3C Recommendation</a>.</p>
|
|
<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@w3.org">public-qt-comments@w3.org</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
|
|
<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
|
|
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
|
|
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">
|
|
Essential Claim(s)</a> must disclose the information in accordance
|
|
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"></a>Quick
|
|
Contents</h2>
|
|
<ul>
|
|
<li>
|
|
<p><a href="#func-abs">abs</a>  <a href=
|
|
"#func-math-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-math-asin">asin</a>  <a href=
|
|
"#func-math-atan">atan</a>  <a href=
|
|
"#func-math-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-math-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-math-exp">exp</a>  <a href=
|
|
"#func-math-exp10">exp10</a> </p>
|
|
</li>
|
|
<li>
|
|
<p><a href="#func-false">false</a>  <a href=
|
|
"#func-filter">filter</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-lookup">function-lookup</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-math-log">log</a>  <a href=
|
|
"#func-math-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-parse-xml-fragment">parse-xml-fragment</a>  <a href=
|
|
"#func-path">path</a>  <a href="#func-math-pi">pi</a> 
|
|
<a href="#func-position">position</a>  <a href=
|
|
"#func-math-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-math-sin">sin</a>  <a href=
|
|
"#func-math-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-math-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"></a>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 />
|
|
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 />
|
|
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="#parsing-numbers">Parsing
|
|
numbers</a><br />
|
|
        4.5.1 <a href=
|
|
"#func-number">fn:number</a><br />
|
|
    4.6 <a href=
|
|
"#formatting-integers">Formatting integers</a><br />
|
|
        4.6.1 <a href=
|
|
"#func-format-integer">fn:format-integer</a><br />
|
|
    4.7 <a href=
|
|
"#formatting-numbers">Formatting numbers</a><br />
|
|
        4.7.1 <a href=
|
|
"#defining-decimal-format">Defining a decimal format</a><br />
|
|
        4.7.2 <a href=
|
|
"#func-format-number">fn:format-number</a><br />
|
|
        4.7.3 <a href=
|
|
"#syntax-of-picture-string">Syntax of the picture string</a><br />
|
|
        4.7.4 <a href=
|
|
"#analysing-picture-string">Analysing the picture string</a><br />
|
|
        4.7.5 <a href=
|
|
"#formatting-the-number">Formatting the number</a><br />
|
|
    4.8 <a href="#trigonometry">Trigonometric
|
|
and exponential functions</a><br />
|
|
        4.8.1 <a href=
|
|
"#func-math-pi">math:pi</a><br />
|
|
        4.8.2 <a href=
|
|
"#func-math-exp">math:exp</a><br />
|
|
        4.8.3 <a href=
|
|
"#func-math-exp10">math:exp10</a><br />
|
|
        4.8.4 <a href=
|
|
"#func-math-log">math:log</a><br />
|
|
        4.8.5 <a href=
|
|
"#func-math-log10">math:log10</a><br />
|
|
        4.8.6 <a href=
|
|
"#func-math-pow">math:pow</a><br />
|
|
        4.8.7 <a href=
|
|
"#func-math-sqrt">math:sqrt</a><br />
|
|
        4.8.8 <a href=
|
|
"#func-math-sin">math:sin</a><br />
|
|
        4.8.9 <a href=
|
|
"#func-math-cos">math:cos</a><br />
|
|
        4.8.10 <a href=
|
|
"#func-math-tan">math:tan</a><br />
|
|
        4.8.11 <a href=
|
|
"#func-math-asin">math:asin</a><br />
|
|
        4.8.12 <a href=
|
|
"#func-math-acos">math:acos</a><br />
|
|
        4.8.13 <a href=
|
|
"#func-math-atan">math:atan</a><br />
|
|
        4.8.14 <a href=
|
|
"#func-math-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 />
|
|
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 />
|
|
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 />
|
|
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 />
|
|
|
|
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 />
|
|
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 />
|
|
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-lang">fn:lang</a><br />
|
|
    13.5 <a href=
|
|
"#func-is-same-node">op:is-same-node</a><br />
|
|
    13.6 <a href=
|
|
"#func-node-before">op:node-before</a><br />
|
|
    13.7 <a href=
|
|
"#func-node-after">op:node-after</a><br />
|
|
    13.8 <a href="#func-root">fn:root</a><br />
|
|
    13.9 <a href="#func-path">fn:path</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 />
|
|
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-parse-xml-fragment">fn:parse-xml-fragment</a><br />
|
|
        14.9.3 <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 />
|
|
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-lookup">fn:function-lookup</a><br />
|
|
        16.1.2 <a href=
|
|
"#func-function-name">fn:function-name</a><br />
|
|
        16.1.3 <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-to-string">Casting to xs:string and
|
|
xs:untypedAtomic</a><br />
|
|
        18.1.2 <a href=
|
|
"#casting-to-numerics">Casting to numeric types</a><br />
|
|
        18.1.3 <a href=
|
|
"#casting-to-durations">Casting to duration types</a><br />
|
|
        18.1.4 <a href=
|
|
"#casting-to-datetimes">Casting to date and time types</a><br />
|
|
        18.1.5 <a href=
|
|
"#casting-boolean">Casting to xs:boolean</a><br />
|
|
        18.1.6 <a href=
|
|
"#casting-to-binary">Casting to xs:base64Binary and
|
|
xs:hexBinary</a><br />
|
|
        18.1.7 <a href=
|
|
"#casting-to-anyuri">Casting to xs:anyURI</a><br />
|
|
        18.1.8 <a href=
|
|
"#casting-to-qname-and-notation">Casting to xs:QName and
|
|
xs:NOTATION</a><br />
|
|
        18.1.9 <a href=
|
|
"#casting-to-ENTITY">Casting to xs:ENTITY</a><br />
|
|
    18.2 <a href=
|
|
"#casting-from-strings">Casting from xs:string and
|
|
xs:untypedAtomic</a><br />
|
|
    18.3 <a href=
|
|
"#casting-non-primitive-types">Casting involving non-primitive
|
|
types</a><br />
|
|
        18.3.1 <a href=
|
|
"#casting-to-derived-types">Casting to derived types</a><br />
|
|
        18.3.2 <a href=
|
|
"#casting-from-derived-to-parent">Casting from derived types to
|
|
parent types</a><br />
|
|
        18.3.3 <a href=
|
|
"#casting-within-branch">Casting within a branch of the type
|
|
hierarchy</a><br />
|
|
        18.3.4 <a href=
|
|
"#casting-across-hierarchy">Casting across the type
|
|
hierarchy</a><br />
|
|
        18.3.5 <a href=
|
|
"#casting-to-union">Casting to union types</a><br />
|
|
        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 />
|
|
    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 />
|
|
C <a href="#xpath1-compatibility">Compatibility with XPath 1.0</a>
|
|
(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 />
|
|
E <a href="#impl-def">Checklist of implementation-defined
|
|
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 />
|
|
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"></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 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
|
|
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 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>
|
|
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>
|
|
adds to the data types defined in <a href="#xmlschema-2">[XML
|
|
Schema Part 2: Datatypes Second Edition]</a>. It introduces a new
|
|
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, 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
|
|
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)
|
|
3.0]</a>.</p>
|
|
<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
|
|
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
|
|
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
|
|
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
|
|
XML Schema 1.1 that introduces some new data types including
|
|
<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
|
|
provided for explanatory purposes and is not normative.</p>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="namespace-prefixes" id="namespace-prefixes"></a>1.2
|
|
Namespaces and prefixes</h3>
|
|
<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
|
|
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
|
|
(for example) to be written as <code>name()</code> rather than
|
|
<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
|
|
associated with them are:</p>
|
|
<ul>
|
|
<li>
|
|
<p><code>http://www.w3.org/2001/XMLSchema</code> for constructors
|
|
-- associated with <code>xs</code>.</p>
|
|
<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 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
|
|
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
|
|
codes.</p>
|
|
<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
|
|
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
|
|
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">fn: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"></a>1.3
|
|
Function overloading</h3>
|
|
<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
|
|
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
|
|
<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
|
|
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"></a>1.4 Function
|
|
signatures and descriptions</h3>
|
|
<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
|
|
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
|
|
by a parenthesized list of parameter declarations, each declaration
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 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 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
|
|
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 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
|
|
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
|
|
<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
|
|
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
|
|
in which the parameter is omitted. See, for example, the two
|
|
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
|
|
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"></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,
|
|
connecting lines represent relationships between derived types and
|
|
the types from which they are derived; the arrowheads point toward
|
|
the type from which they are derived. The dashed line represents
|
|
relationships not present in this diagram, but that appear in one
|
|
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
|
|
<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
|
|
"item" type hierarchy. In XDM, items include node types, function
|
|
types, and built-in atomic types.</p>
|
|
<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>
|
|
<td class="castOther" align="left" valign="middle">
|
|
xs:anyAtomicType</td>
|
|
</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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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
|
|
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>
|
|
<td class="castOther" align="left" valign="middle">user-defined
|
|
complex types</td>
|
|
</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>
|
|
<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>
|
|
<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,
|
|
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
|
|
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:untypedAtomic</td>
|
|
</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>
|
|
<td class="castOther" align="left" valign="middle">
|
|
xs:yearMonthDuration</td>
|
|
</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: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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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>
|
|
<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">
|
|
xs:gYearMonth</td>
|
|
</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>
|
|
<td class="castOther" align="left" valign="middle">
|
|
xs:normalizedString</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: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">
|
|
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>
|
|
<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"></a>1.6.1 Strings, characters, and
|
|
codepoints</h4>
|
|
<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"></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"></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
|
|
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
|
|
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="#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
|
|
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
|
|
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"></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"></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"></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
|
|
<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
|
|
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
|
|
the whole family of XML specifications. Note also that the
|
|
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"></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"></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"></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"></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"></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"></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"></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
|
|
for two function calls to return the same result:</p>
|
|
<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
|
|
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. (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"></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><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>
|
|
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>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><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
|
|
is evaluated twice with the same arguments then it will return the
|
|
same result each time (because the static context, by definition,
|
|
does not change at run time). However, two distinct calls (that is,
|
|
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
|
|
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"></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="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><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
|
|
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>
|
|
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
|
|
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
|
|
by reading external documents. Such functions are guaranteed to be
|
|
<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
|
|
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"></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"></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">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
|
|
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
|
|
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
|
|
an <code>xs:QName</code> in which the prefix and namespace URI are
|
|
<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
|
|
<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"></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"> as </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"> 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">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 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
|
|
returns false.</p>
|
|
<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"></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">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
|
|
the zero-length string.</p>
|
|
<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
|
|
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>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
|
|
<code>"false"</code>.</p>
|
|
<p>The expression <code>string("Paris")</code> returns
|
|
<code>"Paris"</code>.</p>
|
|
<p>The expression <code>string(abs#1)</code> raises error
|
|
<code>FOTY0014</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
|
|
hole in the ground there lived a hobbit."</code>.</p>
|
|
</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">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
|
|
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
|
|
sequence.</p>
|
|
</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
|
|
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>
|
|
<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>
|
|
<para>In a hole in the ground there lived a <term author="Tolkein">hobbit</term>.</para>
|
|
|
|
</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">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 <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
|
|
returns the empty sequence.</li>
|
|
<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 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
|
|
dm:base-uri accessor returns the base-uri property of a node if it
|
|
exists and is non-empty; otherwise it returns the result of
|
|
applying the dm:base-uri accessor to its parent, recursively. If
|
|
the node does not have a parent, or if the recursive ascent up the
|
|
ancestor chain encounters a parentless node whose base-uri property
|
|
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 <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
|
|
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">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>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
|
|
<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
|
|
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,
|
|
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 <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
|
|
section with the provided error code.</p>
|
|
<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.
|
|
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 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"></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">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
|
|
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
|
|
behavior is the same as the function call:</p>
|
|
<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
|
|
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
|
|
with an error:</p>
|
|
<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,
|
|
while the local part identifies the specific error condition. The
|
|
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
|
|
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
|
|
of the error condition.</p>
|
|
</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
|
|
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>
|
|
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>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.).</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> 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.).</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"></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">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
|
|
<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
|
|
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"></a>4
|
|
Functions and operators on numerics</h2>
|
|
<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"></a>4.1 Numeric
|
|
types</h3>
|
|
<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>
|
|
<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-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-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"></a>4.2 Arithmetic
|
|
operators on numeric values</h3>
|
|
<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
|
|
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
|
|
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>
|
|
which always returns an <code>xs:integer</code>.</p>
|
|
<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 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
|
|
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
|
|
<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
|
|
<code>xs:decimal</code>, <code>xs:decimal</code> can be promoted to
|
|
<code>xs:double</code>. As far as possible, the promotions should
|
|
be done in a single step. Specifically, when an
|
|
<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
|
|
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
|
|
<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
|
|
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-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-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-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
|
|
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
|
|
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>
|
|
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,
|
|
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
|
|
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 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
|
|
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
|
|
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
|
|
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"></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 +
|
|
$arg2</code>).</p>
|
|
</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
|
|
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
|
|
<code>INF</code>, <code>INF</code> is returned. If both operands
|
|
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"></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
|
|
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
|
|
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"></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
|
|
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
|
|
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"></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
|
|
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
|
|
<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>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
|
|
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 <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
|
|
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
|
|
example, the implementation-defined precision of the result of
|
|
<code>xs:decimal</code> division.</p>
|
|
</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
|
|
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>
|
|
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>
|
|
returns <code>1</code>.</p>
|
|
<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>
|
|
returns <code>-1</code>.</p>
|
|
<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>
|
|
returns <code>5</code>.</p>
|
|
<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"></a>4.2.6
|
|
op:numeric-mod</h4>
|
|
<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
|
|
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
|
|
<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
|
|
of the result is always less than the magnitude of <code>b</code>.
|
|
This identity holds even in the special case that the dividend is
|
|
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
|
|
the following rules apply:</p>
|
|
<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
|
|
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
|
|
result equals the dividend.</p>
|
|
</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
|
|
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]</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
|
|
<code>0</code>.</p>
|
|
<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>
|
|
returns <code>3.0E0</code>.</p>
|
|
</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
|
|
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
|
|
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>
|
|
<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
|
|
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>,
|
|
<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>
|
|
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,
|
|
<code>NaN</code> returns <code>NaN</code>, <code>0.0E0</code>
|
|
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"></a>4.3 Comparison
|
|
operators on numeric values</h3>
|
|
<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.
|
|
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
|
|
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
|
|
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
|
|
numerically greater than <code>$arg2</code>.</td>
|
|
</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
|
|
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,
|
|
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,
|
|
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"></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,
|
|
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,
|
|
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"></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,
|
|
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"></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
|
|
returned.</p>
|
|
</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
|
|
<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,
|
|
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,
|
|
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>
|
|
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
|
|
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"></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"> as </code><code class=
|
|
"type">numeric?</code>)<code class=
|
|
"as"> as </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
|
|
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,
|
|
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"></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">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
|
|
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,
|
|
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
|
|
<code>11</code>.</p>
|
|
<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"></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"> as </code><code class=
|
|
"type">numeric?</code>)<code class=
|
|
"as"> as </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
|
|
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,
|
|
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
|
|
<code>10</code>.</p>
|
|
<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"></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">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
|
|
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
|
|
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
|
|
<code>xs:double</code>:</p>
|
|
<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
|
|
<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
|
|
<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
|
|
<code>$arg</code>.</p>
|
|
</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 <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
|
|
<code>2.0</code>.</p>
|
|
<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>1.13</code>.</p>
|
|
<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
|
|
<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"></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">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
|
|
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
|
|
the second signature with <code>$precision=0</code>.</p>
|
|
<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,
|
|
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> <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
|
|
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-half-to-even(xs:float(150.015), 2)</code>. The result
|
|
is not 150.02 as might be expected, but 150.01. This is because the
|
|
conversion of the <code>xs:float</code> value represented by the
|
|
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
|
|
<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,
|
|
2)</code> returns <code>3567.81e0</code>.</p>
|
|
<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>
|
|
returns <code>35600</code>.</p>
|
|
</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"> as </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"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </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"></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">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
|
|
the format in which <code>$value</code> is output.</p>
|
|
<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
|
|
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>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
|
|
category Nd, having digit values 0 through 9. Within the format
|
|
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,
|
|
No, Lu, Ll, Lt, Lm or Lo.</p>
|
|
</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> <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.
|
|
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
|
|
character used as the <var>grouping-separator-sign</var> within the
|
|
format token indicates the character to be used as the
|
|
corresponding grouping separator in the formatted number. If
|
|
<var>grouping-separator-signs</var> appear at regular intervals
|
|
within the format token, that is if the same grouping separator
|
|
appears at positions forming a sequence <var>N</var>,
|
|
2<var>N</var>, 3<var>N</var>, ... for some integer value
|
|
<var>N</var> (including the case where there is only one number in
|
|
the list), then the sequence is extrapolated to the left, so
|
|
grouping separators will be used in the formatted number at every
|
|
multiple of <var>N</var>. For example, if the format token is
|
|
<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
|
|
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
|
|
number fifteen will be formatted as <code>15</code>. A grouping
|
|
separator is included in the formatted number only if there is a
|
|
digit to its left, which will only be the case if either (a) the
|
|
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
|
|
hundred will be output as <code>300</code>, despite the absence of
|
|
any <var>optional-digit-sign</var>.</p>
|
|
</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
|
|
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>
|
|
(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
|
|
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
|
|
differing conventions for how roman numerals are written (for
|
|
example, <code>IV</code> versus <code>IIII</code> as the
|
|
representation of the number 4). Sometimes alphabetic sequences are
|
|
used that omit letters such as <code>i</code> and <code>o</code>.
|
|
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
|
|
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. <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
|
|
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
|
|
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
|
|
be used to indicate the variation of the ordinal number required.
|
|
The way in which the variation is indicated will depend on the
|
|
conventions of the language. For inflected languages that vary the
|
|
ending of the word, the preferred approach is to indicate the
|
|
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
|
|
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="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>
|
|
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 <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>
|
|
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
|
|
<code>"g"</code>.</p>
|
|
<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"></a>4.7
|
|
Formatting numbers</h3>
|
|
<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
|
|
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
|
|
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"></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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
<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
|
|
(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
|
|
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
|
|
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
|
|
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
|
|
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"></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.
|
|
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"></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
|
|
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">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.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
|
|
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>, <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
|
|
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
|
|
<code>$decimal-format-name</code> argument is not a valid lexical
|
|
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
|
|
on the left.</p>
|
|
</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
|
|
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"></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
|
|
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
|
|
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
|
|
"immediately followed".</p>
|
|
<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
|
|
<var>decimal-separator-sign</var>.</p>
|
|
</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
|
|
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
|
|
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
|
|
<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>
|
|
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"></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
|
|
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
|
|
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
|
|
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
|
|
part of the sub-picture, this sequence contains an integer that is
|
|
equal to the total number of <var>optional-digit-sign</var> and
|
|
<var>decimal-digit-family</var> characters that appear within the
|
|
integer part of the sub-picture and to the right of the
|
|
<var>grouping-separator-sign</var>. In addition, if these
|
|
<var>integer-part-grouping-positions</var> are at regular intervals
|
|
(that is, if they form a sequence <var>N</var>, <var>2N</var>,
|
|
<var>3N</var>, ... for some integer value <var>N</var>, including
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
fractional part of the sub-picture, this sequence contains an
|
|
integer that is equal to the total number of
|
|
<var>optional-digit-sign</var> and <var>decimal-digit-family</var>
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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"></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 <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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
<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
|
|
there are several such values that are numerically equal to the
|
|
<var>adjusted number</var> (bearing in mind that if the
|
|
<var>adjusted number</var> is an <code>xs:double</code> or
|
|
<code>xs:float</code>, the comparison will be done by converting
|
|
the decimal value back to an <code>xs:double</code> or
|
|
<code>xs:float</code>), the one that is chosen
|
|
<strong>should</strong> be one with the smallest possible number of
|
|
digits not counting leading or trailing zeroes (whether significant
|
|
or insignificant). For example, 1.0 is preferred to 0.9999999999,
|
|
and 100000000 is preferred to 100000001. This value is then rounded
|
|
so that it uses no more than
|
|
<code>maximum-fractional-part-size</code> digits in its fractional
|
|
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 <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
|
|
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
|
|
digits, and the <var>decimal-separator-sign</var> to separate the
|
|
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
|
|
<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
|
|
<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
|
|
<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
|
|
<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
|
|
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
|
|
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"></a>4.8 Trigonometric
|
|
and exponential functions</h3>
|
|
<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
|
|
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-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
|
|
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
|
|
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><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><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-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"> as </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
|
|
<code>6.283185307179586e0</code>.</p>
|
|
<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-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"> 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">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 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
|
|
<code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:exp(1)</code> returns
|
|
<code>2.7182818284590455e0</code>.</p>
|
|
<p>The expression <code>math:exp(2)</code> returns
|
|
<code>7.38905609893065e0</code>.</p>
|
|
<p>The expression <code>math:exp(-1)</code> returns
|
|
<code>0.36787944117144233e0</code>.</p>
|
|
<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
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<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
|
|
<code>0.0e0</code>.</p>
|
|
</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"> 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">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
|
|
<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
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>math:exp10(0)</code> returns
|
|
<code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:exp10(1)</code> returns
|
|
<code>1.0e1</code>.</p>
|
|
<p>The expression <code>math:exp10(0.5)</code> returns
|
|
<code>3.1622776601683795e0</code>.</p>
|
|
<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
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<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>
|
|
returns <code>0.0e0</code>.</p>
|
|
</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"> 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">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
|
|
<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
|
|
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
|
|
<code>()</code>.</p>
|
|
<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
|
|
<code>1.0e0</code>.</p>
|
|
<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
|
|
<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
|
|
<code>xs:double('INF')</code>.</p>
|
|
<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-math-log10" id="func-math-log10"></a>4.8.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><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 base-10 logarithm of
|
|
<code>$arg</code>, as defined in the <a href="#ieee754-2008">[IEEE
|
|
754-2008]</a> specification of the <code>log10</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
|
|
equal to zero, the result is <code>NaN</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>math:log10(())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>math:log10(0)</code> returns
|
|
<code>xs:double('-INF')</code>.</p>
|
|
<p>The expression <code>math:log10(1.0e3)</code> returns
|
|
<code>3.0e0</code>.</p>
|
|
<p>The expression <code>math:log10(1.0e-3)</code> returns
|
|
<code>-3.0e0</code>.</p>
|
|
<p>The expression <code>math:log10(2)</code> returns
|
|
<code>0.3010299956639812e0</code>.</p>
|
|
<p>The expression <code>math:log10(-1)</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:log10(xs:double('NaN'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:log10(xs:double('INF'))</code> returns
|
|
<code>xs:double('INF')</code>.</p>
|
|
<p>The expression <code>math:log10(xs:double('-INF'))</code>
|
|
returns <code>xs:double('NaN')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-math-pow" id="func-math-pow"></a>4.8.6
|
|
math:pow</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the result of raising the first argument to the power of
|
|
the second.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">math:pow</code>(<code class="arg">$x</code><code class=
|
|
"as"> as </code><code class="type">xs:double?</code>,
|
|
<code class="arg">$y</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">numeric</code>)<code class=
|
|
"as"> as </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>$x</code> is the empty sequence, the function returns
|
|
the empty sequence.</p>
|
|
<p>If <code>$y</code> is an instance of <code>xs:integer</code>,
|
|
the result is <code>$x</code> raised to the power of
|
|
<code>$y</code> as defined in the <a href="#ieee754-2008">[IEEE
|
|
754-2008]</a> specification of the <code>pown</code> function
|
|
applied to a 64-bit binary floating point value and an integer.</p>
|
|
<p>Otherwise <code>$y</code> is converted to an
|
|
<code>xs:double</code> by numeric promotion, and the result is the
|
|
value of <code>$x</code> raised to the power of <code>$y</code> as
|
|
defined in the <a href="#ieee754-2008">[IEEE 754-2008]</a>
|
|
specification of the <code>pow</code> function applied to two
|
|
64-bit binary floating point values.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The treatment of the <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>. Some of the consequences are illustrated in the
|
|
examples below.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>math:pow((), 93.7)</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>math:pow(2, 3)</code> returns
|
|
<code>8.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(-2, 3)</code> returns
|
|
<code>-8.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(2, -3)</code> returns
|
|
<code>0.125e0</code>.</p>
|
|
<p>The expression <code>math:pow(-2, -3)</code> returns
|
|
<code>-0.125e0</code>.</p>
|
|
<p>The expression <code>math:pow(2, 0)</code> returns
|
|
<code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(0, 0)</code> returns
|
|
<code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(xs:double('INF'), 0)</code>
|
|
returns <code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(xs:double('NaN'), 0)</code>
|
|
returns <code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(-math:pi(), 0)</code> returns
|
|
<code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(0e0, 3)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(0e0, 4)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(-0e0, 3)</code> returns
|
|
<code>-0.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(0, 4)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(0e0, -3)</code> returns
|
|
<code>xs:double('INF')</code>.</p>
|
|
<p>The expression <code>math:pow(0e0, -4)</code> returns
|
|
<code>xs:double('INF')</code>.</p>
|
|
<p>The expression <code>math:pow(-0e0, -3)</code> returns
|
|
<code>xs:double('-INF')</code>.</p>
|
|
<p>The expression <code>math:pow(0, -4)</code> returns
|
|
<code>xs:double('INF')</code>.</p>
|
|
<p>The expression <code>math:pow(16, 0.5e0)</code> returns
|
|
<code>4.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(16, 0.25e0)</code> returns
|
|
<code>2.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(0e0, -3.0e0)</code> returns
|
|
<code>xs:double('INF')</code>.</p>
|
|
<p>The expression <code>math:pow(-0e0, -3.0e0)</code> returns
|
|
<code>xs:double('-INF')</code>. <em>(Odd-valued whole numbers are
|
|
treated specially).</em></p>
|
|
<p>The expression <code>math:pow(0e0, -3.1e0)</code> returns
|
|
<code>xs:double('INF')</code>.</p>
|
|
<p>The expression <code>math:pow(-0e0, -3.1e0)</code> returns
|
|
<code>xs:double('INF')</code>.</p>
|
|
<p>The expression <code>math:pow(0e0, 3.0e0)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(-0e0, 3.0e0)</code> returns
|
|
<code>-0.0e0</code>. <em>(Odd-valued whole numbers are treated
|
|
specially).</em></p>
|
|
<p>The expression <code>math:pow(0e0, 3.1e0)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(-0e0, 3.1e0)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(-1, xs:double('INF'))</code>
|
|
returns <code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(-1, xs:double('-INF'))</code>
|
|
returns <code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(1, xs:double('INF'))</code>
|
|
returns <code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(1, xs:double('-INF'))</code>
|
|
returns <code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(1, xs:double('NaN'))</code>
|
|
returns <code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:pow(-2.5e0, 2.0e0)</code> returns
|
|
<code>6.25e0</code>.</p>
|
|
<p>The expression <code>math:pow(-2.5e0, 2.00000001e0)</code>
|
|
returns <code>xs:double('NaN')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-math-sqrt" id="func-math-sqrt"></a>4.8.7
|
|
math:sqrt</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the non-negative square root of the argument.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">math:sqrt</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">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 mathematical non-negative square
|
|
root of <code>$arg</code> as defined in the <a href=
|
|
"#ieee754-2008">[IEEE 754-2008]</a> specification of the
|
|
<code>squareRoot</code> function applied to 64-bit binary floating
|
|
point values.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The treatment of the <code>invalidOperation</code> exception 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 zero, the result is <code>NaN</code>.</p>
|
|
<p>If <code>$arg</code> is positive or negative zero, positive
|
|
infinity, or <code>NaN</code>, then the result is
|
|
<code>$arg</code>. (Negative zero is the only case where the result
|
|
can have negative sign)</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>math:sqrt(())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>math:sqrt(0.0e0)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:sqrt(-0.0e0)</code> returns
|
|
<code>-0.0e0</code>.</p>
|
|
<p>The expression <code>math:sqrt(1.0e6)</code> returns
|
|
<code>1.0e3</code>.</p>
|
|
<p>The expression <code>math:sqrt(2.0e0)</code> returns
|
|
<code>1.4142135623730951e0</code>.</p>
|
|
<p>The expression <code>math:sqrt(-2.0e0)</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:sqrt(xs:double('NaN'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:sqrt(xs:double('INF'))</code> returns
|
|
<code>xs:double('INF')</code>.</p>
|
|
<p>The expression <code>math:sqrt(xs:double('-INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-math-sin" id="func-math-sin"></a>4.8.8
|
|
math:sin</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the sine of the argument, expressed in radians.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">math:sin</code>(<code class="arg">$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span><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">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>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span> is the empty
|
|
sequence, the function returns the empty sequence.</p>
|
|
<p>Otherwise the result is the sine of <code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span>, treated as an
|
|
angle in radians, as defined in the <a href="#ieee754-2008">[IEEE
|
|
754-2008]</a> specification of the <code>sin</code> function
|
|
applied to 64-bit binary floating point values.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The treatment of the <code>invalidOperation</code> and
|
|
<code>underflow</code> exceptions is defined in <a href=
|
|
"#op.numeric"><b>4.2 Arithmetic operators on numeric
|
|
values</b></a>.</p>
|
|
<p>If <code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span> is positive or
|
|
negative zero, the result is <code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span>.</p>
|
|
<p>If <code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span> is positive or
|
|
negative infinity, or <code>NaN</code>, then the result is
|
|
<code>NaN</code>.</p>
|
|
<p>Otherwise the result is always in the range -1.0e0 to +1.0e0</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>math:sin(())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>math:sin(0)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:sin(-0.0e0)</code> returns
|
|
<code>-0.0e0</code>.</p>
|
|
<p>The expression <code>math:sin(math:pi() div 2)</code> returns
|
|
<code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:sin(-math:pi() div 2)</code> returns
|
|
<code>-1.0e0</code>.</p>
|
|
<p>The expression <code>math:sin(math:pi())</code> returns
|
|
<code>0.0e0</code> (approximately).</p>
|
|
<p>The expression <code>math:sin(xs:double('NaN'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:sin(xs:double('INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:sin(xs:double('-INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-math-cos" id="func-math-cos"></a>4.8.9
|
|
math:cos</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the cosine of the argument, expressed in radians.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">math:cos</code>(<code class="arg">$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span><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">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>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span> is the empty
|
|
sequence, the function returns the empty sequence.</p>
|
|
<p>If <code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span> is positive or
|
|
negative infinity, or <code>NaN</code>, then the result is
|
|
<code>NaN</code>.</p>
|
|
<p>Otherwise the result is the cosine of <code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span>, treated as an
|
|
angle in radians, as defined in the <a href="#ieee754-2008">[IEEE
|
|
754-2008]</a> specification of the <code>cos</code> function
|
|
applied to 64-bit binary floating point values.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The treatment of the <code>invalidOperation</code> exception is
|
|
defined in <a href="#op.numeric"><b>4.2 Arithmetic operators on
|
|
numeric values</b></a>.</p>
|
|
<p>If <code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span> is positive or
|
|
negative zero, the result is <code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span>.</p>
|
|
<p>If <code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span> is positive or
|
|
negative infinity, or <code>NaN</code>, then the result is
|
|
<code>NaN</code>.</p>
|
|
<p>Otherwise the result is always in the range -1.0e0 to +1.0e0</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>math:cos(())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>math:cos(0)</code> returns
|
|
<code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:cos(-0.0e0)</code> returns
|
|
<code>1.0e0</code>.</p>
|
|
<p>The expression <code>math:cos(math:pi() div 2)</code> returns
|
|
<code>0.0e0</code> (approximately).</p>
|
|
<p>The expression <code>math:cos(-math:pi() div 2)</code> returns
|
|
<code>0.0e0</code> (approximately).</p>
|
|
<p>The expression <code>math:cos(math:pi())</code> returns
|
|
<code>-1.0e0</code>.</p>
|
|
<p>The expression <code>math:cos(xs:double('NaN'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:cos(xs:double('INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:cos(xs:double('-INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-math-tan" id="func-math-tan"></a>4.8.10
|
|
math:tan</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the tangent of the argument, expressed in radians.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">math:tan</code>(<code class="arg">$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span><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">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>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span> is the empty
|
|
sequence, the function returns the empty sequence.</p>
|
|
<p>Otherwise the result is the tangent of
|
|
<code>$</code><span style="font-family:Times; font-style:italic">θ</span>,
|
|
treated as an angle in radians, as defined in the <a href=
|
|
"#ieee754-2008">[IEEE 754-2008]</a> specification of the
|
|
<code>tan</code> function applied to 64-bit binary floating point
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The treatment of the <code>invalidOperation</code> and
|
|
<code>underflow</code> exceptions is defined in <a href=
|
|
"#op.numeric"><b>4.2 Arithmetic operators on numeric
|
|
values</b></a>.</p>
|
|
<p>If <code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span> is positive or
|
|
negative infinity, or <code>NaN</code>, then the result is
|
|
<code>NaN</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>math:tan(())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>math:tan(0)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:tan(-0.0e0)</code> returns
|
|
<code>-0.0e0</code>.</p>
|
|
<p>The expression <code>math:tan(math:pi() div 4)</code> returns
|
|
<code>1.0e0</code> (approximately).</p>
|
|
<p>The expression <code>math:tan(-math:pi() div 4)</code> returns
|
|
<code>-1.0e0</code> (approximately).</p>
|
|
<p>The expression <code>math:tan(math:pi() div 2)</code> returns
|
|
<code>1.633123935319537E16</code> (approximately).</p>
|
|
<p>The expression <code>math:tan(-math:pi() div 2)</code> returns
|
|
<code>-1.633123935319537E16</code> (approximately).</p>
|
|
<p>The expression <code>math:tan(math:pi())</code> returns
|
|
<code>0.0e0</code> (approximately).</p>
|
|
<p>The expression <code>math:tan(xs:double('NaN'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:tan(xs:double('INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:tan(xs:double('-INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-math-asin" id="func-math-asin"></a>4.8.11
|
|
math:asin</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>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.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">math:asin</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">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 arc sine of
|
|
<code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span>, treated as an
|
|
angle in radians, as defined in the <a href="#ieee754-2008">[IEEE
|
|
754-2008]</a> specification of the <code>asin</code> function
|
|
applied to 64-bit binary floating point values.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The treatment of the <code>invalidOperation</code> and
|
|
<code>underflow</code> exceptions is defined in <a href=
|
|
"#op.numeric"><b>4.2 Arithmetic operators on numeric
|
|
values</b></a>.</p>
|
|
<p>If <code>$arg</code> is positive or negative zero, the result is
|
|
<code>$arg</code>.</p>
|
|
<p>If <code>$arg</code> is <code>NaN</code>, or if its absolute
|
|
value is greater than one, then the result is <code>NaN</code>.</p>
|
|
<p>In other cases the result is an <code>xs:double</code> value
|
|
representing an angle <span style=
|
|
"font-family:Times; font-style:italic">θ</span> in radians in the
|
|
range -<span style=
|
|
"font-family:Times; font-style:italic">π</span><code>/2 <=
|
|
$</code><span style="font-family:Times; font-style:italic">θ</span>
|
|
<code><= +</code><span style=
|
|
"font-family:Times; font-style:italic">π</span><code>/2</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>math:asin(())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>math:asin(0)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:asin(-0.0e0)</code> returns
|
|
<code>-0.0e0</code>.</p>
|
|
<p>The expression <code>math:asin(1.0e0)</code> returns
|
|
<code>1.5707963267948966e0</code> (approximately).</p>
|
|
<p>The expression <code>math:asin(-1.0e0)</code> returns
|
|
<code>-1.5707963267948966e0</code> (approximately).</p>
|
|
<p>The expression <code>math:asin(2.0e0)</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:asin(xs:double('NaN'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:asin(xs:double('INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:asin(xs:double('-INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-math-acos" id="func-math-acos"></a>4.8.12
|
|
math:acos</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>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.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">math:acos</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">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 arc cosine of
|
|
<code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span>, treated as an
|
|
angle in radians, as defined in the <a href="#ieee754-2008">[IEEE
|
|
754-2008]</a> specification of the <code>acos</code> function
|
|
applied to 64-bit binary floating point values.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The treatment of the <code>invalidOperation</code> exception is
|
|
defined in <a href="#op.numeric"><b>4.2 Arithmetic operators on
|
|
numeric values</b></a>.</p>
|
|
<p>If <code>$arg</code> is <code>NaN</code>, or if its absolute
|
|
value is greater than one, then the result is <code>NaN</code>.</p>
|
|
<p>In other cases the result is an <code>xs:double</code> value
|
|
representing an angle <span style=
|
|
"font-family:Times; font-style:italic">θ</span> in radians in the
|
|
range <code>0 <= $</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span> <code><=
|
|
+</code><span style=
|
|
"font-family:Times; font-style:italic">π</span>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>math:acos(())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>math:acos(0)</code> returns
|
|
<code>1.5707963267948966e0</code> (approximately).</p>
|
|
<p>The expression <code>math:acos(-0.0e0)</code> returns
|
|
<code>1.5707963267948966e0</code> (approximately).</p>
|
|
<p>The expression <code>math:acos(1.0e0)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:acos(-1.0e0)</code> returns
|
|
<code>3.141592653589793e0</code> (approximately).</p>
|
|
<p>The expression <code>math:acos(2.0e0)</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:acos(xs:double('NaN'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:acos(xs:double('INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:acos(xs:double('-INF'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-math-atan" id="func-math-atan"></a>4.8.13
|
|
math:atan</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>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.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">math:atan</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">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 arc tangent of
|
|
<code>$</code><span style=
|
|
"font-family:Times; font-style:italic">θ</span>, treated as an
|
|
angle in radians, as defined in the <a href="#ieee754-2008">[IEEE
|
|
754-2008]</a> specification of the <code>atan</code> function
|
|
applied to 64-bit binary floating point values.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The treatment of the <code>underflow</code> exception is defined
|
|
in <a href="#op.numeric"><b>4.2 Arithmetic operators on numeric
|
|
values</b></a>.</p>
|
|
<p>If <code>$arg</code> is positive or negative zero, the result is
|
|
<code>$arg</code>.</p>
|
|
<p>If <code>$arg</code> is <code>NaN</code> then the result is
|
|
<code>NaN</code>.</p>
|
|
<p>In other cases the result is an <code>xs:double</code> value
|
|
representing an angle <span style=
|
|
"font-family:Times; font-style:italic">θ</span> in radians in the
|
|
range -<span style=
|
|
"font-family:Times; font-style:italic">π</span><code>/2 <=
|
|
$</code><span style="font-family:Times; font-style:italic">θ</span>
|
|
<code><= +</code><span style=
|
|
"font-family:Times; font-style:italic">π</span><code>/2</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>math:atan(())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>math:atan(0)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:atan(-0.0e0)</code> returns
|
|
<code>-0.0e0</code>.</p>
|
|
<p>The expression <code>math:atan(1.0e0)</code> returns
|
|
<code>0.7853981633974483e0</code> (approximately).</p>
|
|
<p>The expression <code>math:atan(-1.0e0)</code> returns
|
|
<code>-0.7853981633974483e0</code> (approximately).</p>
|
|
<p>The expression <code>math:atan(xs:double('NaN'))</code> returns
|
|
<code>xs:double('NaN')</code>.</p>
|
|
<p>The expression <code>math:atan(xs:double('INF'))</code> returns
|
|
<code>1.5707963267948966e0</code> (approximately).</p>
|
|
<p>The expression <code>math:atan(xs:double('-INF'))</code> returns
|
|
<code>-1.5707963267948966e0</code> (approximately).</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-math-atan2" id="func-math-atan2"></a>4.8.14
|
|
math:atan2</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the angle in radians subtended at the origin by the
|
|
point on a plane with coordinates (x, y) and the positive x-axis,
|
|
the result being in the range -<span style=
|
|
"font-family:Times; font-style:italic">π</span> to +<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:atan2</code>(<code class=
|
|
"arg">$y</code><code class="as"> as </code><code class=
|
|
"type">xs:double</code>, <code class="arg">$x</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">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 result is the value of <code>atan2(y, x)</code> as defined
|
|
in the <a href="#ieee754-2008">[IEEE 754-2008]</a> specification of
|
|
the <code>atan2</code> function applied to 64-bit binary floating
|
|
point values.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The treatment of the <code>underflow</code> exception is defined
|
|
in <a href="#op.numeric"><b>4.2 Arithmetic operators on numeric
|
|
values</b></a>.</p>
|
|
<p>If <code>$arg</code> is <code>NaN</code> then the result is
|
|
<code>NaN</code>.</p>
|
|
<p>If <code>$y</code> is positive and <code>$x</code> is positive
|
|
and finite, then (subject to rules for overflow, underflow and
|
|
approximation) the value of <code>atan2($y, $x)</code> is
|
|
<code>atan($y div $x)</code>.</p>
|
|
<p>If <code>$y</code> is positive and <code>$x</code> is negative
|
|
and finite, then (subject to the same caveats) the value of
|
|
<code>atan2($y, $x)</code> is <span style=
|
|
"font-family:Times; font-style:italic">π</span> <code>- atan($y div
|
|
$x)</code>.</p>
|
|
<p>Some results for special values of the arguments are shown in
|
|
the examples below.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>math:atan2(+0.0e0, 0.0e0)</code> returns
|
|
<code>0.0e0</code>.</p>
|
|
<p>The expression <code>math:atan2(-0.0e0, 0.0e0)</code> returns
|
|
<code>-0.0e0</code>.</p>
|
|
<p>The expression <code>math:atan2(+0.0e0, -0.0e0)</code> returns
|
|
<a href="#func-math-pi"><code>math:pi()</code></a>.</p>
|
|
<p>The expression <code>math:atan2(-0.0e0, -0.0e0)</code> returns
|
|
<code>-math:pi()</code>.</p>
|
|
<p>The expression <code>math:atan2(-1, 0.0e0)</code> returns
|
|
<code>-math:pi() div 2</code>.</p>
|
|
<p>The expression <code>math:atan2(+1, 0.0e0)</code> returns
|
|
<code>+math:pi() div 2</code>.</p>
|
|
<p>The expression <code>math:atan2(-0.0e0, -1)</code> returns
|
|
<code>-math:pi()</code>.</p>
|
|
<p>The expression <code>math:atan2(+0.0e0, -1)</code> returns
|
|
<code>+math:pi()</code>.</p>
|
|
<p>The expression <code>math:atan2(-0.0e0, +1)</code> returns
|
|
<code>-0.0e0</code>.</p>
|
|
<p>The expression <code>math:atan2(+0.0e0, +1)</code> returns
|
|
<code>+0.0e0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="string-functions" id="string-functions"></a>5
|
|
Functions on strings</h2>
|
|
<p>This section specifies functions and operators on the <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
<code>xs:string</code> datatype and the datatypes derived from
|
|
it.</p>
|
|
<div class="div2">
|
|
<h3><a name="string-types" id="string-types"></a>5.1 String
|
|
types</h3>
|
|
<p>The operators described in this section are defined on the
|
|
following 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="Type summary" border="0">
|
|
<tbody>
|
|
<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>
|
|
<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>
|
|
</tbody>
|
|
</table>
|
|
<p>They also apply to user-defined types derived by restriction
|
|
from the above types.</p>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-assemble-disassemble-string" id=
|
|
"func-assemble-disassemble-string"></a>5.2 Functions to assemble
|
|
and disassemble strings</h3>
|
|
<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-codepoints-to-string"><code>fn:codepoints-to-string</code></a></td>
|
|
<td>Creates an <code>xs:string</code> from a sequence of <a title=
|
|
"codepoint" class="termref" href="#codepoint"><span class=
|
|
"arrow">·</span>codepoints<span class="arrow">·</span></a>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-string-to-codepoints"><code>fn:string-to-codepoints</code></a></td>
|
|
<td>Returns the sequence of <a title="codepoint" class="termref"
|
|
href="#codepoint"><span class=
|
|
"arrow">·</span>codepoints<span class="arrow">·</span></a> that
|
|
constitute an <code>xs:string</code> value.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-codepoints-to-string" id=
|
|
"func-codepoints-to-string"></a>5.2.1 fn:codepoints-to-string</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Creates an <code>xs:string</code> from a sequence of <a title=
|
|
"codepoint" class="termref" href="#codepoint"><span class=
|
|
"arrow">·</span>codepoints<span class="arrow">·</span></a>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:codepoints-to-string</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">xs:string</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 string made up from the <a title=
|
|
"character" class="termref" href="#character"><span class=
|
|
"arrow">·</span>characters<span class="arrow">·</span></a> whose
|
|
Unicode <a title="codepoint" class="termref" href=
|
|
"#codepoint"><span class="arrow">·</span>codepoints<span class=
|
|
"arrow">·</span></a> are supplied in <code>$arg</code>. This will
|
|
be the zero-length string if <code>$arg</code> is the empty
|
|
sequence.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFOCH0001" title=
|
|
"err:FOCH0001">err:FOCH0001</a>] if any of the codepoints in
|
|
<code>$arg</code> is not a permitted XML character.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:codepoints-to-string((66, 65, 67,
|
|
72))</code> returns <code>"BACH"</code>.</p>
|
|
<p>The expression <code>fn:codepoints-to-string((2309, 2358, 2378,
|
|
2325))</code> returns <code>"अशॊक"</code>.</p>
|
|
<p>The expression <code>fn:codepoints-to-string(())</code> returns
|
|
<code>""</code>.</p>
|
|
<p>The expression <code>fn:codepoints-to-string(0)</code> raises
|
|
error <code>FOCH0001</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-string-to-codepoints" id=
|
|
"func-string-to-codepoints"></a>5.2.2 fn:string-to-codepoints</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the sequence of <a title="codepoint" class="termref"
|
|
href="#codepoint"><span class=
|
|
"arrow">·</span>codepoints<span class="arrow">·</span></a> that
|
|
constitute an <code>xs:string</code> value.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:string-to-codepoints</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer*</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 a sequence of integers, each integer being
|
|
the Unicode <a title="codepoint" class="termref" href=
|
|
"#codepoint"><span class="arrow">·</span>codepoints<span class=
|
|
"arrow">·</span></a> of the corresponding <a title="character"
|
|
class="termref" href="#character"><span class=
|
|
"arrow">·</span>character<span class="arrow">·</span></a> in
|
|
<code>$arg</code>.</p>
|
|
<p>If <code>$arg</code> is a zero-length string or the empty
|
|
sequence, the function returns the empty sequence.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:string-to-codepoints("Thérèse")</code>
|
|
returns <code>(84, 104, 233, 114, 232, 115, 101)</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="string-compare" id="string-compare"></a>5.3 Comparison
|
|
of strings</h3>
|
|
<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-compare"><code>fn:compare</code></a></td>
|
|
<td>Returns -1, 0, or 1, depending on whether
|
|
<code>$comparand1</code> collates before, equal to, or after
|
|
<code>$comparand2</code> according to the rules of a selected
|
|
collation.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-codepoint-equal"><code>fn:codepoint-equal</code></a></td>
|
|
<td>Returns true if two strings are equal, considered
|
|
codepoint-by-codepoint.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="collations" id="collations"></a>5.3.1 Collations</h4>
|
|
<p>A collation is a specification of the manner in which <a title=
|
|
"string" class="termref" href="#string"><span class=
|
|
"arrow">·</span>strings<span class="arrow">·</span></a>s are
|
|
compared and, by extension, ordered. When values whose type is
|
|
<code>xs:string</code> or a type derived from
|
|
<code>xs:string</code> are compared (or, equivalently, sorted), the
|
|
comparisons are inherently performed according to some collation
|
|
(even if that collation is defined entirely on codepoint values).
|
|
The <a href="#charmod">[Character Model for the World Wide Web 1.0:
|
|
Fundamentals]</a> observes that some applications may require
|
|
different comparison and ordering behaviors than other
|
|
applications. Similarly, some users having particular linguistic
|
|
expectations may require different behaviors than other users.
|
|
Consequently, the collation must be taken into account when
|
|
comparing strings in any context. Several functions in this and the
|
|
following section make use of a collation.</p>
|
|
<p>Collations can indicate that two different codepoints are, in
|
|
fact, equal for comparison purposes (e.g., "v" and "w" are
|
|
considered equivalent in some Swedish collations). Strings can be
|
|
compared codepoint-by-codepoint or in a linguistically appropriate
|
|
manner, as defined by the collation.</p>
|
|
<p>Some collations, especially those based on the <a href=
|
|
"#Unicode-Collations">[Unicode Collation Algorithm]</a> can be
|
|
"tailored" for various purposes. This document does not discuss
|
|
such tailoring, nor does it provide a mechanism to perform
|
|
tailoring. Instead, it assumes that the collation argument to the
|
|
various functions below is a tailored and named collation.</p>
|
|
<p>The <a title="Unicode codepoint collation" class="termref" href=
|
|
"#dt-codepoint-collation"><span class="arrow">·</span>Unicode
|
|
codepoint collation<span class="arrow">·</span></a> is a collation
|
|
available in every implementation, which sorts based on codepoint
|
|
values. For further details see <a href=
|
|
"#codepoint-collation"><b>5.3.2 The Unicode Codepoint
|
|
Collation</b></a></p>
|
|
<p>In the ideal case, a collation should treat two strings as equal
|
|
if the two strings are identical after Unicode normalization. Thus,
|
|
the <a href="#charmod-normalization">[Character Model for the World
|
|
Wide Web 1.0: Normalization]</a> recommends that all strings be
|
|
subjected to early Unicode normalization and some collations will
|
|
raise runtime errors if they encounter strings that are not
|
|
properly normalized. However, it is not possible to guarantee that
|
|
all strings in all XML documents are, in fact, normalized, or that
|
|
they are normalized in the same manner. In order to maximize
|
|
interoperability of operations on XML documents in general, there
|
|
may be collations that operate on unnormalized strings and other
|
|
collations that implicitly normalize strings before comparing them.
|
|
Applications may choose the kind of collation best suited for their
|
|
needs. Note that collations based on the Unicode collation
|
|
algorithm implicitly normalize strings before comparison and
|
|
produce equivalent results regardless of a string's
|
|
normalization.</p>
|
|
<p>This specification assumes that collations are named and that
|
|
the collation name may be provided as an argument to string
|
|
functions. Functions that allow specification of a collation do so
|
|
with an argument whose type is <code>xs:string</code> but whose
|
|
lexical form must conform to an <code>xs:anyURI</code>. If the
|
|
collation is specified using a relative URI, it is assumed to be
|
|
relative to the value of the <span>Dynamic Base URI property from
|
|
the dynamic context</span>. This specification also defines the
|
|
manner in which a default collation is determined if the collation
|
|
argument is not specified in calls of functions that use a
|
|
collation but allow it to be omitted.</p>
|
|
<p>This specification does not define whether or not the collation
|
|
URI is dereferenced. The collation URI may be an abstract
|
|
identifier, or it may refer to an actual resource describing the
|
|
collation. If it refers to a resource, this specification does not
|
|
define the nature of that resource. One possible candidate is that
|
|
the resource is a locale description expressed using the Locale
|
|
Data Markup Language: see <a href="#LDML">[Locale Data Markup
|
|
Language]</a>.</p>
|
|
<p>Functions such as <a href=
|
|
"#func-compare"><code>fn:compare</code></a> and <a href=
|
|
"#func-max"><code>fn:max</code></a> that compare
|
|
<code>xs:string</code> values use a single collation URI to
|
|
identify all aspects of the collation rules. This means that any
|
|
parameters such as the strength of the collation must be specified
|
|
as part of the collation URI. For example, suppose there is a
|
|
collation " <code>http://www.example.com/collations/French</code> "
|
|
that refers to a French collation that compares on the basis of
|
|
base characters. Collations that use the same basic rules, but with
|
|
higher strengths, for example, base characters and accents, or base
|
|
characters, accents and case, would need to be given different
|
|
names, say " <code>http://www.example.com/collations/French1</code>
|
|
" and " <code>http://www.example.com/collations/French2</code> ".
|
|
Note that some specifications use the term collation to refer to an
|
|
algorithm that can be parameterized, but in this specification,
|
|
each possible parameterization is considered to be a distinct
|
|
collation.</p>
|
|
<p>The XQuery/XPath static context includes a provision for a
|
|
default collation that can be used for string comparisons and
|
|
ordering operations. See the description of the static context in
|
|
<a href="http://www.w3.org/TR/xpath-30/#static_context">Section
|
|
2.1.1 Static Context</a> <sup><small>XP30</small></sup>. If the
|
|
default collation is not specified by the user or the system, the
|
|
default collation is the <a title="Unicode codepoint collation"
|
|
class="termref" href="#dt-codepoint-collation"><span class=
|
|
"arrow">·</span>Unicode codepoint collation<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>XML allows elements to specify the <code>xml:lang</code>
|
|
attribute to indicate the language associated with the content of
|
|
such an element. This specification does not use
|
|
<code>xml:lang</code> to identify the default collation because
|
|
using <code>xml:lang</code> does not produce desired effects when
|
|
the two strings to be compared have different <code>xml:lang</code>
|
|
values or when a string is multilingual.</p>
|
|
</div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="codepoint-collation" id=
|
|
"codepoint-collation"></a>5.3.2 The Unicode Codepoint
|
|
Collation</h4>
|
|
<p><span class="termdef"><a name="dt-codepoint-collation" id=
|
|
"dt-codepoint-collation"></a>[Definition] The collation URI
|
|
<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>
|
|
identifies a collation which must be recognized by every
|
|
implementation: it is referred to as the <b>Unicode codepoint
|
|
collation</b> (not to be confused with the Unicode collation
|
|
algorithm).</span></p>
|
|
<p>The Unicode codepoint collation does not perform any
|
|
normalization on the supplied strings.</p>
|
|
<p>The collation is defined as follows. Each of the two strings is
|
|
converted to a sequence of integers using the <a href=
|
|
"#func-string-to-codepoints"><code>fn:string-to-codepoints</code></a>
|
|
function. These two sequences <code>$A</code> and <code>$B</code>
|
|
are then compared as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If both sequences are empty, the strings are equal</p>
|
|
</li>
|
|
<li>
|
|
<p>If one sequence is empty and the other is not, then the string
|
|
corresponding to the empty sequence is less than the other
|
|
string.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the first integer in <code>$A</code> is less than the first
|
|
integer in <code>$B</code>, then the string corresponding to
|
|
<code>$A</code> is less than the string corresponding to
|
|
<code>$B</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the first integer in <code>$A</code> is greater than the
|
|
first integer in <code>$B</code>, then the string corresponding to
|
|
<code>$A</code> is greater than the string corresponding to
|
|
<code>$B</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Otherwise (the first pair of integers are equal), the result is
|
|
obtained by applying the same rules recursively to <a href=
|
|
"#func-subsequence"><code>fn:subsequence($A, 2)</code></a> and
|
|
<a href="#func-subsequence"><code>fn:subsequence($B,
|
|
2)</code></a></p>
|
|
</li>
|
|
</ul>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>While the Unicode codepoint collation does not produce results
|
|
suitable for quality publishing of printed indexes or directories,
|
|
it is adequate for many purposes where a restricted alphabet is
|
|
used, such as sorting of vehicle registrations.</p>
|
|
</div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="choosing-a-collation" id=
|
|
"choosing-a-collation"></a>5.3.3 Choosing a collation</h4>
|
|
<p>Many functions have two signatures, where one signature includes
|
|
a <code>$collation</code> argument and the other omits this
|
|
argument.</p>
|
|
<p>The collation to use for these functions is determined by the
|
|
following rules:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>If the function specifies an explicit collation, CollationA
|
|
(e.g., if the optional collation argument is specified in a call of
|
|
the <a href="#func-compare"><code>fn:compare</code></a> function),
|
|
then:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If CollationA is supported by the implementation, then
|
|
CollationA is used.</p>
|
|
</li>
|
|
<li>
|
|
<p>Otherwise, an error is raised [<a href="#ERRFOCH0002" title=
|
|
"err:FOCH0002">err:FOCH0002</a>].</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>If no collation is explicitly specified for the function and the
|
|
default collation in the XQuery/XPath static context is CollationB,
|
|
then:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If CollationB is supported by the implementation, then
|
|
CollationB is used.</p>
|
|
</li>
|
|
<li>
|
|
<p>Otherwise, an error is raised [<a href="#ERRFOCH0002" title=
|
|
"err:FOCH0002">err:FOCH0002</a>].</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ol>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>Because the set of collations that are supported is <a title=
|
|
"implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>, an implementation has the option to support
|
|
all collation URIs, in which case it will never raise this
|
|
error.</p>
|
|
</div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-compare" id="func-compare"></a>5.3.4
|
|
fn:compare</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns -1, 0, or 1, depending on whether
|
|
<code>$comparand1</code> collates before, equal to, or after
|
|
<code>$comparand2</code> according to the rules of a selected
|
|
collation.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:compare</code>(<code class=
|
|
"arg">$comparand1</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$comparand2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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:compare</code>(</td>
|
|
<td valign="baseline"><code class="arg">$comparand1</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">$comparand2</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">$collation</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:integer?</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>Returns -1, 0, or 1, depending on whether the value of the
|
|
<code>$comparand1</code> is respectively less than, equal to, or
|
|
greater than the value of <code>$comparand2</code>, according to
|
|
the rules of the collation that is used.</p>
|
|
<p>The collation used by this function is determined according to
|
|
the rules in <a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>.</p>
|
|
<p>If either <code>$comparand1</code> or <code>$comparand2</code>
|
|
is the empty sequence, the function returns the empty sequence.</p>
|
|
<p>This function, called with the first signature, defines the
|
|
semantics of the "eq", "ne", "gt", "lt", "le" and "ge" operators on
|
|
<code>xs:string</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:compare('abc', 'abc')</code> returns
|
|
<code>0</code>.</p>
|
|
<p>The expression <code>fn:compare('Strasse', 'Straße')</code>
|
|
returns <code>0</code>. <em>(Assuming the default collation
|
|
includes provisions that equate "ss" and the (German) character "ß"
|
|
("sharp-s"). Otherwise, the returned value depends on the semantics
|
|
of the default collation.).</em></p>
|
|
<p>The expression <code>fn:compare('Strasse', 'Straße',
|
|
'http://example.com/deutsch')</code> returns <code>0</code>.
|
|
<em>(Assuming the collation identified by the URI
|
|
<code>http://example.com/deutsch</code> includes provisions that
|
|
equate "ss" and the (German) character "ß" ("sharp-s"). Otherwise,
|
|
the returned value depends on the semantics of that
|
|
collation.).</em></p>
|
|
<p>The expression <code>fn:compare('Strassen', 'Straße')</code>
|
|
returns <code>1</code>. <em>(Assuming the default collation
|
|
includes provisions that treat differences between "ss" and the
|
|
(German) character "ß" ("sharp-s") with less strength than the
|
|
differences between the base characters, such as the final "n".
|
|
).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-codepoint-equal" id=
|
|
"func-codepoint-equal"></a>5.3.5 fn:codepoint-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if two strings are equal, considered
|
|
codepoint-by-codepoint.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:codepoint-equal</code>(</td>
|
|
<td valign="baseline"><code class="arg">$comparand1</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">$comparand2</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:boolean?</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 either argument is the empty sequence, the function returns
|
|
the empty sequence.</p>
|
|
<p>Otherwise, the function returns <code>true</code> or
|
|
<code>false</code> depending on whether the value of
|
|
<code>$comparand1</code> is equal to the value of
|
|
<code>$comparand2</code>, according to the Unicode codepoint
|
|
collation
|
|
(<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>This function allows <code>xs:anyURI</code> values to be
|
|
compared without having to specify the Unicode codepoint
|
|
collation.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:codepoint-equal("abcd", "abcd")</code>
|
|
returns <code>true()</code>.</p>
|
|
<p>The expression <code>fn:codepoint-equal("abcd", "abcd ")</code>
|
|
returns <code>false()</code>.</p>
|
|
<p>The expression <code>fn:codepoint-equal("", "")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:codepoint-equal("", ())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>fn:codepoint-equal((), ())</code> returns
|
|
<code>()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="string-value-functions" id=
|
|
"string-value-functions"></a>5.4 Functions on string values</h3>
|
|
<p>The following functions are defined on values of type
|
|
<code>xs:string</code> and types derived from it.</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-concat"><code>fn:concat</code></a></td>
|
|
<td>Returns the concatenation of the string values of the
|
|
arguments.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-string-join"><code>fn:string-join</code></a></td>
|
|
<td>Returns a string created by concatenating the items in a
|
|
sequence, with a defined separator between adjacent items.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-substring"><code>fn:substring</code></a></td>
|
|
<td>Returns the portion of the value of <code>$sourceString</code>
|
|
beginning at the position indicated by the value of
|
|
<code>$start</code> and continuing for the number of <a title=
|
|
"character" class="termref" href="#character"><span class=
|
|
"arrow">·</span>characters<span class="arrow">·</span></a>
|
|
indicated by the value of <code>$length</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-string-length"><code>fn:string-length</code></a></td>
|
|
<td>Returns the number of <a title="character" class="termref"
|
|
href="#character"><span class=
|
|
"arrow">·</span>characters<span class="arrow">·</span></a> in a
|
|
string.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-normalize-space"><code>fn:normalize-space</code></a></td>
|
|
<td>Returns the value of <code>$arg</code> with leading and
|
|
trailing whitespace removed, and sequences of internal whitespace
|
|
reduced to a single space character.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-normalize-unicode"><code>fn:normalize-unicode</code></a></td>
|
|
<td>Returns the value of <code>$arg</code> after applying Unicode
|
|
normalization.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-upper-case"><code>fn:upper-case</code></a></td>
|
|
<td>Converts a string to upper case.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-lower-case"><code>fn:lower-case</code></a></td>
|
|
<td>Converts a string to lower case.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-translate"><code>fn:translate</code></a></td>
|
|
<td>Returns the value of <code>$arg</code> modified by replacing or
|
|
removing individual characters.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="note">
|
|
<p class="prefix"><b>Notes:</b></p>
|
|
<p>When the above operators and functions are applied to datatypes
|
|
derived from <code>xs:string</code>, they are guaranteed to return
|
|
values that are instances of <code>xs:string</code>, but the value
|
|
might or might not be an instance of the particular subtype of
|
|
<code>xs:string</code> to which they were applied.</p>
|
|
<p>The strings returned by <a href=
|
|
"#func-concat"><code>fn:concat</code></a> and <a href=
|
|
"#func-string-join"><code>fn:string-join</code></a> are not
|
|
guaranteed to be normalized. But see note in <a href=
|
|
"#func-concat"><code>fn:concat</code></a>.</p>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-concat" id="func-concat"></a>5.4.1 fn:concat</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the concatenation of the string values of the
|
|
arguments.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>The two-argument form of this function defines the semantics of
|
|
the "||" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<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:concat</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><span class="varargs">...</span></td>
|
|
<td valign="baseline">)<code class=
|
|
"as"> as </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>This function accepts two or more <code>xs:anyAtomicType</code>
|
|
arguments and casts each one to <code>xs:string</code>. The
|
|
function returns the <code>xs:string</code> that is the
|
|
concatenation of the values of its arguments after conversion. If
|
|
any argument is the empty sequence, that argument is treated as the
|
|
zero-length string.</p>
|
|
<p>The <code>fn:concat</code> function is specified to allow two or
|
|
more arguments, which are concatenated together. This is the only
|
|
function specified in this document that allows a variable number
|
|
of arguments. This capability is retained for compatibility with
|
|
<a href="#xpath">[XML Path Language (XPath) Version 1.0]</a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>As mentioned in <a href="#string-types"><b>5.1 String
|
|
types</b></a> Unicode normalization is not automatically applied to
|
|
the result of <code>fn:concat</code>. If a normalized result is
|
|
required, <a href=
|
|
"#func-normalize-unicode"><code>fn:normalize-unicode</code></a> can
|
|
be applied to the <code>xs:string</code> returned by
|
|
<code>fn:concat</code>. The following XQuery:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
let $v1 := "I plan to go to Mu"
|
|
let $v2 := "?nchen in September"
|
|
return concat($v1, $v2)
|
|
</pre></div>
|
|
<p>where the "?" represents either the actual Unicode character
|
|
COMBINING DIARESIS (Unicode codepoint U+0308) or "&#x0308;",
|
|
will return:</p>
|
|
<p>"I plan to go to Mu?nchen in September"</p>
|
|
<p>where the "?" represents either the actual Unicode character
|
|
COMBINING DIARESIS (Unicode codepoint U+0308) or "&#x0308;". It
|
|
is worth noting that the returned value is not normalized in NFC;
|
|
however, it is normalized in NFD. .</p>
|
|
<p>However, the following XQuery:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
let $v1 := "I plan to go to Mu"
|
|
let $v2 := "?nchen in September"
|
|
return normalize-unicode(concat($v1, $v2))
|
|
</pre></div>
|
|
<p>where the "?" represents either the actual Unicode character
|
|
COMBINING DIARESIS (Unicode codepoint U+0308) or "&#x0308;",
|
|
will return:</p>
|
|
<p>"I plan to go to München in September"</p>
|
|
<p>This returned result is normalized in NFC.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:concat('un', 'grateful')</code> returns
|
|
<code>"ungrateful"</code>.</p>
|
|
<p>The expression <code>fn:concat('Thy ', (), 'old ', "groans", "",
|
|
' ring', ' yet', ' in', ' my', ' ancient',' ears.')</code> returns
|
|
<code>"Thy old groans ring yet in my ancient ears."</code>.</p>
|
|
<p>The expression <code>fn:concat('Ciao!',())</code> returns
|
|
<code>"Ciao!"</code>.</p>
|
|
<p>The expression <code>fn:concat('Ingratitude, ', 'thou ',
|
|
'marble-hearted', ' fiend!')</code> returns <code>"Ingratitude,
|
|
thou marble-hearted fiend!"</code>.</p>
|
|
<p>The expression <code>fn:concat(01, 02, 03, 04, true())</code>
|
|
returns <code>"1234true"</code>.</p>
|
|
<p>The expression <code>10 || '/' || 6</code> returns
|
|
<code>"10/6"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-string-join" id="func-string-join"></a>5.4.2
|
|
fn:string-join</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a string created by concatenating the items in a
|
|
sequence, with a defined separator between adjacent items.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:string-join</code>(<code class=
|
|
"arg">$arg1</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"><code class=
|
|
"function">fn:string-join</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:string*</code>,
|
|
<code class="arg">$arg2</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>
|
|
</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 effect of calling the single-argument version of this
|
|
function is the same as calling the two-argument version with
|
|
<code>$arg2</code> set to a zero-length string.</p>
|
|
<p>The function returns an <code>xs:string</code> created by
|
|
concatenating the items in the sequence <code>$arg1</code>, in
|
|
order, using the value of <code>$arg2</code> as a separator between
|
|
adjacent items. If the value of <code>$arg2</code> is the
|
|
zero-length string, then the members of <code>$arg1</code> are
|
|
concatenated without a separator.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If the value of <code>$arg1</code> is the empty sequence, the
|
|
function returns the zero-length string.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:string-join(('Now', 'is', 'the', 'time',
|
|
'...'), ' ')</code> returns <code>"Now is the time ..."</code>.</p>
|
|
<p>The expression <code>fn:string-join(('Blow, ', 'blow, ', 'thou
|
|
', 'winter ', 'wind!'), '')</code> returns <code>"Blow, blow, thou
|
|
winter wind!"</code>.</p>
|
|
<p>The expression <code>fn:string-join((), 'separator')</code>
|
|
returns <code>""</code>.</p>
|
|
<p>Assume a document:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<doc>
|
|
<chap>
|
|
<section/>
|
|
</chap>
|
|
</doc>
|
|
</pre></div>
|
|
<p>with the <code><section></code> element as the context
|
|
node, the <a href="#xpath20">[XML Path Language (XPath) 2.0]</a>
|
|
expression:</p>
|
|
<p><code>fn:string-join(ancestor-or-self::*/name(), '/')</code></p>
|
|
<p>returns <code>"doc/chap/section"</code></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-substring" id="func-substring"></a>5.4.3
|
|
fn:substring</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the portion of the value of <code>$sourceString</code>
|
|
beginning at the position indicated by the value of
|
|
<code>$start</code> and continuing for the number of <a title=
|
|
"character" class="termref" href="#character"><span class=
|
|
"arrow">·</span>characters<span class="arrow">·</span></a>
|
|
indicated by the value of <code>$length</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:substring</code>(<code class=
|
|
"arg">$sourceString</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$start</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:double</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:substring</code>(</td>
|
|
<td valign="baseline"><code class="arg">$sourceString</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">$start</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:double</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$length</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:double</code>)<code class=
|
|
"as"> as </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 the value of <code>$sourceString</code> is the empty
|
|
sequence, the function returns the zero-length string.</p>
|
|
<p>Otherwise, the function returns a string comprising those
|
|
<a title="character" class="termref" href="#character"><span class=
|
|
"arrow">·</span>characters<span class="arrow">·</span></a> of
|
|
<code>$sourceString</code> whose index position (counting from one)
|
|
is greater than or equal to the value of <code>$start</code>
|
|
(rounded to an integer), and (if <code>$length</code> is specified)
|
|
less than the sum of <code>$start</code> and <code>$length</code>
|
|
(both rounded to integers).</p>
|
|
<p>The characters returned do not extend beyond
|
|
<code>$sourceString</code>. If <code>$start</code> is zero or
|
|
negative, only those characters in positions greater than zero are
|
|
returned.</p>
|
|
<p>More specifically, the three argument version of the function
|
|
returns the characters in <code>$sourceString</code> whose position
|
|
<code>$p</code> satisfies:</p>
|
|
<p><a href="#func-round"><code>fn:round($start) <= $p <
|
|
fn:round($start) + fn:round($length)</code></a></p>
|
|
<p>The two argument version of the function assumes that
|
|
<code>$length</code> is infinite and thus returns the <a title=
|
|
"character" class="termref" href="#character"><span class=
|
|
"arrow">·</span>characters<span class="arrow">·</span></a> in
|
|
<code>$sourceString</code> whose position <code>$p</code>
|
|
satisfies:</p>
|
|
<p><a href="#func-round"><code>fn:round($start) <=
|
|
$p</code></a></p>
|
|
<p>In the above computations, the rules for <a href=
|
|
"#func-numeric-less-than"><code>op:numeric-less-than</code></a> and
|
|
<a href=
|
|
"#func-numeric-greater-than"><code>op:numeric-greater-than</code></a>
|
|
apply.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The first character of a string is located at position 1, not
|
|
position 0.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:substring("motor car", 6)</code> returns
|
|
<code>" car"</code>. <em>(Characters starting at position 6 to the
|
|
end of <code>$sourceString</code> are selected.).</em></p>
|
|
<p>The expression <code>fn:substring("metadata", 4, 3)</code>
|
|
returns <code>"ada"</code>. <em>(Characters at positions greater
|
|
than or equal to 4 and less than 7 are selected.).</em></p>
|
|
<p>The expression <code>fn:substring("12345", 1.5, 2.6)</code>
|
|
returns <code>"234"</code>. <em>(Characters at positions greater
|
|
than or equal to 2 and less than 5 are selected.).</em></p>
|
|
<p>The expression <code>fn:substring("12345", 0, 3)</code> returns
|
|
<code>"12"</code>. <em>(Characters at positions greater than or
|
|
equal to 0 and less than 3 are selected. Since the first position
|
|
is 1, these are the characters at positions 1 and 2.).</em></p>
|
|
<p>The expression <code>fn:substring("12345", 5, -3)</code> returns
|
|
<code>""</code>. <em>(Characters at positions greater than or equal
|
|
to 5 and less than 2 are selected.).</em></p>
|
|
<p>The expression <code>fn:substring("12345", -3, 5)</code> returns
|
|
<code>"1"</code>. <em>(Characters at positions greater than or
|
|
equal to -3 and less than 2 are selected. Since the first position
|
|
is 1, this is the character at position 1.).</em></p>
|
|
<p>The expression <code>fn:substring("12345", 0 div 0E0, 3)</code>
|
|
returns <code>""</code>. <em>(Since <code>0 div 0E0</code> returns
|
|
<code>NaN</code>, and <code>NaN</code> compared to any other number
|
|
returns <code>false</code>, no characters are selected.).</em></p>
|
|
<p>The expression <code>fn:substring("12345", 1, 0 div 0E0)</code>
|
|
returns <code>""</code>. <em>(As above.).</em></p>
|
|
<p>The expression <code>fn:substring((), 1, 3)</code> returns
|
|
<code>""</code>.</p>
|
|
<p>The expression <code>fn:substring("12345", -42, 1 div
|
|
0E0)</code> returns <code>"12345"</code>. <em>(Characters at
|
|
positions greater than or equal to -42 and less than
|
|
<code>INF</code> are selected.).</em></p>
|
|
<p>The expression <code>fn:substring("12345", -1 div 0E0, 1 div
|
|
0E0)</code> returns <code>""</code>. <em>(Since the value of
|
|
<code>-INF + INF</code> is <code>NaN</code>, no characters are
|
|
selected.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-string-length" id="func-string-length"></a>5.4.4
|
|
fn:string-length</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the number of <a title="character" class="termref" href=
|
|
"#character"><span class="arrow">·</span>characters<span class=
|
|
"arrow">·</span></a> in a string.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:string-length</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer</code></div>
|
|
</div>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:string-length</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer</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 function returns an <code>xs:integer</code> equal to the
|
|
length in <a title="character" class="termref" href=
|
|
"#character"><span class="arrow">·</span>characters<span class=
|
|
"arrow">·</span></a> of the value of <code>$arg</code>.</p>
|
|
<p>Calling the zero-argument version of the function is equivalent
|
|
to calling <code>fn:string-length(fn:string(.))</code>.</p>
|
|
<p>If the value of <code>$arg</code> is the empty sequence, the
|
|
function returns the <code>xs:integer</code> value zero (0).</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>If <code>$arg</code> is not specified and the context item is
|
|
<a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>,
|
|
an error is raised: [<a href=
|
|
"http://www.w3.org/TR/xpath20/#ERRXPDY0002" title=
|
|
"err:XPDY0002">err:XPDY0002</a>]<sup><small>XP</small></sup>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Unlike some programming languages, a <a title="codepoint" class=
|
|
"termref" href="#codepoint"><span class=
|
|
"arrow">·</span>codepoint<span class="arrow">·</span></a> greater
|
|
than 65535 counts as one character, not two.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:string-length("Harp not on that string,
|
|
madam; that is past.")</code> returns <code>45</code>.</p>
|
|
<p>The expression <code>fn:string-length(())</code> returns
|
|
<code>0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-normalize-space" id=
|
|
"func-normalize-space"></a>5.4.5 fn:normalize-space</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the value of <code>$arg</code> with leading and trailing
|
|
whitespace removed, and sequences of internal whitespace reduced to
|
|
a single space character.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:normalize-space</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:normalize-space</code>(<code class=
|
|
"arg">$arg</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>
|
|
</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 value of <code>$arg</code> is the empty sequence, the
|
|
function returns the zero-length string.</p>
|
|
<p>The function returns a string constructed by stripping leading
|
|
and trailing whitespace from the value of <code>$arg</code>, and
|
|
replacing sequences of one or more adjacent whitespace characters
|
|
with a single space, <code>#x20</code>.</p>
|
|
<p>The whitespace characters are defined in the metasymbol S
|
|
(Production 3) of <a href="#REC-xml">[REC-xml]</a>.</p>
|
|
<p>If no argument is supplied, then <code>$arg</code> defaults to
|
|
the string value (calculated using <a href=
|
|
"#func-string"><code>fn:string</code></a>) of the context item
|
|
(<code>.</code>).</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>If no argument is supplied and the context item is <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>
|
|
then an error is raised: [<a href=
|
|
"http://www.w3.org/TR/xpath20/#ERRXPDY0002" title=
|
|
"err:XPDY0002">err:XPDY0002</a>]<sup><small>XP</small></sup>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The definition of whitespace is unchanged in <a href=
|
|
"#xml11">[Extensible Markup Language (XML) 1.1
|
|
Recommendation]</a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:normalize-space(" The    wealthy curled darlings
|
|
                                        of    our    nation. ")</code>
|
|
returns <code>"The wealthy curled darlings of our
|
|
nation."</code>.</p>
|
|
<p>The expression <code>fn:normalize-space(())</code> returns
|
|
<code>""</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-normalize-unicode" id=
|
|
"func-normalize-unicode"></a>5.4.6 fn:normalize-unicode</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the value of <code>$arg</code> after applying Unicode
|
|
normalization.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:normalize-unicode</code>(<code class=
|
|
"arg">$arg</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="2"><code class=
|
|
"function">fn:normalize-unicode</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg</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">$normalizationForm</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">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 the value of <code>$arg</code> is the empty sequence, the
|
|
function returns the zero-length string.</p>
|
|
<p>If the single-argument version of the function is used, the
|
|
result is the same as calling the two-argument version with
|
|
<code>$normalizationForm</code> set to the string "NFC".</p>
|
|
<p>Otherwise, the function returns the value of <code>$arg</code>
|
|
normalized according to the rules of the normalization form
|
|
identified by the value of <code>$normalizationForm</code>.</p>
|
|
<p>The effective value of <code>$normalizationForm</code> is the
|
|
value of the expression <a href=
|
|
"#func-upper-case"><code>fn:upper-case(fn:normalize-space($normalizationForm))</code></a>.</p>
|
|
<ul>
|
|
<li>
|
|
<p>If the effective value of <code>$normalizationForm</code> is
|
|
"NFC", then the function returns the value of <code>$arg</code>
|
|
converted to Unicode Normalization Form C (NFC).</p>
|
|
</li>
|
|
<li>
|
|
<p>If the effective value of <code>$normalizationForm</code> is
|
|
"NFD", then the function returns the value of <code>$arg</code>
|
|
converted to Unicode Normalization Form D (NFD).</p>
|
|
</li>
|
|
<li>
|
|
<p>If the effective value of <code>$normalizationForm</code> is
|
|
"NFKC", then the function returns the value of <code>$arg</code> in
|
|
Unicode Normalization Form KC (NFKC).</p>
|
|
</li>
|
|
<li>
|
|
<p>If the effective value of <code>$normalizationForm</code> is
|
|
"NFKD", then the function returns the value of <code>$arg</code>
|
|
converted to Unicode Normalization Form KD (NFKD).</p>
|
|
</li>
|
|
<li>
|
|
<p>If the effective value of <code>$normalizationForm</code> is
|
|
"FULLY-NORMALIZED", then the function returns the value of
|
|
<code>$arg</code> converted to fully normalized form.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the effective value of <code>$normalizationForm</code> is the
|
|
zero-length string, no normalization is performed and
|
|
<code>$arg</code> is returned.</p>
|
|
</li>
|
|
</ul>
|
|
<p>Normalization forms NFC, NFD, NFKC, and NFKD, and the algorithms
|
|
to be used for converting a string to each of these forms, are
|
|
defined in <a href="#Unicode-Normalization">[Unicode Normaliation
|
|
Forms]</a>.</p>
|
|
<p>The motivation for normalization form FULLY-NORMALIZED is
|
|
explained in <a href="#charmod-normalization">[Character Model for
|
|
the World Wide Web 1.0: Normalization]</a>. However, as that
|
|
specification did not progress beyond working draft status, the
|
|
normative specification is as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>A string is <b>fully-normalized</b> if (a) it is in
|
|
normalization form NFC as defined in <a href=
|
|
"#Unicode-Normalization">[Unicode Normaliation Forms]</a>, and (b)
|
|
it does not start with a composing character.</p>
|
|
</li>
|
|
<li>
|
|
<p>A composing character is a character that is one or both of the
|
|
following:</p>
|
|
<ul>
|
|
<li>
|
|
<p>the second character in the canonical decomposition mapping of
|
|
some character that is not listed in the Composition Exclusion
|
|
Table defined in <a href="#Unicode-Normalization">[Unicode
|
|
Normaliation Forms]</a>;</p>
|
|
</li>
|
|
<li>
|
|
<p>of non-zero canonical combining class (as defined in <a href=
|
|
"#Unicode">[The Unicode Standard]</a>).</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>A string is converted to FULLY-NORMALIZED form as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>if the first character in the string is a composing character,
|
|
prepend a single space (x20);</p>
|
|
</li>
|
|
<li>
|
|
<p>convert the resulting string to normalization form NFC.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<p>Conforming implementations <strong>must</strong> support
|
|
normalization form "NFC" and <strong>may</strong> support
|
|
normalization forms "NFD", "NFKC", "NFKD", and "FULLY-NORMALIZED".
|
|
They <strong>may</strong> also support other normalization forms
|
|
with <a title="implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> semantics.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFOCH0003" title=
|
|
"err:FOCH0003">err:FOCH0003</a>] if the effective value of the
|
|
<code>$normalizationForm</code> argument is not one of the values
|
|
supported by the implementation.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-upper-case" id="func-upper-case"></a>5.4.7
|
|
fn:upper-case</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Converts a string to upper case.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:upper-case</code>(<code class=
|
|
"arg">$arg</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>
|
|
</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 the value of <code>$arg</code> is the empty sequence, the
|
|
zero-length string is returned.</p>
|
|
<p>Otherwise, the function returns the value of <code>$arg</code>
|
|
after translating every <a title="character" class="termref" href=
|
|
"#character"><span class="arrow">·</span>character<span class=
|
|
"arrow">·</span></a> to its upper-case correspondent as defined in
|
|
the appropriate case mappings section in the Unicode standard
|
|
<a href="#Unicode">[The Unicode Standard]</a>. For versions of
|
|
Unicode beginning with the 2.1.8 update, only locale-insensitive
|
|
case mappings should be applied. Beginning with version 3.2.0 (and
|
|
likely future versions) of Unicode, precise mappings are described
|
|
in default case operations, which are full case mappings in the
|
|
absence of tailoring for particular languages and environments.
|
|
Every lower-case character that does not have an upper-case
|
|
correspondent, as well as every upper-case character, is included
|
|
in the returned value in its original form.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Case mappings may change the length of a string. In general, the
|
|
<code>fn:upper-case</code> and <a href=
|
|
"#func-lower-case"><code>fn:lower-case</code></a> functions are not
|
|
inverses of each other: <a href=
|
|
"#func-lower-case"><code>fn:lower-case(fn:upper-case($arg))</code></a>
|
|
is not guaranteed to return <code>$arg</code>, nor is
|
|
<code>fn:upper-case(fn:lower-case($arg))</code>. The Latin small
|
|
letter dotless i (as used in Turkish) is perhaps the most prominent
|
|
lower-case letter which will not round-trip. The Latin capital
|
|
letter i with dot above is the most prominent upper-case letter
|
|
which will not round trip; there are others, such as Latin capital
|
|
letter Sharp S (#1E9E) which is introduced in Unicode 5.1.</p>
|
|
<p>These functions may not always be linguistically appropriate
|
|
(e.g. Turkish i without dot) or appropriate for the application
|
|
(e.g. titlecase). In cases such as Turkish, a simple translation
|
|
should be used first.</p>
|
|
<p>Because the function is not sensitive to locale, results will
|
|
not always match user expectations. In Quebec, for example, the
|
|
standard uppercase equivalent of "è" is "È", while in metropolitan
|
|
France it is more commonly "E"; only one of these is supported by
|
|
the functions as defined.</p>
|
|
<p>Many characters of class Ll lack uppercase equivalents in the
|
|
Unicode case mapping tables; many characters of class Lu lack
|
|
lowercase equivalents.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:upper-case("abCd0")</code> returns
|
|
<code>"ABCD0"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-lower-case" id="func-lower-case"></a>5.4.8
|
|
fn:lower-case</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Converts a string to lower case.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:lower-case</code>(<code class=
|
|
"arg">$arg</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>
|
|
</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 the value of <code>$arg</code> is the empty sequence, the
|
|
zero-length string is returned.</p>
|
|
<p>Otherwise, the function returns the value of <code>$arg</code>
|
|
after translating every <a title="character" class="termref" href=
|
|
"#character"><span class="arrow">·</span>character<span class=
|
|
"arrow">·</span></a> to its lower-case correspondent as defined in
|
|
the appropriate case mappings section in the Unicode standard
|
|
<a href="#Unicode">[The Unicode Standard]</a>. For versions of
|
|
Unicode beginning with the 2.1.8 update, only locale-insensitive
|
|
case mappings should be applied. Beginning with version 3.2.0 (and
|
|
likely future versions) of Unicode, precise mappings are described
|
|
in default case operations, which are full case mappings in the
|
|
absence of tailoring for particular languages and environments.
|
|
Every upper-case character that does not have a lower-case
|
|
correspondent, as well as every lower-case character, is included
|
|
in the returned value in its original form.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Case mappings may change the length of a string. In general, the
|
|
<a href="#func-upper-case"><code>fn:upper-case</code></a> and
|
|
<code>fn:lower-case</code> functions are not inverses of each
|
|
other: <code>fn:lower-case(fn:upper-case($arg))</code> is not
|
|
guaranteed to return <code>$arg</code>, nor is <a href=
|
|
"#func-upper-case"><code>fn:upper-case(fn:lower-case($arg))</code></a>.
|
|
The Latin small letter dotless i (as used in Turkish) is perhaps
|
|
the most prominent lower-case letter which will not round-trip. The
|
|
Latin capital letter i with dot above is the most prominent
|
|
upper-case letter which will not round trip; there are others, such
|
|
as Latin capital letter Sharp S (#1E9E) which is introduced in
|
|
Unicode 5.1.</p>
|
|
<p>These functions may not always be linguistically appropriate
|
|
(e.g. Turkish i without dot) or appropriate for the application
|
|
(e.g. titlecase). In cases such as Turkish, a simple translation
|
|
should be used first.</p>
|
|
<p>Because the function is not sensitive to locale, results will
|
|
not always match user expectations. In Quebec, for example, the
|
|
standard uppercase equivalent of "è" is "È", while in metropolitan
|
|
France it is more commonly "E"; only one of these is supported by
|
|
the functions as defined.</p>
|
|
<p>Many characters of class Ll lack uppercase equivalents in the
|
|
Unicode case mapping tables; many characters of class Lu lack
|
|
lowercase equivalents.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:lower-case("ABc!D")</code> returns
|
|
<code>"abc!d"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-translate" id="func-translate"></a>5.4.9
|
|
fn:translate</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the value of <code>$arg</code> modified by replacing or
|
|
removing individual characters.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<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:translate</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg</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">$mapString</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">$transString</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">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 the value of <code>$arg</code> is the empty sequence, the
|
|
function returns the zero-length string.</p>
|
|
<p>Otherwise, the function returns a result string constructed by
|
|
processing each <a title="character" class="termref" href=
|
|
"#character"><span class="arrow">·</span>character<span class=
|
|
"arrow">·</span></a> in the value of <code>$arg</code>, in order,
|
|
according to the following rules:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>If the character does not appear in the value of
|
|
<code>$mapString</code> then it is added to the result string
|
|
unchanged.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the character first appears in the value of
|
|
<code>$mapString</code> at some position <em>M</em>, where the
|
|
value of <code>$transString</code> is <em>M</em> or more characters
|
|
in length, then the character at position <em>M</em> in
|
|
<code>$transString</code> is added to the result string.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the character first appears in the value of
|
|
<code>$mapString</code> at some position <em>M</em>, where the
|
|
value of <code>$transString</code> is less than <em>M</em>
|
|
characters in length, then the character is omitted from the result
|
|
string.</p>
|
|
</li>
|
|
</ol>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If <code>$mapString</code> is the zero-length string then the
|
|
function returns <code>$arg</code> unchanged.</p>
|
|
<p>If a character occurs more than once in <code>$mapString</code>,
|
|
then the first occurrence determines the action taken.</p>
|
|
<p>If <code>$transString</code> is longer than
|
|
<code>$mapString</code>, the excess characters are ignored.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:translate("bar","abc","ABC")</code>
|
|
returns <code>"BAr"</code>.</p>
|
|
<p>The expression <code>fn:translate("--aaa--","abc-","ABC")</code>
|
|
returns <code>"AAA"</code>.</p>
|
|
<p>The expression <code>fn:translate("abcdabc", "abc", "AB")</code>
|
|
returns <code>"ABdAB"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="substring.functions" id="substring.functions"></a>5.5
|
|
Functions based on substring matching</h3>
|
|
<p>The functions described in the section examine a string
|
|
<code>$arg1</code> to see whether it contains another string
|
|
<code>$arg2</code> as a substring. The result depends on whether
|
|
<code>$arg2</code> is a substring of <code>$arg1</code>, and if so,
|
|
on the range of <a title="character" class="termref" href=
|
|
"#character"><span class="arrow">·</span>characters<span class=
|
|
"arrow">·</span></a> in <code>$arg1</code> which <code>$arg2</code>
|
|
matches.</p>
|
|
<p>When the <a title="Unicode codepoint collation" class="termref"
|
|
href="#dt-codepoint-collation"><span class="arrow">·</span>Unicode
|
|
codepoint collation<span class="arrow">·</span></a> is used, this
|
|
simply involves determining whether <code>$arg1</code> contains a
|
|
contiguous sequence of characters whose <a title="codepoint" class=
|
|
"termref" href="#codepoint"><span class=
|
|
"arrow">·</span>codepoints<span class="arrow">·</span></a> are the
|
|
same, one for one, with the codepoints of the characters in
|
|
<code>$arg2</code>.</p>
|
|
<p>When a collation is specified, the rules are more complex.</p>
|
|
<p>All collations support the capability of deciding whether two
|
|
<a title="string" class="termref" href="#string"><span class=
|
|
"arrow">·</span>strings<span class="arrow">·</span></a> are
|
|
considered equal, and if not, which of the strings should be
|
|
regarded as preceding the other. For functions such as <a href=
|
|
"#func-compare"><code>fn:compare</code></a>, this is all that is
|
|
required. For other functions, such as <a href=
|
|
"#func-contains"><code>fn:contains</code></a>, the collation needs
|
|
to support an additional property: it must be able to decompose the
|
|
string into a sequence of collation units, each unit consisting of
|
|
one or more characters, such that two strings can be compared by
|
|
pairwise comparison of these units. ("collation unit" is equivalent
|
|
to "collation element" as defined in <a href=
|
|
"#Unicode-Collations">[Unicode Collation Algorithm]</a>.) The
|
|
string <code>$arg1</code> is then considered to contain
|
|
<code>$arg2</code> as a substring if the sequence of collation
|
|
units corresponding to <code>$arg2</code> is a subsequence of the
|
|
sequence of the collation units corresponding to
|
|
<code>$arg1</code>. The characters in <code>$arg1</code> that match
|
|
are the characters corresponding to these collation units.</p>
|
|
<p>This rule may occasionally lead to surprises. For example,
|
|
consider a collation that treats "Jaeger" and "Jäger" as equal. It
|
|
might do this by treating "ä" as representing two collation units,
|
|
in which case the expression <a href=
|
|
"#func-contains"><code>fn:contains("Jäger", "eg")</code></a> will
|
|
return <code>true</code>. Alternatively, a collation might treat
|
|
"ae" as a single collation unit, in which case the expression
|
|
<a href="#func-contains"><code>fn:contains("Jaeger",
|
|
"eg")</code></a> will return <code>false</code>. The results of
|
|
these functions thus depend strongly on the properties of the
|
|
collation that is used.</p>
|
|
<p>In addition, collations may specify that some collation units
|
|
should be ignored during matching. If hyphen is an ignored
|
|
collation unit, then <a href=
|
|
"#func-contains"><code>fn:contains("code-point",
|
|
"codepoint")</code></a> will be true, and <a href=
|
|
"#func-contains"><code>fn:contains("codepoint", "-")</code></a>
|
|
will also be true.</p>
|
|
<p>In the definitions below, we refer to the terms <b>match</b> and
|
|
<b>minimal match</b> as defined in definitions DS2 and DS4 of
|
|
<a href="#Unicode-Collations">[Unicode Collation Algorithm]</a>. In
|
|
applying these definitions:</p>
|
|
<ul>
|
|
<li>
|
|
<p><var>C</var> is the collation; that is, the value of the
|
|
<code>$collation</code> argument if specified, otherwise the
|
|
default collation.</p>
|
|
</li>
|
|
<li>
|
|
<p><var>P</var> is the (candidate) substring <code>$arg2</code></p>
|
|
</li>
|
|
<li>
|
|
<p><var>Q</var> is the (candidate) containing string
|
|
<code>$arg1</code></p>
|
|
</li>
|
|
<li>
|
|
<p>The boundary condition <var>B</var> is satisfied at the start
|
|
and end of a string, and between any two characters that belong to
|
|
different collation units ("collation elements" in the language of
|
|
<a href="#Unicode-Collations">[Unicode Collation Algorithm]</a>).
|
|
It is not satisfied between two characters that belong to the same
|
|
collation unit.</p>
|
|
</li>
|
|
</ul>
|
|
<p>It is possible to define collations that do not have the ability
|
|
to decompose a string into units suitable for substring matching.
|
|
An argument to a function defined in this section may be a URI that
|
|
identifies a collation that is able to compare two strings, but
|
|
that does not have the capability to split the string into
|
|
collation units. Such a collation may cause the function to fail,
|
|
or to give unexpected results or it may be rejected as an
|
|
unsuitable argument. The ability to decompose strings into
|
|
collation units is an <a title="implementation-defined" class=
|
|
"termref" href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> property of the collation.</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-contains"><code>fn:contains</code></a></td>
|
|
<td>Returns true if the string <code>$arg1</code> contains
|
|
<code>$arg2</code> as a substring, taking collations into
|
|
account.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-starts-with"><code>fn:starts-with</code></a></td>
|
|
<td>Returns true if the string <code>$arg1</code> contains
|
|
<code>$arg2</code> as a leading substring, taking collations into
|
|
account.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-ends-with"><code>fn:ends-with</code></a></td>
|
|
<td>Returns true if the string <code>$arg1</code> contains
|
|
<code>$arg2</code> as a trailing substring, taking collations into
|
|
account.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-substring-before"><code>fn:substring-before</code></a></td>
|
|
<td>Returns the part of <code>$arg1</code> that precedes the first
|
|
occurrence of <code>$arg2</code>, taking collations into
|
|
account.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-substring-after"><code>fn:substring-after</code></a></td>
|
|
<td>Returns the part of <code>$arg1</code> that follows the first
|
|
occurrence of <code>$arg2</code>, taking collations into
|
|
account.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-contains" id="func-contains"></a>5.5.1
|
|
fn:contains</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the string <code>$arg1</code> contains
|
|
<code>$arg2</code> as a substring, taking collations into
|
|
account.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:contains</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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:contains</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</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">$arg2</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">$collation</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:boolean</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If the value of <code>$arg1</code> or <code>$arg2</code> is the
|
|
empty sequence, or contains only ignorable collation units, it is
|
|
interpreted as the zero-length string.</p>
|
|
<p>If the value of <code>$arg2</code> is the zero-length string,
|
|
then the function returns <code>true</code>.</p>
|
|
<p>If the value of <code>$arg1</code> is the zero-length string,
|
|
the function returns <code>false</code>.</p>
|
|
<p>The collation used by this function is determined according to
|
|
the rules in <a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>.</p>
|
|
<p>The function returns an <code>xs:boolean</code> indicating
|
|
whether or not the value of <code>$arg1</code> contains (at the
|
|
beginning, at the end, or anywhere within) at least one sequence of
|
|
collation units that provides a <b>minimal match</b> to the
|
|
collation units in the value of <code>$arg2</code>, according to
|
|
the collation that is used.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p><b>Minimal match</b> is defined in <a href=
|
|
"#Unicode-Collations">[Unicode Collation Algorithm]</a>.</p>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error <strong>may</strong> be raised [<a href="#ERRFOCH0004"
|
|
title="err:FOCH0004">err:FOCH0004</a>] if the specified collation
|
|
does not support collation units.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The collation used in these examples,
|
|
<code>http://example.com/CollationA</code> is a collation in which
|
|
both "-" and "*" are ignorable collation units.</p>
|
|
<p>"Ignorable collation unit" is equivalent to "ignorable collation
|
|
element" in <a href="#Unicode-Collations">[Unicode Collation
|
|
Algorithm]</a>.</p>
|
|
<p>The expression <code>fn:contains ( "tattoo", "t")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:contains ( "tattoo", "ttt")</code>
|
|
returns <code>false()</code>.</p>
|
|
<p>The expression <code>fn:contains ( "", ())</code> returns
|
|
<code>true()</code>. <em>(The first rule is applied, followed by
|
|
the second rule.).</em></p>
|
|
<p>The expression <code>fn:contains ( "abcdefghi", "-d-e-f-",
|
|
"http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:contains ( "a*b*c*d*e*f*g*h*i*",
|
|
"d-ef-", "http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:contains ( "abcd***e---f*--*ghi", "def",
|
|
"http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:contains ( (), "--***-*---",
|
|
"http://example.com/CollationA")</code> returns
|
|
<code>true()</code>. <em>(The second argument contains only
|
|
ignorable collation units and is equivalent to the zero-length
|
|
string.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-starts-with" id="func-starts-with"></a>5.5.2
|
|
fn:starts-with</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the string <code>$arg1</code> contains
|
|
<code>$arg2</code> as a leading substring, taking collations into
|
|
account.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:starts-with</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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:starts-with</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</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">$arg2</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">$collation</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:boolean</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If the value of <code>$arg1</code> or <code>$arg2</code> is the
|
|
empty sequence, or contains only ignorable collation units, it is
|
|
interpreted as the zero-length string.</p>
|
|
<p>If the value of <code>$arg2</code> is the zero-length string,
|
|
then the function returns <code>true</code>. If the value of
|
|
<code>$arg1</code> is the zero-length string and the value of
|
|
<code>$arg2</code> is not the zero-length string, then the function
|
|
returns <code>false</code>.</p>
|
|
<p>The collation used by this function is determined according to
|
|
the rules in <a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>.</p>
|
|
<p>The function returns an <code>xs:boolean</code> indicating
|
|
whether or not the value of <code>$arg1</code> starts with a
|
|
sequence of collation units that provides a <b>match</b> to the
|
|
collation units of <code>$arg2</code> according to the collation
|
|
that is used.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p><b>Match</b> is defined in <a href=
|
|
"#Unicode-Collations">[Unicode Collation Algorithm]</a>.</p>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error <strong>may</strong> be raised [<a href="#ERRFOCH0004"
|
|
title="err:FOCH0004">err:FOCH0004</a>] if the specified collation
|
|
does not support collation units.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The collation used in these examples,
|
|
<code>http://example.com/CollationA</code> is a collation in which
|
|
both "-" and "*" are ignorable collation units.</p>
|
|
<p>"Ignorable collation unit" is equivalent to "ignorable collation
|
|
element" in <a href="#Unicode-Collations">[Unicode Collation
|
|
Algorithm]</a>.</p>
|
|
<p>The expression <code>fn:starts-with("tattoo", "tat")</code>
|
|
returns <code>true()</code>.</p>
|
|
<p>The expression <code>fn:starts-with ( "tattoo", "att")</code>
|
|
returns <code>false()</code>.</p>
|
|
<p>The expression <code>fn:starts-with ((), ())</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:starts-with ( "abcdefghi", "-a-b-c-",
|
|
"http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:starts-with ( "a*b*c*d*e*f*g*h*i*",
|
|
"a-bc-", "http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:starts-with ( "abcd***e---f*--*ghi",
|
|
"abcdef", "http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:starts-with ( (), "--***-*---",
|
|
"http://example.com/CollationA")</code> returns
|
|
<code>true()</code>. <em>(The second argument contains only
|
|
ignorable collation units and is equivalent to the zero-length
|
|
string.).</em></p>
|
|
<p>The expression <code>fn:starts-with ( "-abcdefghi", "-abc",
|
|
"http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-ends-with" id="func-ends-with"></a>5.5.3
|
|
fn:ends-with</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the string <code>$arg1</code> contains
|
|
<code>$arg2</code> as a trailing substring, taking collations into
|
|
account.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:ends-with</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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:ends-with</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</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">$arg2</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">$collation</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:boolean</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If the value of <code>$arg1</code> or <code>$arg2</code> is the
|
|
empty sequence, or contains only ignorable collation units, it is
|
|
interpreted as the zero-length string.</p>
|
|
<p>If the value of <code>$arg2</code> is the zero-length string,
|
|
then the function returns <code>true</code>. If the value of
|
|
<code>$arg1</code> is the zero-length string and the value of
|
|
<code>$arg2</code> is not the zero-length string, then the function
|
|
returns <code>false</code>.</p>
|
|
<p>The collation used by this function is determined according to
|
|
the rules in <a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>.</p>
|
|
<p>The function returns an <code>xs:boolean</code> indicating
|
|
whether or not the value of <code>$arg1</code> starts with a
|
|
sequence of collation units that provides a <b>match</b> to the
|
|
collation units of <code>$arg2</code> according to the collation
|
|
that is used.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p><b>Match</b> is defined in <a href=
|
|
"#Unicode-Collations">[Unicode Collation Algorithm]</a>.</p>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error <strong>may</strong> be raised [<a href="#ERRFOCH0004"
|
|
title="err:FOCH0004">err:FOCH0004</a>] if the specified collation
|
|
does not support collation units.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The collation used in these examples,
|
|
<code>http://example.com/CollationA</code> is a collation in which
|
|
both "-" and "*" are ignorable collation units.</p>
|
|
<p>"Ignorable collation unit" is equivalent to "ignorable collation
|
|
element" in <a href="#Unicode-Collations">[Unicode Collation
|
|
Algorithm]</a>.</p>
|
|
<p>The expression <code>fn:ends-with ( "tattoo", "tattoo")</code>
|
|
returns <code>true()</code>.</p>
|
|
<p>The expression <code>fn:ends-with ( "tattoo", "atto")</code>
|
|
returns <code>false()</code>.</p>
|
|
<p>The expression <code>fn:ends-with ((), ())</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:ends-with ( "abcdefghi", "-g-h-i-",
|
|
"http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:ends-with ( "abcd***e---f*--*ghi",
|
|
"defghi", "http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:ends-with ( "abcd***e---f*--*ghi",
|
|
"defghi", "http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:ends-with ( (), "--***-*---",
|
|
"http://example.com/CollationA")</code> returns
|
|
<code>true()</code>. <em>(The second argument contains only
|
|
ignorable collation units and is equivalent to the zero-length
|
|
string.).</em></p>
|
|
<p>The expression <code>fn:ends-with ( "abcdefghi", "ghi-",
|
|
"http://example.com/CollationA")</code> returns
|
|
<code>true()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-substring-before" id=
|
|
"func-substring-before"></a>5.5.4 fn:substring-before</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the part of <code>$arg1</code> that precedes the first
|
|
occurrence of <code>$arg2</code>, taking collations into
|
|
account.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:substring-before</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$arg2</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:substring-before</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</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">$arg2</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">$collation</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">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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If the value of <code>$arg1</code> or <code>$arg2</code> is the
|
|
empty sequence, or contains only ignorable collation units, it is
|
|
interpreted as the zero-length string.</p>
|
|
<p>If the value of <code>$arg2</code> is the zero-length string,
|
|
then the function returns the zero-length string.</p>
|
|
<p>If the value of <code>$arg1</code> does not contain a string
|
|
that is equal to the value of <code>$arg2</code>, then the function
|
|
returns the zero-length string.</p>
|
|
<p>The collation used by this function is determined according to
|
|
the rules in <a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>.</p>
|
|
<p>The function returns the substring of the value of
|
|
<code>$arg1</code> that precedes in the value of <code>$arg1</code>
|
|
the first occurrence of a sequence of collation units that provides
|
|
a <b>minimal match</b> to the collation units of <code>$arg2</code>
|
|
according to the collation that is used.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p><b>Minimal match</b> is defined in <a href=
|
|
"#Unicode-Collations">[Unicode Collation Algorithm]</a>.</p>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error <strong>may</strong> be raised [<a href="#ERRFOCH0004"
|
|
title="err:FOCH0004">err:FOCH0004</a>] if the specified collation
|
|
does not support collation units.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The collation used in these examples,
|
|
<code>http://example.com/CollationA</code> is a collation in which
|
|
both "-" and "*" are ignorable collation units.</p>
|
|
<p>"Ignorable collation unit" is equivalent to "ignorable collation
|
|
element" in <a href="#Unicode-Collations">[Unicode Collation
|
|
Algorithm]</a>.</p>
|
|
<p>The expression <code>fn:substring-before ( "tattoo",
|
|
"attoo")</code> returns <code>"t"</code>.</p>
|
|
<p>The expression <code>fn:substring-before ( "tattoo",
|
|
"tatto")</code> returns <code>""</code>.</p>
|
|
<p>The expression <code>fn:substring-before ((), ())</code> returns
|
|
<code>""</code>.</p>
|
|
<p>The expression <code>fn:substring-before ( "abcdefghi",
|
|
"--d-e-", "http://example.com/CollationA")</code> returns
|
|
<code>"abc"</code>.</p>
|
|
<p>The expression <code>fn:substring-before ( "abc--d-e-fghi",
|
|
"--d-e-", "http://example.com/CollationA")</code> returns
|
|
<code>"abc--"</code>.</p>
|
|
<p>The expression <code>fn:substring-before ( "a*b*c*d*e*f*g*h*i*",
|
|
"***cde", "http://example.com/CollationA")</code> returns
|
|
<code>"a*b*"</code>.</p>
|
|
<p>The expression <code>fn:substring-before ( "Eureka!",
|
|
"--***-*---", "http://example.com/CollationA")</code> returns
|
|
<code>""</code>. <em>(The second argument contains only ignorable
|
|
collation units and is equivalent to the zero-length
|
|
string.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-substring-after" id=
|
|
"func-substring-after"></a>5.5.5 fn:substring-after</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the part of <code>$arg1</code> that follows the first
|
|
occurrence of <code>$arg2</code>, taking collations into
|
|
account.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:substring-after</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$arg2</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:substring-after</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</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">$arg2</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">$collation</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">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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If the value of <code>$arg1</code> or <code>$arg2</code> is the
|
|
empty sequence, or contains only ignorable collation units, it is
|
|
interpreted as the zero-length string.</p>
|
|
<p>If the value of <code>$arg2</code> is the zero-length string,
|
|
then the function returns the value of <code>$arg1</code>.</p>
|
|
<p>If the value of <code>$arg1</code> does not contain a string
|
|
that is equal to the value of <code>$arg2</code>, then the function
|
|
returns the zero-length string.</p>
|
|
<p>The collation used by this function is determined according to
|
|
the rules in <a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>.</p>
|
|
<p>The function returns the substring of the value of
|
|
<code>$arg1</code> that follows in the value of <code>$arg1</code>
|
|
the first occurrence of a sequence of collation units that provides
|
|
a <b>minimal match</b> to the collation units of <code>$arg2</code>
|
|
according to the collation that is used.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p><b>Minimal match</b> is defined in <a href=
|
|
"#Unicode-Collations">[Unicode Collation Algorithm]</a>.</p>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error <strong>may</strong> be raised [<a href="#ERRFOCH0004"
|
|
title="err:FOCH0004">err:FOCH0004</a>] if the specified collation
|
|
does not support collation units.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The collation used in these examples,
|
|
<code>http://example.com/CollationA</code> is a collation in which
|
|
both "-" and "*" are ignorable collation units.</p>
|
|
<p>"Ignorable collation unit" is equivalent to "ignorable collation
|
|
element" in <a href="#Unicode-Collations">[Unicode Collation
|
|
Algorithm]</a>.</p>
|
|
<p>The expression <code>fn:substring-after("tattoo", "tat")</code>
|
|
returns <code>"too"</code>.</p>
|
|
<p>The expression <code>fn:substring-after("tattoo",
|
|
"tattoo")</code> returns <code>""</code>.</p>
|
|
<p>The expression <code>fn:substring-after((), ())</code> returns
|
|
<code>""</code>.</p>
|
|
<p>The expression <code>fn:substring-after("abcdefghi", "--d-e-",
|
|
"http://example.com/CollationA")</code> returns
|
|
<code>"fghi"</code>.</p>
|
|
<p>The expression <code>fn:substring-after("abc--d-e-fghi",
|
|
"--d-e-", "http://example.com/CollationA")</code> returns
|
|
<code>"-fghi"</code>.</p>
|
|
<p>The expression <code>fn:substring-after ( "a*b*c*d*e*f*g*h*i*",
|
|
"***cde***", "http://example.com/CollationA")</code> returns
|
|
<code>"*f*g*h*i*"</code>.</p>
|
|
<p>The expression <code>fn:substring-after ( "Eureka!",
|
|
"--***-*---", "http://example.com/CollationA")</code> returns
|
|
<code>"Eureka!"</code>. <em>(The second argument contains only
|
|
ignorable collation units and is equivalent to the zero-length
|
|
string.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="string.match" id="string.match"></a>5.6 String
|
|
functions that use regular expressions</h3>
|
|
<p>The three functions described in this section make use of a
|
|
regular expression syntax for pattern matching. This is described
|
|
below.</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-matches"><code>fn:matches</code></a></td>
|
|
<td>Returns true if the supplied string matches a given regular
|
|
expression.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-replace"><code>fn:replace</code></a></td>
|
|
<td>Returns a string produced from the input string by replacing
|
|
any substrings that match a given regular expression with a
|
|
supplied replacement string.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-tokenize"><code>fn:tokenize</code></a></td>
|
|
<td>Returns a sequence of strings constructed by splitting the
|
|
input wherever a separator is found; the separator is any substring
|
|
that matches a given regular expression.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-analyze-string"><code>fn:analyze-string</code></a></td>
|
|
<td>Analyzes a string using a regular expression, returning an XML
|
|
structure that identifies which parts of the input string matched
|
|
or failed to match the regular expression, and in the case of
|
|
matched substrings, which substrings matched each capturing group
|
|
in the regular expression.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="regex-syntax" id="regex-syntax"></a>5.6.1 Regular
|
|
expression syntax</h4>
|
|
<p>The regular expression syntax used by these functions is defined
|
|
in terms of the regular expression syntax specified in XML Schema
|
|
(see <a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a>), which in turn is based on the established
|
|
conventions of languages such as Perl. However, because XML Schema
|
|
uses regular expressions only for validity checking, it omits some
|
|
facilities that are widely-used with languages such as Perl. This
|
|
section, therefore, describes extensions to the XML Schema regular
|
|
expressions syntax that reinstate these capabilities.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>It is recommended that implementers consult <a href=
|
|
"#Unicode-Regex">[Unicode Regular Expressions]</a> for information
|
|
on using regular expression processing on Unicode characters.</p>
|
|
</div>
|
|
<p>The regular expression syntax and semantics are identical to
|
|
those defined in <a href="#xmlschema-2">[XML Schema Part 2:
|
|
Datatypes Second Edition]</a> with the following additions:</p>
|
|
<ul>
|
|
<li>
|
|
<p>Two meta-characters, <code>^</code> and <code>$</code> are
|
|
added. By default, the meta-character <code>^</code> matches the
|
|
start of the entire string, while <code>$</code> matches the end of
|
|
the entire string. In multi-line mode, <code>^</code> matches the
|
|
start of any line (that is, the start of the entire string, and the
|
|
position immediately after a newline character), while
|
|
<code>$</code> matches the end of any line (that is, the end of the
|
|
entire string, and the position immediately before a newline
|
|
character). Newline here means the character <code>#x0A</code>
|
|
only.</p>
|
|
<p>This means that the production in <a href="#xmlschema-2">[XML
|
|
Schema Part 2: Datatypes Second Edition]</a>:</p>
|
|
<p><code>[10] Char ::= [^.\?*+()|#x5B#x5D]</code></p>
|
|
<p>is modified to read:</p>
|
|
<p><code>[10] Char ::= [^.\?*+{}()|^$#x5B#x5D]</code></p>
|
|
<p>The characters <code>#x5B</code> and <code>#x5D</code>
|
|
correspond to "<code>[</code>" and "<code>]</code>"
|
|
respectively.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>The definition of Char (production [10]) in <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
has a known error in which it omits the left brace ("{") and right
|
|
brace ("}"). That error is corrected here.</p>
|
|
</div>
|
|
<p>The following production:</p>
|
|
<p><code>[11] charClass ::= charClassEsc | charClassExpr |
|
|
WildCardEsc</code></p>
|
|
<p>is modified to read:</p>
|
|
<p><code>[11] charClass ::= charClassEsc | charClassExpr |
|
|
WildCardEsc | "^" | "$"</code></p>
|
|
</li>
|
|
<li>
|
|
<p><em>Reluctant quantifiers</em> are supported. They are indicated
|
|
by a " <code>?</code> " following a quantifier. Specifically:</p>
|
|
<ul>
|
|
<li>
|
|
<p><code>X??</code> matches X, once or not at all</p>
|
|
</li>
|
|
<li>
|
|
<p><code>X*?</code> matches X, zero or more times</p>
|
|
</li>
|
|
<li>
|
|
<p><code>X+?</code> matches X, one or more times</p>
|
|
</li>
|
|
<li>
|
|
<p><code>X{n}?</code> matches X, exactly n times</p>
|
|
</li>
|
|
<li>
|
|
<p><code>X{n,}?</code> matches X, at least n times</p>
|
|
</li>
|
|
<li>
|
|
<p><code>X{n,m}?</code> matches X, at least n times, but not more
|
|
than m times</p>
|
|
</li>
|
|
</ul>
|
|
<p>The effect of these quantifiers is that the regular expression
|
|
matches the <em>shortest</em> possible substring consistent with
|
|
the match as a whole succeeding. Without the " <code>?</code> ",
|
|
the regular expression matches the <em>longest</em> possible
|
|
substring.</p>
|
|
<p>To achieve this, the production in <a href="#xmlschema-2">[XML
|
|
Schema Part 2: Datatypes Second Edition]</a>:</p>
|
|
<p><code>[4] quantifier ::= [?*+] | ( '{' quantity '}' )</code></p>
|
|
<p>is changed to:</p>
|
|
<p><code>[4] quantifier ::= ( [?*+] | ( '{' quantity '}' ) )
|
|
'?'?</code></p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>Reluctant quantifiers have no effect on the results of the
|
|
boolean <a href="#func-matches"><code>fn:matches</code></a>
|
|
function, since this function is only interested in discovering
|
|
whether a match exists, and not where it exists.</p>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<p>Sub-expressions (groups) within the regular expression are
|
|
recognized. The regular expression syntax defined by <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
allows a regular expression to contain parenthesized
|
|
sub-expressions, but attaches no special significance to them. The
|
|
<a href="#func-replace"><code>fn:replace</code></a> function
|
|
described below allows access to the parts of the input string that
|
|
matched a sub-expression (called captured substrings). The
|
|
sub-expressions are numbered according to the position of the
|
|
opening parenthesis in left-to-right order within the top-level
|
|
regular expression: the first opening parenthesis identifies
|
|
captured substring 1, the second identifies captured substring 2,
|
|
and so on. 0 identifies the substring captured by the entire
|
|
regular expression. If a sub-expression matches more than one
|
|
substring (because it is within a construct that allows
|
|
repetition), then only the <em>last</em> substring that it matched
|
|
will be captured.</p>
|
|
<p>Non-capturing groups are also recognized. These are indicated by
|
|
the syntax <code>(?:xxxx)</code>. Specifically, the production rule
|
|
for <code>atom</code> in <a href="#xmlschema-2">[XML Schema Part 2:
|
|
Datatypes Second Edition]</a> is changed from:</p>
|
|
<p><code>[9] atom ::= Char | charClass | ( '(' regExp ')'
|
|
)</code></p>
|
|
<p>to:</p>
|
|
<p><code>[9] atom ::= Char | charClass | ( '(' '?:'? regExp ')'
|
|
)</code></p>
|
|
<p>The presence of the optional <code>?:</code> has no effect on
|
|
the set of strings that match the regular expression, but causes
|
|
the left parenthesis not to be counted by operations that number
|
|
the groups within a regular expression, for example the <a href=
|
|
"#func-replace"><code>fn:replace</code></a> function.</p>
|
|
</li>
|
|
<li>
|
|
<p>Back-references are allowed <span>outside a character class
|
|
expression. A back-reference is an additional kind of atom.</span>
|
|
The construct <code>\N</code> where <code>N</code> is a single
|
|
digit is always recognized as a back-reference; if this is followed
|
|
by further digits, these digits are taken to be part of the
|
|
back-reference if and only if <span>the resulting number
|
|
<code>NN</code> is such that the back-reference is preceded by
|
|
<code>NN</code> or more unescaped opening parentheses. The regular
|
|
expression is invalid if a back-reference refers to a subexpression
|
|
that does not exist or whose closing right parenthesis occurs after
|
|
the back-reference.</span></p>
|
|
<p>A back-reference matches the string that was matched by the
|
|
<code>N</code>th capturing subexpression within the regular
|
|
expression, that is, the parenthesized subexpression whose opening
|
|
left parenthesis is the <code>N</code>th unescaped left parenthesis
|
|
within the regular expression. For example, the regular expression
|
|
<code>('|").*\1</code> matches a sequence of characters delimited
|
|
either by an apostrophe at the start and end, or by a quotation
|
|
mark at the start and end.</p>
|
|
<p>If no string is matched by the <code>N</code>th capturing
|
|
subexpression, the back-reference is interpreted as matching a
|
|
zero-length string.</p>
|
|
<p>Back-references change the following production:</p>
|
|
<p><span><code>[9] atom ::= Char | charClass | ( '(' regExp ')'
|
|
)</code></span></p>
|
|
<p>to</p>
|
|
<p><span><code>[9] atom ::= Char | charClass | ( '(' regExp ')' ) |
|
|
backReference</code></span></p>
|
|
<p><span><code>[9a] backReference ::= "\"
|
|
[1-9][0-9]*</code></span></p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p><span>Within a character class expression, <code>\</code>
|
|
followed by a digit is invalid. Some other regular expression
|
|
languages interpret this as an octal character
|
|
reference.</span></p>
|
|
</div>
|
|
</li>
|
|
<li>
|
|
<p>Single character escapes are extended to allow the
|
|
<code>$</code> character to be escaped. The following production is
|
|
changed:</p>
|
|
<p><code>[24]SingleCharEsc ::= '\'
|
|
[nrt\|.?*+(){}#x2D#x5B#x5D#x5E]</code></p>
|
|
<p>to</p>
|
|
<p><code>[24]SingleCharEsc ::= '\'
|
|
[nrt\|.?*+(){}$#x2D#x5B#x5D#x5E]</code></p>
|
|
</li>
|
|
</ul>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>In <a href="#xmlschema11-2">[XML Schema 1.1 Part 2:
|
|
Datatypes]</a> the rules for the interpretation of hyphens within
|
|
square brackets in a regular expression have been clarified; and
|
|
the semantics of regular expressions are no longer tied to a
|
|
specific version of Unicode.</p>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="flags" id="flags"></a>5.6.1.1 Flags</h5>
|
|
<p>All these functions provide an optional parameter,
|
|
<code>$flags</code>, to set options for the interpretation of the
|
|
regular expression. The parameter accepts a <code>xs:string</code>,
|
|
in which individual letters are used to set options. The presence
|
|
of a letter within the string indicates that the option is on; its
|
|
absence indicates that the option is off. Letters may appear in any
|
|
order and may be repeated. If there are characters present that are
|
|
not defined here as flags, then an error is raised [<a href=
|
|
"#ERRFORX0001" title="err:FORX0001">err:FORX0001</a>].</p>
|
|
<p>The following options are defined:</p>
|
|
<ul>
|
|
<li>
|
|
<p><code>s</code>: If present, the match operates in "dot-all"
|
|
mode. (Perl calls this the single-line mode.) If the <code>s</code>
|
|
flag is not specified, the meta-character <code>.</code> matches
|
|
any character except a newline (<code>#x0A</code>) character. In
|
|
dot-all mode, the meta-character <code>.</code> matches any
|
|
character whatsoever. Suppose the input contains "hello" and
|
|
"world" on two lines. This will not be matched by the regular
|
|
expression "hello.*world" unless dot-all mode is enabled.</p>
|
|
</li>
|
|
<li>
|
|
<p><code>m</code>: If present, the match operates in multi-line
|
|
mode. By default, the meta-character <code>^</code> matches the
|
|
start of the entire string, while $ matches the end of the entire
|
|
string. In multi-line mode, <code>^</code> matches the start of any
|
|
line (that is, the start of the entire string, and the position
|
|
immediately after a newline character <span>other than a newline
|
|
that appears as the last character in the string</span>), while
|
|
<code>$</code> matches the end of any line <span>(that is, the
|
|
position immediately before a newline character, and the end of the
|
|
entire string if there is no newline character at the end of the
|
|
string).</span> Newline here means the character <code>#x0A</code>
|
|
only.</p>
|
|
</li>
|
|
<li>
|
|
<p><code>i</code>: If present, the match operates in
|
|
case-insensitive mode. The detailed rules are as follows. In these
|
|
rules, a character C2 is considered to be a <em>case-variant</em>
|
|
of another character C1 if the following XPath expression returns
|
|
<code>true</code> when the two characters are considered as strings
|
|
of length one, and the <a title="Unicode codepoint collation"
|
|
class="termref" href="#dt-codepoint-collation"><span class=
|
|
"arrow">·</span>Unicode codepoint collation<span class=
|
|
"arrow">·</span></a> is used:</p>
|
|
<p><a href="#func-lower-case"><code>fn:lower-case(C1) eq
|
|
fn:lower-case(C2)</code></a></p>
|
|
<p>or</p>
|
|
<p><a href="#func-upper-case"><code>fn:upper-case(C1) eq
|
|
fn:upper-case(C2)</code></a></p>
|
|
<p>Note that the case-variants of a character under this definition
|
|
are always single characters.</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>When a normal character (<code>Char</code>) is used as an atom,
|
|
it represents the set containing that character and all its
|
|
case-variants. For example, the regular expression "z" will match
|
|
both "z" and "Z".</p>
|
|
</li>
|
|
<li>
|
|
<p>A character range (<code>charRange</code>) represents the set
|
|
containing all the characters that it would match in the absence of
|
|
the "<code>i</code>" flag, together with their case-variants. For
|
|
example, the regular expression "[A-Z]" will match all the letters
|
|
A-Z and all the letters a-z. It will also match certain other
|
|
characters such as <code>#x212A</code> (KELVIN SIGN), since
|
|
<a href="#func-lower-case"><code>fn:lower-case("#x212A")</code></a>
|
|
is "k".</p>
|
|
<p>This rule applies also to a character range used in a character
|
|
class subtraction (<code>charClassSub</code>): thus [A-Z-[IO]] will
|
|
match characters such as "A", "B", "a", and "b", but will not match
|
|
"I", "O", "i", or "o".</p>
|
|
<p>The rule also applies to a character range used as part of a
|
|
negative character group: thus [^Q] will match every character
|
|
except "Q" and "q" (these being the only case-variants of "Q" in
|
|
Unicode).</p>
|
|
</li>
|
|
<li>
|
|
<p>A back-reference is compared using case-blind comparison: that
|
|
is, each character must either be the same as the corresponding
|
|
character of the previously matched string, or must be a
|
|
case-variant of that character. For example, the strings "Mum",
|
|
"mom", "Dad", and "DUD" all match the regular expression
|
|
"([md])[aeiou]\1" when the "<code>i</code>" flag is used.</p>
|
|
</li>
|
|
<li>
|
|
<p>All other constructs are unaffected by the "<code>i</code>"
|
|
flag. For example, "\p{Lu}" continues to match upper-case letters
|
|
only.</p>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>
|
|
<p><code>x</code>: If present, whitespace characters (#x9, #xA, #xD
|
|
and #x20) in the regular expression are removed prior to matching
|
|
with one exception: whitespace characters within character class
|
|
expressions (<code>charClassExpr</code>) are not removed. This flag
|
|
can be used, for example, to break up long regular expressions into
|
|
readable lines.</p>
|
|
<p>Examples:</p>
|
|
<p><a href="#func-matches"><code>fn:matches("helloworld", "hello
|
|
world", "x")</code></a> returns <code>true()</code></p>
|
|
<p><a href="#func-matches"><code>fn:matches("helloworld", "hello[
|
|
]world", "x")</code></a> returns <code>false()</code></p>
|
|
<p><a href="#func-matches"><code>fn:matches("hello world", "hello\
|
|
sworld", "x")</code></a> returns <code>true()</code></p>
|
|
<p><a href="#func-matches"><code>fn:matches("hello world", "hello
|
|
world", "x")</code></a> returns <code>false()</code></p>
|
|
</li>
|
|
<li>
|
|
<p><code>q</code>: if present, all characters in the regular
|
|
expression are treated as representing themselves, not as
|
|
metacharacters. In effect, every character that would normally have
|
|
a special meaning in a regular expression is implicitly escaped by
|
|
preceding it with a backslash.</p>
|
|
<p>Furthermore, when this flag is present, the characters
|
|
<code>$</code> and <code>\</code> have no special significance when
|
|
used in the replacement string supplied to the <a href=
|
|
"#func-replace"><code>fn:replace</code></a> function.</p>
|
|
<p>This flag can be used in conjunction with the <code>i</code>
|
|
flag. If it is used together with the <code>m</code>,
|
|
<code>s</code>, or <code>x</code> flag, that flag has no
|
|
effect.</p>
|
|
<p>Examples:</p>
|
|
<p><a href="#func-tokenize"><code>fn:tokenize("12.3.5.6", ".",
|
|
"q")</code></a> returns <code>("12", "3", "5", "6")</code></p>
|
|
<p><a href="#func-replace"><code>fn:replace("a\b\c", "\", "\\",
|
|
"q")</code></a> returns <code>"a\\b\\c"</code></p>
|
|
<p><a href="#func-replace"><code>fn:replace("a/b/c", "/", "$",
|
|
"q")</code></a> returns <code>"a$b$c"</code></p>
|
|
<p><a href="#func-matches"><code>fn:matches("abcd", ".*",
|
|
"q")</code></a> returns <code>false()</code></p>
|
|
<p><a href="#func-matches"><code>fn:matches("Mr. B. Obama", "B.
|
|
OBAMA", "iq")</code></a> returns <code>true()</code></p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-matches" id="func-matches"></a>5.6.2
|
|
fn:matches</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the supplied string matches a given regular
|
|
expression.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:matches</code>(<code class=
|
|
"arg">$input</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$pattern</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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:matches</code>(</td>
|
|
<td valign="baseline"><code class="arg">$input</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">$pattern</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">$flags</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:boolean</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>The effect of calling the first version of this function
|
|
(omitting the argument <code>$flags</code>) is the same as the
|
|
effect of calling the second version with the <code>$flags</code>
|
|
argument set to a zero-length string. Flags are defined in <a href=
|
|
"#flags"><b>5.6.1.1 Flags</b></a>.</p>
|
|
<p>If <code>$input</code> is the empty sequence, it is interpreted
|
|
as the zero-length string.</p>
|
|
<p>The function returns <code>true</code> if <code>$input</code> or
|
|
some substring of <code>$input</code> matches the regular
|
|
expression supplied as <code>$pattern</code>. Otherwise, the
|
|
function returns <code>false</code>. The matching rules are
|
|
influenced by the value of <code>$flags</code> if present.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFORX0002" title=
|
|
"err:FORX0002">err:FORX0002</a>] if the value of
|
|
<code>$pattern</code> is invalid according to the rules described
|
|
in <a href="#regex-syntax"><b>5.6.1 Regular expression
|
|
syntax</b></a>.</p>
|
|
<p>An error is raised [<a href="#ERRFORX0001" title=
|
|
"err:FORX0001">err:FORX0001</a>] if the value of
|
|
<code>$flags</code> is invalid according to the rules described in
|
|
<a href="#flags"><b>5.6.1.1 Flags</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Unless the metacharacters <code>^</code> and <code>$</code> are
|
|
used as anchors, the string is considered to match the pattern if
|
|
any substring matches the pattern. But if anchors are used, the
|
|
anchors must match the start/end of the string (in string mode), or
|
|
the start/end of a line (in multiline mode).</p>
|
|
<p>This is different from the behavior of patterns in <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>,
|
|
where regular expressions are <em>implicitly</em> anchored.</p>
|
|
<p>Regular expression matching is defined on the basis of Unicode
|
|
code points; it takes no account of collations.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:matches("abracadabra", "bra")</code>
|
|
returns <code>true()</code>.</p>
|
|
<p>The expression <code>fn:matches("abracadabra", "^a.*a$")</code>
|
|
returns <code>true()</code>.</p>
|
|
<p>The expression <code>fn:matches("abracadabra", "^bra")</code>
|
|
returns <code>false()</code>.</p>
|
|
<p>Given the source document:</p>
|
|
<p>let <code>$poem</code> :=</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<poem author="Wilhelm Busch">
|
|
Kaum hat dies der Hahn gesehen,
|
|
Fängt er auch schon an zu krähen:
|
|
Kikeriki! Kikikerikih!!
|
|
Tak, tak, tak! - da kommen sie.
|
|
</poem>
|
|
</pre></div>
|
|
<p>the following function calls produce the following results, with
|
|
the <code>poem</code> element as the context node:</p>
|
|
<p>The expression <code>fn:matches($poem, "Kaum.*krähen")</code>
|
|
returns <code>false()</code>.</p>
|
|
<p>The expression <code>fn:matches($poem, "Kaum.*krähen",
|
|
"s")</code> returns <code>true()</code>.</p>
|
|
<p>The expression <code>fn:matches($poem, "^Kaum.*gesehen,$",
|
|
"m")</code> returns <code>true()</code>.</p>
|
|
<p>The expression <code>fn:matches($poem,
|
|
"^Kaum.*gesehen,$")</code> returns <code>false()</code>.</p>
|
|
<p>The expression <code>fn:matches($poem, "kiki", "i")</code>
|
|
returns <code>true()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-replace" id="func-replace"></a>5.6.3
|
|
fn:replace</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a string produced from the input string by replacing any
|
|
substrings that match a given regular expression with a supplied
|
|
replacement string.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<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:replace</code>(</td>
|
|
<td valign="baseline"><code class="arg">$input</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">$pattern</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">$replacement</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>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="4"><code class=
|
|
"function">fn:replace</code>(</td>
|
|
<td valign="baseline"><code class="arg">$input</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">$pattern</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">$replacement</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">$flags</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">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 effect of calling the first version of this function
|
|
(omitting the argument <code>$flags</code>) is the same as the
|
|
effect of calling the second version with the <code>$flags</code>
|
|
argument set to a zero-length string. Flags are defined in <a href=
|
|
"#flags"><b>5.6.1.1 Flags</b></a>.</p>
|
|
<p>The <code>$flags</code> argument is interpreted in the same
|
|
manner as for the <a href=
|
|
"#func-matches"><code>fn:matches</code></a> function.</p>
|
|
<p>If <code>$input</code> is the empty sequence, it is interpreted
|
|
as the zero-length string.</p>
|
|
<p>The function returns the <code>xs:string</code> that is obtained
|
|
by replacing each non-overlapping substring of <code>$input</code>
|
|
that matches the given <code>$pattern</code> with an occurrence of
|
|
the <code>$replacement</code> string.</p>
|
|
<p>If two overlapping substrings of <code>$input</code> both match
|
|
the <code>$pattern</code>, then only the first one (that is, the
|
|
one whose first <a title="character" class="termref" href=
|
|
"#character"><span class="arrow">·</span>character<span class=
|
|
"arrow">·</span></a> comes first in the <code>$input</code> string)
|
|
is replaced.</p>
|
|
<p>If the <code>q</code> flag is present, the replacement string is
|
|
used <em>as is</em>.</p>
|
|
<p><span>Otherwise,</span> within the <code>$replacement</code>
|
|
string, a variable <code>$N</code> may be used to refer to the
|
|
substring captured by the Nth parenthesized sub-expression in the
|
|
regular expression. For each match of the pattern, these variables
|
|
are assigned the value of the content matched by the relevant
|
|
sub-expression, and the modified replacement string is then
|
|
substituted for the <a title="character" class="termref" href=
|
|
"#character"><span class="arrow">·</span>characters<span class=
|
|
"arrow">·</span></a> in <code>$input</code> that matched the
|
|
pattern. <code>$0</code> refers to the substring captured by the
|
|
regular expression as a whole.</p>
|
|
<p>More specifically, the rules are as follows, where
|
|
<code>S</code> is the number of parenthesized sub-expressions in
|
|
the regular expression, and <code>N</code> is the decimal number
|
|
formed by taking all the digits that consecutively follow the
|
|
<code>$</code> character:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>If <code>N</code>=<code>0</code>, then the variable is replaced
|
|
by the substring matched by the regular expression as a whole.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <code>1</code><=<code>N</code><=<code>S</code>, then
|
|
the variable is replaced by the substring captured by the Nth
|
|
parenthesized sub-expression. If the <code>Nth</code> parenthesized
|
|
sub-expression was not matched, then the variable is replaced by
|
|
the zero-length string.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <code>S</code><<code>N</code><=<code>9</code>, then the
|
|
variable is replaced by the zero-length string.</p>
|
|
</li>
|
|
<li>
|
|
<p>Otherwise (if <code>N</code>><code>S</code> and
|
|
<code>N</code>><code>9</code>), the last digit of <code>N</code>
|
|
is taken to be a literal character to be included "as is" in the
|
|
replacement string, and the rules are reapplied using the number
|
|
<code>N</code> formed by stripping off this last digit.</p>
|
|
</li>
|
|
</ol>
|
|
<p>For example, if the replacement string is " <code>$23</code> "
|
|
and there are 5 substrings, the result contains the value of the
|
|
substring that matches the second sub-expression, followed by the
|
|
digit " <code>3</code> ".</p>
|
|
<p>Unless the <code>q</code> flag is used, a literal <code>$</code>
|
|
character within the replacement string must be written as
|
|
<code>\$</code>, and a literal <code>\</code> character must be
|
|
written as <code>\\</code>.</p>
|
|
<p>If two alternatives within the pattern both match at the same
|
|
position in the <code>$input</code>, then the match that is chosen
|
|
is the one matched by the first alternative. For example:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
fn:replace("abcd", "(ab)|(a)", "[1=$1][2=$2]") returns "[1=ab][2=]cd"
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFORX0002" title=
|
|
"err:FORX0002">err:FORX0002</a>] if the value of
|
|
<code>$pattern</code> is invalid according to the rules described
|
|
in section <a href="#regex-syntax"><b>5.6.1 Regular expression
|
|
syntax</b></a>.</p>
|
|
<p>An error is raised [<a href="#ERRFORX0001" title=
|
|
"err:FORX0001">err:FORX0001</a>] if the value of
|
|
<code>$flags</code> is invalid according to the rules described in
|
|
section <a href="#regex-syntax"><b>5.6.1 Regular expression
|
|
syntax</b></a>.</p>
|
|
<p>An error is raised [<a href="#ERRFORX0003" title=
|
|
"err:FORX0003">err:FORX0003</a>] if the pattern matches a
|
|
zero-length string, that is, if the expression <a href=
|
|
"#func-matches"><code>fn:matches("", $pattern, $flags)</code></a>
|
|
returns <code>true</code>. It is not an error, however, if a
|
|
captured substring is zero-length.</p>
|
|
<p>An error is raised [<a href="#ERRFORX0004" title=
|
|
"err:FORX0004">err:FORX0004</a>] if the value of
|
|
<code>$replacement</code> contains a "<code>$</code>" character
|
|
that is not immediately followed by a digit <code>0-9</code> and
|
|
not immediately preceded by a "\".</p>
|
|
<p>An error is raised [<a href="#ERRFORX0004" title=
|
|
"err:FORX0004">err:FORX0004</a>] if the value of
|
|
<code>$replacement</code> contains a "<code>\</code>" character
|
|
that is not part of a "<code>\\</code>" pair, unless it is
|
|
immediately followed by a "<code>$</code>" character.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If the input string contains no substring that matches the
|
|
regular expression, the result of the function is a single string
|
|
identical to the input string.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>replace("abracadabra", "bra", "*")</code>
|
|
returns <code>"a*cada*"</code>.</p>
|
|
<p>The expression <code>replace("abracadabra", "a.*a", "*")</code>
|
|
returns <code>"*"</code>.</p>
|
|
<p>The expression <code>replace("abracadabra", "a.*?a", "*")</code>
|
|
returns <code>"*c*bra"</code>.</p>
|
|
<p>The expression <code>replace("abracadabra", "a", "")</code>
|
|
returns <code>"brcdbr"</code>.</p>
|
|
<p>The expression <code>replace("abracadabra", "a(.)",
|
|
"a$1$1")</code> returns <code>"abbraccaddabbra"</code>.</p>
|
|
<p>The expression <code>replace("abracadabra", ".*?", "$1")</code>
|
|
raises an error, because the pattern matches the zero-length
|
|
string</p>
|
|
<p>The expression <code>replace("AAAA", "A+", "b")</code> returns
|
|
<code>"b"</code>.</p>
|
|
<p>The expression <code>replace("AAAA", "A+?", "b")</code> returns
|
|
<code>"bbbb"</code>.</p>
|
|
<p>The expression <code>replace("darted", "^(.*?)d(.*)$",
|
|
"$1c$2")</code> returns <code>"carted"</code>. <em>(The first
|
|
<code>d</code> is replaced.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-tokenize" id="func-tokenize"></a>5.6.4
|
|
fn:tokenize</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a sequence of strings constructed by splitting the input
|
|
wherever a separator is found; the separator is any substring that
|
|
matches a given regular expression.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:tokenize</code>(<code class=
|
|
"arg">$input</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$pattern</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:tokenize</code>(</td>
|
|
<td valign="baseline"><code class="arg">$input</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">$pattern</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">$flags</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">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 effect of calling the first version of this function
|
|
(omitting the argument <code>$flags</code>) is the same as the
|
|
effect of calling the second version with the <code>$flags</code>
|
|
argument set to a zero-length string. Flags are defined in <a href=
|
|
"#flags"><b>5.6.1.1 Flags</b></a>.</p>
|
|
<p>The <code>$flags</code> argument is interpreted in the same way
|
|
as for the <a href="#func-matches"><code>fn:matches</code></a>
|
|
function.</p>
|
|
<p>If <code>$input</code> is the empty sequence, or if
|
|
<code>$input</code> is the zero-length string, the function returns
|
|
the empty sequence.</p>
|
|
<p>The function returns a sequence of strings formed by breaking
|
|
the <code>$input</code> string into a sequence of strings, treating
|
|
any substring that matches <code>$pattern</code> as a separator.
|
|
The separators themselves are not returned.</p>
|
|
<p>If a separator occurs at the start of the <code>$input</code>
|
|
string, the result sequence will start with a zero-length string.
|
|
Zero-length strings will also occur in the result sequence if a
|
|
separator occurs at the end of the <code>$input</code> string, or
|
|
if two adjacent substrings match the supplied
|
|
<code>$pattern</code>.</p>
|
|
<p>If two alternatives within the supplied <code>$pattern</code>
|
|
both match at the same position in the <code>$input</code> string,
|
|
then the match that is chosen is the first. For example:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
fn:tokenize("abracadabra", "(ab)|(a)") returns ("", "r", "c", "d", "r", "")
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFORX0002" title=
|
|
"err:FORX0002">err:FORX0002</a>] if the value of
|
|
<code>$pattern</code> is invalid according to the rules described
|
|
in section <a href="#regex-syntax"><b>5.6.1 Regular expression
|
|
syntax</b></a>.</p>
|
|
<p>An error is raised [<a href="#ERRFORX0001" title=
|
|
"err:FORX0001">err:FORX0001</a>] if the value of
|
|
<code>$flags</code> is invalid according to the rules described in
|
|
section <a href="#regex-syntax"><b>5.6.1 Regular expression
|
|
syntax</b></a>.</p>
|
|
<p>an error is raised [<a href="#ERRFORX0003" title=
|
|
"err:FORX0003">err:FORX0003</a>] if the supplied
|
|
<code>$pattern</code> matches a zero-length string, that is, if
|
|
<a href="#func-matches"><code>fn:matches("", $pattern,
|
|
$flags)</code></a> returns <code>true</code>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If the input string is not zero length, and no separators are
|
|
found in the input string, the result of the function is a single
|
|
string identical to the input string.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:tokenize("The cat sat on the mat",
|
|
"\s+")</code> returns <code>("The", "cat", "sat", "on", "the",
|
|
"mat")</code>.</p>
|
|
<p>The expression <code>fn:tokenize("1, 15, 24, 50", ",\s*")</code>
|
|
returns <code>("1", "15", "24", "50")</code>.</p>
|
|
<p>The expression <code>fn:tokenize("1,15,,24,50,", ",")</code>
|
|
returns <code>("1", "15", "", "24", "50", "")</code>.</p>
|
|
<p><code>fn:tokenize("abba", ".?")</code> raises the error
|
|
[<a href="#ERRFORX0003" title="err:FORX0003">err:FORX0003</a>].</p>
|
|
<p>The expression <code>fn:tokenize("Some unparsed <br> HTML
|
|
<BR> text", "\s*<br>\s*", "i")</code> returns
|
|
<code>("Some unparsed", "HTML", "text")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-analyze-string" id=
|
|
"func-analyze-string"></a>5.6.5 fn:analyze-string</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Analyzes a string using a regular expression, returning an XML
|
|
structure that identifies which parts of the input string matched
|
|
or failed to match the regular expression, and in the case of
|
|
matched substrings, which substrings matched each capturing group
|
|
in the regular expression.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:analyze-string</code>(</td>
|
|
<td valign="baseline"><code class="arg">$input</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">$pattern</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">element(fn:analyze-string-result)</code></td>
|
|
</tr>
|
|
</table>
|
|
</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:analyze-string</code>(</td>
|
|
<td valign="baseline"><code class="arg">$input</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">$pattern</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">$flags</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">element(fn:analyze-string-result)</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>The effect of calling the first version of this function
|
|
(omitting the argument <code>$flags</code>) is the same as the
|
|
effect of calling the second version with the <code>$flags</code>
|
|
argument set to a zero-length string. Flags are defined in <a href=
|
|
"#flags"><b>5.6.1.1 Flags</b></a>.</p>
|
|
<p>The <code>$flags</code> argument is interpreted in the same way
|
|
as for the <a href="#func-matches"><code>fn:matches</code></a>
|
|
function.</p>
|
|
<p>If <code>$input</code> is the empty sequence the function
|
|
behaves as if <code>$input</code> were the zero-length string. In
|
|
this situation the result will be an element node with no
|
|
children.</p>
|
|
<p>The function returns an element node whose local name is
|
|
<code>analyze-string-result</code>. This element and all its
|
|
descendant elements have the namespace URI
|
|
<code>http://www.w3.org/2005/xpath-functions</code>. The namespace
|
|
prefix is <a title="implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a>. The children of this element are a sequence
|
|
of <code>fn:match</code> and <code>fn:non-match</code> elements.
|
|
This sequence is formed by breaking the <code>$input</code> string
|
|
into a sequence of strings, returning any substring that matches
|
|
<code>$pattern</code> as the content of a <code>match</code>
|
|
element, and any intervening substring as the content of a
|
|
<code>non-match</code> element.</p>
|
|
<p>More specifically, the function starts at the beginning of the
|
|
input string and attempts to find the first substring that matches
|
|
the regular expression. If there are several matches, the first
|
|
match is defined to be the one whose starting position comes first
|
|
in the string. If several alternatives within the regular
|
|
expression both match at the same position in the input string,
|
|
then the match that is chosen is the first alternative that
|
|
matches. For example, if the input string is <code>The quick brown
|
|
fox jumps</code> and the regular expression is
|
|
<code>jump|jumps</code>, then the match that is chosen is
|
|
<code>jump</code>.</p>
|
|
<p>Having found the first match, the instruction proceeds to find
|
|
the second and subsequent matches by repeating the search, starting
|
|
at the first <a title="character" class="termref" href=
|
|
"#character"><span class="arrow">·</span>character<span class=
|
|
"arrow">·</span></a> that was not included in the previous
|
|
match.</p>
|
|
<p>The input string is thus partitioned into a sequence of
|
|
substrings, some of which match the regular expression, others
|
|
which do not match it. Each substring will contain at least one
|
|
character. This sequence is represented in the result by the
|
|
sequence of <code>fn:match</code> and <code>fn:non-match</code>
|
|
children of the returned element node; the string value of the
|
|
<code>fn:match</code> or <code>fn:non-match</code> element will be
|
|
the corresponding substring of <code>$input</code>, and the string
|
|
value of the returned element node will therefore be the same as
|
|
<code>$input</code>.</p>
|
|
<p>The content of an <code>fn:non-match</code> element is always a
|
|
single text node.</p>
|
|
<p>The content of a <code>fn:match</code> element, however, is in
|
|
general a sequence of text nodes and <code>fn:group</code> element
|
|
children. An <code>fn:group</code> element with a <code>nr</code>
|
|
attribute having the integer value <var>N</var> identifies the
|
|
substring captured by the <var>Nth</var> parenthesized
|
|
sub-expression in the regular expression. For each capturing
|
|
subexpression there will be at most one corresponding
|
|
<code>fn:group</code> element in each <code>fn:match</code> element
|
|
in the result.</p>
|
|
<p>If the function is called twice with the same arguments, it is
|
|
<a title="implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a> whether the two calls return the same element
|
|
node or distinct (but deep equal) element nodes. In this respect it
|
|
is <a title="" class="termref" href="#"><span class=
|
|
"arrow">·</span>nondeterministic<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>The base URI of the element nodes in the result is <a title=
|
|
"implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a></p>
|
|
<p>A schema is defined for the structure of the returned element,
|
|
containing the definitions below. The returned element and its
|
|
descendants will have type annotations obtained by validating the
|
|
returned element against this schema, unless the function is used
|
|
in an environment where type annotations are not supported (for
|
|
example, a Basic XSLT Processor), in which case the elements will
|
|
all be annotated as <code>xs:untyped</code> and the attributes as
|
|
<code>xs:untypedAtomic</code>.</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
targetNamespace="http://www.w3.org/2005/xpath-functions"
|
|
xmlns:fn="http://www.w3.org/2005/xpath-functions"
|
|
elementFormDefault="qualified">
|
|
|
|
<xs:element name="analyze-string-result" type="fn:analyze-string-result-type"/>
|
|
<xs:element name="match" type="fn:match-type"/>
|
|
<xs:element name="non-match" type="xs:string"/>
|
|
<xs:element name="group" type="fn:group-type"/>
|
|
|
|
<xs:complexType name="analyze-string-result-type" mixed="true">
|
|
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
|
<xs:element ref="fn:match"/>
|
|
<xs:element ref="fn:non-match"/>
|
|
</xs:choice>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="match-type" mixed="true">
|
|
<xs:sequence>
|
|
<xs:element ref="fn:group" minOccurs="0" maxOccurs="unbounded"/>
|
|
</xs:sequence>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="group-type" mixed="true">
|
|
<xs:sequence>
|
|
<xs:element ref="fn:group" minOccurs="0" maxOccurs="unbounded"/>
|
|
</xs:sequence>
|
|
<xs:attribute name="nr" type="xs:positiveInteger"/>
|
|
</xs:complexType>
|
|
|
|
</xs:schema>
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFORX0002" title=
|
|
"err:FORX0002">err:FORX0002</a>] if the value of
|
|
<code>$pattern</code> is invalid according to the rules described
|
|
in section <a href="#regex-syntax"><b>5.6.1 Regular expression
|
|
syntax</b></a>.</p>
|
|
<p>An error is raised [<a href="#ERRFORX0001" title=
|
|
"err:FORX0001">err:FORX0001</a>] if the value of
|
|
<code>$flags</code> is invalid according to the rules described in
|
|
section <a href="#regex-syntax"><b>5.6.1 Regular expression
|
|
syntax</b></a>.</p>
|
|
<p>An error is raised [<a href="#ERRFORX0003" title=
|
|
"err:FORX0003">err:FORX0003</a>] if the supplied
|
|
<code>$pattern</code> matches a zero-length string, that is, if
|
|
<a href="#func-matches"><code>fn:matches("", $pattern,
|
|
$flags)</code></a> returns <code>true</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>In the following examples, the result document is shown in
|
|
serialized form, with whitespace between the element nodes. This
|
|
whitespace is not actually present in the result.</p>
|
|
<p>The expression <code>fn:analyze-string("The cat sat on the
|
|
mat.", "\w+")</code> returns <code><analyze-string-result
|
|
xmlns="http://www.w3.org/2005/xpath-functions">
|
|
<match>The</match> <non-match> </non-match>
|
|
<match>cat</match> <non-match> </non-match>
|
|
<match>sat</match> <non-match> </non-match>
|
|
<match>on</match> <non-match> </non-match>
|
|
<match>the</match> <non-match> </non-match>
|
|
<match>mat</match> <non-match>.</non-match>
|
|
</analyze-string-result></code>.</p>
|
|
<p>The expression <code>fn:analyze-string("2008-12-03",
|
|
"^(\d+)\-(\d+)\-(\d+)$")</code> returns
|
|
<code><analyze-string-result
|
|
xmlns="http://www.w3.org/2005/xpath-functions">
|
|
<match><group nr="1">2008</group>-<group
|
|
nr="2">12</group>-<group
|
|
nr="3">03</group></match>
|
|
</analyze-string-result></code>.</p>
|
|
<p>The expression <code>fn:analyze-string("A1,C15,,D24, X50,",
|
|
"([A-Z])([0-9]+)")</code> returns <code><analyze-string-result
|
|
xmlns="http://www.w3.org/2005/xpath-functions">
|
|
<match><group nr="1">A</group><group
|
|
nr="2">1</group></match>
|
|
<non-match>,</non-match> <match><group
|
|
nr="1">C</group><group
|
|
nr="2">15</group></match>
|
|
<non-match>,,</non-match> <match><group
|
|
nr="1">D</group><group
|
|
nr="2">24</group></match> <non-match>,
|
|
</non-match> <match><group
|
|
nr="1">X</group><group
|
|
nr="2">50</group></match>
|
|
<non-match>,</non-match>
|
|
</analyze-string-result></code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="anyURI-functions" id="anyURI-functions"></a>6
|
|
Functions that manipulate URIs</h2>
|
|
<p>This section specifies functions that manipulate URI values,
|
|
either as instances of <code>xs:anyURI</code> or as strings.</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-resolve-uri"><code>fn:resolve-uri</code></a></td>
|
|
<td>Resolves a relative IRI reference against an absolute IRI.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-encode-for-uri"><code>fn:encode-for-uri</code></a></td>
|
|
<td>Encodes reserved characters in a string that is intended to be
|
|
used in the path segment of a URI.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-iri-to-uri"><code>fn:iri-to-uri</code></a></td>
|
|
<td>Converts a string containing an IRI into a URI according to the
|
|
rules of <a href="#rfc3987">[RFC 3987]</a>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-escape-html-uri"><code>fn:escape-html-uri</code></a></td>
|
|
<td>Escapes a URI in the same way that HTML user agents handle
|
|
attribute values expected to contain URIs.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div2">
|
|
<h3><a name="func-resolve-uri" id="func-resolve-uri"></a>6.1
|
|
fn:resolve-uri</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Resolves a relative IRI reference against an absolute IRI.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:resolve-uri</code>(<code class=
|
|
"arg">$relative</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string?</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:resolve-uri</code>(<code class=
|
|
"arg">$relative</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$base</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyURI?</code></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-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 base-uri.</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-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 second argument is absent, the effect is the same as
|
|
calling the two-argument function with the value of <a href=
|
|
"#func-static-base-uri"><code>fn:static-base-uri()</code></a> as
|
|
the second argument.</p>
|
|
<p>The function is defined to operate on IRI references as defined
|
|
in <a href="#rfc3987">[RFC 3987]</a>, and the implementation
|
|
<strong>must</strong> permit all arguments that are valid according
|
|
to that specification. In addition, the implementation
|
|
<strong>may</strong> accept some or all strings that conform to the
|
|
rules for (absolute or relative) Legacy Extended IRI references as
|
|
defined in <a href="#LEIRI">[Legacy extended IRIs for XML resource
|
|
identification]</a>. For the purposes of this section, the terms
|
|
IRI and IRI reference include these extensions, insofar as the
|
|
implementation chooses to support them.</p>
|
|
<p>If <code>$relative</code> is the empty sequence, the function
|
|
returns the empty sequence.</p>
|
|
<p>If <code>$relative</code> is an absolute IRI (as defined above),
|
|
then it is returned unchanged.</p>
|
|
<p>Otherwise, the function resolves the relative IRI reference
|
|
<code>$relative</code> against the base IRI <code>$base</code>
|
|
using the algorithm defined in <a href="#rfc3986">[RFC 3986]</a>,
|
|
adapted by treating any <a title="character" class="termref" href=
|
|
"#character"><span class="arrow">·</span>character<span class=
|
|
"arrow">·</span></a> that would not be valid in an RFC3986 URI or
|
|
relative reference in the same way that RFC3986 treats unreserved
|
|
characters. No percent-encoding takes place.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>The first form of this function resolves <code>$relative</code>
|
|
against the value of the base-uri property from the static context.
|
|
An error is raised [<a href="#ERRFONS0005" title=
|
|
"err:FONS0005">err:FONS0005</a>] if the base-uri property is not
|
|
initialized in the static context.</p>
|
|
<p>An error is raised [<a href="#ERRFORG0002" title=
|
|
"err:FORG0002">err:FORG0002</a>] if <code>$relative</code> is not a
|
|
valid IRI according to the rules of RFC3987, extended with an
|
|
implementation-defined subset of the extensions permitted in LEIRI,
|
|
or if it is not a suitable relative reference to use as input to
|
|
the RFC3986 resolution algorithm extended to handle additional
|
|
unreserved characters.</p>
|
|
<p>An error is raised [<a href="#ERRFORG0002" title=
|
|
"err:FORG0002">err:FORG0002</a>] if <code>$base</code> is not a
|
|
valid IRI according to the rules of RFC3987, extended with an
|
|
implementation-defined subset of the extensions permitted in LEIRI,
|
|
or if it is not a suitable IRI to use as input to the chosen
|
|
resolution algorithm (for example, if it is a relative IRI
|
|
reference, if it is a non-hierarchic URI, or if it contains a
|
|
fragment identifier), then .</p>
|
|
<p>An error is raised [<a href="#ERRFORG0009" title=
|
|
"err:FORG0009">err:FORG0009</a>] if the chosen resolution algorithm
|
|
fails for any other reason.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Resolving a URI does not dereference it. This is merely a
|
|
syntactic operation on two <a title="string" class="termref" href=
|
|
"#string"><span class="arrow">·</span>strings<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>The algorithms in the cited RFCs include some variations that
|
|
are optional or recommended rather than mandatory; they also
|
|
describe some common practices that are not recommended, but which
|
|
are permitted for backwards compatibility. Where the cited RFCs
|
|
permit variations in behavior, so does this specification.</p>
|
|
<p>Throughout this family of specifications, the phrase "resolving
|
|
a relative URI (or IRI) reference" should be understood as using
|
|
the rules of this function, unless otherwise stated.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-encode-for-uri" id="func-encode-for-uri"></a>6.2
|
|
fn:encode-for-uri</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Encodes reserved characters in a string that is intended to be
|
|
used in the path segment of a URI.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:encode-for-uri</code>(<code class=
|
|
"arg">$uri-part</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>
|
|
</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>$uri-part</code> is the empty sequence, the function
|
|
returns the zero-length string.</p>
|
|
<p>This function applies the URI escaping rules defined in section
|
|
2 of <a href="#rfc3986">[RFC 3986]</a> to the
|
|
<code>xs:string</code> supplied as <code>$uri-part</code>. The
|
|
effect of the function is to escape reserved characters. Each such
|
|
character in the string is replaced with its percent-encoded form
|
|
as described in <a href="#rfc3986">[RFC 3986]</a>.</p>
|
|
<p>Since <a href="#rfc3986">[RFC 3986]</a> recommends that, for
|
|
consistency, URI producers and normalizers should use uppercase
|
|
hexadecimal digits for all percent-encodings, this function must
|
|
always generate hexadecimal values using the upper-case letters
|
|
A-F.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>All characters are escaped except those identified as
|
|
"unreserved" by <a href="#rfc3986">[RFC 3986]</a>, that is the
|
|
upper- and lower-case letters A-Z, the digits 0-9, HYPHEN-MINUS
|
|
("-"), LOW LINE ("_"), FULL STOP ".", and TILDE "~".</p>
|
|
<p>This function escapes URI delimiters and therefore cannot be
|
|
used indiscriminately to encode "invalid" characters in a path
|
|
segment.</p>
|
|
<p>This function is invertible but not idempotent. This is because
|
|
a string containing a percent character will be modified by
|
|
applying the function: for example <code>100%</code> becomes
|
|
<code>100%25</code>, while <code>100%25</code> becomes
|
|
<code>100%2525</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:encode-for-uri("http://www.example.com/00/Weather/CA/Los%20Angeles#ocean")</code>
|
|
returns
|
|
<code>"http%3A%2F%2Fwww.example.com%2F00%2FWeather%2FCA%2FLos%2520Angeles%23ocean"</code>.
|
|
<em>(This is probably not what the user intended because all of the
|
|
delimiters have been encoded.).</em></p>
|
|
<p>The expression <code>concat("http://www.example.com/",
|
|
encode-for-uri("~bébé"))</code> returns
|
|
<code>"http://www.example.com/~b%C3%A9b%C3%A9"</code>.</p>
|
|
<p>The expression <code>concat("http://www.example.com/",
|
|
encode-for-uri("100% organic"))</code> returns
|
|
<code>"http://www.example.com/100%25%20organic"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-iri-to-uri" id="func-iri-to-uri"></a>6.3
|
|
fn:iri-to-uri</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Converts a string containing an IRI into a URI according to the
|
|
rules of <a href="#rfc3987">[RFC 3987]</a>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:iri-to-uri</code>(<code class=
|
|
"arg">$iri</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>
|
|
</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>$iri</code> is the empty sequence, the function returns
|
|
the zero-length string.</p>
|
|
<p>Otherwise, the function converts the value of <code>$iri</code>
|
|
into a URI according to the rules given in Section 3.1 of <a href=
|
|
"#rfc3987">[RFC 3987]</a> by percent-encoding characters that are
|
|
allowed in an IRI but not in a URI. If <code>$iri</code> contains a
|
|
character that is invalid in an IRI, such as the space character
|
|
(see note below), the invalid character is replaced by its
|
|
percent-encoded form as described in <a href="#rfc3986">[RFC
|
|
3986]</a> before the conversion is performed.</p>
|
|
<p>Since <a href="#rfc3986">[RFC 3986]</a> recommends that, for
|
|
consistency, URI producers and normalizers should use uppercase
|
|
hexadecimal digits for all percent-encodings, this function must
|
|
always generate hexadecimal values using the upper-case letters
|
|
A-F.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The function is idempotent but not invertible. Both the inputs
|
|
<code>My Documents</code> and <code>My%20Documents</code> will be
|
|
converted to the output <code>My%20Documents</code>.</p>
|
|
<p>This function does not check whether <code>$iri</code> is a
|
|
valid IRI. It treats it as an <a title="string" class="termref"
|
|
href="#string"><span class="arrow">·</span>string<span class=
|
|
"arrow">·</span></a> and operates on the <a title="character"
|
|
class="termref" href="#character"><span class=
|
|
"arrow">·</span>characters<span class="arrow">·</span></a> in the
|
|
string.</p>
|
|
<p>The following printable ASCII characters are invalid in an IRI:
|
|
"<", ">", " " " (double quote), space, "{", "}", "|", "\",
|
|
"^", and "`". Since these characters should not appear in an IRI,
|
|
if they do appear in <code>$iri</code> they will be
|
|
percent-encoded. In addition, characters outside the range
|
|
x20-<span>x7E</span> will be percent-encoded because they are
|
|
invalid in a URI.</p>
|
|
<p>Since this function does not escape the PERCENT SIGN "%" and
|
|
this character is not allowed in data within a URI, users wishing
|
|
to convert character strings (such as file names) that include "%"
|
|
to a URI should manually escape "%" by replacing it with "%25".</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:iri-to-uri
|
|
("http://www.example.com/00/Weather/CA/Los%20Angeles#ocean")</code>
|
|
returns
|
|
<code>"http://www.example.com/00/Weather/CA/Los%20Angeles#ocean"</code>.</p>
|
|
<p>The expression <code>fn:iri-to-uri
|
|
("http://www.example.com/~bébé")</code> returns
|
|
<code>"http://www.example.com/~b%C3%A9b%C3%A9"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-escape-html-uri" id=
|
|
"func-escape-html-uri"></a>6.4 fn:escape-html-uri</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Escapes a URI in the same way that HTML user agents handle
|
|
attribute values expected to contain URIs.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:escape-html-uri</code>(<code class=
|
|
"arg">$uri</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>
|
|
</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>$uri</code> is the empty sequence, the function returns
|
|
the zero-length string.</p>
|
|
<p>Otherwise, the function escapes all <a title="character" class=
|
|
"termref" href="#character"><span class=
|
|
"arrow">·</span>characters<span class="arrow">·</span></a> except
|
|
printable characters of the US-ASCII coded character set,
|
|
specifically the <a title="codepoint" class="termref" href=
|
|
"#codepoint"><span class="arrow">·</span>codepoints<span class=
|
|
"arrow">·</span></a> between 32 and 126 (decimal) inclusive. Each
|
|
character in <code>$uri</code> to be escaped is replaced by an
|
|
escape sequence, which is formed by encoding the character as a
|
|
sequence of octets in UTF-8, and then representing each of these
|
|
octets in the form %HH, where HH is the hexadecimal representation
|
|
of the octet. This function must always generate hexadecimal values
|
|
using the upper-case letters A-F.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The behavior of this function corresponds to the recommended
|
|
handling of non-ASCII characters in URI attribute values as
|
|
described in <a href="#HTML40">[HTML 4.0]</a> Appendix B.2.1.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:escape-html-uri
|
|
("http://www.example.com/00/Weather/CA/Los Angeles#ocean")</code>
|
|
returns <code>"http://www.example.com/00/Weather/CA/Los
|
|
Angeles#ocean"</code>.</p>
|
|
<p>The expression <code>fn:escape-html-uri ("javascript:if
|
|
(navigator.browserLanguage == 'fr')
|
|
window.open('http://www.example.com/~bébé');")</code> returns
|
|
<code>"javascript:if (navigator.browserLanguage == 'fr')
|
|
window.open('http://www.example.com/~b%C3%A9b%C3%A9');"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="boolean-functions" id="boolean-functions"></a>7
|
|
Functions and operators on Boolean values</h2>
|
|
<p>This section defines functions and operators on the
|
|
<code>xs:boolean</code> datatype.</p>
|
|
<div class="div2">
|
|
<h3><a name="boolean-constructors" id=
|
|
"boolean-constructors"></a>7.1 Boolean constant functions</h3>
|
|
<p>Since no literals are defined in XPath to reference the constant
|
|
boolean values true and false, two functions are provided for the
|
|
purpose.</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-true"><code>fn:true</code></a></td>
|
|
<td>Returns the <code>xs:boolean</code> value
|
|
<code>true</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-false"><code>fn:false</code></a></td>
|
|
<td>Returns the <code>xs:boolean</code> value
|
|
<code>false</code>.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-true" id="func-true"></a>7.1.1 fn:true</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:boolean</code> value <code>true</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:true</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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 result is equivalent to <code>xs:boolean("1")</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:true()</code> returns
|
|
<code>xs:boolean(1)</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-false" id="func-false"></a>7.1.2 fn:false</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:boolean</code> value
|
|
<code>false</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:false</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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 result is equivalent to <code>xs:boolean("0")</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:false()</code> returns
|
|
<code>xs:boolean(0)</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="op.boolean" id="op.boolean"></a>7.2 Operators on
|
|
Boolean values</h3>
|
|
<p>The following functions define the semantics of operators on
|
|
boolean values 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>:</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-boolean-equal"><code>op:boolean-equal</code></a></td>
|
|
<td>Returns <code>true</code> if the two arguments are the same
|
|
boolean value.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-boolean-less-than"><code>op:boolean-less-than</code></a></td>
|
|
<td>Returns true if the first argument is false and the second is
|
|
true.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-boolean-greater-than"><code>op:boolean-greater-than</code></a></td>
|
|
<td>Returns true if the first argument is true and the second is
|
|
false.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>The ordering operators <a href=
|
|
"#func-boolean-less-than"><code>op:boolean-less-than</code></a> and
|
|
<a href=
|
|
"#func-boolean-greater-than"><code>op:boolean-greater-than</code></a>
|
|
are provided for application purposes and for compatibility with
|
|
<a href="#xpath">[XML Path Language (XPath) Version 1.0]</a>. The
|
|
<a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a> datatype <code>xs:boolean</code> is not ordered.</p>
|
|
<div class="div3">
|
|
<h4><a name="func-boolean-equal" id="func-boolean-equal"></a>7.2.1
|
|
op:boolean-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if the two arguments are the same
|
|
boolean value.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" operator on
|
|
<code>xs:boolean</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:boolean-equal</code>(<code class=
|
|
"arg">$value1</code><code class=
|
|
"as"> as </code><code class="type">xs:boolean</code>,
|
|
<code class="arg">$value2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:boolean</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 returns <code>true</code> if both arguments are
|
|
<code>true</code> or if both arguments are <code>false</code>. It
|
|
returns <code>false</code> if one of the arguments is
|
|
<code>true</code> and the other argument is <code>false</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-boolean-less-than" id=
|
|
"func-boolean-less-than"></a>7.2.2 op:boolean-less-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the first argument is false and the second is
|
|
true.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "lt" operator on
|
|
<code>xs:boolean</code> values. Also used in the definition of the
|
|
"ge" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:boolean-less-than</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:boolean</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:boolean</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 returns <code>true</code> if <code>$arg1</code> is
|
|
<code>false</code> and <code>$arg2</code> is <code>true</code>.
|
|
Otherwise, it returns <code>false</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-boolean-greater-than" id=
|
|
"func-boolean-greater-than"></a>7.2.3 op:boolean-greater-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the first argument is true and the second is
|
|
false.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "gt" operator on
|
|
<code>xs:boolean</code> values. Also used in the definition of the
|
|
"le" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:boolean-greater-than</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:boolean</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:boolean</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:boolean-greater-than($A, $B)</code>
|
|
is defined to return the same result as <a href=
|
|
"#func-boolean-less-than"><code>op:boolean-less-than($B,
|
|
$A)</code></a></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="boolean-value-functions" id=
|
|
"boolean-value-functions"></a>7.3 Functions on Boolean values</h3>
|
|
<p>The following functions are defined on boolean values:</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-boolean"><code>fn:boolean</code></a></td>
|
|
<td>Computes the effective boolean value of the sequence
|
|
<code>$arg</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-not"><code>fn:not</code></a></td>
|
|
<td>Returns <code>true</code> if the effective boolean value of
|
|
<code>$arg</code> is <code>false</code>, or <code>false</code> if
|
|
it is <code>true</code>.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-boolean" id="func-boolean"></a>7.3.1
|
|
fn:boolean</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Computes the effective boolean value of the sequence
|
|
<code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:boolean</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:boolean</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function computes the effective boolean value of a sequence,
|
|
defined according to the following rules. See also <a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-ebv">Section 2.4.3 Effective
|
|
Boolean Value</a> <sup><small>XP30</small></sup>.</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <code>$arg</code> is the empty sequence,
|
|
<code>fn:boolean</code> returns <code>false</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <code>$arg</code> is a sequence whose first item is a node,
|
|
<code>fn:boolean</code> returns <code>true</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <code>$arg</code> is a singleton value of type
|
|
<code>xs:boolean</code> or a derived from <code>xs:boolean</code>,
|
|
<code>fn:boolean</code> returns <code>$arg</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <code>$arg</code> is a singleton value of type
|
|
<code>xs:string</code> or a type derived from
|
|
<code>xs:string</code>, <code>xs:anyURI</code> or a type derived
|
|
from <code>xs:anyURI</code> or <code>xs:untypedAtomic</code>,
|
|
<code>fn:boolean</code> returns <code>false</code> if the operand
|
|
value has zero length; otherwise it returns <code>true</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <code>$arg</code> is a singleton value of any numeric type or
|
|
a type derived from a numeric type, <code>fn:boolean</code> returns
|
|
<code>false</code> if the operand value is <code>NaN</code> or is
|
|
numerically equal to zero; otherwise it returns
|
|
<code>true</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>In all other cases, <code>fn:boolean</code> raises a type error
|
|
[<a href="#ERRFORG0006" title="err:FORG0006">err:FORG0006</a>].</p>
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The result of this function is not necessarily the same as
|
|
<code>$arg cast as xs:boolean</code>. For example,
|
|
<code>fn:boolean("false")</code> returns the value
|
|
<code>true</code> whereas <code>"false" cast as xs:boolean</code>
|
|
(which can also be written <code>xs:boolean("false")</code>)
|
|
returns <code>false</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$abc</code> := <code>("a", "b", "")</code></p>
|
|
<p><code>fn:boolean($abc)</code> raises a type error [<a href=
|
|
"#ERRFORG0006" title="err:FORG0006">err:FORG0006</a>].</p>
|
|
<p>The expression <code>fn:boolean($abc[1])</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:boolean($abc[0])</code> returns
|
|
<code>false()</code>.</p>
|
|
<p>The expression <code>fn:boolean($abc[3])</code> returns
|
|
<code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-not" id="func-not"></a>7.3.2 fn:not</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if the effective boolean value of
|
|
<code>$arg</code> is <code>false</code>, or <code>false</code> if
|
|
it is <code>true</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:not</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:boolean</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 value of <code>$arg</code> is first reduced to an effective
|
|
boolean value by applying the <a href=
|
|
"#func-boolean"><code>fn:boolean()</code></a> function. The
|
|
function returns <code>true</code> if the effective boolean value
|
|
is <code>false</code>, or <code>false</code> if the effective
|
|
boolean value is <code>true</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:not(fn:true())</code> returns
|
|
<code>false()</code>.</p>
|
|
<p>The expression <code>fn:not("false")</code> returns
|
|
<code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="durations" id="durations"></a>8 Functions and
|
|
operators on durations</h2>
|
|
<p>Operators are defined on the following type:</p>
|
|
<ul>
|
|
<li>
|
|
<p>xs:duration</p>
|
|
</li>
|
|
</ul>
|
|
<p>and on the two defined subtypes (see <a href=
|
|
"#duration-subtypes"><b>8.1 Two totally ordered subtypes of
|
|
duration</b></a>):</p>
|
|
<ul>
|
|
<li>
|
|
<p>xs:yearMonthDuration</p>
|
|
</li>
|
|
<li>
|
|
<p>xs:dayTimeDuration</p>
|
|
</li>
|
|
</ul>
|
|
<p>No ordering relation is defined on <code>xs:duration</code>
|
|
values. Two <code>xs:duration</code> values may however be compared
|
|
for equality.</p>
|
|
<p>Operations on durations (including equality comparison, casting
|
|
to string, and extraction of components) all treat the duration as
|
|
normalized. This means that the seconds and minutes components will
|
|
always be less than 60, the hours component less than 24, and the
|
|
months component less than 12. Thus, for example, a duration of 120
|
|
seconds always gives the same result as a duration of two
|
|
minutes.</p>
|
|
<p>Conditions such as underflow and overflow may occur with
|
|
arithmetic on durations: see <a href="#duration-limits"><b>9.7.1
|
|
Limits and precision</b></a></p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>This means that in practice, the information content of an
|
|
<code>xs:duration</code> value can be reduced to an
|
|
<code>xs:integer</code> number of months, and an
|
|
<code>xs:decimal</code> number of seconds. For the two defined
|
|
subtypes this is further simplified so that one of these two
|
|
components is fixed at zero. Operations such as comparison of
|
|
durations and arithmetic on durations can be expressed in terms of
|
|
numeric operations applied to these two components.</p>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="duration-subtypes" id="duration-subtypes"></a>8.1 Two
|
|
totally ordered subtypes of duration</h3>
|
|
<p>Two totally ordered subtypes of <code>xs:duration</code> are
|
|
defined in <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#types">Section 2.7 Schema
|
|
Information</a> <sup><small>DM30</small></sup> specification using
|
|
the mechanisms described in <a href="#xmlschema-2">[XML Schema Part
|
|
2: Datatypes Second Edition]</a> for defining user-defined types.
|
|
Additional details about these types is given below.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>These types were not defined in XSD 1.0, but they are defined in
|
|
the current draft of XSD 1.1. The description given here is
|
|
believed to be equivalent to that in XSD 1.1, and will become
|
|
non-normative when XSD 1.1 reaches Recommendation status.</p>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="dt-yearMonthDuration" id=
|
|
"dt-yearMonthDuration"></a>8.1.1 xs:yearMonthDuration</h4>
|
|
<p>[Definition] <code>xs:yearMonthDuration</code> is derived from
|
|
<code>xs:duration</code> by restricting its lexical representation
|
|
to contain only the year and month components. The value space of
|
|
<code>xs:yearMonthDuration</code> is the set of
|
|
<code>xs:integer</code> month values. The year and month components
|
|
of <code>xs:yearMonthDuration</code> correspond to the Gregorian
|
|
year and month components defined in section 5.5.3.2 of <a href=
|
|
"#ISO8601">[ISO 8601]</a>, respectively.</p>
|
|
<div class="div4">
|
|
<h5><a name="lexical-yearMonthDuration" id=
|
|
"lexical-yearMonthDuration"></a>8.1.1.1 Lexical representation</h5>
|
|
<p>The lexical representation for <code>xs:yearMonthDuration</code>
|
|
is the <a href="#ISO8601">[ISO 8601]</a> reduced format PnYnM,
|
|
where nY represents the number of years and nM the number of
|
|
months. The values of the years and months components are not
|
|
restricted but allow an arbitrary unsigned
|
|
<code>xs:integer</code>.</p>
|
|
<p>An optional preceding minus sign ('-') is allowed to indicate a
|
|
negative duration. If the sign is omitted a positive duration is
|
|
indicated. To indicate a <code>xs:yearMonthDuration</code> of 1
|
|
year, 2 months, one would write: P1Y2M. One could also indicate a
|
|
<code>xs:yearMonthDuration</code> of minus 13 months as: -P13M.</p>
|
|
<p>Reduced precision and truncated representations of this format
|
|
are allowed provided they conform to the following:</p>
|
|
<p>If the number of years or months in any expression equals zero
|
|
(0), the number and its corresponding designator <a title="may"
|
|
class="termref" href="#may"><span class=
|
|
"arrow">·</span>may<span class="arrow">·</span></a> be omitted.
|
|
However, at least one number and its designator <a title="must"
|
|
class="termref" href="#must"><span class=
|
|
"arrow">·</span>must<span class="arrow">·</span></a> be present.
|
|
For example, P1347Y and P1347M are allowed; P-1347M is not allowed,
|
|
although -P1347M is allowed. P1Y2MT is not allowed. Also, P24YM is
|
|
not allowed, nor is PY43M since Y must have at least one preceding
|
|
digit and M must have one preceding digit.</p>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="calculating-value-yearMonthDuration" id=
|
|
"calculating-value-yearMonthDuration"></a>8.1.1.2 Calculating the
|
|
value from the lexical representation</h5>
|
|
<p>The value of a <code>xs:yearMonthDuration</code> lexical form is
|
|
obtained by multiplying the value of the years component by 12 and
|
|
adding the value of the months component. The value is positive or
|
|
negative depending on the preceding sign.</p>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="canonical-yearMonthDuration" id=
|
|
"canonical-yearMonthDuration"></a>8.1.1.3 Canonical
|
|
representation</h5>
|
|
<p>The canonical representation of
|
|
<code>xs:yearMonthDuration</code> restricts the value of the months
|
|
component to <code>xs:integer</code> values between 0 and 11, both
|
|
inclusive. To convert from a non-canonical representation to the
|
|
canonical representation, the lexical representation is first
|
|
converted to a value in <code>xs:integer</code> months as defined
|
|
above. This value is then divided by 12 to obtain the value of the
|
|
years component of the canonical representation. The remaining
|
|
number of months is the value of the months component of the
|
|
canonical representation. For negative durations, the canonical
|
|
form is calculated using the absolute value of the duration and a
|
|
negative sign is prepended to it. If a component has the value zero
|
|
(0), then the number and the designator for that component
|
|
<a title="must" class="termref" href="#must"><span class=
|
|
"arrow">·</span>must<span class="arrow">·</span></a> be omitted.
|
|
However, if the value is zero (0) months, the canonical form is
|
|
"P0M".</p>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="order-yearMonthDuration" id=
|
|
"order-yearMonthDuration"></a>8.1.1.4 Order relation on
|
|
xs:yearMonthDuration</h5>
|
|
<p>Let the function that calculates the value of an
|
|
<code>xs:yearMonthDuration</code> in the manner described above be
|
|
called V(d). Then for two <code>xs:yearMonthDuration</code> values
|
|
x and y, x > y if and only if V(x) > V(y). The order relation
|
|
on <code>yearMonthDuration</code> is a total order.</p>
|
|
</div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="dt-dayTimeDuration" id="dt-dayTimeDuration"></a>8.1.2
|
|
xs:dayTimeDuration</h4>
|
|
<p>[Definition] <code>xs:dayTimeDuration</code> is derived from
|
|
<code>xs:duration</code> by restricting its lexical representation
|
|
to contain only the days, hours, minutes and seconds components.
|
|
The value space of <code>xs:dayTimeDuration</code> is the set of
|
|
fractional second values. The components of
|
|
<code>xs:dayTimeDuration</code> correspond to the day, hour, minute
|
|
and second components defined in Section 5.5.3.2 of <a href=
|
|
"#ISO8601">[ISO 8601]</a>, respectively.</p>
|
|
<div class="div4">
|
|
<h5><a name="lexical-dayTimeDuration" id=
|
|
"lexical-dayTimeDuration"></a>8.1.2.1 Lexical representation</h5>
|
|
<p>The lexical representation for <code>xs:dayTimeDuration</code>
|
|
is the <a href="#ISO8601">[ISO 8601]</a> truncated format
|
|
PnDTnHnMnS, where nD represents the number of days, T is the
|
|
date/time separator, nH the number of hours, nM the number of
|
|
minutes and nS the number of seconds.</p>
|
|
<p>The values of the days, hours and minutes components are not
|
|
restricted, but allow an arbitrary unsigned
|
|
<code>xs:integer</code>. Similarly, the value of the seconds
|
|
component allows an arbitrary unsigned <code>xs:decimal</code>. An
|
|
optional minus sign ('-') is allowed to precede the 'P', indicating
|
|
a negative duration. If the sign is omitted, the duration is
|
|
positive. See also <a href="#ISO8601">[ISO 8601]</a> Date and Time
|
|
Formats.</p>
|
|
<p>For example, to indicate a duration of 3 days, 10 hours and 30
|
|
minutes, one would write: P3DT10H30M. One could also indicate a
|
|
duration of minus 120 days as: -P120D. Reduced precision and
|
|
truncated representations of this format are allowed, provided they
|
|
conform to the following:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If the number of days, hours, minutes, or seconds in any
|
|
expression equals zero (0), the number and its corresponding
|
|
designator <a title="may" class="termref" href="#may"><span class=
|
|
"arrow">·</span>may<span class="arrow">·</span></a> be omitted.
|
|
However, at least one number and its designator <a title="must"
|
|
class="termref" href="#must"><span class=
|
|
"arrow">·</span>must<span class="arrow">·</span></a> be
|
|
present.</p>
|
|
</li>
|
|
<li>
|
|
<p>The seconds part <a title="may" class="termref" href=
|
|
"#may"><span class="arrow">·</span>may<span class=
|
|
"arrow">·</span></a> have a decimal fraction.</p>
|
|
</li>
|
|
<li>
|
|
<p>The designator 'T' <a title="must" class="termref" href=
|
|
"#must"><span class="arrow">·</span>must<span class=
|
|
"arrow">·</span></a> be absent if and only if all of the time items
|
|
are absent. The designator 'P' <a title="must" class="termref"
|
|
href="#must"><span class="arrow">·</span>must<span class=
|
|
"arrow">·</span></a> always be present.</p>
|
|
</li>
|
|
</ul>
|
|
<p>For example, P13D, PT47H, P3DT2H, -PT35.89S and P4DT251M are all
|
|
allowed. P-134D is not allowed (invalid location of minus sign),
|
|
although -P134D is allowed.</p>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="calculating-value-dayTimeDuration" id=
|
|
"calculating-value-dayTimeDuration"></a>8.1.2.2 Calculating the
|
|
value of a xs:dayTimeDuration from the lexical representation</h5>
|
|
<p>The value of a <code>xs:dayTimeDuration</code> lexical form in
|
|
fractional seconds is obtained by converting the days, hours,
|
|
minutes and seconds value to fractional seconds using the
|
|
conversion rules: 24 hours = 1 day, 60 minutes = 1 hour and 60
|
|
seconds = 1 minute.</p>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="canonical-dayTimeDuration" id=
|
|
"canonical-dayTimeDuration"></a>8.1.2.3 Canonical
|
|
representation</h5>
|
|
<p>The canonical representation of <code>xs:dayTimeDuration</code>
|
|
restricts the value of the hours component to
|
|
<code>xs:integer</code> values between 0 and 23, both inclusive;
|
|
the value of the minutes component to <code>xs:integer</code>
|
|
values between 0 and 59; both inclusive; and the value of the
|
|
seconds component to <code>xs:decimal</code> valued from 0.0 to
|
|
59.999... (see <a href="#xmlschema-2">[XML Schema Part 2: Datatypes
|
|
Second Edition]</a>, Appendix D).</p>
|
|
<p>To convert from a non-canonical representation to the canonical
|
|
representation, the value of the lexical form in fractional seconds
|
|
is first calculated in the manner described above. The value of the
|
|
days component in the canonical form is then calculated by dividing
|
|
the value by 86,400 (24*60*60). The remainder is in fractional
|
|
seconds. The value of the hours component in the canonical form is
|
|
calculated by dividing this remainder by 3,600 (60*60). The
|
|
remainder is again in fractional seconds. The value of the minutes
|
|
component in the canonical form is calculated by dividing this
|
|
remainder by 60. The remainder in fractional seconds is the value
|
|
of the seconds component in the canonical form. For negative
|
|
durations, the canonical form is calculated using the absolute
|
|
value of the duration and a negative sign is prepended to it. If a
|
|
component has the value zero (0) then the number and the designator
|
|
for that component must be omitted. However, if all the components
|
|
of the lexical form are zero (0), the canonical form is "PT0S".</p>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="order-dayTimeDuration" id=
|
|
"order-dayTimeDuration"></a>8.1.2.4 Order relation on
|
|
xs:dayTimeDuration</h5>
|
|
<p>Let the function that calculates the value of a
|
|
<code>xs:dayTimeDuration</code> in the manner described above be
|
|
called <em>V(d)</em>. Then for two <code>xs:dayTimeDuration</code>
|
|
values <em>x</em> and <em>y, x > y</em> if and only if <em>V(x)
|
|
> V(y)</em>. The order relation on
|
|
<code>xs:dayTimeDuration</code> is a total order.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="comp.duration" id="comp.duration"></a>8.2 Comparison
|
|
operators on durations</h3>
|
|
<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-yearMonthDuration-less-than"><code>op:yearMonthDuration-less-than</code></a></td>
|
|
<td>Returns true if <code>$arg1</code> is a shorter duration than
|
|
<code>$arg2</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-yearMonthDuration-greater-than"><code>op:yearMonthDuration-greater-than</code></a></td>
|
|
<td>Returns true if <code>$arg1</code> is a longer duration than
|
|
<code>$arg2</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-dayTimeDuration-less-than"><code>op:dayTimeDuration-less-than</code></a></td>
|
|
<td>Returns true if <code>$arg1</code> is a shorter duration than
|
|
<code>$arg2</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-dayTimeDuration-greater-than"><code>op:dayTimeDuration-greater-than</code></a></td>
|
|
<td>Returns true if <code>$arg1</code> is a longer duration than
|
|
<code>$arg2</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-duration-equal"><code>op:duration-equal</code></a></td>
|
|
<td>Returns true if <code>$arg1</code> and <code>$arg2</code> are
|
|
durations of the same length.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>The following comparison operators are defined on the <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
duration datatypes. Each operator takes two operands of the same
|
|
type and returns an <code>xs:boolean</code> result. As discussed in
|
|
<a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a>, the order relation on <code>xs:duration</code> is a
|
|
partial order rather than a total order. For this reason, only
|
|
equality is defined on <code>xs:duration</code>. A full complement
|
|
of comparison and arithmetic functions are defined on the two
|
|
subtypes of duration described in <a href=
|
|
"#duration-subtypes"><b>8.1 Two totally ordered subtypes of
|
|
duration</b></a> which do have a total order.</p>
|
|
<div class="div3">
|
|
<h4><a name="func-yearMonthDuration-less-than" id=
|
|
"func-yearMonthDuration-less-than"></a>8.2.1
|
|
op:yearMonthDuration-less-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if <code>$arg1</code> is a shorter duration than
|
|
<code>$arg2</code>.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "lt" operator on
|
|
<code>xs:yearMonthDuration</code> values. Also used in the
|
|
definition of the "ge" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:yearMonthDuration-less-than</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If the number of months in the value of <code>$arg1</code> is
|
|
numerically less than the number of months in the value of
|
|
<code>$arg2</code>, the function returns true.</p>
|
|
<p>Otherwise, the function returns false.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either or both durations may be negative</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-yearMonthDuration-greater-than" id=
|
|
"func-yearMonthDuration-greater-than"></a>8.2.2
|
|
op:yearMonthDuration-greater-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if <code>$arg1</code> is a longer duration than
|
|
<code>$arg2</code>.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "gt" operator on
|
|
<code>xs:yearMonthDuration</code> values. Also used in the
|
|
definition of the "le" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:yearMonthDuration-greater-than</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function call <code>op:yearMonthDuration-greater-than($A,
|
|
$B)</code> is defined to return the same result as <a href=
|
|
"#func-yearMonthDuration-less-than"><code>op:yearMonthDuration-less-than($B,
|
|
$A)</code></a></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-dayTimeDuration-less-than" id=
|
|
"func-dayTimeDuration-less-than"></a>8.2.3
|
|
op:dayTimeDuration-less-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if <code>$arg1</code> is a shorter duration than
|
|
<code>$arg2</code>.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "lt" operator on
|
|
<code>xs:dayTimeDuration</code> values. Also used in the definition
|
|
of the "ge" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:dayTimeDuration-less-than</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If the number of seconds in the value of <code>$arg1</code> is
|
|
numerically less than the number of seconds in the value of
|
|
<code>$arg2</code>, the function returns true.</p>
|
|
<p>Otherwise, the function returns false.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either or both durations may be negative</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-dayTimeDuration-greater-than" id=
|
|
"func-dayTimeDuration-greater-than"></a>8.2.4
|
|
op:dayTimeDuration-greater-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if <code>$arg1</code> is a longer duration than
|
|
<code>$arg2</code>.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "gt" operator on
|
|
<code>xs:dayTimeDuration</code> values. Also used in the definition
|
|
of the "le" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:dayTimeDuration-greater-than</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function call <code>op:dayTimeDuration-greater-than($A,
|
|
$B)</code> is defined to return the same result as <a href=
|
|
"#func-dayTimeDuration-less-than"><code>op:dayTimeDuration-less-than($B,
|
|
$A)</code></a></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-duration-equal" id=
|
|
"func-duration-equal"></a>8.2.5 op:duration-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if <code>$arg1</code> and <code>$arg2</code> are
|
|
durations of the same length.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" operators on
|
|
<code>xs:duration</code> values. Also used in the definition of the
|
|
"ne" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:duration-equal</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:duration</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:duration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If the <code>xs:yearMonthDuration</code> components of
|
|
<code>$arg1</code> and <code>$arg2</code> are equal and the
|
|
<code>xs:dayTimeDuration</code> components of <code>$arg1</code>
|
|
and <code>$arg2</code> are equal, the function returns
|
|
<code>true</code>.</p>
|
|
<p>Otherwise, the function returns false.</p>
|
|
<p>The semantics of this function are:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
xs:yearMonthDuration($arg1) div xs:yearMonthDuration('P1M') eq
|
|
xs:yearMonthDuration($arg2) div xs:yearMonthDuration('P1M')
|
|
and
|
|
xs:dayTimeDuration($arg1) div xs:dayTimeDuration('PT1S') eq
|
|
xs:dayTimeDuration($arg2) div xs:dayTimeDuration('PT1S')
|
|
</pre></div>
|
|
<p>that is, the function returns <code>true</code> if the months
|
|
and seconds values of the two durations are equal.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Note that this function, like any other, may be applied to
|
|
arguments that are derived from the types given in the function
|
|
signature, including the two subtypes
|
|
<code>xs:dayTimeDuration</code> and
|
|
<code>xs:yearMonthDuration</code>. With the exception of the
|
|
zero-length duration, no instance of
|
|
<code>xs:dayTimeDuration</code> can ever be equal to an instance of
|
|
<code>xs:yearMonthDuration</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>op:duration-equal(xs:duration("P1Y"),
|
|
xs:duration("P12M"))</code> returns <code>true()</code>.</p>
|
|
<p>The expression <code>op:duration-equal(xs:duration("PT24H"),
|
|
xs:duration("P1D"))</code> returns <code>true()</code>.</p>
|
|
<p>The expression <code>op:duration-equal(xs:duration("P1Y"),
|
|
xs:duration("P365D"))</code> returns <code>false()</code>.</p>
|
|
<p>The expression
|
|
<code>op:duration-equal(xs:yearMonthDuration("P0Y"),
|
|
xs:dayTimeDuration("P0D"))</code> returns <code>true()</code>.</p>
|
|
<p>The expression
|
|
<code>op:duration-equal(xs:yearMonthDuration("P1Y"),
|
|
xs:dayTimeDuration("P365D"))</code> returns
|
|
<code>false()</code>.</p>
|
|
<p>The expression
|
|
<code>op:duration-equal(xs:yearMonthDuration("P2Y"),
|
|
xs:yearMonthDuration("P24M"))</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression
|
|
<code>op:duration-equal(xs:dayTimeDuration("P10D"),
|
|
xs:dayTimeDuration("PT240H"))</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression
|
|
<code>op:duration-equal(xs:duration("P2Y0M0DT0H0M0S"),
|
|
xs:yearMonthDuration("P24M"))</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>op:duration-equal(xs:duration("P0Y0M10D"),
|
|
xs:dayTimeDuration("PT240H"))</code> returns
|
|
<code>true()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="component-extraction-durations" id=
|
|
"component-extraction-durations"></a>8.3 Component extraction
|
|
functions on durations</h3>
|
|
<p>The duration datatype may be considered to be a composite
|
|
datatypes in that it contains distinct properties or components.
|
|
The extraction functions specified below extract a single component
|
|
from a duration value. For <code>xs:duration</code> and its
|
|
subtypes, including the two subtypes
|
|
<code>xs:yearMonthDuration</code> and
|
|
<code>xs:dayTimeDuration</code>, the components are normalized:
|
|
this means that the seconds and minutes components will always be
|
|
less than 60, the hours component less than 24, and the months
|
|
component less than 12.</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-years-from-duration"><code>fn:years-from-duration</code></a></td>
|
|
<td>Returns the number of years in a duration.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-months-from-duration"><code>fn:months-from-duration</code></a></td>
|
|
<td>Returns the number of months in a duration.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-days-from-duration"><code>fn:days-from-duration</code></a></td>
|
|
<td>Returns the number of days in a duration.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-hours-from-duration"><code>fn:hours-from-duration</code></a></td>
|
|
<td>Returns the number of hours in a duration.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-minutes-from-duration"><code>fn:minutes-from-duration</code></a></td>
|
|
<td>Returns the number of minutes in a duration.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-seconds-from-duration"><code>fn:seconds-from-duration</code></a></td>
|
|
<td>Returns the number of seconds in a duration.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-years-from-duration" id=
|
|
"func-years-from-duration"></a>8.3.1 fn:years-from-duration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the number of years in a duration.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:years-from-duration</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:duration?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
representing the years component in the value of <code>$arg</code>.
|
|
The result is obtained by casting <code>$arg</code> to an
|
|
<code>xs:yearMonthDuration</code> (see <a href=
|
|
"#casting-to-durations"><b>18.1.3 Casting to duration
|
|
types</b></a>) and then computing the years component as described
|
|
in <a href="#canonical-yearMonthDuration"><b>8.1.1.3 Canonical
|
|
representation</b></a>.</p>
|
|
<p>If <code>$arg</code> is a negative duration then the result will
|
|
be negative..</p>
|
|
<p>If <code>$arg</code> is an <code>xs:dayTimeDuration</code> the
|
|
function returns 0.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:years-from-duration(xs:yearMonthDuration("P20Y15M"))</code>
|
|
returns <code>21</code>.</p>
|
|
<p>The expression
|
|
<code>fn:years-from-duration(xs:yearMonthDuration("-P15M"))</code>
|
|
returns <code>-1</code>.</p>
|
|
<p>The expression
|
|
<code>fn:years-from-duration(xs:dayTimeDuration("-P2DT15H"))</code>
|
|
returns <code>0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-months-from-duration" id=
|
|
"func-months-from-duration"></a>8.3.2 fn:months-from-duration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the number of months in a duration.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:months-from-duration</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:duration?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
representing the months component in the value of
|
|
<code>$arg</code>. The result is obtained by casting
|
|
<code>$arg</code> to an <code>xs:yearMonthDuration</code> (see
|
|
<a href="#casting-to-durations"><b>18.1.3 Casting to duration
|
|
types</b></a>) and then computing the months component as described
|
|
in <a href="#canonical-yearMonthDuration"><b>8.1.1.3 Canonical
|
|
representation</b></a>.</p>
|
|
<p>If <code>$arg</code> is a negative duration then the result will
|
|
be negative..</p>
|
|
<p>If <code>$arg</code> is an <code>xs:dayTimeDuration</code> the
|
|
function returns 0.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:months-from-duration(xs:yearMonthDuration("P20Y15M"))</code>
|
|
returns <code>3</code>.</p>
|
|
<p>The expression
|
|
<code>fn:months-from-duration(xs:yearMonthDuration("-P20Y18M"))</code>
|
|
returns <code>-6</code>.</p>
|
|
<p>The expression
|
|
<code>fn:months-from-duration(xs:dayTimeDuration("-P2DT15H0M0S"))</code>
|
|
returns <code>0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-days-from-duration" id=
|
|
"func-days-from-duration"></a>8.3.3 fn:days-from-duration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the number of days in a duration.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:days-from-duration</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:duration?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
representing the days component in the value of <code>$arg</code>.
|
|
The result is obtained by casting <code>$arg</code> to an
|
|
<code>xs:dayTimeDuration</code> (see <a href=
|
|
"#casting-to-durations"><b>18.1.3 Casting to duration
|
|
types</b></a>) and then computing the days component as described
|
|
in <a href="#canonical-dayTimeDuration"><b>8.1.2.3 Canonical
|
|
representation</b></a>.</p>
|
|
<p>If <code>$arg</code> is a negative duration then the result will
|
|
be negative..</p>
|
|
<p>If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the
|
|
function returns 0.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:days-from-duration(xs:dayTimeDuration("P3DT10H"))</code>
|
|
returns <code>3</code>.</p>
|
|
<p>The expression
|
|
<code>fn:days-from-duration(xs:dayTimeDuration("P3DT55H"))</code>
|
|
returns <code>5</code>.</p>
|
|
<p>The expression
|
|
<code>fn:days-from-duration(xs:yearMonthDuration("P3Y5M"))</code>
|
|
returns <code>0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-hours-from-duration" id=
|
|
"func-hours-from-duration"></a>8.3.4 fn:hours-from-duration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the number of hours in a duration.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:hours-from-duration</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:duration?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
representing the hours component in the value of <code>$arg</code>.
|
|
The result is obtained by casting <code>$arg</code> to an
|
|
<code>xs:dayTimeDuration</code> (see <a href=
|
|
"#casting-to-durations"><b>18.1.3 Casting to duration
|
|
types</b></a>) and then computing the hours component as described
|
|
in <a href="#canonical-dayTimeDuration"><b>8.1.2.3 Canonical
|
|
representation</b></a>.</p>
|
|
<p>If <code>$arg</code> is a negative duration then the result will
|
|
be negative..</p>
|
|
<p>If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the
|
|
function returns 0.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:hours-from-duration(xs:dayTimeDuration("P3DT10H"))</code>
|
|
returns <code>10</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-duration(xs:dayTimeDuration("P3DT12H32M12S"))</code>
|
|
returns <code>12</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-duration(xs:dayTimeDuration("PT123H"))</code>
|
|
returns <code>3</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-duration(xs:dayTimeDuration("-P3DT10H"))</code>
|
|
returns <code>-10</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-minutes-from-duration" id=
|
|
"func-minutes-from-duration"></a>8.3.5
|
|
fn:minutes-from-duration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the number of minutes in a duration.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:minutes-from-duration</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:duration?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
representing the minutes component in the value of
|
|
<code>$arg</code>. The result is obtained by casting
|
|
<code>$arg</code> to an <code>xs:dayTimeDuration</code> (see
|
|
<a href="#casting-to-durations"><b>18.1.3 Casting to duration
|
|
types</b></a>) and then computing the minutes component as
|
|
described in <a href="#canonical-dayTimeDuration"><b>8.1.2.3
|
|
Canonical representation</b></a>.</p>
|
|
<p>If <code>$arg</code> is a negative duration then the result will
|
|
be negative..</p>
|
|
<p>If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the
|
|
function returns 0.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:minutes-from-duration(xs:dayTimeDuration("P3DT10H"))</code>
|
|
returns <code>0</code>.</p>
|
|
<p>The expression
|
|
<code>fn:minutes-from-duration(xs:dayTimeDuration("-P5DT12H30M"))</code>
|
|
returns <code>-30</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-seconds-from-duration" id=
|
|
"func-seconds-from-duration"></a>8.3.6
|
|
fn:seconds-from-duration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the number of seconds in a duration.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:seconds-from-duration</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:duration?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:decimal?</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 function returns an <code>xs:decimal</code>
|
|
representing the seconds component in the value of
|
|
<code>$arg</code>. The result is obtained by casting
|
|
<code>$arg</code> to an <code>xs:dayTimeDuration</code> (see
|
|
<a href="#casting-to-durations"><b>18.1.3 Casting to duration
|
|
types</b></a>) and then computing the seconds component as
|
|
described in <a href="#canonical-dayTimeDuration"><b>8.1.2.3
|
|
Canonical representation</b></a>.</p>
|
|
<p>If <code>$arg</code> is a negative duration then the result will
|
|
be negative..</p>
|
|
<p>If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the
|
|
function returns 0.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:seconds-from-duration(xs:dayTimeDuration("P3DT10H12.5S"))</code>
|
|
returns <code>12.5</code>.</p>
|
|
<p>The expression
|
|
<code>fn:seconds-from-duration(xs:dayTimeDuration("-PT256S"))</code>
|
|
returns <code>-16.0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="duration-arithmetic" id="duration-arithmetic"></a>8.4
|
|
Arithmetic operators on durations</h3>
|
|
<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-add-yearMonthDurations"><code>op:add-yearMonthDurations</code></a></td>
|
|
<td>Returns the result of adding two
|
|
<code>xs:yearMonthDuration</code> values.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-subtract-yearMonthDurations"><code>op:subtract-yearMonthDurations</code></a></td>
|
|
<td>Returns the result of subtracting one
|
|
<code>xs:yearMonthDuration</code> value from another.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-multiply-yearMonthDuration"><code>op:multiply-yearMonthDuration</code></a></td>
|
|
<td>Returns the result of multiplying the value of
|
|
<code>$arg1</code> by <code>$arg2</code>. The result is rounded to
|
|
the nearest month.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-divide-yearMonthDuration"><code>op:divide-yearMonthDuration</code></a></td>
|
|
<td>Returns the result of dividing the value of <code>$arg1</code>
|
|
by <code>$arg2</code>. The result is rounded to the nearest
|
|
month.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-divide-yearMonthDuration-by-yearMonthDuration"><code>op:divide-yearMonthDuration-by-yearMonthDuration</code></a></td>
|
|
<td>Returns the ratio of two <code>xs:yearMonthDuration</code>
|
|
values.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-add-dayTimeDurations"><code>op:add-dayTimeDurations</code></a></td>
|
|
<td>Returns the sum of two <code>xs:dayTimeDuration</code>
|
|
values.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-subtract-dayTimeDurations"><code>op:subtract-dayTimeDurations</code></a></td>
|
|
<td>Returns the result of subtracting one
|
|
<code>xs:dayTimeDuration</code> from another.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-multiply-dayTimeDuration"><code>op:multiply-dayTimeDuration</code></a></td>
|
|
<td>Returns the result of multiplying a
|
|
<code>xs:dayTimeDuration</code> by a number.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-divide-dayTimeDuration"><code>op:divide-dayTimeDuration</code></a></td>
|
|
<td>Returns the result of multiplying a
|
|
<code>xs:dayTimeDuration</code> by a number.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-divide-dayTimeDuration-by-dayTimeDuration"><code>op:divide-dayTimeDuration-by-dayTimeDuration</code></a></td>
|
|
<td>Returns the ratio of two <code>xs:dayTimeDuration</code>
|
|
values, as a decimal number.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>For operators that combine a duration and a date/time value, see
|
|
<a href="#dateTime-arithmetic"><b>9.7 Arithmetic operators on
|
|
durations, dates and times</b></a>.</p>
|
|
<div class="div3">
|
|
<h4><a name="func-add-yearMonthDurations" id=
|
|
"func-add-yearMonthDurations"></a>8.4.1
|
|
op:add-yearMonthDurations</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the result of adding two
|
|
<code>xs:yearMonthDuration</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "+" operator on
|
|
<code>xs:yearMonthDuration</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:add-yearMonthDurations</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:yearMonthDuration</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the result of adding the value of
|
|
<code>$arg1</code> to the value of <code>$arg2</code>. The result
|
|
will be an <code>xs:yearMonthDuration</code> whose length in months
|
|
is equal to the length in months of <code>$arg1</code> plus the
|
|
length in months of <code>$arg2</code>.</p>
|
|
<p>For handling of overflow, see <a href=
|
|
"#duration-limits"><b>9.7.1 Limits and precision</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either duration (and therefore the result) may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:add-yearMonthDurations(xs:yearMonthDuration("P2Y11M"),
|
|
xs:yearMonthDuration("P3Y3M"))</code> returns
|
|
<code>xs:yearMonthDuration("P6Y2M")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subtract-yearMonthDurations" id=
|
|
"func-subtract-yearMonthDurations"></a>8.4.2
|
|
op:subtract-yearMonthDurations</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the result of subtracting one
|
|
<code>xs:yearMonthDuration</code> value from another.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "-" operator on
|
|
<code>xs:yearMonthDuration</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:subtract-yearMonthDurations</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:yearMonthDuration</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the result of subtracting the value of
|
|
<code>$arg2</code> from the value of <code>$arg1</code>. The result
|
|
will be an <code>xs:yearMonthDuration</code> whose length in months
|
|
is equal to the length in months of <code>$arg1</code> minus the
|
|
length in months of <code>$arg2</code>.</p>
|
|
<p>For handling of overflow, see <a href=
|
|
"#duration-limits"><b>9.7.1 Limits and precision</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either duration (and therefore the result) may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:subtract-yearMonthDurations(xs:yearMonthDuration("P2Y11M"),
|
|
xs:yearMonthDuration("P3Y3M"))</code> returns
|
|
<code>xs:yearMonthDuration("-P4M")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-multiply-yearMonthDuration" id=
|
|
"func-multiply-yearMonthDuration"></a>8.4.3
|
|
op:multiply-yearMonthDuration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the result of multiplying the value of
|
|
<code>$arg1</code> by <code>$arg2</code>. The result is rounded to
|
|
the nearest month.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "*" operator on
|
|
<code>xs:yearMonthDuration</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:multiply-yearMonthDuration</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:double</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:yearMonthDuration</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The result is the <code>xs:yearMonthDuration</code> whose length
|
|
in months is equal to the result of applying the <a href=
|
|
"#func-round"><code>fn:round</code></a> function to the value
|
|
obtained by multiplying the length in months of <code>$arg1</code>
|
|
by the value of <code>$arg2</code>.</p>
|
|
<p>If <code>$arg2</code> is positive or negative zero, the result
|
|
is a zero-length duration. If <code>$arg2</code> is positive or
|
|
negative infinity, the result overflows and is handled as discussed
|
|
in <a href="#duration-limits"><b>9.7.1 Limits and
|
|
precision</b></a>.</p>
|
|
<p>For handling of overflow and underflow, see <a href=
|
|
"#duration-limits"><b>9.7.1 Limits and precision</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFOCA0005" title=
|
|
"err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
|
|
<code>NaN</code>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either duration (and therefore the result) may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:multiply-yearMonthDuration(xs:yearMonthDuration("P2Y11M"),
|
|
2.3)</code> returns <code>xs:yearMonthDuration("P6Y9M")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-divide-yearMonthDuration" id=
|
|
"func-divide-yearMonthDuration"></a>8.4.4
|
|
op:divide-yearMonthDuration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the result of dividing the value of <code>$arg1</code>
|
|
by <code>$arg2</code>. The result is rounded to the nearest
|
|
month.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "div" operator on
|
|
<code>xs:yearMonthDuration</code> and numeric values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:divide-yearMonthDuration</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:double</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:yearMonthDuration</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The result is the <code>xs:yearMonthDuration</code> whose length
|
|
in months is equal to the result of applying the <a href=
|
|
"#func-round"><code>fn:round</code></a> function to the value
|
|
obtained by dividing the length in months of <code>$arg1</code> by
|
|
the value of <code>$arg2</code>.</p>
|
|
<p>If <code>$arg2</code> is positive or negative infinity, the
|
|
result is a zero-length duration. If <code>$arg2</code> is positive
|
|
or negative zero, the result overflows and is handled as discussed
|
|
in <a href="#duration-limits"><b>9.7.1 Limits and
|
|
precision</b></a>.</p>
|
|
<p>For handling of overflow and underflow, see <a href=
|
|
"#duration-limits"><b>9.7.1 Limits and precision</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFOCA0005" title=
|
|
"err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
|
|
<code>NaN</code>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either operand (and therefore the result) may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:divide-yearMonthDuration(xs:yearMonthDuration("P2Y11M"),
|
|
1.5)</code> returns
|
|
<code>xs:yearMonthDuration("P1Y11M")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-divide-yearMonthDuration-by-yearMonthDuration"
|
|
id="func-divide-yearMonthDuration-by-yearMonthDuration"></a>8.4.5
|
|
op:divide-yearMonthDuration-by-yearMonthDuration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the ratio of two <code>xs:yearMonthDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "div" operator on
|
|
<code>xs:yearMonthDuration</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:divide-yearMonthDuration-by-yearMonthDuration</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:decimal</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the result of dividing the length in months
|
|
of <code>$arg1</code> by the length in months of
|
|
<code>$arg2</code>, according to the rules of the <a href=
|
|
"#func-numeric-divide"><code>op:numeric-divide</code></a> function
|
|
for integer operands.</p>
|
|
<p>For handling of overflow and underflow, see <a href=
|
|
"#duration-limits"><b>9.7.1 Limits and precision</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either duration (and therefore the result) may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:divide-yearMonthDuration-by-yearMonthDuration(xs:yearMonthDuration("P3Y4M"),
|
|
xs:yearMonthDuration("-P1Y4M"))</code> returns
|
|
<code>-2.5</code>.</p>
|
|
<p>The following example demonstrates how to calculate the length
|
|
of an <code>xs:yearMonthDuration</code> value in months:</p>
|
|
<p>The expression
|
|
<code>op:divide-yearMonthDuration-by-yearMonthDuration(xs:yearMonthDuration("P3Y4M"),
|
|
xs:yearMonthDuration("P1M"))</code> returns <code>40</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-add-dayTimeDurations" id=
|
|
"func-add-dayTimeDurations"></a>8.4.6 op:add-dayTimeDurations</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the sum of two <code>xs:dayTimeDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "+" operator on
|
|
<code>xs:dayTimeDuration</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:add-dayTimeDurations</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the result of adding the value of
|
|
<code>$arg1</code> to the value of <code>$arg2</code>. The result
|
|
is the <code>xs:dayTimeDuration</code> whose length in seconds is
|
|
equal to the sum of the length in seconds of the two input
|
|
durations.</p>
|
|
<p>For handling of overflow, see <a href=
|
|
"#duration-limits"><b>9.7.1 Limits and precision</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either duration (and therefore the result) may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:add-dayTimeDurations(xs:dayTimeDuration("P2DT12H5M"),
|
|
xs:dayTimeDuration("P5DT12H"))</code> returns
|
|
<code>xs:dayTimeDuration('P8DT5M')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subtract-dayTimeDurations" id=
|
|
"func-subtract-dayTimeDurations"></a>8.4.7
|
|
op:subtract-dayTimeDurations</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the result of subtracting one
|
|
<code>xs:dayTimeDuration</code> from another.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "-" operator on
|
|
<code>xs:dayTimeDuration</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:subtract-dayTimeDurations</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the result of subtracting the value of
|
|
<code>$arg2</code> from the value of <code>$arg1</code>. The result
|
|
is the <code>xs:dayTimeDuration</code> whose length in seconds is
|
|
equal to the length in seconds of <code>$arg1</code> minus the
|
|
length in seconds of <code>$arg2</code>.</p>
|
|
<p>For handling of overflow, see <a href=
|
|
"#duration-limits"><b>9.7.1 Limits and precision</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either duration (and therefore the result) may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:subtract-dayTimeDurations(xs:dayTimeDuration("P2DT12H"),
|
|
xs:dayTimeDuration("P1DT10H30M"))</code> returns
|
|
<code>xs:dayTimeDuration('P1DT1H30M')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-multiply-dayTimeDuration" id=
|
|
"func-multiply-dayTimeDuration"></a>8.4.8
|
|
op:multiply-dayTimeDuration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the result of multiplying a
|
|
<code>xs:dayTimeDuration</code> by a number.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "*" operator on
|
|
<code>xs:dayTimeDuration</code> and numeric values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:multiply-dayTimeDuration</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:double</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the result of multiplying the value of
|
|
<code>$arg1</code> by <code>$arg2</code>. The result is the
|
|
<code>xs:dayTimeDuration</code> whose length in seconds is equal to
|
|
the length in seconds of <code>$arg1</code> multiplied by the
|
|
numeric value <code>$arg2</code>.</p>
|
|
<p>If <code>$arg2</code> is positive or negative zero, the result
|
|
is a zero-length duration. If <code>$arg2</code> is positive or
|
|
negative infinity, the result overflows and is handled as discussed
|
|
in <a href="#date-time-duration-conformance"><b>9.1.1 Limits and
|
|
precision</b></a>.</p>
|
|
<p>For handling of overflow and underflow, see <a href=
|
|
"#duration-limits"><b>9.7.1 Limits and precision</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFOCA0005" title=
|
|
"err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
|
|
<code>NaN</code>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either operand (and therefore the result) may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:multiply-dayTimeDuration(xs:dayTimeDuration("PT2H10M"),
|
|
2.1)</code> returns <code>xs:dayTimeDuration('PT4H33M')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-divide-dayTimeDuration" id=
|
|
"func-divide-dayTimeDuration"></a>8.4.9
|
|
op:divide-dayTimeDuration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the result of multiplying a
|
|
<code>xs:dayTimeDuration</code> by a number.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "div" operator on
|
|
<code>xs:dayTimeDuration</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:divide-dayTimeDuration</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:double</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the result of dividing the value of
|
|
<code>$arg1</code> by <code>$arg2</code>. The result is the
|
|
<code>xs:dayTimeDuration</code> whose length in seconds is equal to
|
|
the length in seconds of <code>$arg1</code> divided by the numeric
|
|
value <code>$arg2</code>.</p>
|
|
<p>If <code>$arg2</code> is positive or negative infinity, the
|
|
result is a zero-length duration. If <code>$arg2</code> is positive
|
|
or negative zero, the result overflows and is handled as discussed
|
|
in <a href="#date-time-duration-conformance"><b>9.1.1 Limits and
|
|
precision</b></a>.</p>
|
|
<p>For handling of overflow and underflow, see <a href=
|
|
"#duration-limits"><b>9.7.1 Limits and precision</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFOCA0005" title=
|
|
"err:FOCA0005">err:FOCA0005</a>] if <code>$arg2</code> is
|
|
<code>NaN</code>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either operand (and therefore the result) may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:divide-dayTimeDuration(xs:dayTimeDuration("P1DT2H30M10.5S"),
|
|
1.5)</code> returns <code>xs:duration("PT17H40M7S")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-divide-dayTimeDuration-by-dayTimeDuration" id=
|
|
"func-divide-dayTimeDuration-by-dayTimeDuration"></a>8.4.10
|
|
op:divide-dayTimeDuration-by-dayTimeDuration</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the ratio of two <code>xs:dayTimeDuration</code> values,
|
|
as a decimal number.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "div" operator on
|
|
<code>xs:dayTimeDuration</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:divide-dayTimeDuration-by-dayTimeDuration</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:decimal</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the result of dividing the value of
|
|
<code>$arg1</code> by <code>$arg2</code>. The result is the
|
|
<code>xs:dayTimeDuration</code> whose length in seconds is equal to
|
|
the length in seconds of <code>$arg1</code> divided by the length
|
|
in seconds of <code>$arg2</code>. The calculation is performed by
|
|
applying <a href=
|
|
"#func-numeric-divide"><code>op:numeric-divide</code></a> to the
|
|
two <code>xs:decimal</code> operands.</p>
|
|
<p>For handling of overflow and underflow, see <a href=
|
|
"#duration-limits"><b>9.7.1 Limits and precision</b></a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Either operand (and therefore the result) may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <a href=
|
|
"#func-round-half-to-even"><code>fn:round-half-to-even(
|
|
op:divide-dayTimeDuration-by-dayTimeDuration(
|
|
xs:dayTimeDuration("P2DT53M11S"), xs:dayTimeDuration("P1DT10H")),
|
|
4)</code></a> returns <code>1.4378</code>.</p>
|
|
<p>This examples shows how to determine the number of seconds in a
|
|
duration.</p>
|
|
<p>The expression
|
|
<code>op:divide-dayTimeDuration-by-dayTimeDuration(xs:dayTimeDuration("P2DT53M11S"),
|
|
xs:dayTimeDuration("PT1S"))</code> returns
|
|
<code>175991.0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="dates-times" id="dates-times"></a>9 Functions and
|
|
operators on dates and times</h2>
|
|
<p>This section defines operations on the <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
date and time types.</p>
|
|
<p>See <a href="#Working-With-Timezones">[Working With
|
|
Timezones]</a> for a disquisition on working with date and time
|
|
values with and without timezones.</p>
|
|
<div class="div2">
|
|
<h3><a name="date-time-types" id="date-time-types"></a>9.1 Date and
|
|
time types</h3>
|
|
<p>The operators described in this section are defined on the
|
|
following date and time types:</p>
|
|
<ul>
|
|
<li>
|
|
<p>xs:dateTime</p>
|
|
</li>
|
|
<li>
|
|
<p>xs:date</p>
|
|
</li>
|
|
<li>
|
|
<p>xs:time</p>
|
|
</li>
|
|
<li>
|
|
<p>xs:gYearMonth</p>
|
|
</li>
|
|
<li>
|
|
<p>xs:gYear</p>
|
|
</li>
|
|
<li>
|
|
<p>xs:gMonthDay</p>
|
|
</li>
|
|
<li>
|
|
<p>xs:gMonth</p>
|
|
</li>
|
|
<li>
|
|
<p>xs:gDay</p>
|
|
</li>
|
|
</ul>
|
|
<p>The only operations defined on <code>xs:gYearMonth</code>,
|
|
<code>xs:gYear</code>, <code>xs:gMonthDay</code>,
|
|
<code>xs:gMonth</code> and <code>xs:gDay</code> values are equality
|
|
comparison and component extraction. For other types, further
|
|
operations are provided, including order comparisons, arithmetic,
|
|
formatted display, and timezone adjustment.</p>
|
|
<div class="div3">
|
|
<h4><a name="date-time-duration-conformance" id=
|
|
"date-time-duration-conformance"></a>9.1.1 Limits and
|
|
precision</h4>
|
|
<p>For a number of the above datatypes <a href="#xmlschema-2">[XML
|
|
Schema Part 2: Datatypes Second Edition]</a> extends the basic
|
|
<a href="#ISO8601">[ISO 8601]</a> lexical representations, such as
|
|
YYYY-MM-DDThh:mm:ss.s for dateTime, by allowing a preceding minus
|
|
sign, more than four digits to represent the year field — no
|
|
maximum is specified — and an unlimited number of digits for
|
|
fractional seconds. Leap seconds are not supported.</p>
|
|
<p>All <em>minimally conforming</em> processors <a title="must"
|
|
class="termref" href="#must"><span class=
|
|
"arrow">·</span>must<span class="arrow">·</span></a> support
|
|
positive year values with a minimum of 4 digits (i.e., YYYY) and a
|
|
minimum fractional second precision of 1 millisecond or three
|
|
digits (i.e., s.sss). However, <em>conforming</em> processors
|
|
<a title="may" class="termref" href="#may"><span class=
|
|
"arrow">·</span>may<span class="arrow">·</span></a> set larger
|
|
<a title="implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> limits on the maximum number of digits they
|
|
support in these two situations. Processors <a title="may" class=
|
|
"termref" href="#may"><span class="arrow">·</span>may<span class=
|
|
"arrow">·</span></a> also choose to support the year 0000 and years
|
|
with negative values. The results of operations on dates that cross
|
|
the year 0000 are <a title="implementation-defined" class="termref"
|
|
href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>A processor that limits the number of digits in date and time
|
|
datatype representations may encounter overflow and underflow
|
|
conditions when it tries to execute the functions in <a href=
|
|
"#dateTime-arithmetic"><b>9.7 Arithmetic operators on durations,
|
|
dates and times</b></a>. In these situations, the processor
|
|
<a title="must" class="termref" href="#must"><span class=
|
|
"arrow">·</span>must<span class="arrow">·</span></a> return
|
|
00:00:00 in case of time underflow. It <a title="must" class=
|
|
"termref" href="#must"><span class="arrow">·</span>must<span class=
|
|
"arrow">·</span></a> raise an error [<a href="#ERRFODT0001" title=
|
|
"err:FODT0001">err:FODT0001</a>] in case of overflow.</p>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="date-time-values" id="date-time-values"></a>9.2
|
|
Date/time datatype values</h3>
|
|
<p>As defined in <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dates-and-times">Section
|
|
3.3.2 Dates and Times</a> <sup><small>DM30</small></sup>,
|
|
<code>xs:dateTime</code>, <code>xs:date</code>,
|
|
<code>xs:time</code>, <code>xs:gYearMonth</code>,
|
|
<code>xs:gYear</code>, <code>xs:gMonthDay</code>,
|
|
<code>xs:gMonth</code>, <code>xs:gDay</code> values, referred to
|
|
collectively as date/time values, are represented as seven
|
|
components or properties: <code>year</code>, <code>month</code>,
|
|
<code>day</code>, <code>hour</code>, <code>minute</code>,
|
|
<code>second</code> and <code>timezone</code>. The first five
|
|
components are <code>xs:integer</code> values. The value of the
|
|
<code>second</code> component is an <code>xs:decimal</code> and the
|
|
value of the <code>timezone</code> component is an
|
|
<code>xs:dayTimeDuration</code>. For all the primitive date/time
|
|
datatypes, the <code>timezone</code> property is optional and may
|
|
or may not be present. Depending on the datatype, some of the
|
|
remaining six properties must be present and some must be <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>.
|
|
Absent, or missing, properties are represented by the empty
|
|
sequence. This value is referred to as the <em>local</em> value in
|
|
that the value retains its original timezone. Before comparing or
|
|
subtracting <code>xs:dateTime</code> values, this local value
|
|
<a title="must" class="termref" href="#must"><span class=
|
|
"arrow">·</span>must<span class="arrow">·</span></a> be translated
|
|
or <em>normalized</em> to UTC.</p>
|
|
<p>For <code>xs:time</code>, <code>00:00:00</code> and
|
|
<code>24:00:00</code> are alternate lexical forms for the same
|
|
value, whose canonical representation is <code>00:00:00</code>. For
|
|
<code>xs:dateTime</code>, a time component <code>24:00:00</code>
|
|
translates to <code>00:00:00</code> of the following day.</p>
|
|
<div class="div3">
|
|
<h4><a name="date-time-lexical-mapping" id=
|
|
"date-time-lexical-mapping"></a>9.2.1 Examples</h4>
|
|
<ul>
|
|
<li>
|
|
<p>An <code>xs:dateTime</code> with lexical representation
|
|
<code>1999-05-31T05:00:00</code> is represented in the datamodel by
|
|
<code>{1999, 5, 31, 5, 0, 0.0, ()}</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>An <code>xs:dateTime</code> with lexical representation
|
|
<code>1999-05-31T13:20:00-05:00</code> is represented by
|
|
<code>{1999, 5, 31, 13, 20, 0.0, -PT5H}</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>An <code>xs:dateTime</code> with lexical representation
|
|
<code>1999-12-31T24:00:00</code> is represented by <code>{2000, 1,
|
|
1, 0, 0, 0.0, ()}</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>An <code>xs:date</code> with lexical representation
|
|
<code>2005-02-28+8:00</code> is represented by <code>{2005, 2, 28,
|
|
(), (), (), PT8H}</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>An <code>xs:time</code> with lexical representation
|
|
<code>24:00:00</code> is represented by <code>{(), (), (), 0, 0, 0,
|
|
()}</code>.</p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="constructing-dateTime" id=
|
|
"constructing-dateTime"></a>9.3 Constructing a dateTime</h3>
|
|
<p>A function is provided for constructing a
|
|
<code>xs:dateTime</code> value from a <code>xs:date</code> value
|
|
and a <code>xs:time</code> value.</p>
|
|
<div class="div3">
|
|
<h4><a name="func-dateTime" id="func-dateTime"></a>9.3.1
|
|
fn:dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns an <code>xs:dateTime</code> value created by combining
|
|
an <code>xs:date</code> and an <code>xs:time</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:dateTime</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:date?</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:time?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dateTime?</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 either <code>$arg1</code> or <code>$arg2</code> is the empty
|
|
sequence the function returns the empty sequence.</p>
|
|
<p>Otherwise, the function returns an <code>xs:dateTime</code>
|
|
whose date component is equal to <code>$arg1</code> and whose time
|
|
component is equal to <code>$arg2</code>.</p>
|
|
<p>The timezone of the result is computed as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If neither argument has a timezone, the result has no
|
|
timezone.</p>
|
|
</li>
|
|
<li>
|
|
<p>If exactly one of the arguments has a timezone, or if both
|
|
arguments have the same timezone, the result has this timezone.</p>
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFORG0008" title=
|
|
"err:FORG0008">err:FORG0008</a>] if the two arguments both have
|
|
timezones and the timezones are different.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:dateTime(xs:date("1999-12-31"),
|
|
xs:time("12:00:00"))</code> returns
|
|
<code>xs:dateTime("1999-12-31T12:00:00")</code>.</p>
|
|
<p>The expression <code>fn:dateTime(xs:date("1999-12-31"),
|
|
xs:time("24:00:00"))</code> returns
|
|
<code>xs:dateTime("1999-12-31T00:00:00")</code>. <em>(This is
|
|
because <code>"24:00:00"</code> is an alternate lexical form for
|
|
<code>"00:00:00"</code>).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="comp.datetime" id="comp.datetime"></a>9.4 Comparison
|
|
operators on duration, date and time values</h3>
|
|
<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-dateTime-equal"><code>op:dateTime-equal</code></a></td>
|
|
<td>Returns true if the two supplied <code>xs:dateTime</code>
|
|
values refer to the same instant in time.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-dateTime-less-than"><code>op:dateTime-less-than</code></a></td>
|
|
<td>Returns <code>true</code> if the first argument represents an
|
|
earlier instant in time than the second argument.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-dateTime-greater-than"><code>op:dateTime-greater-than</code></a></td>
|
|
<td>Returns <code>true</code> if the first argument represents a
|
|
later instant in time than the second argument.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-date-equal"><code>op:date-equal</code></a></td>
|
|
<td>Returns <code>true</code> if and only if the starting instants
|
|
of the two supplied <code>xs:date</code> values are the same.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-date-less-than"><code>op:date-less-than</code></a></td>
|
|
<td>Returns <code>true</code> if and only if the starting instant
|
|
of <code>$arg1</code> is less than the starting instant of
|
|
<code>$arg2</code>. Returns <code>false</code> otherwise.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-date-greater-than"><code>op:date-greater-than</code></a></td>
|
|
<td>Returns <code>true</code> if and only if the starting instant
|
|
of <code>$arg1</code> is greater than the starting instant of
|
|
<code>$arg2</code>. Returns <code>false</code> otherwise.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-time-equal"><code>op:time-equal</code></a></td>
|
|
<td>Returns <code>true</code> if the two <code>xs:time</code>
|
|
values represent the same instant in time, when treated as being
|
|
times on the same date, before adjusting the timezone.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-time-less-than"><code>op:time-less-than</code></a></td>
|
|
<td>Returns <code>true</code> if the first <code>xs:time</code>
|
|
value represents an earlier instant in time than the second, when
|
|
both are treated as being times on the same date, before adjusting
|
|
the timezone.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-time-greater-than"><code>op:time-greater-than</code></a></td>
|
|
<td>Returns <code>true</code> if the first <code>xs:time</code>
|
|
value represents a later instant in time than the second, when both
|
|
are treated as being times on the same date, before adjusting the
|
|
timezone.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-gYearMonth-equal"><code>op:gYearMonth-equal</code></a></td>
|
|
<td>Returns true if the two <code>xs:gYearMonth</code> values have
|
|
the same starting instant.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-gYear-equal"><code>op:gYear-equal</code></a></td>
|
|
<td>Returns true if the two <code>xs:gYear</code> values have the
|
|
same starting instant.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-gMonthDay-equal"><code>op:gMonthDay-equal</code></a></td>
|
|
<td>Returns true if the two <code>xs:gMonthDay</code> values have
|
|
the same starting instant, when considered as days in the same
|
|
year.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-gMonth-equal"><code>op:gMonth-equal</code></a></td>
|
|
<td>Returns true if the two <code>xs:gMonth</code> values have the
|
|
same starting instant, when considered as months in the same
|
|
year.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-gDay-equal"><code>op:gDay-equal</code></a></td>
|
|
<td>Returns true if the two <code>xs:gDay</code> values have the
|
|
same starting instant, when considered as days in the same month of
|
|
the same year.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>The following comparison operators are defined on the <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
date/time datatypes. Each operator takes two operands of the same
|
|
type and returns an <code>xs:boolean</code> result.</p>
|
|
<p><a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a> also states that the order relation on date and time
|
|
datatypes is not a total order but a partial order because these
|
|
datatypes may or may not have a timezone. This is handled as
|
|
follows. If either operand to a comparison function on date or time
|
|
values does not have an (explicit) timezone then, for the purpose
|
|
of the operation, an implicit timezone, provided by the dynamic
|
|
context <a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
|
|
Section C.2 Dynamic Context Components</a>
|
|
<sup><small>XP30</small></sup>, is assumed to be present as part of
|
|
the value. This creates a total order for all date and time
|
|
values.</p>
|
|
<p>An <code>xs:dateTime</code> can be considered to consist of
|
|
seven components: <code>year</code>, <code>month</code>,
|
|
<code>day</code>, <code>hour</code>, <code>minute</code>,
|
|
<code>second</code> and <code>timezone</code>. For
|
|
<code>xs:dateTime</code> six components (<code>year</code>,
|
|
<code>month</code>, <code>day</code>, <code>hour</code>,
|
|
<code>minute</code> and <code>second</code>) are required and
|
|
<code>timezone</code> is optional. For other date/time values, of
|
|
the first six components, some are required and others must be
|
|
<a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>.
|
|
<code>Timezone</code> is always optional. For example, for
|
|
<code>xs:date</code>, the <code>year</code>, <code>month</code> and
|
|
<code>day</code> components are required and <code>hour</code>,
|
|
<code>minute</code> and <code>second</code> components must be
|
|
absent; for <code>xs:time</code> the <code>hour</code>,
|
|
<code>minute</code> and <code>second</code> components are required
|
|
and <code>year</code>, <code>month</code> and <code>day</code> are
|
|
missing; for <code>xs:gDay</code>, <code>day</code> is required and
|
|
<code>year</code>, <code>month</code>, <code>hour</code>,
|
|
<code>minute</code> and <code>second</code> are missing.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>In <a href="#xmlschema11-2">[XML Schema 1.1 Part 2:
|
|
Datatypes]</a>, a new <code>explicitTimezone</code> facet is
|
|
available with values <code>optional</code>, <code>required</code>,
|
|
or <code>prohibited</code> to enable the timezone to be defined as
|
|
mandatory or disallowed.</p>
|
|
</div>
|
|
<p>Values of the date/time datatypes <code>xs:time</code>,
|
|
<code>xs:gMonthDay</code>, <code>xs:gMonth</code>, and
|
|
<code>xs:gDay</code>, can be considered to represent a sequence of
|
|
recurring time instants or time periods. An <code>xs:time</code>
|
|
occurs every day. An <code>xs:gMonth</code> occurs every year.
|
|
Comparison operators on these datatypes compare the starting
|
|
instants of equivalent occurrences in the recurring series. These
|
|
<code>xs:dateTime</code> values are calculated as described
|
|
below.</p>
|
|
<p>Comparison operators on <code>xs:date</code>,
|
|
<code>xs:gYearMonth</code> and <code>xs:gYear</code> compare their
|
|
starting instants. These <code>xs:dateTime</code> values are
|
|
calculated as described below.</p>
|
|
<p>The starting instant of an occurrence of a date/time value is an
|
|
<code>xs:dateTime</code> calculated by filling in the missing
|
|
components of the local value from a reference
|
|
<code>xs:dateTime</code>. An example of a suitable reference
|
|
<code>xs:dateTime</code> is <code>1972-01-01T00:00:00</code>. Then,
|
|
for example, the starting instant corresponding to the
|
|
<code>xs:date</code> value <code>2009-03-12</code> is
|
|
<code>2009-03-12T00:00:00</code>; the starting instant
|
|
corresponding to the <code>xs:time</code> value
|
|
<code>13:30:02</code> is <code>1972-01-01T13:30:02</code>; and the
|
|
starting instant corresponding to the <code>gMonthDay</code> value
|
|
<code>--02-29</code> is <code>1972-02-29T00:00:00</code> (which
|
|
explains why a leap year was chosen for the reference).</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>In the previous version of this specification, the reference
|
|
date/time chosen was <code>1972-12-31T00:00:00</code>. While this
|
|
gives the same results, it produces a "starting instant" for a
|
|
<code>gMonth</code> or <code>gMonthDay</code> that bears no
|
|
relation to the ordinary meaning of the term, and it also required
|
|
special handling of short months. The original choice was made to
|
|
allow for leap seconds; but since leap seconds are not recognized
|
|
in date/time arithmetic, this is not actually necessary.</p>
|
|
</div>
|
|
<p>If the <code>xs:time</code> value written as
|
|
<code>24:00:00</code> is to be compared, filling in the missing
|
|
components gives <code>1972-01-01T00:00:00</code>, because
|
|
<code>24:00:00</code> is an alternative representation of
|
|
<code>00:00:00</code> (the lexical value <code>"24:00:00"</code> is
|
|
converted to the time components {0,0,0} before the missing
|
|
components are filled in). This has the consequence that when
|
|
ordering <code>xs:time</code> values, <code>24:00:00</code> is
|
|
considered to be earlier than <code>23:59:59</code>. However, when
|
|
ordering <code>xs:dateTime</code> values, a time component of
|
|
<code>24:00:00</code> is considered equivalent to
|
|
<code>00:00:00</code> on the following day.</p>
|
|
<p>Note that the reference <code>xs:dateTime</code> does not have a
|
|
timezone. The <code>timezone</code> component is never filled in
|
|
from the reference <code>xs:dateTime</code>. In some cases, if the
|
|
date/time value does not have a timezone, the implicit timezone
|
|
from the dynamic context is used as the timezone.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>This specification uses the reference <code>xs:dateTime
|
|
1972-01-01T00:00:00</code> in the description of the comparison
|
|
operators. Implementations may use other reference
|
|
<code>xs:dateTime</code> values as long as they yield the same
|
|
results. The reference <code>xs:dateTime</code> used must meet the
|
|
following constraints: when it is used to supply components into
|
|
<code>xs:gMonthDay</code> values, the year must allow for February
|
|
29 and so must be a leap year; when it is used to supply missing
|
|
components into <code>xs:gDay</code> values, the month must allow
|
|
for 31 days. Different reference <code>xs:dateTime</code> values
|
|
may be used for different operators.</p>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-dateTime-equal" id=
|
|
"func-dateTime-equal"></a>9.4.1 op:dateTime-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the two supplied <code>xs:dateTime</code> values
|
|
refer to the same instant in time.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" operator on
|
|
<code>xs:dateTime</code> values. Also used in the definition of the
|
|
"ne", "le" and "ge" operators.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:dateTime-equal</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:dateTime</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If either <code>$arg1</code> or <code>$arg2</code> has no
|
|
timezone component, the effective value of the argument is obtained
|
|
by substituting the implicit timezone from the dynamic evaluation
|
|
context.</p>
|
|
<p>The function then returns <code>true</code> if and only if the
|
|
effective value of <code>$arg1</code> is equal to the effective
|
|
value of <code>$arg2</code> according to the algorithm defined in
|
|
section 3.2.7.4 of <a href="#xmlschema-2">[XML Schema Part 2:
|
|
Datatypes Second Edition]</a> "Order relation on dateTime" for
|
|
<code>xs:dateTime</code> values with timezones. Otherwise the
|
|
function returns <code>false</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>-05:00</code></p>
|
|
<p>The expression
|
|
<code>op:dateTime-equal(xs:dateTime("2002-04-02T12:00:00-01:00"),
|
|
xs:dateTime("2002-04-02T17:00:00+04:00"))</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression
|
|
<code>op:dateTime-equal(xs:dateTime("2002-04-02T12:00:00"),
|
|
xs:dateTime("2002-04-02T23:00:00+06:00"))</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression
|
|
<code>op:dateTime-equal(xs:dateTime("2002-04-02T12:00:00"),
|
|
xs:dateTime("2002-04-02T17:00:00"))</code> returns
|
|
<code>false()</code>.</p>
|
|
<p>The expression
|
|
<code>op:dateTime-equal(xs:dateTime("2002-04-02T12:00:00"),
|
|
xs:dateTime("2002-04-02T12:00:00"))</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression
|
|
<code>op:dateTime-equal(xs:dateTime("2002-04-02T23:00:00-04:00"),
|
|
xs:dateTime("2002-04-03T02:00:00-01:00"))</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression
|
|
<code>op:dateTime-equal(xs:dateTime("1999-12-31T24:00:00"),
|
|
xs:dateTime("2000-01-01T00:00:00"))</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression
|
|
<code>op:dateTime-equal(xs:dateTime("2005-04-04T24:00:00"),
|
|
xs:dateTime("2005-04-04T00:00:00"))</code> returns
|
|
<code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-dateTime-less-than" id=
|
|
"func-dateTime-less-than"></a>9.4.2 op:dateTime-less-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if the first argument represents an
|
|
earlier instant in time than the second argument.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "lt" operator on
|
|
<code>xs:dateTime</code> values. Also used in the definition of the
|
|
"le" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:dateTime-less-than</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:dateTime</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If either <code>$arg1</code> or <code>$arg2</code> has no
|
|
timezone component, the effective value of the argument is obtained
|
|
by substituting the implicit timezone from the dynamic evaluation
|
|
context.</p>
|
|
<p>The function then returns <code>true</code> if and only if the
|
|
effective value of <code>$arg1</code> is less than the effective
|
|
value of <code>$arg2</code> according to the algorithm defined in
|
|
section 3.2.7.4 of <a href="#xmlschema-2">[XML Schema Part 2:
|
|
Datatypes Second Edition]</a> "Order relation on dateTime" for
|
|
<code>xs:dateTime</code> values with timezones. Otherwise the
|
|
function returns <code>false</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-dateTime-greater-than" id=
|
|
"func-dateTime-greater-than"></a>9.4.3
|
|
op:dateTime-greater-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if the first argument represents a
|
|
later instant in time than the second argument.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "gt" operator on
|
|
<code>xs:dateTime</code> values. Also used in the definition of the
|
|
"ge" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:dateTime-greater-than</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function call <code>op:dateTime-greater-than($A, $B)</code>
|
|
is defined to return the same result as <a href=
|
|
"#func-dateTime-less-than"><code>op:dateTime-less-than($B,
|
|
$A)</code></a></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-date-equal" id="func-date-equal"></a>9.4.4
|
|
op:date-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if and only if the starting instants
|
|
of the two supplied <code>xs:date</code> values are the same.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" operator on
|
|
<code>xs:date</code> values. Also used in the definition of the
|
|
"ne", "le" and "ge" operators.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:date-equal</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:date</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:date</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The starting instant of an <code>xs:date</code> is the
|
|
<code>xs:dateTime</code> at time <code>00:00:00</code> on that
|
|
date.</p>
|
|
<p>The function returns the result of the expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
op:dateTime-equal(xs:dateTime($arg1), xs:dateTime($arg2))
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>op:date-equal(xs:date("2004-12-25Z"),
|
|
xs:date("2004-12-25+07:00"))</code> returns <code>false()</code>.
|
|
<em>(The starting instants are
|
|
<code>xs:dateTime("2004-12-25T00:00:00Z")</code> and
|
|
<code>xs:dateTime("2004-12-25T00:00:00+07:00")</code>. These are
|
|
normalized to <code>xs:dateTime("2004-12-25T00:00:00Z")</code> and
|
|
<code>xs:dateTime("2004-12-24T17:00:00Z")</code>. ).</em></p>
|
|
<p>The expression <code>op:date-equal(xs:date("2004-12-25-12:00"),
|
|
xs:date("2004-12-26+12:00"))</code> returns
|
|
<code>true()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-date-less-than" id=
|
|
"func-date-less-than"></a>9.4.5 op:date-less-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if and only if the starting instant of
|
|
<code>$arg1</code> is less than the starting instant of
|
|
<code>$arg2</code>. Returns <code>false</code> otherwise.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "lt" operator on
|
|
<code>xs:date</code> values. Also used in the definition of the
|
|
"le" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:date-less-than</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:date</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:date</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The starting instant of an <code>xs:date</code> is the
|
|
<code>xs:dateTime</code> at time <code>00:00:00</code> on that
|
|
date.</p>
|
|
<p>The function returns the result of the expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
op:dateTime-less-than(xs:dateTime($arg1), xs:dateTime($arg2))
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>op:date-less-than(xs:date("2004-12-25Z"),
|
|
xs:date("2004-12-25-05:00"))</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression
|
|
<code>op:date-less-than(xs:date("2004-12-25-12:00"),
|
|
xs:date("2004-12-26+12:00"))</code> returns
|
|
<code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-date-greater-than" id=
|
|
"func-date-greater-than"></a>9.4.6 op:date-greater-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if and only if the starting instant of
|
|
<code>$arg1</code> is greater than the starting instant of
|
|
<code>$arg2</code>. Returns <code>false</code> otherwise.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "gt" operator on
|
|
<code>xs:date</code> values. Also used in the definition of the
|
|
"ge" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:date-greater-than</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:date</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:date</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function call <code>op:date-greater-than($A, $B)</code> is
|
|
defined to return the same result as <a href=
|
|
"#func-date-less-than"><code>op:date-less-than($B,
|
|
$A)</code></a></p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:date-greater-than(xs:date("2004-12-25Z"),
|
|
xs:date("2004-12-25+07:00"))</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression
|
|
<code>op:date-greater-than(xs:date("2004-12-25-12:00"),
|
|
xs:date("2004-12-26+12:00"))</code> returns
|
|
<code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-time-equal" id="func-time-equal"></a>9.4.7
|
|
op:time-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if the two <code>xs:time</code> values
|
|
represent the same instant in time, when treated as being times on
|
|
the same date, before adjusting the timezone.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" operator on
|
|
<code>xs:time</code> values. Also used in the definition of the
|
|
"ne", "le" and "ge" operators.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:time-equal</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:time</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:time</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>Each of the supplied <code>xs:time</code> values is expanded to
|
|
an <code>xs:dateTime</code> value by associating the time with an
|
|
arbitrary date. The function returns the result of comparing these
|
|
two <code>xs:dateTime</code> values using <a href=
|
|
"#func-dateTime-equal"><code>op:dateTime-equal</code></a>.</p>
|
|
<p>The result of the function is thus the same as the value of the
|
|
expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
op:dateTime-equal(
|
|
fn:dateTime(xs:date('1972-12-31'), $arg1),
|
|
fn:dateTime(xs:date('1972-12-31'), $arg2))
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the date components from the reference
|
|
<code>xs:dateTime</code> correspond to <code>1972-12-31</code>.</p>
|
|
<p>The expression <code>op:time-equal(xs:time("08:00:00+09:00"),
|
|
xs:time("17:00:00-06:00"))</code> returns <code>false()</code>.
|
|
<em>(The <code>xs:dateTime</code>s calculated using the reference
|
|
date components are <code>1972-12-31T08:00:00+09:00</code> and
|
|
<code>1972-12-31T17:00:00-06:00</code>. These normalize to
|
|
<code>1972-12-30T23:00:00Z</code> and
|
|
<code>1972-12-31T23:00:00</code>. ).</em></p>
|
|
<p>The expression <code>op:time-equal(xs:time("21:30:00+10:30"),
|
|
xs:time("06:00:00-05:00"))</code> returns <code>true()</code>.</p>
|
|
<p>The expression <code>op:time-equal(xs:time("24:00:00+01:00"),
|
|
xs:time("00:00:00+01:00"))</code> returns <code>true()</code>.
|
|
<em>(This not the result one might expect. For
|
|
<code>xs:dateTime</code> values, a time of <code>24:00:00</code> is
|
|
equivalent to <code>00:00:00</code> on the following day. For
|
|
<code>xs:time</code>, the normalization from <code>24:00:00</code>
|
|
to <code>00:00:00</code> happens before the <code>xs:time</code> is
|
|
converted into an <code>xs:dateTime</code> for the purpose of the
|
|
equality comparison. For <code>xs:time</code>, any operation on
|
|
<code>24:00:00</code> produces the same result as the same
|
|
operation on <code>00:00:00</code> because these are two different
|
|
lexical representations of the same value. ).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-time-less-than" id=
|
|
"func-time-less-than"></a>9.4.8 op:time-less-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if the first <code>xs:time</code>
|
|
value represents an earlier instant in time than the second, when
|
|
both are treated as being times on the same date, before adjusting
|
|
the timezone.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "lt" operator on
|
|
<code>xs:time</code> values. Also used in the definition of the
|
|
"le" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:time-less-than</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:time</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:time</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>Each of the supplied <code>xs:time</code> values is expanded to
|
|
an <code>xs:dateTime</code> value by associating the time with an
|
|
arbitrary date. The function returns the result of comparing these
|
|
two <code>xs:dateTime</code> values using <a href=
|
|
"#func-dateTime-less-than"><code>op:dateTime-less-than</code></a>.</p>
|
|
<p>The result of the function is thus the same as the value of the
|
|
expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
op:dateTime-less-than(
|
|
fn:dateTime(xs:date('1972-12-31'), $arg1),
|
|
fn:dateTime(xs:date('1972-12-31'), $arg2))
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>-05:00</code>.</p>
|
|
<p>The expression <code>op:time-less-than(xs:time("12:00:00"),
|
|
xs:time("23:00:00+06:00"))</code> returns <code>false()</code>.</p>
|
|
<p>The expression <code>op:time-less-than(xs:time("11:00:00"),
|
|
xs:time("17:00:00Z"))</code> returns <code>true()</code>.</p>
|
|
<p>The expression <code>op:time-less-than(xs:time("23:59:59"),
|
|
xs:time("24:00:00"))</code> returns <code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-time-greater-than" id=
|
|
"func-time-greater-than"></a>9.4.9 op:time-greater-than</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if the first <code>xs:time</code>
|
|
value represents a later instant in time than the second, when both
|
|
are treated as being times on the same date, before adjusting the
|
|
timezone.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "gt" operator on
|
|
<code>xs:time</code> values. Also used in the definition of the
|
|
"ge" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:time-greater-than</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:time</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:time</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function call <code>op:time-greater-than($A, $B)</code> is
|
|
defined to return the same result as <a href=
|
|
"#func-time-less-than"><code>op:time-less-than($B,
|
|
$A)</code></a></p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:time-greater-than(xs:time("08:00:00+09:00"),
|
|
xs:time("17:00:00-06:00"))</code> returns <code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-gYearMonth-equal" id=
|
|
"func-gYearMonth-equal"></a>9.4.10 op:gYearMonth-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the two <code>xs:gYearMonth</code> values have
|
|
the same starting instant.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" operator on
|
|
<code>xs:gYearMonth</code> values. Also used in the definition of
|
|
the "ne" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:gYearMonth-equal</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:gYearMonth</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:gYearMonth</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The starting instants of <code>$arg1</code> and
|
|
<code>$arg2</code> are calculated by supplying the missing
|
|
components of <code>$arg1</code> and <code>$arg2</code> from the
|
|
<code>xs:dateTime</code> template <code>xxxx-xx-01T00:00:00</code>.
|
|
The function returns the result of comparing these two starting
|
|
instants using <a href=
|
|
"#func-dateTime-equal"><code>op:dateTime-equal</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>-05:00</code>.</p>
|
|
<p><code>op:gYearMonth-equal(xs:gYearMonth("1986-02"),
|
|
xs:gYearMonth("1986-03"))</code> returns <code>false()</code>. The
|
|
starting instants are <code>1986-02-01T00:00:00-05:00</code> and
|
|
<code>1986-03-01T00:00:00</code>, respectively.</p>
|
|
<p><code>op:gYearMonth-equal(xs:gYearMonth("1978-03"),
|
|
xs:gYearMonth("1986-03Z"))</code> returns <code>false()</code>. The
|
|
starting instants are <code>1986-03-01T00:00:00-05:00</code> and
|
|
<code>1986-03-01T00:00:00Z</code>, respectively.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-gYear-equal" id="func-gYear-equal"></a>9.4.11
|
|
op:gYear-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the two <code>xs:gYear</code> values have the
|
|
same starting instant.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" operator on
|
|
<code>xs:gYear</code> values. Also used in the definition of the
|
|
"ne" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:gYear-equal</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:gYear</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:gYear</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The starting instants of <code>$arg1</code> and
|
|
<code>$arg2</code> are calculated by supplying the missing
|
|
components of <code>$arg1</code> and <code>$arg2</code> from the
|
|
<code>xs:dateTime</code> template <code>xxxx-01-01T00:00:00</code>.
|
|
The function returns the result of comparing these two starting
|
|
instants using <a href=
|
|
"#func-dateTime-equal"><code>op:dateTime-equal</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>-05:00</code>. Assume, also, that the
|
|
<code>xs:dateTime</code> template is
|
|
<code>xxxx-01-01T00:00:00</code>.</p>
|
|
<p><code>op:gYear-equal(xs:gYear("2005-12:00"),
|
|
xs:gYear("2005+12:00"))</code> returns <code>false()</code>. The
|
|
starting instants are <code>2005-01-01T00:00:00-12:00</code> and
|
|
<code>2005-01-01T00:00:00+12:00</code>, respectively, and normalize
|
|
to <code>2005-01-01T12:00:00Z</code> and
|
|
<code>2004-12-31T12:00:00Z</code>.</p>
|
|
<p>The expression <code>op:gYear-equal(xs:gYear("1976-05:00"),
|
|
xs:gYear("1976"))</code> returns <code>true()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-gMonthDay-equal" id=
|
|
"func-gMonthDay-equal"></a>9.4.12 op:gMonthDay-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the two <code>xs:gMonthDay</code> values have
|
|
the same starting instant, when considered as days in the same
|
|
year.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" operator on
|
|
<code>xs:gMonthDay</code> values. Also used in the definition of
|
|
the "ne" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:gMonthDay-equal</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:gMonthDay</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:gMonthDay</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The starting instants of <code>$arg1</code> and
|
|
<code>$arg2</code> are calculated by supplying the missing
|
|
components of <code>$arg1</code> and <code>$arg2</code> from the
|
|
<code>xs:dateTime</code> template <code>1972-xx-xxT00:00:00</code>
|
|
or an equivalent. The function returns the result of comparing
|
|
these two starting instants using <a href=
|
|
"#func-dateTime-equal"><code>op:dateTime-equal</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>-05:00</code>. Assume for the purposes of
|
|
illustration that the <code>xs:dateTime</code> template used is
|
|
<code>1972-xx-xxT00:00:00</code> (this does not affect the
|
|
result).</p>
|
|
<p>The expression
|
|
<code>op:gMonthDay-equal(xs:gMonthDay("--12-25-14:00"),
|
|
xs:gMonthDay("--12-26+10:00"))</code> returns <code>true()</code>.
|
|
<em>( The starting instants are
|
|
<code>1972-12-25T00:00:00-14:00</code> and
|
|
<code>1972-12-26T00:00:00+10:00</code>, respectively, and normalize
|
|
to <code>1972-12-25T14:00:00Z</code> and
|
|
<code>1972-12-25T14:00:00Z</code>. ).</em></p>
|
|
<p>The expression <code>op:gMonthDay-equal(xs:gMonthDay("--12-25"),
|
|
xs:gMonthDay("--12-26Z"))</code> returns <code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-gMonth-equal" id="func-gMonth-equal"></a>9.4.13
|
|
op:gMonth-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the two <code>xs:gMonth</code> values have the
|
|
same starting instant, when considered as months in the same
|
|
year.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" operator on
|
|
<code>xs:gMonth</code> values. Also used in the definition of the
|
|
"ne" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:gMonth-equal</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:gMonth</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:gMonth</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The starting instants of <code>$arg1</code> and
|
|
<code>$arg2</code> are calculated by supplying the missing
|
|
components of <code>$arg1</code> and <code>$arg2</code> from the
|
|
<code>xs:dateTime</code> template <code>1972-xx-01T00:00:00</code>
|
|
or an equivalent. The function returns the result of comparing
|
|
these two starting instants using <a href=
|
|
"#func-dateTime-equal"><code>op:dateTime-equal</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>-05:00</code>. Assume, also, that the
|
|
<code>xs:dateTime</code> template chosen is
|
|
<code>1972-xx-01T00:00:00</code>.</p>
|
|
<p>The expression <code>op:gMonth-equal(xs:gMonth("--12-14:00"),
|
|
xs:gMonth("--12+10:00"))</code> returns <code>false()</code>. <em>(
|
|
The starting instants are <code>1972-12-01T00:00:00-14:00</code>
|
|
and <code>1972-12-01T00:00:00+10:00</code>, respectively, and
|
|
normalize to <code>1972-11-30T14:00:00Z</code> and
|
|
<code>1972-12-01T14:00:00Z</code>. ).</em></p>
|
|
<p>The expression <code>op:gMonth-equal(xs:gMonth("--12"),
|
|
xs:gMonth("--12Z"))</code> returns <code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-gDay-equal" id="func-gDay-equal"></a>9.4.14
|
|
op:gDay-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the two <code>xs:gDay</code> values have the
|
|
same starting instant, when considered as days in the same month of
|
|
the same year.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" operator on
|
|
<code>xs:gDay</code> values. Also used in the definition of the
|
|
"ne" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:gDay-equal</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:gDay</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:gDay</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The starting instants of <code>$arg1</code> and
|
|
<code>$arg2</code> are calculated by supplying the missing
|
|
components of <code>$arg1</code> and <code>$arg2</code> from the
|
|
<code>xs:dateTime</code> template <code>1972-12-xxT00:00:00</code>
|
|
or an equivalent. The function returns the result of comparing
|
|
these two starting instants using <a href=
|
|
"#func-dateTime-equal"><code>op:dateTime-equal</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>-05:00</code>. Assume, also, that the
|
|
<code>xs:dateTime</code> template is
|
|
<code>1972-12-xxT00:00:00</code>.</p>
|
|
<p>The expression <code>op:gDay-equal(xs:gDay("---25-14:00"),
|
|
xs:gDay("---25+10:00"))</code> returns <code>false()</code>. <em>(
|
|
The starting instants are <code>1972-12-25T00:00:00-14:00</code>
|
|
and <code>1972-12-25T00:00:00+10:00</code>, respectively, and
|
|
normalize to <code>1972-12-25T14:00:00Z</code> and
|
|
<code>1972-12-24T14:00:00Z</code>. ).</em></p>
|
|
<p>The expression <code>op:gDay-equal(xs:gDay("---12"),
|
|
xs:gDay("---12Z"))</code> returns <code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="component-extraction-dateTime" id=
|
|
"component-extraction-dateTime"></a>9.5 Component extraction
|
|
functions on dates and times</h3>
|
|
<p>The date and time datatypes may be considered to be composite
|
|
datatypes in that they contain distinct properties or components.
|
|
The extraction functions specified below extract a single component
|
|
from a date or time value. In all cases the local value (that is,
|
|
the original value as written, without any timezone adjustment) is
|
|
used.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>A time written as <code>24:00:00</code> is treated as
|
|
<code>00:00:00</code> on the following day.</p>
|
|
</div>
|
|
<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-year-from-dateTime"><code>fn:year-from-dateTime</code></a></td>
|
|
<td>Returns the year component of an <code>xs:dateTime</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-month-from-dateTime"><code>fn:month-from-dateTime</code></a></td>
|
|
<td>Returns the month component of an
|
|
<code>xs:dateTime</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-day-from-dateTime"><code>fn:day-from-dateTime</code></a></td>
|
|
<td>Returns the day component of an <code>xs:dateTime</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-hours-from-dateTime"><code>fn:hours-from-dateTime</code></a></td>
|
|
<td>Returns the hours component of an
|
|
<code>xs:dateTime</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-minutes-from-dateTime"><code>fn:minutes-from-dateTime</code></a></td>
|
|
<td>Returns the minute component of an
|
|
<code>xs:dateTime</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-seconds-from-dateTime"><code>fn:seconds-from-dateTime</code></a></td>
|
|
<td>Returns the seconds component of an
|
|
<code>xs:dateTime</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-timezone-from-dateTime"><code>fn:timezone-from-dateTime</code></a></td>
|
|
<td>Returns the timezone component of an
|
|
<code>xs:dateTime</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-year-from-date"><code>fn:year-from-date</code></a></td>
|
|
<td>Returns the year component of an <code>xs:date</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-month-from-date"><code>fn:month-from-date</code></a></td>
|
|
<td>Returns the month component of an <code>xs:date</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-day-from-date"><code>fn:day-from-date</code></a></td>
|
|
<td>Returns the day component of an <code>xs:date</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-timezone-from-date"><code>fn:timezone-from-date</code></a></td>
|
|
<td>Returns the timezone component of an <code>xs:date</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-hours-from-time"><code>fn:hours-from-time</code></a></td>
|
|
<td>Returns the hours component of an <code>xs:time</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-minutes-from-time"><code>fn:minutes-from-time</code></a></td>
|
|
<td>Returns the minutes component of an <code>xs:time</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-seconds-from-time"><code>fn:seconds-from-time</code></a></td>
|
|
<td>Returns the seconds component of an <code>xs:time</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-timezone-from-time"><code>fn:timezone-from-time</code></a></td>
|
|
<td>Returns the timezone component of an <code>xs:time</code>.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-year-from-dateTime" id=
|
|
"func-year-from-dateTime"></a>9.5.1 fn:year-from-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the year component of an <code>xs:dateTime</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:year-from-dateTime</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:dateTime?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
representing the year component in the local value of
|
|
<code>$arg</code>. The result may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:year-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</code>
|
|
returns <code>1999</code>.</p>
|
|
<p>The expression
|
|
<code>fn:year-from-dateTime(xs:dateTime("1999-05-31T21:30:00-05:00"))</code>
|
|
returns <code>1999</code>.</p>
|
|
<p>The expression
|
|
<code>fn:year-from-dateTime(xs:dateTime("1999-12-31T19:20:00"))</code>
|
|
returns <code>1999</code>.</p>
|
|
<p>The expression
|
|
<code>fn:year-from-dateTime(xs:dateTime("1999-12-31T24:00:00"))</code>
|
|
returns <code>2000</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-month-from-dateTime" id=
|
|
"func-month-from-dateTime"></a>9.5.2 fn:month-from-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the month component of an <code>xs:dateTime</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:month-from-dateTime</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:dateTime?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
between 1 and 12, both inclusive, representing the month component
|
|
in the local value of <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:month-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</code>
|
|
returns <code>5</code>.</p>
|
|
<p>The expression
|
|
<code>fn:month-from-dateTime(xs:dateTime("1999-12-31T19:20:00-05:00"))</code>
|
|
returns <code>12</code>.</p>
|
|
<p>The expression
|
|
<code>fn:month-from-dateTime(fn:adjust-dateTime-to-timezone(xs:dateTime("1999-12-31T19:20:00-05:00"),
|
|
xs:dayTimeDuration("PT0S")))</code> returns <code>1</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-day-from-dateTime" id=
|
|
"func-day-from-dateTime"></a>9.5.3 fn:day-from-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the day component of an <code>xs:dateTime</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:day-from-dateTime</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:dateTime?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
between 1 and 31, both inclusive, representing the day component in
|
|
the local value of <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:day-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</code>
|
|
returns <code>31</code>.</p>
|
|
<p>The expression
|
|
<code>fn:day-from-dateTime(xs:dateTime("1999-12-31T20:00:00-05:00"))</code>
|
|
returns <code>31</code>.</p>
|
|
<p>The expression
|
|
<code>fn:day-from-dateTime(fn:adjust-dateTime-to-timezone(xs:dateTime("1999-12-31T19:20:00-05:00"),
|
|
xs:dayTimeDuration("PT0S")))</code> returns <code>1</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-hours-from-dateTime" id=
|
|
"func-hours-from-dateTime"></a>9.5.4 fn:hours-from-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the hours component of an <code>xs:dateTime</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:hours-from-dateTime</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:dateTime?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
between 0 and 23, both inclusive, representing the hours component
|
|
in the local value of <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:hours-from-dateTime(xs:dateTime("1999-05-31T08:20:00-05:00"))</code>
|
|
returns <code>8</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-dateTime(xs:dateTime("1999-12-31T21:20:00-05:00"))</code>
|
|
returns <code>21</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-dateTime(fn:adjust-dateTime-to-timezone(xs:dateTime("1999-12-31T21:20:00-05:00"),
|
|
xs:dayTimeDuration("PT0S")))</code> returns <code>2</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-dateTime(xs:dateTime("1999-12-31T12:00:00"))</code>
|
|
returns <code>12</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-dateTime(xs:dateTime("1999-12-31T24:00:00"))</code>
|
|
returns <code>0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-minutes-from-dateTime" id=
|
|
"func-minutes-from-dateTime"></a>9.5.5
|
|
fn:minutes-from-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the minute component of an <code>xs:dateTime</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:minutes-from-dateTime</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:dateTime?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code> value
|
|
between 0 and 59, both inclusive, representing the minute component
|
|
in the local value of <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:minutes-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</code>
|
|
returns <code>20</code>.</p>
|
|
<p>The expression
|
|
<code>fn:minutes-from-dateTime(xs:dateTime("1999-05-31T13:30:00+05:30"))</code>
|
|
returns <code>30</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-seconds-from-dateTime" id=
|
|
"func-seconds-from-dateTime"></a>9.5.6
|
|
fn:seconds-from-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the seconds component of an
|
|
<code>xs:dateTime</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:seconds-from-dateTime</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:dateTime?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:decimal?</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 function returns an <code>xs:decimal</code> value
|
|
greater than or equal to zero and less than 60, representing the
|
|
seconds and fractional seconds in the local value of
|
|
<code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:seconds-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</code>
|
|
returns <code>0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-timezone-from-dateTime" id=
|
|
"func-timezone-from-dateTime"></a>9.5.7
|
|
fn:timezone-from-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the timezone component of an
|
|
<code>xs:dateTime</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:timezone-from-dateTime</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:dateTime?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration?</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 function returns the timezone component of
|
|
<code>$arg</code>, if any. If <code>$arg</code> has a timezone
|
|
component, then the result is an <code>xs:dayTimeDuration</code>
|
|
that indicates deviation from UTC; its value may range from +14:00
|
|
to -14:00 hours, both inclusive. If <code>$arg</code> has no
|
|
timezone component, the result is the empty sequence.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:timezone-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</code>
|
|
returns <code>xs:dayTimeDuration("-PT5H")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:timezone-from-dateTime(xs:dateTime("2000-06-12T13:20:00Z"))</code>
|
|
returns <code>xs:dayTimeDuration("PT0S")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:timezone-from-dateTime(xs:dateTime("2004-08-27T00:00:00"))</code>
|
|
returns <code>()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-year-from-date" id=
|
|
"func-year-from-date"></a>9.5.8 fn:year-from-date</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the year component of an <code>xs:date</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:year-from-date</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:date?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
representing the year in the local value of <code>$arg</code>. The
|
|
value may be negative.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:year-from-date(xs:date("1999-05-31"))</code> returns
|
|
<code>1999</code>.</p>
|
|
<p>The expression
|
|
<code>fn:year-from-date(xs:date("2000-01-01+05:00"))</code> returns
|
|
<code>2000</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-month-from-date" id=
|
|
"func-month-from-date"></a>9.5.9 fn:month-from-date</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the month component of an <code>xs:date</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:month-from-date</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:date?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
between 1 and 12, both inclusive, representing the month component
|
|
in the local value of <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:month-from-date(xs:date("1999-05-31-05:00"))</code>
|
|
returns <code>5</code>.</p>
|
|
<p>The expression
|
|
<code>fn:month-from-date(xs:date("2000-01-01+05:00"))</code>
|
|
returns <code>1</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-day-from-date" id="func-day-from-date"></a>9.5.10
|
|
fn:day-from-date</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the day component of an <code>xs:date</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:day-from-date</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:date?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
between 1 and 31, both inclusive, representing the day component in
|
|
the localized value of <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:day-from-date(xs:date("1999-05-31-05:00"))</code> returns
|
|
<code>31</code>.</p>
|
|
<p>The expression
|
|
<code>fn:day-from-date(xs:date("2000-01-01+05:00"))</code> returns
|
|
<code>1</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-timezone-from-date" id=
|
|
"func-timezone-from-date"></a>9.5.11 fn:timezone-from-date</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the timezone component of an <code>xs:date</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:timezone-from-date</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:date?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration?</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 function returns the timezone component of
|
|
<code>$arg</code>, if any. If <code>$arg</code> has a timezone
|
|
component, then the result is an <code>xs:dayTimeDuration</code>
|
|
that indicates deviation from UTC; its value may range from +14:00
|
|
to -14:00 hours, both inclusive. If <code>$arg</code> has no
|
|
timezone component, the result is the empty sequence.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:timezone-from-date(xs:date("1999-05-31-05:00"))</code>
|
|
returns <code>xs:dayTimeDuration("-PT5H")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:timezone-from-date(xs:date("2000-06-12Z"))</code> returns
|
|
<code>xs:dayTimeDuration("PT0S")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-hours-from-time" id=
|
|
"func-hours-from-time"></a>9.5.12 fn:hours-from-time</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the hours component of an <code>xs:time</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:hours-from-time</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:time?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code>
|
|
between 0 and 23, both inclusive, representing the value of the
|
|
hours component in the local value of <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>-05:00</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-time(xs:time("11:23:00"))</code> returns
|
|
<code>11</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-time(xs:time("21:23:00"))</code> returns
|
|
<code>21</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-time(xs:time("01:23:00+05:00"))</code> returns
|
|
<code>1</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-time(fn:adjust-time-to-timezone(xs:time("01:23:00+05:00"),
|
|
xs:dayTimeDuration("PT0S")))</code> returns <code>20</code>.</p>
|
|
<p>The expression
|
|
<code>fn:hours-from-time(xs:time("24:00:00"))</code> returns
|
|
<code>0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-minutes-from-time" id=
|
|
"func-minutes-from-time"></a>9.5.13 fn:minutes-from-time</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the minutes component of an <code>xs:time</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:minutes-from-time</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:time?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</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 function returns an <code>xs:integer</code> value
|
|
between 0 and 59, both inclusive, representing the value of the
|
|
minutes component in the local value of <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:minutes-from-time(xs:time("13:00:00Z"))</code> returns
|
|
<code>0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-seconds-from-time" id=
|
|
"func-seconds-from-time"></a>9.5.14 fn:seconds-from-time</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the seconds component of an <code>xs:time</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:seconds-from-time</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:time?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:decimal?</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 function returns an <code>xs:decimal</code> value
|
|
greater than or equal to zero and less than 60, representing the
|
|
seconds and fractional seconds in the local value of
|
|
<code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:seconds-from-time(xs:time("13:20:10.5"))</code> returns
|
|
<code>10.5</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-timezone-from-time" id=
|
|
"func-timezone-from-time"></a>9.5.15 fn:timezone-from-time</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the timezone component of an <code>xs:time</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:timezone-from-time</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:time?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration?</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 function returns the timezone component of
|
|
<code>$arg</code>, if any. If <code>$arg</code> has a timezone
|
|
component, then the result is an <code>xs:dayTimeDuration</code>
|
|
that indicates deviation from UTC; its value may range from +14:00
|
|
to -14:00 hours, both inclusive. If <code>$arg</code> has no
|
|
timezone component, the result is the empty sequence.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:timezone-from-time(xs:time("13:20:00-05:00"))</code>
|
|
returns <code>xs:dayTimeDuration("-PT5H")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:timezone-from-time(xs:time("13:20:00"))</code> returns
|
|
<code>()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="timezone.functions" id="timezone.functions"></a>9.6
|
|
Timezone adjustment functions on dates and time values</h3>
|
|
<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-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone</code></a></td>
|
|
<td>Adjusts an <code>xs:dateTime</code> value to a specific
|
|
timezone, or to no timezone at all.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-adjust-date-to-timezone"><code>fn:adjust-date-to-timezone</code></a></td>
|
|
<td>Adjusts an <code>xs:date</code> value to a specific timezone,
|
|
or to no timezone at all; the result is the date in the target
|
|
timezone that contains the starting instant of the supplied
|
|
date.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-adjust-time-to-timezone"><code>fn:adjust-time-to-timezone</code></a></td>
|
|
<td>Adjusts an <code>xs:time</code> value to a specific timezone,
|
|
or to no timezone at all.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>These functions adjust the timezone component of an
|
|
<code>xs:dateTime</code>, <code>xs:date</code> or
|
|
<code>xs:time</code> value. The <code>$timezone</code> argument to
|
|
these functions is defined as an <code>xs:dayTimeDuration</code>
|
|
but must be a valid timezone value.</p>
|
|
<div class="div3">
|
|
<h4><a name="func-adjust-dateTime-to-timezone" id=
|
|
"func-adjust-dateTime-to-timezone"></a>9.6.1
|
|
fn:adjust-dateTime-to-timezone</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Adjusts an <code>xs:dateTime</code> value to a specific
|
|
timezone, or to no timezone at all.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:adjust-dateTime-to-timezone</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:dateTime?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dateTime</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="2"><code class=
|
|
"function">fn:adjust-dateTime-to-timezone</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime?</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$timezone</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dateTime</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Properties</dt>
|
|
<dd>
|
|
<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-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 implicit-timezone.</p>
|
|
<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>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If <code>$timezone</code> is not specified, then the effective
|
|
value of <code>$timezone</code> is the value of the implicit
|
|
timezone in the dynamic context.</p>
|
|
<p>If <code>$arg</code> is the empty sequence, then the function
|
|
returns the empty sequence.</p>
|
|
<p>If <code>$arg</code> does not have a timezone component and
|
|
<code>$timezone</code> is the empty sequence, then the result is
|
|
<code>$arg</code>.</p>
|
|
<p>If <code>$arg</code> does not have a timezone component and
|
|
<code>$timezone</code> is not the empty sequence, then the result
|
|
is <code>$arg</code> with <code>$timezone</code> as the timezone
|
|
component.</p>
|
|
<p>If <code>$arg</code> has a timezone component and
|
|
<code>$timezone</code> is the empty sequence, then the result is
|
|
the local value of <code>$arg</code> without its timezone
|
|
component.</p>
|
|
<p>If <code>$arg</code> has a timezone component and
|
|
<code>$timezone</code> is not the empty sequence, then the result
|
|
is the <code>xs:dateTime</code> value that is equal to
|
|
<code>$arg</code> and that has a timezone component equal to
|
|
<code>$timezone</code>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODT0003" title=
|
|
"err:FODT0003">err:FODT0003</a>] if <code>$timezone</code> is less
|
|
than <code>-PT14H</code> or greater than <code>PT14H</code> or is
|
|
not an integral number of minutes.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume the dynamic context provides an implicit timezone of
|
|
<code>-05:00 (-PT5H0M)</code>.</p>
|
|
<p>let <code>$tz-10</code> :=
|
|
<code>xs:dayTimeDuration("-PT10H")</code></p>
|
|
<p>The expression
|
|
<code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'))</code>
|
|
returns <code>xs:dateTime('2002-03-07T10:00:00-05:00')</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'))</code>
|
|
returns <code>xs:dateTime('2002-03-07T12:00:00-05:00')</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'),
|
|
$tz-10)</code> returns
|
|
<code>xs:dateTime('2002-03-07T10:00:00-10:00')</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'),
|
|
$tz-10)</code> returns
|
|
<code>xs:dateTime('2002-03-07T07:00:00-10:00')</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'),
|
|
xs:dayTimeDuration("PT10H"))</code> returns
|
|
<code>xs:dateTime('2002-03-08T03:00:00+10:00')</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T00:00:00+01:00'),
|
|
xs:dayTimeDuration("-PT8H"))</code> returns
|
|
<code>xs:dateTime('2002-03-06T15:00:00-08:00')</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'),
|
|
())</code> returns
|
|
<code>xs:dateTime('2002-03-07T10:00:00')</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-07:00'),
|
|
())</code> returns
|
|
<code>xs:dateTime('2002-03-07T10:00:00')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-adjust-date-to-timezone" id=
|
|
"func-adjust-date-to-timezone"></a>9.6.2
|
|
fn:adjust-date-to-timezone</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Adjusts an <code>xs:date</code> value to a specific timezone, or
|
|
to no timezone at all; the result is the date in the target
|
|
timezone that contains the starting instant of the supplied
|
|
date.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:adjust-date-to-timezone</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:date?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:date?</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="2"><code class=
|
|
"function">fn:adjust-date-to-timezone</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:date?</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$timezone</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:date?</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Properties</dt>
|
|
<dd>
|
|
<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-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 implicit-timezone.</p>
|
|
<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>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If <code>$timezone</code> is not specified, then the effective
|
|
value of <code>$timezone</code> is the value of the implicit
|
|
timezone in the dynamic context.</p>
|
|
<p>If <code>$arg</code> is the empty sequence, then the function
|
|
returns the empty sequence.</p>
|
|
<p>If <code>$arg</code> does not have a timezone component and
|
|
<code>$timezone</code> is the empty sequence, then the result is
|
|
the value of <code>$arg</code>.</p>
|
|
<p>If <code>$arg</code> does not have a timezone component and
|
|
<code>$timezone</code> is not the empty sequence, then the result
|
|
is <code>$arg</code> with <code>$timezone</code> as the timezone
|
|
component.</p>
|
|
<p>If <code>$arg</code> has a timezone component and
|
|
<code>$timezone</code> is the empty sequence, then the result is
|
|
the local value of <code>$arg</code> without its timezone
|
|
component.</p>
|
|
<p>If <code>$arg</code> has a timezone component and
|
|
<code>$timezone</code> is not the empty sequence, then the function
|
|
returns the value of the expression:</p>
|
|
<ul>
|
|
<li>
|
|
<p>Let <code>$dt</code> be the value of <a href=
|
|
"#func-dateTime"><code>fn:dateTime($arg,
|
|
xs:time('00:00:00'))</code></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Let <code>$adt</code> be the value of <a href=
|
|
"#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone($dt,
|
|
$timezone)</code></a></p>
|
|
</li>
|
|
<li>
|
|
<p>The function returns the value of <code>xs:date($adt)</code></p>
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODT0003" title=
|
|
"err:FODT0003">err:FODT0003</a>] if <code>$timezone</code> is less
|
|
than <code>-PT14H</code> or greater than <code>PT14H</code> or is
|
|
not an integral number of minutes.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume the dynamic context provides an implicit timezone of
|
|
<code>-05:00 (-PT5H0M)</code>.</p>
|
|
<p>let <code>$tz-10</code> :=
|
|
<code>xs:dayTimeDuration("-PT10H")</code></p>
|
|
<p>The expression
|
|
<code>fn:adjust-date-to-timezone(xs:date("2002-03-07"))</code>
|
|
returns <code>xs:date("2002-03-07-05:00")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-date-to-timezone(xs:date("2002-03-07-07:00"))</code>
|
|
returns <code>xs:date("2002-03-07-05:00")</code>.
|
|
<em>(<code>$arg</code> is converted to
|
|
<code>xs:dateTime("2002-03-07T00:00:00-07:00")</code>. This is
|
|
adjusted to the implicit timezone, giving
|
|
<code>"2002-03-07T02:00:00-05:00"</code>. ).</em></p>
|
|
<p>The expression
|
|
<code>fn:adjust-date-to-timezone(xs:date("2002-03-07"),
|
|
$tz-10)</code> returns
|
|
<code>xs:date("2002-03-07-10:00")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-date-to-timezone(xs:date("2002-03-07-07:00"),
|
|
$tz-10)</code> returns <code>xs:date("2002-03-06-10:00")</code>.
|
|
<em>(<code>$arg</code> is converted to the <code>xs:dateTime
|
|
"2002-03-07T00:00:00-07:00"</code>. This is adjusted to the given
|
|
timezone, giving <code>"2002-03-06T21:00:00-10:00"</code>.
|
|
).</em></p>
|
|
<p>The expression
|
|
<code>fn:adjust-date-to-timezone(xs:date("2002-03-07"), ())</code>
|
|
returns <code>xs:date("2002-03-07")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-date-to-timezone(xs:date("2002-03-07-07:00"),
|
|
())</code> returns <code>xs:date("2002-03-07")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-adjust-time-to-timezone" id=
|
|
"func-adjust-time-to-timezone"></a>9.6.3
|
|
fn:adjust-time-to-timezone</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Adjusts an <code>xs:time</code> value to a specific timezone, or
|
|
to no timezone at all.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:adjust-time-to-timezone</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:time?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:time?</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="2"><code class=
|
|
"function">fn:adjust-time-to-timezone</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:time?</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$timezone</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:time?</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Properties</dt>
|
|
<dd>
|
|
<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-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 implicit-timezone.</p>
|
|
<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>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If <code>$timezone</code> is not specified, then the effective
|
|
value of <code>$timezone</code> is the value of the implicit
|
|
timezone in the dynamic context.</p>
|
|
<p>If <code>$arg</code> is the empty sequence, then the function
|
|
returns the empty sequence.</p>
|
|
<p>If <code>$arg</code> does not have a timezone component and
|
|
<code>$timezone</code> is the empty sequence, then the result is
|
|
<code>$arg</code>.</p>
|
|
<p>If <code>$arg</code> does not have a timezone component and
|
|
<code>$timezone</code> is not the empty sequence, then the result
|
|
is <code>$arg</code> with <code>$timezone</code> as the timezone
|
|
component.</p>
|
|
<p>If <code>$arg</code> has a timezone component and
|
|
<code>$timezone</code> is the empty sequence, then the result is
|
|
the localized value of <code>$arg</code> without its timezone
|
|
component.</p>
|
|
<p>If <code>$arg</code> has a timezone component and
|
|
<code>$timezone</code> is not the empty sequence, then:</p>
|
|
<ul>
|
|
<li>
|
|
<p>Let <code>$dt</code> be the <code>xs:dateTime</code> value
|
|
<a href="#func-dateTime"><code>fn:dateTime(xs:date('1972-12-31'),
|
|
$arg)</code></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Let <code>$adt</code> be the value of <a href=
|
|
"#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone($dt,
|
|
$timezone)</code></a></p>
|
|
</li>
|
|
<li>
|
|
<p>The function returns the <code>xs:time</code> value
|
|
<code>xs:time($adt)</code>.</p>
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODT0003" title=
|
|
"err:FODT0003">err:FODT0003</a>] if <code>$timezone</code> is less
|
|
than <code>-PT14H</code> or greater than <code>PT14H</code> or if
|
|
does not contain an integral number of minutes.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume the dynamic context provides an implicit timezone of
|
|
<code>-05:00 (-PT5H0M)</code>.</p>
|
|
<p>let <code>$tz-10</code> :=
|
|
<code>xs:dayTimeDuration("-PT10H")</code></p>
|
|
<p>The expression
|
|
<code>fn:adjust-time-to-timezone(xs:time("10:00:00"))</code>
|
|
returns <code>xs:time("10:00:00-05:00")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"))</code>
|
|
returns <code>xs:time("12:00:00-05:00")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-time-to-timezone(xs:time("10:00:00"),
|
|
$tz-10)</code> returns <code>xs:time("10:00:00-10:00")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"),
|
|
$tz-10)</code> returns <code>xs:time("07:00:00-10:00")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-time-to-timezone(xs:time("10:00:00"), ())</code>
|
|
returns <code>xs:time("10:00:00")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"),
|
|
())</code> returns <code>xs:time("10:00:00")</code>.</p>
|
|
<p>The expression
|
|
<code>fn:adjust-time-to-timezone(xs:time("10:00:00-07:00"),
|
|
xs:dayTimeDuration("PT10H"))</code> returns
|
|
<code>xs:time("03:00:00+10:00")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="dateTime-arithmetic" id="dateTime-arithmetic"></a>9.7
|
|
Arithmetic operators on durations, dates and times</h3>
|
|
<p>These functions support adding or subtracting a duration value
|
|
to or from an <code>xs:dateTime</code>, an <code>xs:date</code> or
|
|
an <code>xs:time</code> value. Appendix E of <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
describes an algorithm for performing such operations.</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-subtract-dateTimes"><code>op:subtract-dateTimes</code></a></td>
|
|
<td>Returns an <code>xs:dayTimeDuration</code> representing the
|
|
amount of elapsed time between the instants <code>arg2</code> and
|
|
<code>arg1</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-subtract-dates"><code>op:subtract-dates</code></a></td>
|
|
<td>Returns the <code>xs:dayTimeDuration</code> that corresponds to
|
|
the elapsed time between the starting instant of <code>$arg2</code>
|
|
and the starting instant of <code>$arg2</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-subtract-times"><code>op:subtract-times</code></a></td>
|
|
<td>Returns the <code>xs:dayTimeDuration</code> that corresponds to
|
|
the elapsed time between the values of <code>$arg2</code> and
|
|
<code>$arg1</code> treated as times on the same date.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-add-yearMonthDuration-to-dateTime"><code>op:add-yearMonthDuration-to-dateTime</code></a></td>
|
|
<td>Returns the <code>xs:dateTime</code> that is a given duration
|
|
after a specified <code>xs:dateTime</code> (or before, if the
|
|
duration is negative).</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-add-dayTimeDuration-to-dateTime"><code>op:add-dayTimeDuration-to-dateTime</code></a></td>
|
|
<td>Returns the <code>xs:dateTime</code> that is a given duration
|
|
after a specified <code>xs:dateTime</code> (or before, if the
|
|
duration is negative).</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-subtract-yearMonthDuration-from-dateTime"><code>op:subtract-yearMonthDuration-from-dateTime</code></a></td>
|
|
<td>Returns the <code>xs:dateTime</code> that is a given duration
|
|
before a specified <code>xs:dateTime</code> (or after, if the
|
|
duration is negative).</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-subtract-dayTimeDuration-from-dateTime"><code>op:subtract-dayTimeDuration-from-dateTime</code></a></td>
|
|
<td>Returns the <code>xs:dateTime</code> that is a given duration
|
|
before a specified <code>xs:dateTime</code> (or after, if the
|
|
duration is negative).</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-add-yearMonthDuration-to-date"><code>op:add-yearMonthDuration-to-date</code></a></td>
|
|
<td>Returns the <code>xs:date</code> that is a given duration after
|
|
a specified <code>xs:date</code> (or before, if the duration is
|
|
negative).</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-add-dayTimeDuration-to-date"><code>op:add-dayTimeDuration-to-date</code></a></td>
|
|
<td>Returns the <code>xs:date</code> that is a given duration after
|
|
a specified <code>xs:date</code> (or before, if the duration is
|
|
negative).</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-subtract-yearMonthDuration-from-date"><code>op:subtract-yearMonthDuration-from-date</code></a></td>
|
|
<td>Returns the <code>xs:date</code> that is a given duration
|
|
before a specified <code>xs:date</code> (or after, if the duration
|
|
is negative).</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-subtract-dayTimeDuration-from-date"><code>op:subtract-dayTimeDuration-from-date</code></a></td>
|
|
<td>Returns the <code>xs:date</code> that is a given duration
|
|
before a specified <code>xs:date</code> (or after, if the duration
|
|
is negative).</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-add-dayTimeDuration-to-time"><code>op:add-dayTimeDuration-to-time</code></a></td>
|
|
<td>Returns the <code>xs:time</code> value that is a given duration
|
|
after a specified <code>xs:time</code> (or before, if the duration
|
|
is negative or causes wrap-around past midnight)</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-subtract-dayTimeDuration-from-time"><code>op:subtract-dayTimeDuration-from-time</code></a></td>
|
|
<td>Returns the <code>xs:time</code> value that is a given duration
|
|
before a specified <code>xs:time</code> (or after, if the duration
|
|
is negative or causes wrap-around past midnight)</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="duration-limits" id="duration-limits"></a>9.7.1 Limits
|
|
and precision</h4>
|
|
<p>A processor that limits the number of digits in date and time
|
|
datatype representations may encounter overflow and underflow
|
|
conditions when it tries to execute the functions in this section.
|
|
In these situations, the processor <a title="must" class="termref"
|
|
href="#must"><span class="arrow">·</span>must<span class=
|
|
"arrow">·</span></a> return P0M or PT0S in case of duration
|
|
underflow and 00:00:00 in case of time underflow. It <a title=
|
|
"must" class="termref" href="#must"><span class=
|
|
"arrow">·</span>must<span class="arrow">·</span></a> raise an error
|
|
[<a href="#ERRFODT0001" title="err:FODT0001">err:FODT0001</a>] in
|
|
case of overflow.</p>
|
|
<p>The value spaces of the two totally ordered subtypes of
|
|
<code>xs:duration</code> described in <a href=
|
|
"#duration-subtypes"><b>8.1 Two totally ordered subtypes of
|
|
duration</b></a> are <code>xs:integer</code> months for
|
|
<code>xs:yearMonthDuration</code> and <code>xs:decimal</code>
|
|
seconds for <code>xs:dayTimeDuration</code>. If a processor limits
|
|
the number of digits allowed in the representation of
|
|
<code>xs:integer</code> and <code>xs:decimal</code> then overflow
|
|
and underflow situations can arise when it tries to execute the
|
|
functions in <a href="#duration-arithmetic"><b>8.4 Arithmetic
|
|
operators on durations</b></a>. In these situations the processor
|
|
<a title="must" class="termref" href="#must"><span class=
|
|
"arrow">·</span>must<span class="arrow">·</span></a> return zero in
|
|
case of numeric underflow and P0M or PT0S in case of duration
|
|
underflow. It <a title="must" class="termref" href=
|
|
"#must"><span class="arrow">·</span>must<span class=
|
|
"arrow">·</span></a> raise an error [<a href="#ERRFODT0002" title=
|
|
"err:FODT0002">err:FODT0002</a>] in case of overflow.</p>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subtract-dateTimes" id=
|
|
"func-subtract-dateTimes"></a>9.7.2 op:subtract-dateTimes</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns an <code>xs:dayTimeDuration</code> representing the
|
|
amount of elapsed time between the instants <code>arg2</code> and
|
|
<code>arg1</code>.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "-" operator on
|
|
<code>xs:dateTime</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:subtract-dateTimes</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If either <code>$arg1</code> or <code>$arg2</code> do not
|
|
contain an explicit timezone then, for the purpose of the
|
|
operation, the implicit timezone provided by the dynamic context
|
|
(See <a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
|
|
Section C.2 Dynamic Context Components</a>
|
|
<sup><small>XP30</small></sup>.) is assumed to be present as part
|
|
of the value.</p>
|
|
<p>The function returns the elapsed time between the date/time
|
|
instant <code>arg2</code> and the date/time instant
|
|
<code>arg1</code>, computed according to the algorithm given in
|
|
Appendix E of <a href="#xmlschema-2">[XML Schema Part 2: Datatypes
|
|
Second Edition]</a>, and expressed as a
|
|
<code>xs:dayTimeDuration</code>.</p>
|
|
<p>If the normalized value of <code>$arg1</code> precedes in time
|
|
the normalized value of <code>$arg2</code>, then the returned value
|
|
is a negative duration.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>-05:00</code>.</p>
|
|
<p>The expression
|
|
<code>op:subtract-dateTimes(xs:dateTime("2000-10-30T06:12:00"),
|
|
xs:dateTime("1999-11-28T09:00:00Z"))</code> returns
|
|
<code>xs:dayTimeDuration("P337DT2H12M")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subtract-dates" id=
|
|
"func-subtract-dates"></a>9.7.3 op:subtract-dates</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:dayTimeDuration</code> that corresponds to
|
|
the elapsed time between the starting instant of <code>$arg2</code>
|
|
and the starting instant of <code>$arg2</code>.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "-" operator on
|
|
<code>xs:date</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:subtract-dates</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:date</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:date</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If either <code>$arg1</code> or <code>$arg2</code> do not
|
|
contain an explicit timezone then, for the purpose of the
|
|
operation, the implicit timezone provided by the dynamic context
|
|
(See <a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
|
|
Section C.2 Dynamic Context Components</a>
|
|
<sup><small>XP30</small></sup>.) is assumed to be present as part
|
|
of the value.</p>
|
|
<p>The starting instant of an <code>xs:date</code> is the
|
|
<code>xs:dateTime</code> at <code>00:00:00</code> on that date.</p>
|
|
<p>The function returns the result of subtracting the two starting
|
|
instants using <a href=
|
|
"#func-subtract-dateTimes"><code>op:subtract-dateTimes</code></a>.</p>
|
|
<p>If the starting instant of <code>$arg1</code> precedes in time
|
|
the starting instant of <code>$arg2</code>, then the returned value
|
|
is a negative duration.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>Z</code>.</p>
|
|
<p>The expression <code>op:subtract-dates(xs:date("2000-10-30"),
|
|
xs:date("1999-11-28"))</code> returns
|
|
<code>xs:dayTimeDuration("P337D")</code>. <em>(The normalized
|
|
values of the two starting instants are <code>{2000, 10, 30, 0, 0,
|
|
0, PT0S}</code> and <code>{1999, 11, 28, 0, 0, 0,
|
|
PT0S}</code>.).</em></p>
|
|
<p>Now assume that the dynamic context provides an implicit
|
|
timezone value of <code>+05:00</code>.</p>
|
|
<p>The expression <code>op:subtract-dates(xs:date("2000-10-30"),
|
|
xs:date("1999-11-28Z"))</code> returns
|
|
<code>xs:dayTimeDuration("P336DT19H")</code>. <em>( The normalized
|
|
values of the two starting instants are <code>{2000, 10, 29, 19, 0,
|
|
0, PT0S}</code> and <code>{1999, 11, 28, 0, 0, 0,
|
|
PT0S}</code>.).</em></p>
|
|
<p>The expression
|
|
<code>op:subtract-dates(xs:date("2000-10-15-05:00"),
|
|
xs:date("2000-10-10+02:00"))</code> returns
|
|
<code>xs:dayTimeDuration("P5DT7H")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subtract-times" id=
|
|
"func-subtract-times"></a>9.7.4 op:subtract-times</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:dayTimeDuration</code> that corresponds to
|
|
the elapsed time between the values of <code>$arg2</code> and
|
|
<code>$arg1</code> treated as times on the same date.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "-" operator on
|
|
<code>xs:time</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:subtract-times</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:time</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:time</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the result of the expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
op-subtract-dateTimes(
|
|
fn:dateTime(xs:date('1972-12-31'), $arg1),
|
|
fn:dateTime(xs:date('1972-12-31'), $arg2))
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Any other reference date would work equally well.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the dynamic context provides an implicit timezone
|
|
value of <code>-05:00</code>. Assume, also, that the date
|
|
components of the reference <code>xs:dateTime</code> correspond to
|
|
<code>"1972-12-31"</code>.</p>
|
|
<p>The expression <code>op:subtract-times(xs:time("11:12:00Z"),
|
|
xs:time("04:00:00"))</code> returns
|
|
<code>xs:dayTimeDuration("PT2H12M")</code>. <em>(This is obtained
|
|
by subtracting from the <code>xs:dateTime</code> value <code>{1972,
|
|
12, 31, 11, 12, 0, PT0S}</code> the <code>xs:dateTime</code> value
|
|
<code>{1972, 12, 31, 9, 0, 0, PT0S}</code>.).</em></p>
|
|
<p>The expression
|
|
<code>op:subtract-times(xs:time("11:00:00-05:00"),
|
|
xs:time("21:30:00+05:30"))</code> returns
|
|
<code>xs:dayTimeDuration("PT0S")</code>. <em>(The two
|
|
<code>xs:dateTime</code> values are <code>{1972, 12, 31, 11, 0, 0,
|
|
-PT5H}</code> and <code>{1972, 12, 31, 21, 30, 0, PT5H30M}</code>.
|
|
These normalize to <code>{1972, 12, 31, 16, 0, 0, PT0S}</code> and
|
|
<code>{1972, 12, 31, 16, 0, 0, PT0S}</code>. ).</em></p>
|
|
<p>The expression
|
|
<code>op:subtract-times(xs:time("17:00:00-06:00"),
|
|
xs:time("08:00:00+09:00"))</code> returns
|
|
<code>xs:dayTimeDuration("P1D")</code>. <em>(The two normalized
|
|
<code>xs:dateTime</code> values are <code>{1972, 12, 31, 23, 0, 0,
|
|
PT0S}</code> and <code>{1972, 12, 30, 23, 0, 0,
|
|
PT0S}</code>.).</em></p>
|
|
<p>The expression <code>op:subtract-times(xs:time("24:00:00"),
|
|
xs:time("23:59:59"))</code> returns
|
|
<code>xs:dayTimeDuration("-PT23H59M59S")</code>. <em>(The two
|
|
normalized <code>xs:dateTime</code> values are <code>{1972, 12, 31,
|
|
0, 0, 0, ()}</code> and <code>{1972, 12, 31, 23, 59, 59.0,
|
|
()}</code>.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-add-yearMonthDuration-to-dateTime" id=
|
|
"func-add-yearMonthDuration-to-dateTime"></a>9.7.5
|
|
op:add-yearMonthDuration-to-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:dateTime</code> that is a given duration
|
|
after a specified <code>xs:dateTime</code> (or before, if the
|
|
duration is negative).</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "+" operator on
|
|
<code>xs:dateTime</code> and <code>xs:yearMonthDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:add-yearMonthDuration-to-dateTime</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dateTime</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>The function returns the result of adding <code>$arg2</code> to
|
|
the value of <code>$arg1</code> using the algorithm described in
|
|
Appendix E of <a href="#xmlschema-2">[XML Schema Part 2: Datatypes
|
|
Second Edition]</a>, disregarding the rule about leap seconds. If
|
|
<code>$arg2</code> is negative, then the result
|
|
<code>xs:dateTime</code> precedes <code>$arg1</code>.</p>
|
|
<p>The result has the same timezone as <code>$arg1</code>. If
|
|
<code>$arg1</code> has no timezone, the result has no timezone.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:add-yearMonthDuration-to-dateTime(xs:dateTime("2000-10-30T11:12:00"),
|
|
xs:yearMonthDuration("P1Y2M"))</code> returns
|
|
<code>xs:dateTime("2001-12-30T11:12:00")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-add-dayTimeDuration-to-dateTime" id=
|
|
"func-add-dayTimeDuration-to-dateTime"></a>9.7.6
|
|
op:add-dayTimeDuration-to-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:dateTime</code> that is a given duration
|
|
after a specified <code>xs:dateTime</code> (or before, if the
|
|
duration is negative).</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "+" operator on
|
|
<code>xs:dateTime</code> and <code>xs:dayTimeDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:add-dayTimeDuration-to-dateTime</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dateTime</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>The function returns the result of adding <code>$arg2</code> to
|
|
the value of <code>$arg1</code> using the algorithm described in
|
|
Appendix E of <a href="#xmlschema-2">[XML Schema Part 2: Datatypes
|
|
Second Edition]</a>, disregarding the rule about leap seconds. If
|
|
<code>$arg2</code> is negative, then the result
|
|
<code>xs:dateTime</code> precedes <code>$arg1</code>.</p>
|
|
<p>The result has the same timezone as <code>$arg1</code>. If
|
|
<code>$arg1</code> has no timezone, the result has no timezone.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:add-dayTimeDuration-to-dateTime(xs:dateTime("2000-10-30T11:12:00"),
|
|
xs:dayTimeDuration("P3DT1H15M"))</code> returns
|
|
<code>xs:dateTime("2000-11-02T12:27:00")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subtract-yearMonthDuration-from-dateTime" id=
|
|
"func-subtract-yearMonthDuration-from-dateTime"></a>9.7.7
|
|
op:subtract-yearMonthDuration-from-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:dateTime</code> that is a given duration
|
|
before a specified <code>xs:dateTime</code> (or after, if the
|
|
duration is negative).</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "-" operator on
|
|
<code>xs:dateTime</code> and <code>xs:yearMonthDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:subtract-yearMonthDuration-from-dateTime</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dateTime</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>The function returns the <code>xs:dateTime</code> computed by
|
|
negating <code>$arg2</code> and adding the result to the value of
|
|
<code>$arg1</code> using the function <a href=
|
|
"#func-add-yearMonthDuration-to-dateTime"><code>op:add-yearMonthDuration-to-dateTime</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:subtract-yearMonthDuration-from-dateTime(xs:dateTime("2000-10-30T11:12:00"),
|
|
xs:yearMonthDuration("P1Y2M"))</code> returns
|
|
<code>xs:dateTime("1999-08-30T11:12:00")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subtract-dayTimeDuration-from-dateTime" id=
|
|
"func-subtract-dayTimeDuration-from-dateTime"></a>9.7.8
|
|
op:subtract-dayTimeDuration-from-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:dateTime</code> that is a given duration
|
|
before a specified <code>xs:dateTime</code> (or after, if the
|
|
duration is negative).</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "-" operator on
|
|
<code>xs:dateTime</code> and <code>xs:dayTimeDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:subtract-dayTimeDuration-from-dateTime</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dateTime</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the <code>xs:dateTime</code> computed by
|
|
negating <code>$arg2</code> and adding the result to the value of
|
|
<code>$arg1</code> using the function <a href=
|
|
"#func-add-dayTimeDuration-to-dateTime"><code>op:add-dayTimeDuration-to-dateTime</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:subtract-dayTimeDuration-from-dateTime(xs:dateTime("2000-10-30T11:12:00"),
|
|
xs:dayTimeDuration("P3DT1H15M"))</code> returns
|
|
<code>xs:dateTime("2000-10-27T09:57:00")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-add-yearMonthDuration-to-date" id=
|
|
"func-add-yearMonthDuration-to-date"></a>9.7.9
|
|
op:add-yearMonthDuration-to-date</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:date</code> that is a given duration after
|
|
a specified <code>xs:date</code> (or before, if the duration is
|
|
negative).</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "+" operator on
|
|
<code>xs:date</code> and <code>xs:yearMonthDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:add-yearMonthDuration-to-date</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:date</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:date</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>The function returns the result of casting <code>$arg1</code> to
|
|
an <code>xs:dateTime</code>, adding <code>$arg2</code> using the
|
|
function <a href=
|
|
"#func-add-yearMonthDuration-to-dateTime"><code>op:add-yearMonthDuration-to-dateTime</code></a>,
|
|
and casting the result back to an <code>xs:date</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:add-yearMonthDuration-to-date(xs:date("2000-10-30"),
|
|
xs:yearMonthDuration("P1Y2M"))</code> returns
|
|
<code>xs:date("2001-12-30")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-add-dayTimeDuration-to-date" id=
|
|
"func-add-dayTimeDuration-to-date"></a>9.7.10
|
|
op:add-dayTimeDuration-to-date</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:date</code> that is a given duration after
|
|
a specified <code>xs:date</code> (or before, if the duration is
|
|
negative).</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "+" operator on
|
|
<code>xs:date</code> and <code>xs:dayTimeDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:add-dayTimeDuration-to-date</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:date</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:date</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>The function returns the result of casting <code>$arg1</code> to
|
|
an <code>xs:dateTime</code>, adding <code>$arg2</code> using the
|
|
function <a href=
|
|
"#func-add-dayTimeDuration-to-dateTime"><code>op:add-dayTimeDuration-to-dateTime</code></a>,
|
|
and casting the result back to an <code>xs:date</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:add-dayTimeDuration-to-date(xs:date("2004-10-30Z"),
|
|
xs:dayTimeDuration("P2DT2H30M0S"))</code> returns
|
|
<code>xs:date("2004-11-01Z")</code>. <em>( The starting instant of
|
|
the first argument is the <code>xs:dateTime</code> value
|
|
<code>{2004, 10, 30, 0, 0, 0, PT0S}</code>. Adding the second
|
|
argument to this gives the <code>xs:dateTime</code> value
|
|
<code>{2004, 11, 1, 2, 30, 0, PT0S}</code>. The time components are
|
|
then discarded. ).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subtract-yearMonthDuration-from-date" id=
|
|
"func-subtract-yearMonthDuration-from-date"></a>9.7.11
|
|
op:subtract-yearMonthDuration-from-date</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:date</code> that is a given duration before
|
|
a specified <code>xs:date</code> (or after, if the duration is
|
|
negative).</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "-" operator on
|
|
<code>xs:date</code> and <code>xs:yearMonthDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:subtract-yearMonthDuration-from-date</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:date</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:yearMonthDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:date</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>Returns the <code>xs:date</code> computed by negating
|
|
<code>$arg2</code> and adding the result to <code>$arg1</code>
|
|
using the function <a href=
|
|
"#func-add-yearMonthDuration-to-date"><code>op:add-yearMonthDuration-to-date</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:subtract-yearMonthDuration-from-date(xs:date("2000-10-30"),
|
|
xs:yearMonthDuration("P1Y2M"))</code> returns
|
|
<code>xs:date("1999-08-30")</code>.</p>
|
|
<p>The expression
|
|
<code>op:subtract-yearMonthDuration-from-date(xs:date("2000-02-29Z"),
|
|
xs:yearMonthDuration("P1Y"))</code> returns
|
|
<code>xs:date("1999-02-28Z")</code>.</p>
|
|
<p>The expression
|
|
<code>op:subtract-yearMonthDuration-from-date(xs:date("2000-10-31-05:00"),
|
|
xs:yearMonthDuration("P1Y1M"))</code> returns
|
|
<code>xs:date("1999-09-30-05:00")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subtract-dayTimeDuration-from-date" id=
|
|
"func-subtract-dayTimeDuration-from-date"></a>9.7.12
|
|
op:subtract-dayTimeDuration-from-date</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:date</code> that is a given duration before
|
|
a specified <code>xs:date</code> (or after, if the duration is
|
|
negative).</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "-" operator on
|
|
<code>xs:date</code> and <code>xs:dayTimeDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:subtract-dayTimeDuration-from-date</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:date</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:date</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>Returns the <code>xs:date</code> computed by negating
|
|
<code>$arg2</code> and adding the result to <code>$arg1</code>
|
|
using the function <a href=
|
|
"#func-add-dayTimeDuration-to-date"><code>op:add-dayTimeDuration-to-date</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:subtract-dayTimeDuration-from-date(xs:date("2000-10-30"),
|
|
xs:dayTimeDuration("P3DT1H15M"))</code> returns
|
|
<code>xs:date("2000-10-26")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-add-dayTimeDuration-to-time" id=
|
|
"func-add-dayTimeDuration-to-time"></a>9.7.13
|
|
op:add-dayTimeDuration-to-time</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:time</code> value that is a given duration
|
|
after a specified <code>xs:time</code> (or before, if the duration
|
|
is negative or causes wrap-around past midnight)</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "+" operator on
|
|
<code>xs:time</code> and <code>xs:dayTimeDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:add-dayTimeDuration-to-time</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:time</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:time</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>First, the days component in the canonical lexical
|
|
representation of <code>$arg2</code> is set to zero (0) and the
|
|
value of the resulting <code>xs:dayTimeDuration</code> is
|
|
calculated. Alternatively, the value of <code>$arg2</code> modulus
|
|
86,400 is used as the second argument. This value is added to the
|
|
value of <code>$arg1</code> converted to an
|
|
<code>xs:dateTime</code> using a reference date such as
|
|
<code>1972-12-31</code>, and the time component of the result is
|
|
returned. Note that the <code>xs:time</code> returned may occur in
|
|
a following or preceding day and may be less than
|
|
<code>$arg1</code>.</p>
|
|
<p>The result has the same timezone as <code>$arg1</code>. If
|
|
<code>$arg1</code> has no timezone, the result has no timezone.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:add-dayTimeDuration-to-time(xs:time("11:12:00"),
|
|
xs:dayTimeDuration("P3DT1H15M"))</code> returns
|
|
<code>xs:time("12:27:00")</code>.</p>
|
|
<p>The expression
|
|
<code>op:add-dayTimeDuration-to-time(xs:time("23:12:00+03:00"),
|
|
xs:dayTimeDuration("P1DT3H15M"))</code> returns
|
|
<code>xs:time("02:27:00+03:00")</code>. <em>(That is, <code>{0, 0,
|
|
0, 2, 27, 0, PT3H}</code>).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subtract-dayTimeDuration-from-time" id=
|
|
"func-subtract-dayTimeDuration-from-time"></a>9.7.14
|
|
op:subtract-dayTimeDuration-from-time</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the <code>xs:time</code> value that is a given duration
|
|
before a specified <code>xs:time</code> (or after, if the duration
|
|
is negative or causes wrap-around past midnight)</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "-" operator on
|
|
<code>xs:time</code> and <code>xs:dayTimeDuration</code>
|
|
values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:subtract-dayTimeDuration-from-time</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:time</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dayTimeDuration</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:time</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>The function returns the result of negating <code>$arg2</code>
|
|
and adding the result to <code>$arg1</code> using the function
|
|
<code>add-dayTimeDuration-to-time</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>op:subtract-dayTimeDuration-from-time(xs:time("11:12:00"),
|
|
xs:dayTimeDuration("P3DT1H15M"))</code> returns
|
|
<code>xs:time("09:57:00")</code>.</p>
|
|
<p>The expression
|
|
<code>op:subtract-dayTimeDuration-from-time(xs:time("08:20:00-05:00"),
|
|
xs:dayTimeDuration("P23DT10H10M"))</code> returns
|
|
<code>xs:time("22:10:00-05:00")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="formatting-dates-and-times" id=
|
|
"formatting-dates-and-times"></a>9.8 Formatting dates and
|
|
times</h3>
|
|
<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-dateTime"><code>fn:format-dateTime</code></a></td>
|
|
<td>Returns a string containing an <code>xs:dateTime</code> value
|
|
formatted for display.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-format-date"><code>fn:format-date</code></a></td>
|
|
<td>Returns a string containing an <code>xs:date</code> value
|
|
formatted for display.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-format-time"><code>fn:format-time</code></a></td>
|
|
<td>Returns a string containing an <code>xs:time</code> value
|
|
formatted for display.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>Three functions are provided to represent dates and times as a
|
|
string, using the conventions of a selected calendar, language, and
|
|
country. The signatures are presented first, followed by the rules
|
|
which apply to each of the functions.</p>
|
|
<div class="div3">
|
|
<h4><a name="func-format-dateTime" id=
|
|
"func-format-dateTime"></a>9.8.1 fn:format-dateTime</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a string containing an <code>xs:dateTime</code> value
|
|
formatted for display.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:format-dateTime</code>(<code class=
|
|
"arg">$value</code><code class=
|
|
"as"> as </code><code class="type">xs:dateTime?</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="5"><code class=
|
|
"function">fn:format-dateTime</code>(</td>
|
|
<td valign="baseline"><code class="arg">$value</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:dateTime?</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>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$calendar</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">$place</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">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-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>.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>See <a href="#rules-for-datetime-formatting"><b>9.8.4 The
|
|
date/time formatting functions</b></a>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-format-date" id="func-format-date"></a>9.8.2
|
|
fn:format-date</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a string containing an <code>xs:date</code> value
|
|
formatted for display.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:format-date</code>(<code class=
|
|
"arg">$value</code><code class=
|
|
"as"> as </code><code class="type">xs:date?</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="5"><code class=
|
|
"function">fn:format-date</code>(</td>
|
|
<td valign="baseline"><code class="arg">$value</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:date?</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>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$calendar</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">$place</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">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-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>.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>See <a href="#rules-for-datetime-formatting"><b>9.8.4 The
|
|
date/time formatting functions</b></a>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-format-time" id="func-format-time"></a>9.8.3
|
|
fn:format-time</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a string containing an <code>xs:time</code> value
|
|
formatted for display.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:format-time</code>(<code class=
|
|
"arg">$value</code><code class=
|
|
"as"> as </code><code class="type">xs:time?</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="5"><code class=
|
|
"function">fn:format-time</code>(</td>
|
|
<td valign="baseline"><code class="arg">$value</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:time?</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>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$calendar</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">$place</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">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-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>.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>See <a href="#rules-for-datetime-formatting"><b>9.8.4 The
|
|
date/time formatting functions</b></a>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="rules-for-datetime-formatting" id=
|
|
"rules-for-datetime-formatting"></a>9.8.4 The date/time formatting
|
|
functions</h4>
|
|
<p>The <a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a>,
|
|
<a href="#func-format-date"><code>fn:format-date</code></a>, and
|
|
<a href="#func-format-time"><code>fn:format-time</code></a>
|
|
functions format <code>$value</code> as a string using the picture
|
|
string specified by the <code>$picture</code> argument, the
|
|
calendar specified by the <code>$calendar</code> argument, the
|
|
language specified by the <code>$language</code> argument, and the
|
|
country <span>or other place name</span> specified by the
|
|
<code>$place</code> argument. The result of the function is the
|
|
formatted string representation of the supplied
|
|
<code>xs:dateTime</code>, <code>xs:date</code>, or
|
|
<code>xs:time</code> value.</p>
|
|
<p><span class="termdef"><a name="dt-date-formatting-function" id=
|
|
"dt-date-formatting-function"></a>[Definition] The three functions
|
|
<a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a>,
|
|
<a href="#func-format-date"><code>fn:format-date</code></a>, and
|
|
<a href="#func-format-time"><code>fn:format-time</code></a> are
|
|
referred to collectively as the <b>date formatting
|
|
functions</b>.</span></p>
|
|
<p>If <code>$value</code> is the empty sequence, the function
|
|
returns the empty sequence.</p>
|
|
<p>Calling the two-argument form of each of the three functions is
|
|
equivalent to calling the five-argument form with each of the last
|
|
three arguments set to an empty sequence.</p>
|
|
<p>For details of the <code>$language</code>,
|
|
<code>$calendar</code>, and <code>$place</code> arguments, see
|
|
<a href="#lang-cal-place"><b>9.8.4.3 The language, calendar, and
|
|
place arguments</b></a>.</p>
|
|
<p>In general, the use of an invalid <code>$picture</code>,
|
|
<code>$language</code>, <code>$calendar</code>, or
|
|
<code>$place</code> argument results in a dynamic error. By
|
|
contrast, use of an option in any of these arguments that is valid
|
|
but not supported by the implementation is not an error, and in
|
|
these cases the implementation is required to output the value in a
|
|
fallback representation.</p>
|
|
<div class="div4">
|
|
<h5><a name="date-picture-string" id=
|
|
"date-picture-string"></a>9.8.4.1 The picture string</h5>
|
|
<p>The picture consists of a sequence of variable markers and
|
|
literal substrings. A substring enclosed in square brackets is
|
|
interpreted as a variable marker; substrings not enclosed in square
|
|
brackets are taken as literal substrings. The literal substrings
|
|
are optional and if present are rendered unchanged, including any
|
|
whitespace. If an opening or closing square bracket is required
|
|
within a literal substring, it <strong>must</strong> be doubled.
|
|
The variable markers are replaced in the result by strings
|
|
representing aspects of the date and/or time to be formatted. These
|
|
are described in detail below.</p>
|
|
<p>A variable marker consists of a component specifier followed
|
|
optionally by one or two presentation modifiers and/or optionally
|
|
by a width modifier. Whitespace within a variable marker is
|
|
ignored.</p>
|
|
<p>The variable marker may be separated into its components by
|
|
applying the following rules:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>The component specifier is always present and is always a single
|
|
letter.</p>
|
|
</li>
|
|
<li>
|
|
<p>The width modifier may be recognized by the presence of a
|
|
comma.</p>
|
|
</li>
|
|
<li>
|
|
<p>The substring between the component specifier and the comma (if
|
|
present) or the end of the string (if there is no comma) contains
|
|
the first and second presentation modifiers, both of which are
|
|
optional. If this substring contains a single character, this is
|
|
interpreted as the first presentation modifier. If it contains more
|
|
than one character, the last character is examined: if it is valid
|
|
as a second presentation modifier then it is treated as such, and
|
|
the preceding part of the substring constitutes the first
|
|
presentation modifier. Otherwise, the second presentation modifier
|
|
is presumed absent and the whole substring is interpreted as the
|
|
first presentation modifier.</p>
|
|
</li>
|
|
</ol>
|
|
<p>The <em>component specifier</em> indicates the component of the
|
|
date or time that is required, and takes the following values:</p>
|
|
<table summary="A table [this is bad style]" border="1"
|
|
cellpadding="5">
|
|
<thead>
|
|
<tr>
|
|
<th align="left" colspan="1">Specifier</th>
|
|
<th align="left" colspan="1">Meaning</th>
|
|
<th align="left" colspan="1">Default Presentation Modifier</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td valign="top">Y</td>
|
|
<td>year (absolute value)</td>
|
|
<td valign="top">1</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">M</td>
|
|
<td>month in year</td>
|
|
<td valign="top">1</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">D</td>
|
|
<td>day in month</td>
|
|
<td valign="top">1</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">d</td>
|
|
<td>day in year</td>
|
|
<td valign="top">1</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">F</td>
|
|
<td>day of week</td>
|
|
<td valign="top">n</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">W</td>
|
|
<td>week in year</td>
|
|
<td valign="top">1</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">w</td>
|
|
<td>week in month</td>
|
|
<td valign="top">1</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">H</td>
|
|
<td>hour in day (24 hours)</td>
|
|
<td valign="top">1</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">h</td>
|
|
<td>hour in half-day (12 hours)</td>
|
|
<td valign="top">1</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">P</td>
|
|
<td>am/pm marker</td>
|
|
<td valign="top">n</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">m</td>
|
|
<td>minute in hour</td>
|
|
<td valign="top">01</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">s</td>
|
|
<td>second in minute</td>
|
|
<td valign="top">01</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">f</td>
|
|
<td>fractional seconds</td>
|
|
<td valign="top">1</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Z</td>
|
|
<td>timezone</td>
|
|
<td valign="top">01:01</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">z</td>
|
|
<td>timezone (same as Z, but modified where appropriate to include
|
|
a prefix as a time offset using GMT, for example GMT+1 or
|
|
GMT-05:00. For this component there is a fixed prefix of
|
|
<code>GMT</code>, or a localized variation thereof for the chosen
|
|
language, and the remainder of the value is formatted as for
|
|
specifier <code>Z</code>.</td>
|
|
<td valign="top">01:01</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">C</td>
|
|
<td>calendar: the name or abbreviation of a calendar name</td>
|
|
<td valign="top">n</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">E</td>
|
|
<td>era: the name of a baseline for the numbering of years, for
|
|
example the reign of a monarch</td>
|
|
<td valign="top">n</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>An error is reported [<a href="#ERRFOFD1340" title=
|
|
"err:FOFD1340">err:FOFD1340</a>] if the syntax of the picture is
|
|
incorrect.</p>
|
|
<p>An error is reported [<a href="#ERRFOFD1350" title=
|
|
"err:FOFD1350">err:FOFD1350</a>] if a component specifier within
|
|
the picture refers to components that are not available in the
|
|
given type of <code>$value</code>, for example if the picture
|
|
supplied to the <a href=
|
|
"#func-format-time"><code>fn:format-time</code></a> refers to the
|
|
year, month, or day component.</p>
|
|
<p>It is not an error to include a timezone component when the
|
|
supplied value has no timezone. In these circumstances the timezone
|
|
component will be ignored.</p>
|
|
<p>The first <em>presentation modifier</em> indicates the style in
|
|
which the value of a component is to be represented. Its value may
|
|
be either:</p>
|
|
<ul>
|
|
<li>
|
|
<p>any format token permitted as a primary format token in the
|
|
second argument of the <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a> function,
|
|
indicating that the value of the component is to be output
|
|
numerically using the specified number format (for example,
|
|
<code>1</code>, <code>01</code>, <code>i</code>, <code>I</code>,
|
|
<code>w</code>, <code>W</code>, or <code>Ww</code>) or</p>
|
|
</li>
|
|
<li>
|
|
<p>the format token <code>n</code>, <code>N</code>, or
|
|
<code>Nn</code>, indicating that the value of the component is to
|
|
be output by name, in lower-case, upper-case, or title-case
|
|
respectively. Components that can be output by name include (but
|
|
are not limited to) months, days of the week, timezones, and eras.
|
|
If the processor cannot output these components by name for the
|
|
chosen calendar and language then it must use an
|
|
implementation-defined fallback representation.</p>
|
|
</li>
|
|
</ul>
|
|
<p>If a comma is to be used as a grouping separator within the
|
|
format token, then there must be a width specifier. More
|
|
specifically: if a variable marker contains one or more commas,
|
|
then the last comma is treated as introducing the width modifier,
|
|
and all others are treated as grouping separators. So
|
|
<code>[Y9,999,*]</code> will output the year as
|
|
<code>2,008</code>.</p>
|
|
<p>If the implementation does not support the use of the requested
|
|
format token, it <strong>must</strong> use the default presentation
|
|
modifier for that component.</p>
|
|
<p>If the first presentation modifier is present, then it may
|
|
optionally be followed by a second presentation modifier as
|
|
follows:</p>
|
|
<table summary="A table [this is bad style]" border="1"
|
|
cellpadding="5">
|
|
<thead>
|
|
<tr>
|
|
<th align="left" colspan="1">Modifier</th>
|
|
<th align="left" colspan="1">Meaning</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td valign="top">either <code>a</code> or <code>t</code></td>
|
|
<td valign="top">indicates alphabetic or traditional numbering
|
|
respectively, the default being implementation-defined. This has
|
|
the same meaning as in the second argument of <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">either <code>c</code> or <code>o</code></td>
|
|
<td valign="top">indicates cardinal or ordinal numbering
|
|
respective, for example <code>7</code> or <code>seven</code> for a
|
|
cardinal number, or <code>7th</code>, <code>seventh</code>, or
|
|
<code>7º</code> for an ordinal number. This has the same meaning as
|
|
in the second argument of <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>. The
|
|
actual representation of the ordinal form of a number may depend
|
|
not only on the language, but also on the grammatical context (for
|
|
example, in some languages it must agree in gender).</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>Although the formatting rules are expressed in terms of the
|
|
rules for format tokens in <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>, the
|
|
formats actually used may be specialized to the numbering of date
|
|
components where appropriate. For example, in Italian, it is
|
|
conventional to use an ordinal number (<code>primo</code>) for the
|
|
first day of the month, and cardinal numbers (<code>due, tre,
|
|
quattro ...</code>) for the remaining days. A processor may
|
|
therefore use this convention to number days of the month, ignoring
|
|
the presence or absence of the ordinal presentation modifier.</p>
|
|
</div>
|
|
<p>Whether or not a presentation modifier is included, a width
|
|
modifier may be supplied. This indicates the number of characters
|
|
or digits to be included in the representation of the value.</p>
|
|
<p>The width modifier, if present, is introduced by a comma or
|
|
semicolon. It takes the form:</p>
|
|
<p><code>   ","  min-width ("-"
|
|
max-width)?</code></p>
|
|
<p>where <code>min-width</code> is either an unsigned integer
|
|
indicating the minimum number of characters to be output, or
|
|
<code>*</code> indicating that there is no explicit minimum, and
|
|
<code>max-width</code> is either an unsigned integer indicating the
|
|
maximum number of characters to be output, or <code>*</code>
|
|
indicating that there is no explicit maximum; if
|
|
<code>max-width</code> is omitted then <code>*</code> is assumed.
|
|
Both integers, if present, <strong>must</strong> be greater than
|
|
zero.</p>
|
|
<p>A format token containing more than one digit, such as
|
|
<code>001</code> or <code>9999</code>, sets the minimum and maximum
|
|
width to the number of digits appearing in the format token; if a
|
|
width modifier is also present, then the width modifier takes
|
|
precedence.</p>
|
|
<p>A numeric format token may contain
|
|
<var>optional-digit-signs</var> and <var>grouping-separators</var>
|
|
as described for <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>. However,
|
|
the grouping separator cannot be a closing square bracket
|
|
(<code>"]"</code>).</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>A format token consisting of a single digit, such as
|
|
<code>1</code>, does not constrain the number of digits in the
|
|
output. In the case of fractional seconds in particular,
|
|
<code>[f001]</code> requests three decimal digits,
|
|
<code>[f01]</code> requests two digits, but <code>[f1]</code> will
|
|
produce an implementation-defined number of digits. If exactly one
|
|
digit is required, this can be achieved using the component
|
|
specifier <code>[f1,1-1]</code>.</p>
|
|
</div>
|
|
<p>If the minimum and maximum width are unspecified, then the
|
|
output uses as many characters as are required to represent the
|
|
value of the component without truncation and without padding: this
|
|
is referred to below as the <em>full representation</em> of the
|
|
value. For a timezone offset (component specifier <code>z</code>),
|
|
the full representation consists of a sign for the offset, the
|
|
number of hours of the offset, and if the offset is not an integral
|
|
number of hours, a colon (<code>:</code>) followed by the two
|
|
digits of the minutes of the offset..</p>
|
|
<p>If the full representation of the value exceeds the specified
|
|
maximum width, then the processor <strong>should</strong> attempt
|
|
to use an alternative shorter representation that fits within the
|
|
maximum width. Where the presentation modifier is <code>N</code>,
|
|
<code>n</code>, or <code>Nn</code>, this is done by abbreviating
|
|
the name, using either conventional abbreviations if available, or
|
|
crude right-truncation if not. For example, setting
|
|
<code>max-width</code> to <code>4</code> indicates that four-letter
|
|
abbreviations <strong>should</strong> be used, though it would be
|
|
acceptable to use a three-letter abbreviation if this is in
|
|
conventional use. (For example, "Tuesday" might be abbreviated to
|
|
"Tues", and "Friday" to "Fri".) In the case of the year component,
|
|
setting <code>max-width</code> requests omission of high-order
|
|
digits from the year, for example, if <code>max-width</code> is set
|
|
to <code>2</code> then the year 2003 will be output as
|
|
<code>03</code>. In the case of the fractional seconds component,
|
|
the value is rounded to the specified size as if by applying the
|
|
function <code>round-half-to-even(fractional-seconds,
|
|
max-width)</code>. If no mechanism is available for fitting the
|
|
value within the specified maximum width (for example, when roman
|
|
numerals are used), then the value <strong>should</strong> be
|
|
output in its full representation.</p>
|
|
<p>If the full representation of the value is shorter than the
|
|
specified minimum width, then the processor <strong>should</strong>
|
|
pad the value to the specified width.</p>
|
|
<ul>
|
|
<li>
|
|
<p>For decimal representations of numbers, this
|
|
<strong>should</strong> be done by prepending zero digits from the
|
|
appropriate set of digit characters, or appending zero digits in
|
|
the case of the fractional seconds component.</p>
|
|
</li>
|
|
<li>
|
|
<p>For timezone offsets this should be done by first appending a
|
|
colon (<code>:</code>) followed by two zero digits from the
|
|
appropriate set of digit characters if the full representation does
|
|
not already include a minutes component and if the specified
|
|
minimum width permits adding three characters, and then if
|
|
necessary prepending zero digits from the appropriate set of digit
|
|
characters to the hour component.</p>
|
|
</li>
|
|
<li>
|
|
<p>In other cases, it <strong>should</strong> be done by appending
|
|
spaces.</p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="formatting-timezones" id=
|
|
"formatting-timezones"></a>9.8.4.2 Formatting timezones</h5>
|
|
<p>Special rules apply to the formatting of timezones. When the
|
|
component specifiers <code>Z</code> or <code>z</code> are used, the
|
|
rules in this section override any rules given elsewhere in the
|
|
case of discrepancies.</p>
|
|
<p>If the date/time value to be formatted does not include a
|
|
timezone offset, then the timezone component specifier is generally
|
|
ignored (results in no output). The exception is where military
|
|
timezones are used (format ZZ) in which case the string "J" is
|
|
output, indicating local time.</p>
|
|
<ul>
|
|
<li>
|
|
<p>When the component specifier is <code>z</code>, the output is
|
|
the same as for component specifier <code>Z</code>, except that it
|
|
is prefixed by the characters <code>GMT</code> or some localized
|
|
equivalent. The prefix is omitted, however, in cases where the
|
|
timezone is identified by name rather than by a numeric offset from
|
|
UTC.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the first <var>presentation modifier</var> is numeric and
|
|
comprises one or two digits with no <var>grouping-separator</var>
|
|
(for example <code>1</code> or <code>01</code>), then the timezone
|
|
is formatted as a displacement from UTC in hours, preceded by a
|
|
plus or minus sign: for example <code>-5</code> or
|
|
<code>+03</code>. If the actual timezone offset is not an integral
|
|
number of hours, then the minutes part of the offset is appended,
|
|
separated by a colon: for example <code>+10:30</code> or
|
|
<code>-1:15</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the first <var>presentation modifier</var> is numeric with a
|
|
<var>grouping-separator</var> (for example <code>1:01</code> or
|
|
<code>01.01</code>), then the timezone offset is output in hours
|
|
and minutes, separated by the grouping separator, even if the
|
|
number of minutes is zero: for example <code>+5:00</code> or
|
|
<code>+10.30</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the first <var>presentation modifier</var> is numeric and
|
|
comprises three or four digits with no
|
|
<var>grouping-separator</var>, for example <code>001</code> or
|
|
<code>0001</code>, then the timezone offset is shown in hours and
|
|
minutes with no separator, for example <code>-0500</code> or
|
|
<code>+1030</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the first <var>presentation modifier</var> is numeric, in any
|
|
of the above formats, and the second <var>presentation
|
|
modifier</var> is <code>t</code>, then a zero timezone offset (that
|
|
is, UTC) is output as <code>Z</code> instead of a signed numeric
|
|
value. In this presentation modifier is absent or if the timezone
|
|
offset is non-zero, then the displayed timezone offset is preceded
|
|
by a "-" sign for negative offsets or a "+" sign for non-negative
|
|
offsets.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the first <var>presentation modifier</var> is <code>Z</code>,
|
|
then the timezone is formatted as a military timezone letter, using
|
|
the convention Z = +00:00, A = +01:00, B = +02:00, ..., M = +12:00,
|
|
N = -01:00, O = -02:00, ... Y = -12:00. The letter J (meaning local
|
|
time) is used in the case of a value that does not specify a
|
|
timezone offset. Timezone offsets that have no representation in
|
|
this system (for example Indian Standard Time, +05:30) are output
|
|
as if the format <code>01:01</code> had been requested.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the first <var>presentation modifier</var> is <code>N</code>,
|
|
then the timezone is output (where possible) as a timezone name,
|
|
for example <code>EST</code> or <code>CET</code>. The same timezone
|
|
offset has different names in different places; it is therefore
|
|
<strong>recommended</strong> that this option should be used only
|
|
if a country code or Olson timezone name is supplied in the
|
|
<code>$place</code> argument. In the absence of this information,
|
|
the implementation may apply a default, for example by using the
|
|
timezone names that are conventional in North America. If no
|
|
timezone name can be identified, the timezone offset is output
|
|
using the fallback format <code>+01:01</code>.</p>
|
|
</li>
|
|
</ul>
|
|
<p>The following examples illustrate options for timezone
|
|
formatting.</p>
|
|
<table summary="A table [this is bad style]" border="1"
|
|
cellpadding="5">
|
|
<thead>
|
|
<tr>
|
|
<th colspan="1">Variable marker</th>
|
|
<th colspan="1"><code>$place</code></th>
|
|
<th colspan="5">Timezone offsets (with time = 12:00:00)</th>
|
|
</tr>
|
|
<tr>
|
|
<th colspan="1"> </th>
|
|
<th colspan="1"> </th>
|
|
<th colspan="1">-10:00</th>
|
|
<th colspan="1">-05:00</th>
|
|
<th colspan="1">+00:00</th>
|
|
<th colspan="1">+05:30</th>
|
|
<th colspan="1">+13:00</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>[Z]</td>
|
|
<td>()</td>
|
|
<td>-10:00</td>
|
|
<td>-05:00</td>
|
|
<td>+00:00</td>
|
|
<td>+05:30</td>
|
|
<td>+13:00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>[Z0]</td>
|
|
<td>()</td>
|
|
<td>-10</td>
|
|
<td>-5</td>
|
|
<td>+0</td>
|
|
<td>+5:30</td>
|
|
<td>+13:00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>[Z0:00]</td>
|
|
<td>()</td>
|
|
<td>-10:00</td>
|
|
<td>-5:00</td>
|
|
<td>+0:00</td>
|
|
<td>+5:30</td>
|
|
<td>+13:00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>[Z00:00]</td>
|
|
<td>()</td>
|
|
<td>-10:00</td>
|
|
<td>-05:00</td>
|
|
<td>+00:00</td>
|
|
<td>+05:30</td>
|
|
<td>+13:00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>[Z0000]</td>
|
|
<td>()</td>
|
|
<td>-1000</td>
|
|
<td>-0500</td>
|
|
<td>+0000</td>
|
|
<td>+0530</td>
|
|
<td>+1300</td>
|
|
</tr>
|
|
<tr>
|
|
<td>[Z00:00t]</td>
|
|
<td>()</td>
|
|
<td>-10:00</td>
|
|
<td>-05:00</td>
|
|
<td>Z</td>
|
|
<td>+05:30</td>
|
|
<td>+13:00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>[z]</td>
|
|
<td>()</td>
|
|
<td>GMT-10:00</td>
|
|
<td>GMT-05:00</td>
|
|
<td>GMT+00:00</td>
|
|
<td>GMT+05:30</td>
|
|
<td>GMT+13:00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>[ZZ]</td>
|
|
<td>()</td>
|
|
<td>W</td>
|
|
<td>R</td>
|
|
<td>Z</td>
|
|
<td>+05:30</td>
|
|
<td>+13:00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>[ZN]</td>
|
|
<td>"us"</td>
|
|
<td>HST</td>
|
|
<td>EST</td>
|
|
<td>GMT</td>
|
|
<td>IST</td>
|
|
<td>+13:00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>[H00]:[M00] [ZN]</td>
|
|
<td>"America/New_York"</td>
|
|
<td>06:00 EST</td>
|
|
<td>12:00 EST</td>
|
|
<td>07:00 EST</td>
|
|
<td>01:30 EST</td>
|
|
<td>18:00 EST</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="lang-cal-place" id="lang-cal-place"></a>9.8.4.3 The
|
|
language, calendar, and <span>place</span> arguments</h5>
|
|
<p>The set of languages, calendars, and <span>places</span> that
|
|
are supported in the <a title="date formatting function" class=
|
|
"termref" href="#dt-date-formatting-function"><span class=
|
|
"arrow">·</span>date formatting functions<span class=
|
|
"arrow">·</span></a> is <a title="implementation-defined" class=
|
|
"termref" href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>. When any of these arguments is omitted or is
|
|
an empty sequence, an <a title="implementation-defined" class=
|
|
"termref" href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> default value is used.</p>
|
|
<p>If the fallback representation uses a different calendar from
|
|
that requested, the output string <strong>must</strong> identify
|
|
the calendar actually used, for example by prefixing the string
|
|
with <code>[Calendar: X]</code> (where X is the calendar actually
|
|
used), localized as appropriate to the requested language. If the
|
|
fallback representation uses a different language from that
|
|
requested, the output string <strong>must</strong> identify the
|
|
language actually used, for example by prefixing the string with
|
|
<code>[Language: Y]</code> (where Y is the language actually used)
|
|
localized in an implementation-dependent way. If a particular
|
|
component of the value cannot be output in the requested format, it
|
|
<strong>should</strong> be output in the default format for that
|
|
component.</p>
|
|
<p>The <code>$language</code> argument specifies the language to be
|
|
used for the result string of the function. The value of the
|
|
argument <strong>must</strong> be either the empty sequence or a
|
|
value that would be valid for the <code>xml:lang</code> attribute
|
|
(see [XML]). Note that this permits the identification of
|
|
sublanguages based on country codes (from <a href="#ISO3166">[ISO
|
|
3166-1]</a>) as well as identification of dialects and of regions
|
|
within a country.</p>
|
|
<p>If the <code>$language</code> argument is omitted or is set to
|
|
an empty sequence, or if it is set to an invalid value or a value
|
|
that the implementation does not recognize, then the processor uses
|
|
<span>the default language defined in the dynamic
|
|
context.</span></p>
|
|
<p>The language is used to select the appropriate
|
|
language-dependent forms of:</p>
|
|
<blockquote>
|
|
<p>names (for example, of months)<br />
|
|
numbers expressed as words or as ordinals (<code>twenty, 20th,
|
|
twentieth</code>)<br />
|
|
hour convention (0-23 vs 1-24, 0-11 vs 1-12)<br />
|
|
first day of week, first week of year</p>
|
|
</blockquote>
|
|
<p>Where appropriate this choice may also take into account the
|
|
value of the <code>$place</code> argument, though this
|
|
<strong>should</strong> not be used to override the language or any
|
|
sublanguage that is specified as part of the <code>language</code>
|
|
argument.</p>
|
|
<p>The choice of the names and abbreviations used in any given
|
|
language is <a title="implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>. For example, one implementation might
|
|
abbreviate July as <code>Jul</code> while another uses
|
|
<code>Jly</code>. In German, one implementation might represent
|
|
Saturday as <code>Samstag</code> while another uses
|
|
<code>Sonnabend</code>. Implementations <strong>may</strong>
|
|
provide mechanisms allowing users to control such choices.</p>
|
|
<p>Where ordinal numbers are used, the selection of the correct
|
|
representation of the ordinal (for example, the linguistic gender)
|
|
<strong>may</strong> depend on the component being formatted and on
|
|
its textual context in the picture string.</p>
|
|
<p>The <code>calendar</code> attribute specifies that the
|
|
<code>dateTime</code>, <code>date</code>, or <code>time</code>
|
|
supplied in the <code>$value</code> argument <strong>must</strong>
|
|
be converted to a value in the specified calendar and then
|
|
converted to a string using the conventions of that calendar.</p>
|
|
<p>A calendar value <strong>must</strong> be a valid lexical QName.
|
|
If the QName does not have a prefix, then it identifies a calendar
|
|
with the designator specified below. If the QName has a prefix,
|
|
then the QName is expanded into an expanded-QName using the
|
|
<span>statically known namespaces</span>; the expanded-QName
|
|
identifies the calendar; the behavior in this case is <a title=
|
|
"implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>If the <code>$calendar</code> argument is omitted or is set to
|
|
an empty sequence then the default calendar defined in the dynamic
|
|
context is used.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>The calendars listed below were known to be in use during the
|
|
last hundred years. Many other calendars have been used in the
|
|
past.</p>
|
|
<p>This specification does not define any of these calendars, nor
|
|
the way that they map to the value space of the
|
|
<code>xs:date</code> data type in <a href="#xmlschema-2">[XML
|
|
Schema Part 2: Datatypes Second Edition]</a>. There may be
|
|
ambiguities when dates are recorded using different calendars. For
|
|
example, the start of a new day is not simultaneous in different
|
|
calendars, and may also vary geographically (for example, based on
|
|
the time of sunrise or sunset). Translation of dates is therefore
|
|
more reliable when the time of day is also known, and when the
|
|
geographic location is known. When translating dates between one
|
|
calendar and another, the processor may take account of the values
|
|
of the <code>$place</code> and/or <code>$language</code> arguments,
|
|
with the <code>$place</code> argument taking precedence.</p>
|
|
<p>Information about some of these calendars, and algorithms for
|
|
converting between them, may be found in <a href=
|
|
"#CALCALC">[Calendrical Calculations]</a>.</p>
|
|
</div>
|
|
<table summary="A table [this is bad style]" border="1"
|
|
cellpadding="5">
|
|
<thead>
|
|
<tr>
|
|
<th valign="top" align="left" colspan="1">Designator</th>
|
|
<th valign="top" align="left" colspan="1">Calendar</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>AD</td>
|
|
<td>Anno Domini (Christian Era)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>AH</td>
|
|
<td>Anno Hegirae (Muhammedan Era)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>AME</td>
|
|
<td>Mauludi Era (solar years since Mohammed's birth)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>AM</td>
|
|
<td>Anno Mundi (Jewish Calendar)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>AP</td>
|
|
<td>Anno Persici</td>
|
|
</tr>
|
|
<tr>
|
|
<td>AS</td>
|
|
<td>Aji Saka Era (Java)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>BE</td>
|
|
<td>Buddhist Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>CB</td>
|
|
<td>Cooch Behar Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>CE</td>
|
|
<td>Common Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>CL</td>
|
|
<td>Chinese Lunar Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>CS</td>
|
|
<td>Chula Sakarat Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>EE</td>
|
|
<td>Ethiopian Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>FE</td>
|
|
<td>Fasli Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>ISO</td>
|
|
<td>ISO 8601 calendar</td>
|
|
</tr>
|
|
<tr>
|
|
<td>JE</td>
|
|
<td>Japanese Calendar</td>
|
|
</tr>
|
|
<tr>
|
|
<td>KE</td>
|
|
<td>Khalsa Era (Sikh calendar)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>KY</td>
|
|
<td>Kali Yuga</td>
|
|
</tr>
|
|
<tr>
|
|
<td>ME</td>
|
|
<td>Malabar Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>MS</td>
|
|
<td>Monarchic Solar Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>NS</td>
|
|
<td>Nepal Samwat Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OS</td>
|
|
<td>Old Style (Julian Calendar)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>RS</td>
|
|
<td>Rattanakosin (Bangkok) Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>SE</td>
|
|
<td>Saka Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>SH</td>
|
|
<td>Mohammedan Solar Era (Iran)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>SS</td>
|
|
<td>Saka Samvat</td>
|
|
</tr>
|
|
<tr>
|
|
<td>TE</td>
|
|
<td>Tripurabda Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>VE</td>
|
|
<td>Vikrama Era</td>
|
|
</tr>
|
|
<tr>
|
|
<td>VS</td>
|
|
<td>Vikrama Samvat Era</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>At least one of the above calendars <strong>must</strong> be
|
|
supported. It is <a title="implementation-defined" class="termref"
|
|
href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> which calendars are supported.</p>
|
|
<p>The ISO 8601 calendar (<a href="#ISO8601">[ISO 8601]</a>), which
|
|
is included in the above list and designated <code>ISO</code>, is
|
|
very similar to the Gregorian calendar designated <code>AD</code>,
|
|
but it differs in several ways. The ISO calendar is intended to
|
|
ensure that date and time formats can be read easily by other
|
|
software, as well as being legible for human users. The ISO
|
|
calendar prescribes the use of particular numbering conventions as
|
|
defined in ISO 8601, rather than allowing these to be localized on
|
|
a per-language basis. In particular it provides a numeric 'week
|
|
date' format which identifies dates by year, week of the year, and
|
|
day in the week; in the ISO calendar the days of the week are
|
|
numbered from 1 (Monday) to 7 (Sunday), and week 1 in any calendar
|
|
year is the week (from Monday to Sunday) that includes the first
|
|
Thursday of that year. The numeric values of the components year,
|
|
month, day, hour, minute, and second are the same in the ISO
|
|
calendar as the values used in the lexical representation of the
|
|
date and time as defined in <a href="#xmlschema-2">[XML Schema Part
|
|
2: Datatypes Second Edition]</a>. The era ("E" component) with this
|
|
calendar is either a minus sign (for negative years) or a
|
|
zero-length string (for positive years). For dates before 1
|
|
January, AD 1, year numbers in the ISO and AD calendars are off by
|
|
one from each other: ISO year 0000 is 1 BC, -0001 is 2 BC, etc.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>The value space of the date and time data types, as defined in
|
|
XML Schema, is based on absolute points in time. The lexical space
|
|
of these data types defines a representation of these absolute
|
|
points in time using the proleptic Gregorian calendar, that is, the
|
|
modern Western calendar extrapolated into the past and the future;
|
|
but the value space is calendar-neutral. The <a title=
|
|
"date formatting function" class="termref" href=
|
|
"#dt-date-formatting-function"><span class="arrow">·</span>date
|
|
formatting functions<span class="arrow">·</span></a> produce a
|
|
representation of this absolute point in time, but denoted in a
|
|
possibly different calendar. So, for example, the date whose
|
|
lexical representation in XML Schema is <code>1502-01-11</code>
|
|
(the day on which Pope Gregory XIII was born) might be formatted
|
|
using the Old Style (Julian) calendar as <code>1 January
|
|
1502</code>. This reflects the fact that there was at that time a
|
|
ten-day difference between the two calendars. It would be
|
|
incorrect, and would produce incorrect results, to represent this
|
|
date in an element or attribute of type <code>xs:date</code> as
|
|
<code>1502-01-01</code>, even though this might reflect the way the
|
|
date was recorded in contemporary documents.</p>
|
|
<p>When referring to years occurring in antiquity, modern
|
|
historians generally use a numbering system in which there is no
|
|
year zero (the year before 1 CE is thus 1 BCE). This is the
|
|
convention that <strong>should</strong> be used when the requested
|
|
calendar is OS (Julian) or AD (Gregorian). When the requested
|
|
calendar is ISO, however, the conventions of ISO 8601
|
|
<strong>should</strong> be followed: here the year before +0001 is
|
|
numbered zero. In <a href="#xmlschema-2">[XML Schema Part 2:
|
|
Datatypes Second Edition]</a> (version 1.0), the value space for
|
|
<code>xs:date</code> and <code>xs:dateTime</code> does not include
|
|
a year zero: however, a future edition is expected to endorse the
|
|
ISO 8601 convention. This means that the date on which Julius
|
|
Caesar was assassinated has the ISO 8601 lexical representation
|
|
-0043-03-13, but will be formatted as 15 March 44 BCE in the Julian
|
|
calendar or 13 March 44 BCE in the Gregorian calendar (dependant on
|
|
the chosen localization of the names of months and eras).</p>
|
|
</div>
|
|
<p>The intended use of the <code>$place</code> argument is to
|
|
identify the place where an event represented by the
|
|
<code>dateTime</code>, <code>date</code>, or <code>time</code>
|
|
supplied in the <code>$value</code> argument took place or will
|
|
take place. <span>If the <code>$place</code> argument is omitted or
|
|
is set to an empty sequence, then the default place defined in the
|
|
dynamic context is used.</span> If the value is supplied, and is
|
|
not the empty sequence, then it <strong>should</strong>
|
|
<span>either be a country code or an Olson timezone
|
|
name.</span></p>
|
|
<ul>
|
|
<li>
|
|
<p>Country codes are defined in <a href="#ISO3166">[ISO
|
|
3166-1]</a>. Examples are "de" for Germany and "jp" for Japan.
|
|
Implementations <strong>may</strong> also allow the use of codes
|
|
representing subdivisions of a country from ISO 3166-2, or codes
|
|
representing formerly used names of countries from ISO 3166-3</p>
|
|
</li>
|
|
<li>
|
|
<p>Olson timezone names are defined in the public-domain <b>tz</b>
|
|
timezone database <a href="#olson">[Olson Timezone Database]</a>.
|
|
Examples are "America/New_York" and "Europe/Rome".</p>
|
|
</li>
|
|
</ul>
|
|
<p>This argument is not intended to identify the location of the
|
|
user for whom the date or time is being formatted; that should be
|
|
done by means of the <code>$language</code> attribute. This
|
|
information <strong>may</strong> be used to provide additional
|
|
information when converting dates between calendars or when
|
|
deciding how individual components of the date and time are to be
|
|
formatted. For example, different countries using the Old Style
|
|
(Julian) calendar started the new year on different days, and some
|
|
countries used variants of the calendar that were out of
|
|
synchronization as a result of differences in calculating leap
|
|
years.</p>
|
|
<p>The geographical area identified by a country code is defined by
|
|
the boundaries as they existed at the time of the date to be
|
|
formatted, or the present-day boundaries for dates in the
|
|
future.</p>
|
|
<p>If the <code>$place</code> argument is supplied in the form of
|
|
an Olson timezone name that is recognized by the implementation,
|
|
then the date or time being formatted is adjusted to the timezone
|
|
offset applicable in that timezone. For example, if the
|
|
<code>xs:dateTime</code> value <code>2010-02-15T12:00:00Z</code> is
|
|
formatted with the <code>$place</code> argument set to
|
|
<code>America/New_York</code>, then the output will be as if the
|
|
value <code>2010-02-15T07:00:00-05:00</code> had been supplied.
|
|
This adjustment takes daylight savings time into account where
|
|
possible; if the date in question falls during daylight savings
|
|
time in New York, then it is adjusted to timezone offset
|
|
<code>-PT4H</code> rather than <code>-PT5H</code>. Adjustment using
|
|
daylight savings time is only possible where the value includes a
|
|
date, and where the date is within the range covered by the
|
|
timezone database.</p>
|
|
</div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="date-time-examples" id="date-time-examples"></a>9.8.5
|
|
Examples of date and time formatting</h4>
|
|
<div class="exampleOuter">
|
|
<div class="exampleHeader"><a name="d5e25744" id=
|
|
"d5e25744"></a>Example: Gregorian calendar</div>
|
|
<p>The following examples show a selection of dates and times and
|
|
the way they might be formatted. These examples assume the use of
|
|
the Gregorian calendar as the default calendar.</p>
|
|
<table summary="A table [this is bad style]" border="1"
|
|
cellpadding="5">
|
|
<thead>
|
|
<tr>
|
|
<th align="left" colspan="1">Required Output</th>
|
|
<th align="left" colspan="1">Expression</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><code>2002-12-31</code></td>
|
|
<td><code>format-date($d, "[Y0001]-[M01]-[D01]")</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>12-31-2002</code></td>
|
|
<td><code>format-date($d, "[M]-[D]-[Y]")</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>31-12-2002</code></td>
|
|
<td><code>format-date($d, "[D]-[M]-[Y]")</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>31 XII 2002</code></td>
|
|
<td><code>format-date($d, "[D1] [MI] [Y]")</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>31st December, 2002</code></td>
|
|
<td><code>format-date($d, "[D1o] [MNn], [Y]", "en", (),
|
|
())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>31 DEC 2002</code></td>
|
|
<td><code>format-date($d, "[D01] [MN,*-3] [Y0001]", "en", (),
|
|
())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>December 31, 2002</code></td>
|
|
<td><code>format-date($d, "[MNn] [D], [Y]", "en", (),
|
|
())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>31 Dezember, 2002</code></td>
|
|
<td><code>format-date($d, "[D] [MNn], [Y]", "de", (),
|
|
())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>Tisdag 31 December 2002</code></td>
|
|
<td><code>format-date($d, "[FNn] [D] [MNn] [Y]", "sv", (),
|
|
())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>[2002-12-31]</code></td>
|
|
<td><code>format-date($d, "[[[Y0001]-[M01]-[D01]]]")</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>Two Thousand and Three</code></td>
|
|
<td><code>format-date($d, "[YWw]", "en", (), ())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>einunddreißigste Dezember</code></td>
|
|
<td><code>format-date($d, "[Dwo] [MNn]", "de", (), ())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>3:58 PM</code></td>
|
|
<td><code>format-time($t, "[h]:[m01] [PN]", "en", (),
|
|
())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>3:58:45 pm</code></td>
|
|
<td><code>format-time($t, "[h]:[m01]:[s01] [Pn]", "en", (),
|
|
())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>3:58:45 PM PDT</code></td>
|
|
<td><code>format-time($t, "[h]:[m01]:[s01] [PN] [ZN,*-3]", "en",
|
|
(), ())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>3:58:45 o'clock PM PDT</code></td>
|
|
<td><code>format-time($t, "[h]:[m01]:[s01] o'clock [PN] [ZN,*-3]",
|
|
"en", (), ())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>15:58</code></td>
|
|
<td><code>format-time($t,"[H01]:[m01]")</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>15:58:45.762</code></td>
|
|
<td><code>format-time($t,"[H01]:[m01]:[s01].[f001]")</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>15:58:45 GMT+02:00</code></td>
|
|
<td><code>format-time($t,"[H01]:[m01]:[s01] [z,6-6]", "en", (),
|
|
())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>15.58 Uhr GMT+2</code></td>
|
|
<td><code>format-time($t,"[H01]:[m01] Uhr [z]", "de", (),
|
|
())</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>3.58pm on Tuesday, 31st December</code></td>
|
|
<td><code>format-dateTime($dt, "[h].[m01][Pn] on [FNn], [D1o]
|
|
[MNn]")</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>12/31/2002 at 15:58:45</code></td>
|
|
<td><code>format-dateTime($dt, "[M01]/[D01]/[Y0001] at
|
|
[H01]:[m01]:[s01]")</code></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="exampleOuter">
|
|
<div class="exampleHeader"><a name="d5e26000" id=
|
|
"d5e26000"></a>Example: Non-Gregorian calendars</div>
|
|
<p>The following examples use calendars other than the Gregorian
|
|
calendar.</p>
|
|
<p>These examples use non-Latin characters which might not display
|
|
correctly in all browsers, depending on the system
|
|
configuration.</p>
|
|
<table summary="A table [this is bad style]" border="1"
|
|
cellpadding="5">
|
|
<thead>
|
|
<tr>
|
|
<th align="left" colspan="1">Description</th>
|
|
<th align="left" colspan="1">Request</th>
|
|
<th align="left" colspan="1">Result</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td valign="top">Islamic</td>
|
|
<td valign="top"><code>format-date($d, "[D&#x0661;] [Mn]
|
|
[Y&#x0661;]", "ar", "AH", ())</code></td>
|
|
<td valign="top">٢٦ ﺸﻭّﺍﻝ ١٤٢٣</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Jewish (with Western numbering)</td>
|
|
<td valign="top"><code>format-date($d, "[D] [Mn] [Y]", "he", "AM",
|
|
())</code></td>
|
|
<td valign="top">26 טבת 5763</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Jewish (with traditional numbering)</td>
|
|
<td valign="top"><code>format-date($d, "[D&#x05D0;t] [Mn]
|
|
[Y&#x05D0;t]", "he", "AM", ())</code></td>
|
|
<td valign="top">כ״ו טבת תשס״ג</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Julian (Old Style)</td>
|
|
<td valign="top"><code>format-date($d, "[D] [MNn] [Y]", "en", "OS",
|
|
())</code></td>
|
|
<td valign="top">18 December 2002</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Thai</td>
|
|
<td valign="top"><code>format-date($d, "[D&#x0E51;] [Mn]
|
|
[Y&#x0E51;]", "th", "BE", ())</code></td>
|
|
<td valign="top">๓๑ ธันวาคม ๒๕๔๕</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="QName-funcs" id="QName-funcs"></a>10 Functions related
|
|
to QNames</h2>
|
|
<div class="div2">
|
|
<h3><a name="QName-constructors" id="QName-constructors"></a>10.1
|
|
Functions to create a QName</h3>
|
|
<p>In addition to the <code>xs:QName</code> constructor function,
|
|
QName values can be constructed by combining a namespace URI,
|
|
prefix, and local name, or by resolving a lexical QName against the
|
|
in-scope namespaces of an element node. This section defines these
|
|
functions. Leading and trailing whitespace, if present, is stripped
|
|
from string arguments before the result is constructed.</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-resolve-QName"><code>fn:resolve-QName</code></a></td>
|
|
<td>Returns an <code>xs:QName</code> value (that is, an
|
|
expanded-QName) by taking an <code>xs:string</code> that has the
|
|
lexical form of an <code>xs:QName</code> (a string in the form
|
|
"prefix:local-name" or "local-name") and resolving it using the
|
|
in-scope namespaces for a given element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-QName"><code>fn:QName</code></a></td>
|
|
<td>Constructs an <code>xs:QName</code> value given a namespace URI
|
|
and a lexical QName.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-resolve-QName" id="func-resolve-QName"></a>10.1.1
|
|
fn:resolve-QName</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns an <code>xs:QName</code> value (that is, an
|
|
expanded-QName) by taking an <code>xs:string</code> that has the
|
|
lexical form of an <code>xs:QName</code> (a string in the form
|
|
"prefix:local-name" or "local-name") and resolving it using the
|
|
in-scope namespaces for a given element.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:resolve-QName</code>(<code class=
|
|
"arg">$qname</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$element</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">element()</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:QName?</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>$qname</code> is the empty sequence, returns the empty
|
|
sequence.</p>
|
|
<p>More specifically, the function searches the namespace bindings
|
|
of <code>$element</code> for a binding whose name matches the
|
|
prefix of <code>$qname</code>, or the zero-length string if it has
|
|
no prefix, and constructs an expanded-QName whose local name is
|
|
taken from the supplied <code>$qname</code>, and whose namespace
|
|
URI is taken from the string value of the namespace binding.</p>
|
|
<p>If the <code>$qname</code> has no prefix, and there is no
|
|
namespace binding for <code>$element</code> corresponding to the
|
|
default (unnamed) namespace, then the resulting expanded-QName has
|
|
no namespace part.</p>
|
|
<p>The prefix (or absence of a prefix) in the supplied
|
|
<code>$qname</code> argument is retained in the returned
|
|
expanded-QName, as discussed in <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#terminology">Section 2.1
|
|
Terminology</a> <sup><small>DM30</small></sup>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFOCA0002" title=
|
|
"err:FOCA0002">err:FOCA0002</a>] if <code>$qname</code> does not
|
|
have the correct lexical form for an instance of
|
|
<code>xs:QName</code>.</p>
|
|
<p>An error is raised [<a href="#ERRFONS0004" title=
|
|
"err:FONS0004">err:FONS0004</a>] if <code>$qname</code> has a
|
|
prefix and there is no namespace binding for <code>$element</code>
|
|
that matches this prefix.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Sometimes the requirement is to construct an
|
|
<code>xs:QName</code> without using the default namespace. This can
|
|
be achieved by writing:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
if (contains($qname, ":")) then fn:resolve-QName($qname, $element) else
|
|
fn:QName("", $qname)
|
|
</pre></div>
|
|
<p>If the requirement is to construct an <code>xs:QName</code>
|
|
using the namespaces in the static context, then the
|
|
<code>xs:QName</code> constructor should be used.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Assume that the element bound to <code>$element</code> has a
|
|
single namespace binding bound to the prefix <code>eg</code>.</p>
|
|
<p><code>fn:resolve-QName("hello", $element)</code> returns a QName
|
|
with local name "hello" that is in no namespace.</p>
|
|
<p><code>fn:resolve-QName("eg:myFunc", $element)</code> returns an
|
|
<code>xs:QName</code> whose namespace URI is specified by the
|
|
namespace binding corresponding to the prefix "eg" and whose local
|
|
name is "myFunc".</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-QName" id="func-QName"></a>10.1.2 fn:QName</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Constructs an <code>xs:QName</code> value given a namespace URI
|
|
and a lexical QName.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:QName</code>(<code class=
|
|
"arg">$paramURI</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$paramQName</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:QName</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 namespace URI in the returned QName is taken from
|
|
<code>$paramURI</code>. If <code>$paramURI</code> is the
|
|
zero-length string or the empty sequence, it represents "no
|
|
namespace".</p>
|
|
<p>The prefix (or absence of a prefix) in <code>$paramQName</code>
|
|
is retained in the returned <code>xs:QName</code> value.</p>
|
|
<p>The local name in the result is taken from the local part of
|
|
<code>$paramQName</code>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFOCA0002" title=
|
|
"err:FOCA0002">err:FOCA0002</a>] if <code>$paramQName</code> does
|
|
not have the correct lexical form for an instance of
|
|
<code>xs:QName</code>.</p>
|
|
<p>An error is raised [<a href="#ERRFOCA0002" title=
|
|
"err:FOCA0002">err:FOCA0002</a>] if <code>$paramURI</code> is the
|
|
zero-length string or the empty sequence, and the value of
|
|
<code>$paramQName</code> contains a colon (<code>:</code>).</p>
|
|
<p>An error <strong>may</strong> be raised [<a href="#ERRFOCA0002"
|
|
title="err:FOCA0002">err:FOCA0002</a>] if <code>$paramURI</code> is
|
|
not a valid URI (XML Namespaces 1.0) or IRI (XML Namespaces
|
|
1.1).</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p><code>fn:QName("http://www.example.com/example",
|
|
"person")</code> returns an <code>xs:QName</code> with namespace
|
|
URI = "http://www.example.com/example", local name = "person" and
|
|
prefix = "".</p>
|
|
<p><code>fn:QName("http://www.example.com/example",
|
|
"ht:person")</code> returns an <code>xs:QName</code> with namespace
|
|
URI = "http://www.example.com/example", local name = "person" and
|
|
prefix = "ht".</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="QName-functions" id="QName-functions"></a>10.2
|
|
Functions and operators related to QNames</h3>
|
|
<p>This section specifies functions on QNames as defined in
|
|
<a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a>.</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-QName-equal"><code>op:QName-equal</code></a></td>
|
|
<td>Returns <code>true</code> if two supplied QNames have the same
|
|
namespace URI and the same local part.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-prefix-from-QName"><code>fn:prefix-from-QName</code></a></td>
|
|
<td>Returns the prefix component of the supplied QName.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-local-name-from-QName"><code>fn:local-name-from-QName</code></a></td>
|
|
<td>Returns the local part of the supplied QName.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-namespace-uri-from-QName"><code>fn:namespace-uri-from-QName</code></a></td>
|
|
<td>Returns the namespace URI part of the supplied QName.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-namespace-uri-for-prefix"><code>fn:namespace-uri-for-prefix</code></a></td>
|
|
<td>Returns the namespace URI of one of the in-scope namespaces for
|
|
<code>$element</code>, identified by its namespace prefix.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-in-scope-prefixes"><code>fn:in-scope-prefixes</code></a></td>
|
|
<td>Returns the prefixes of the in-scope namespaces for an element
|
|
node.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-QName-equal" id="func-QName-equal"></a>10.2.1
|
|
op:QName-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if two supplied QNames have the same
|
|
namespace URI and the same local part.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" and "ne" operators on values
|
|
of type <code>xs:QName</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:QName-equal</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:QName</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:QName</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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 <code>true</code> if the namespace URIs of
|
|
<code>$arg1</code> and <code>$arg2</code> are equal and the local
|
|
names of <code>$arg1</code> and <code>$arg2</code> are equal.</p>
|
|
<p>Otherwise, the function returns <code>false</code>.</p>
|
|
<p>The namespace URI parts are considered equal if they are both
|
|
<a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>,
|
|
or if they are both present and equal under the rules of the
|
|
<a href="#func-codepoint-equal"><code>fn:codepoint-equal</code></a>
|
|
function.</p>
|
|
<p>The local parts are also compared under the rules of the
|
|
<a href="#func-codepoint-equal"><code>fn:codepoint-equal</code></a>
|
|
function.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The prefix parts of <code>$arg1</code> and <code>$arg2</code>,
|
|
if any, are ignored.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-prefix-from-QName" id=
|
|
"func-prefix-from-QName"></a>10.2.2 fn:prefix-from-QName</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the prefix component of the supplied QName.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:prefix-from-QName</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:QName?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:NCName?</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>If <code>$arg</code> has no prefix component the function
|
|
returns the empty sequence.</p>
|
|
<p>Otherwise, the function returns an <code>xs:NCName</code>
|
|
representing the prefix component of <code>$arg</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-local-name-from-QName" id=
|
|
"func-local-name-from-QName"></a>10.2.3
|
|
fn:local-name-from-QName</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the local part of the supplied QName.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:local-name-from-QName</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:QName?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:NCName?</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 function returns an <code>xs:NCName</code>
|
|
representing the local part of <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:local-name-from-QName(fn:QName("http://www.example.com/example",
|
|
"person"))</code> returns <code>"person"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-namespace-uri-from-QName" id=
|
|
"func-namespace-uri-from-QName"></a>10.2.4
|
|
fn:namespace-uri-from-QName</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the namespace URI part of the supplied QName.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:namespace-uri-from-QName</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:QName?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyURI?</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 function returns an <code>xs:anyURI</code>
|
|
representing the namespace URI part of <code>$arg</code>.</p>
|
|
<p>If <code>$arg</code> is in no namespace, the function returns
|
|
the zero-length <code>xs:anyURI</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:namespace-uri-from-QName(fn:QName("http://www.example.com/example",
|
|
"person"))</code> returns
|
|
<code>xs:anyURI("http://www.example.com/example")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-namespace-uri-for-prefix" id=
|
|
"func-namespace-uri-for-prefix"></a>10.2.5
|
|
fn:namespace-uri-for-prefix</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the namespace URI of one of the in-scope namespaces for
|
|
<code>$element</code>, identified by its namespace prefix.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:namespace-uri-for-prefix</code>(</td>
|
|
<td valign="baseline"><code class="arg">$prefix</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">$element</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">element()</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyURI?</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>$element</code> has an in-scope namespace whose
|
|
namespace prefix is equal to <code>$prefix</code>, the function
|
|
returns the namespace URI of that namespace.</p>
|
|
<p>If <code>$element</code> has no in-scope namespace whose
|
|
namespace prefix is equal to <code>$prefix</code>, the function
|
|
returns the empty sequence.</p>
|
|
<p>If <code>$prefix</code> is the zero-length string or the empty
|
|
sequence, then if <code>$element</code> has a default namespace
|
|
(that is, a namespace node with no name), the function returns the
|
|
namespace URI of the default namespace. If <code>$element</code>
|
|
has no default namespace, the function returns the empty
|
|
sequence.</p>
|
|
<p>Prefixes are equal only if their Unicode codepoints match
|
|
exactly.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$e</code> :=</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<z:a xmlns="http://example.org/one" xmlns:z="http://example.org/two">
|
|
<b xmlns=""/>
|
|
</z:a>
|
|
</pre></div>
|
|
<p>The expression <code>fn:namespace-uri-for-prefix("z", $e)</code>
|
|
returns <code>"http://example.org/two"</code>.</p>
|
|
<p>The expression <code>fn:namespace-uri-for-prefix("", $e)</code>
|
|
returns <code>"http://example.org/one"</code>.</p>
|
|
<p>The expression <code>fn:namespace-uri-for-prefix((), $e)</code>
|
|
returns <code>"http://example.org/one"</code>.</p>
|
|
<p>The expression <code>fn:namespace-uri-for-prefix("xml",
|
|
$e)</code> returns
|
|
<code>"http://www.w3.org/XML/1998/namespace"</code>.</p>
|
|
<p>The expression <code>fn:namespace-uri-for-prefix("xml",
|
|
$e)</code> returns
|
|
<code>"http://www.w3.org/XML/1998/namespace"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-in-scope-prefixes" id=
|
|
"func-in-scope-prefixes"></a>10.2.6 fn:in-scope-prefixes</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the prefixes of the in-scope namespaces for an element
|
|
node.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:in-scope-prefixes</code>(<code class=
|
|
"arg">$element</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">element()</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string*</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 a sequence of strings representing the
|
|
prefixes of the in-scope namespaces for <code>$element</code>.</p>
|
|
<p>For namespace bindings that have a prefix, the function returns
|
|
the prefix as an <code>xs:NCName</code>. For the default namespace,
|
|
which has no prefix, it returns the zero-length string.</p>
|
|
<p>The result sequence contains no duplicates.</p>
|
|
<p>The ordering of the result sequence is <a title=
|
|
"implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation-dependent<span class=
|
|
"arrow">·</span></a>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="binary-functions" id="binary-functions"></a>11
|
|
Operators on base64Binary and hexBinary</h2>
|
|
<div class="div2">
|
|
<h3><a name="binary-value-comparisons" id=
|
|
"binary-value-comparisons"></a>11.1 Comparisons of base64Binary and
|
|
hexBinary values</h3>
|
|
<p>The following comparison operators on
|
|
<code>xs:base64Binary</code> and <code>xs:hexBinary</code> values
|
|
are defined. Comparisons take two operands of the same type; that
|
|
is, both operands must be <code>xs:base64Binary</code> or both
|
|
operands may be <code>xs:hexBinary</code>. Each returns a boolean
|
|
value.</p>
|
|
<p>A value of type <code>xs:hexBinary</code> can be compared with a
|
|
value of type <code>xs:base64Binary</code> by casting one value to
|
|
the other type. See <a href="#casting-to-binary"><b>18.1.6 Casting
|
|
to xs:base64Binary and xs:hexBinary</b></a>.</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-hexBinary-equal"><code>op:hexBinary-equal</code></a></td>
|
|
<td>Returns true if two <code>xs:hexBinary</code> values contain
|
|
the same octet sequence.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-base64Binary-equal"><code>op:base64Binary-equal</code></a></td>
|
|
<td>Returns true if two <code>xs:base64Binary</code> values contain
|
|
the same octet sequence.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-hexBinary-equal" id=
|
|
"func-hexBinary-equal"></a>11.1.1 op:hexBinary-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if two <code>xs:hexBinary</code> values contain the
|
|
same octet sequence.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" and "ne" operators on
|
|
<code>xs:hexBinary</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:hexBinary-equal</code>(</td>
|
|
<td valign="baseline"><code class="arg">$value1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:hexBinary</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$value2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:hexBinary</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns <code>true</code> if <code>$value1</code>
|
|
and <code>$value2</code> are of the same length, measured in binary
|
|
octets, and contain the same octets in the same order. Otherwise,
|
|
it returns <code>false</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-base64Binary-equal" id=
|
|
"func-base64Binary-equal"></a>11.1.2 op:base64Binary-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if two <code>xs:base64Binary</code> values contain
|
|
the same octet sequence.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" and "ne" operators on
|
|
<code>xs:base64Binary</code> values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">op:base64Binary-equal</code>(</td>
|
|
<td valign="baseline"><code class="arg">$value1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:base64Binary</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$value2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:base64Binary</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns <code>true</code> if <code>$value1</code>
|
|
and <code>$value2</code> are of the same length, measured in binary
|
|
octets, and contain the same octets in the same order. Otherwise,
|
|
it returns <code>false</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="NOTATION-functions" id="NOTATION-functions"></a>12
|
|
Operators on NOTATION</h2>
|
|
<p>This section specifies operators that take
|
|
<code>xs:NOTATION</code> values as arguments.</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-NOTATION-equal"><code>op:NOTATION-equal</code></a></td>
|
|
<td>Returns <code>true</code> if the two <code>xs:NOTATION</code>
|
|
values have the same namespace URI and the same local part.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div2">
|
|
<h3><a name="func-NOTATION-equal" id="func-NOTATION-equal"></a>12.1
|
|
op:NOTATION-equal</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>true</code> if the two <code>xs:NOTATION</code>
|
|
values have the same namespace URI and the same local part.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "eq" and "ne" operators on values
|
|
of type <code>xs:NOTATION</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:NOTATION-equal</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:NOTATION</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:NOTATION</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 returns <code>true</code> if the namespace URIs of
|
|
<code>$arg1</code> and <code>$arg2</code> are equal and the local
|
|
names of <code>$arg1</code> and <code>$arg2</code> are equal.</p>
|
|
<p>Otherwise, the function returns <code>false</code>.</p>
|
|
<p>The namespace URI parts are considered equal if they are both
|
|
<a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dt-absent">absent</a><sup><small>DM30</small></sup>,
|
|
or if they are both present and equal under the rules of the
|
|
<a href="#func-codepoint-equal"><code>fn:codepoint-equal</code></a>
|
|
function.</p>
|
|
<p>The local parts are also compared under the rules of the
|
|
<a href="#func-codepoint-equal"><code>fn:codepoint-equal</code></a>
|
|
function.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The prefix parts of <code>$arg1</code> and <code>$arg2</code>,
|
|
if any, are ignored.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="node-functions" id="node-functions"></a>13 Functions
|
|
and operators on nodes</h2>
|
|
<p>This section specifies functions and operators on nodes. Nodes
|
|
are formally defined in <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#Node">Section 6 Nodes</a>
|
|
<sup><small>DM30</small></sup>.</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-name"><code>fn:name</code></a></td>
|
|
<td>Returns the name of a node, as an <code>xs:string</code> that
|
|
is either the zero-length string, or has the lexical form of an
|
|
<code>xs:QName</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-local-name"><code>fn:local-name</code></a></td>
|
|
<td>Returns the local part of the name of <code>$arg</code> as an
|
|
<code>xs:string</code> that is either the zero-length string, or
|
|
has the lexical form of an <code>xs:NCName</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-namespace-uri"><code>fn:namespace-uri</code></a></td>
|
|
<td>Returns the namespace URI part of the name of
|
|
<code>$arg</code>, as an <code>xs:anyURI</code> value.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-lang"><code>fn:lang</code></a></td>
|
|
<td>This function tests whether the language of <code>$node</code>,
|
|
or the context item if the second argument is omitted, as specified
|
|
by <code>xml:lang</code> attributes is the same as, or is a
|
|
sublanguage of, the language specified by
|
|
<code>$testlang</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-is-same-node"><code>op:is-same-node</code></a></td>
|
|
<td>Returns true if the two arguments refer to the same node.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-node-before"><code>op:node-before</code></a></td>
|
|
<td>Returns true if the node identified by the first argument
|
|
precedes the node identified by the second argument in document
|
|
order.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-node-after"><code>op:node-after</code></a></td>
|
|
<td>Returns true if the node identified by the first argument
|
|
follows the node identified by the second argument in document
|
|
order.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-root"><code>fn:root</code></a></td>
|
|
<td>Returns the root of the tree to which <code>$arg</code>
|
|
belongs. This will usually, but not necessarily, be a document
|
|
node.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-path"><code>fn:path</code></a></td>
|
|
<td>Returns a path expression that can be used to select the
|
|
supplied node relative to the root of its containing document.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-has-children"><code>fn:has-children</code></a></td>
|
|
<td>Returns true if the supplied node has one or more child nodes
|
|
(of any kind).</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-innermost"><code>fn:innermost</code></a></td>
|
|
<td>Returns every node within the input sequence that is not an
|
|
ancestor of another member of the input sequence; the nodes are
|
|
returned in document order with duplicates eliminated.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-outermost"><code>fn:outermost</code></a></td>
|
|
<td>Returns every node within the input sequence that has no
|
|
ancestor that is itself a member of the input sequence; the nodes
|
|
are returned in document order with duplicates eliminated.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>For the illustrative examples below assume an XQuery or
|
|
transformation operating on a PurchaseOrder document containing a
|
|
number of line-item elements. Each line-item has child elements
|
|
called description, price, quantity, etc. whose content is
|
|
different for each line-item. Quantity has simple content of type
|
|
<code>xs:decimal</code>. Further assume that variables
|
|
<code>$item1</code>, <code>$item2</code>, etc. are each bound to
|
|
single line-item element nodes in the document in sequence and that
|
|
the value of the quantity child of the first line-item is
|
|
<code>5.0</code>.</p>
|
|
<p class="global-variable-binding">let <code>$po</code> :=</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<PurchaseOrder>
|
|
<line-item>
|
|
<description>Large widget</description>
|
|
<price>8.95</price>
|
|
<quantity>5.0</quantity>
|
|
</line-item>
|
|
<line-item>
|
|
<description>Small widget</description>
|
|
<price>3.99</price>
|
|
<quantity>2.0</quantity>
|
|
</line-item>
|
|
<line-item>
|
|
<description>Tiny widget</description>
|
|
<price>1.49</price>
|
|
<quantity>805</quantity>
|
|
</line-item>
|
|
</PurchaseOrder>
|
|
</pre></div>
|
|
<p class="global-variable-binding">let <code>$item1</code> :=
|
|
<code>$po/line-item[1]</code></p>
|
|
<p class="global-variable-binding">let <code>$item2</code> :=
|
|
<code>$po/line-item[2]</code></p>
|
|
<p class="global-variable-binding">let <code>$item3</code> :=
|
|
<code>$po/line-item[3]</code></p>
|
|
<div class="div2">
|
|
<h3><a name="func-name" id="func-name"></a>13.1 fn:name</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the name of a node, as an <code>xs:string</code> that is
|
|
either the zero-length string, or has the lexical form of an
|
|
<code>xs:QName</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:name</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: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: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>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 the argument is supplied and is the empty sequence, the
|
|
function returns the zero-length string.</p>
|
|
<p>If the node identified by <code>$arg</code> has no name (that
|
|
is, if it is a document node, a comment, a text node, or a
|
|
namespace node having no name), the function returns the
|
|
zero-length string.</p>
|
|
<p>Otherwise, the function returns the value of the expression
|
|
<a href=
|
|
"#func-string"><code>fn:string(fn:node-name($arg))</code></a>.</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>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-local-name" id="func-local-name"></a>13.2
|
|
fn:local-name</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the local part of the name of <code>$arg</code> as an
|
|
<code>xs:string</code> that is either the zero-length string, or
|
|
has the lexical form of an <code>xs:NCName</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:local-name</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:local-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: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>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 the argument is supplied and is the empty sequence, the
|
|
function returns the zero-length string.</p>
|
|
<p>If the node identified by <code>$arg</code> has no name (that
|
|
is, if it is a document node, a comment, a text node, or a
|
|
namespace node having no name), the function returns the
|
|
zero-length string.</p>
|
|
<p>Otherwise, the function returns the local part of the
|
|
expanded-QName of the node identified by <code>$arg</code>, as
|
|
determined by the <code>dm:node-name</code> accessor defined in
|
|
<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>). This
|
|
will be an <code>xs:string</code> whose lexical form is an
|
|
<code>xs:NCName</code>.</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 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-namespace-uri" id="func-namespace-uri"></a>13.3
|
|
fn:namespace-uri</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the namespace URI part of the name of <code>$arg</code>,
|
|
as an <code>xs:anyURI</code> value.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:namespace-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:namespace-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">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 node
|
|
(<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 the node identified by <code>$arg</code> is neither an
|
|
element nor an attribute node, or if it is an element or attribute
|
|
node whose expanded-QName (as determined by the
|
|
<code>dm:node-name</code> accessor in the <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>) is in
|
|
no namespace, then the function returns the zero-length
|
|
<code>xs:anyURI</code> value.</p>
|
|
<p>Otherwise, the result will be the namespace URI part of the
|
|
expanded-QName of the node identified by <code>$arg</code>, as
|
|
determined by the <code>dm:node-name</code> accessor defined in
|
|
<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>),
|
|
returned as an <code>xs:anyURI</code> value.</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 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-lang" id="func-lang"></a>13.4 fn:lang</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>This function tests whether the language of <code>$node</code>,
|
|
or the context item if the second argument is omitted, as specified
|
|
by <code>xml:lang</code> attributes is the same as, or is a
|
|
sublanguage of, the language specified by
|
|
<code>$testlang</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:lang</code>(<code class=
|
|
"arg">$testlang</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></div>
|
|
</div>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:lang</code>(<code class=
|
|
"arg">$testlang</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$node</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">Properties</dt>
|
|
<dd>
|
|
<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-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 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>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The behavior of the function if the second argument is omitted
|
|
is exactly the same as if the context item (<code>.</code>) had
|
|
been passed as the second argument.</p>
|
|
<p>The language of the argument <code>$node</code>, or the context
|
|
item if the second argument is omitted, is determined by the value
|
|
of the <code>xml:lang</code> attribute on the node, or, if the node
|
|
has no such attribute, by the value of the <code>xml:lang</code>
|
|
attribute on the nearest ancestor of the node that has an
|
|
<code>xml:lang</code> attribute. If there is no such ancestor, then
|
|
the function returns <code>false</code>.</p>
|
|
<p>If <code>$testlang</code> is the empty sequence it is
|
|
interpreted as the zero-length string.</p>
|
|
<p>The relevant <code>xml:lang</code> attribute is determined by
|
|
the value of the XPath expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
(ancestor-or-self::*/@xml:lang)[last()]
|
|
</pre></div>
|
|
<p>If this expression returns an empty sequence, the function
|
|
returns <code>false</code>.</p>
|
|
<p>Otherwise, the function returns <code>true</code> if and only
|
|
if, based on a caseless default match as specified in section 3.13
|
|
of <a href="#Unicode">[The Unicode Standard]</a>, either:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p><code>$testlang</code> is equal to the string-value of the
|
|
relevant <code>xml:lang</code> attribute, or</p>
|
|
</li>
|
|
<li>
|
|
<p><code>$testlang</code> is equal to some substring of the
|
|
string-value of the relevant <code>xml:lang</code> attribute that
|
|
starts at the start of the string-value and ends immediately before
|
|
a hyphen, "-" (the character "-" is HYPHEN-MINUS, #x002D).</p>
|
|
</li>
|
|
</ol>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>When <code>$arg</code> is omitted 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>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:lang("en")</code> would return
|
|
<code>true</code> if the context node were any of the following
|
|
four elements:</p>
|
|
<ul>
|
|
<li>
|
|
<p><code><para xml:lang="en"/></code></p>
|
|
</li>
|
|
<li>
|
|
<p><code><div xml:lang="en"><para>And now, and
|
|
forever!</para></div></code></p>
|
|
</li>
|
|
<li>
|
|
<p><code><para xml:lang="EN"/></code></p>
|
|
</li>
|
|
<li>
|
|
<p><code><para xml:lang="en-us"/></code></p>
|
|
</li>
|
|
</ul>
|
|
<p>The expression <code>fn:lang("fr")</code> would return
|
|
<code>false</code> if the context node were <code><para
|
|
xml:lang="EN"/></code></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-is-same-node" id="func-is-same-node"></a>13.5
|
|
op:is-same-node</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the two arguments refer to the same node.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "is" operator on nodes.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:is-same-node</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">node()</code>,
|
|
<code class="arg">$arg2</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 the node identified by the value of <code>$arg1</code> is the
|
|
same node as the node identified by the value of <code>$arg2</code>
|
|
(that is, the two nodes have the same identity), then the function
|
|
returns <code>true</code>; otherwise, the function returns
|
|
<code>false</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>op:is-same-node($item1, $item1)</code>
|
|
returns <code>true()</code>.</p>
|
|
<p>The expression <code>op:is-same-node($item1, $item2)</code>
|
|
returns <code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-node-before" id="func-node-before"></a>13.6
|
|
op:node-before</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the node identified by the first argument
|
|
precedes the node identified by the second argument in document
|
|
order.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "<<" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:node-before</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">node()</code>,
|
|
<code class="arg">$arg2</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 the node identified by the value of <code>$arg1</code> occurs
|
|
in document order before the node identified by the value of
|
|
<code>$arg2</code>, then the function returns <code>true</code>;
|
|
otherwise, it returns <code>false</code>.</p>
|
|
<p>The rules determining the order of nodes within a single
|
|
document and in different documents can be found in <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#document-order">Section
|
|
2.4 Document Order</a> <sup><small>DM30</small></sup>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>op:node-before($item1, $item2)</code>
|
|
returns <code>true()</code>.</p>
|
|
<p>The expression <code>op:node-before($item1, $item1)</code>
|
|
returns <code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-node-after" id="func-node-after"></a>13.7
|
|
op:node-after</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the node identified by the first argument
|
|
follows the node identified by the second argument in document
|
|
order.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the ">>" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:node-after</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">node()</code>,
|
|
<code class="arg">$arg2</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 the node identified by the value of <code>$arg1</code> occurs
|
|
in document order after the node identified by the value of
|
|
<code>$arg2</code>, the function returns <code>true</code>;
|
|
otherwise, it returns <code>false</code>.</p>
|
|
<p>The rules determining the order of nodes within a single
|
|
document and in different documents can be found in <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#document-order">Section
|
|
2.4 Document Order</a> <sup><small>DM30</small></sup>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>op:node-after($item1, $item2)</code>
|
|
returns <code>false()</code>.</p>
|
|
<p>The expression <code>op:node-after($item1, $item1)</code>
|
|
returns <code>false()</code>.</p>
|
|
<p>The expression <code>op:node-after($item2, $item1)</code>
|
|
returns <code>true()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-root" id="func-root"></a>13.8 fn:root</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the root of the tree to which <code>$arg</code> belongs.
|
|
This will usually, but not necessarily, be a document node.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:root</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">node()</code></div>
|
|
</div>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:root</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">node()?</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 function is called without an argument, the context item
|
|
(<code>.</code>) is used as the default argument. 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 function returns the value of the expression
|
|
<code>($arg/ancestor-or-self::node())[1]</code>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>When <code>$arg</code> is omitted 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>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>These examples use some variables which could be defined in
|
|
<a href="#xquery">[XQuery 1.0: An XML Query Language]</a> as:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
let $i := <tool>wrench</tool>
|
|
let $o := <order> {$i} <quantity>5</quantity> </order>
|
|
let $odoc := document {$o}
|
|
let $newi := $o/tool
|
|
</pre></div>
|
|
<p>Or they could be defined in <a href="#xslt20">[XSL
|
|
Transformations (XSLT) Version 2.0]</a> as:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:variable name="i" as="element()">
|
|
<tool>wrench</tool>
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="o" as="element()">
|
|
<order>
|
|
<xsl:copy-of select="$i"/>
|
|
<quantity>5</quantity>
|
|
</order>
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="odoc">
|
|
<xsl:copy-of select="$o"/>
|
|
</xsl:variable>
|
|
|
|
<xsl:variable name="newi" select="$o/tool"/>
|
|
</pre></div>
|
|
<p><code>fn:root($i)</code> returns the element node
|
|
<code>$i</code></p>
|
|
<p><code>fn:root($o/quantity)</code> returns the element node
|
|
<code>$o</code></p>
|
|
<p><code>fn:root($odoc//quantity)</code> returns the document node
|
|
<code>$odoc</code></p>
|
|
<p><code>fn:root($newi)</code> returns the element node
|
|
<code>$o</code></p>
|
|
<p>The final three examples could be made type-safe by wrapping
|
|
their operands with <a href=
|
|
"#func-exactly-one"><code>fn:exactly-one()</code></a>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-path" id="func-path"></a>13.9 fn:path</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a path expression that can be used to select the
|
|
supplied node relative to the root of its containing document.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:path</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:path</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:string?</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Properties</dt>
|
|
<dd>
|
|
<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-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 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>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The behavior of the function if the argument is omitted is
|
|
exactly the same as if the context item (<code>.</code>) had been
|
|
passed as the argument.</p>
|
|
<p>If <code>$arg</code> is the empty sequence, the function returns
|
|
the empty sequence.</p>
|
|
<p>If <code>$arg</code> is a document node, the function returns
|
|
the string <code>"/"</code>.</p>
|
|
<p>Otherwise, the function constructs a string that consists of a
|
|
sequence of steps, one for each ancestor-or-self of
|
|
<code>$arg</code> other than the document node. Each step consists
|
|
of the character <code>"/"</code> followed by a string whose form
|
|
depends on the kind of node selected by that step, as follows:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>For an element node, <code>"{uri}":{local}[{position}]</code>,
|
|
where <code>{uri}</code> is the namespace URI of the node name or
|
|
the empty string if the node is in no namespace,
|
|
<code>{local}</code> is the local part of the node name, and
|
|
<code>{position}</code> is an integer representing the position of
|
|
the selected node among its like-named siblings.</p>
|
|
</li>
|
|
<li>
|
|
<p>For an attribute node:</p>
|
|
<ol class="enumla">
|
|
<li>
|
|
<p>if the node is in no namespace, <code>@{local}</code>, where
|
|
<code>{local}</code> is the local part of the node name</p>
|
|
</li>
|
|
<li>
|
|
<p>otherwise, <code>@"{uri}":{local}</code>, where
|
|
<code>{uri}</code> is the namespace URI of the node name, and
|
|
<code>{local}</code> is the local part of the node name</p>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>
|
|
<p>For a text node: <code>text()[{position}]</code> where
|
|
<code>{position}</code> is an integer representing the position of
|
|
the selected node among its text node siblings</p>
|
|
</li>
|
|
<li>
|
|
<p>For a comment node: <code>comment()[{position}]</code> where
|
|
<code>{position}</code> is an integer representing the position of
|
|
the selected node among its comment node siblings</p>
|
|
</li>
|
|
<li>
|
|
<p>For a processing-instruction node:
|
|
<code>processing-instruction({local})[{position}]</code> where
|
|
<code>{local}</code> is the name of the processing instruction node
|
|
and <code>{position}</code> is an integer representing the position
|
|
of the selected node among its like-named processing-instruction
|
|
node siblings</p>
|
|
</li>
|
|
<li>
|
|
<p>For a namespace node:</p>
|
|
<ol class="enumla">
|
|
<li>
|
|
<p>If the namespace node has a name:
|
|
<code>namespace::{prefix}</code>, where <code>{prefix}</code> is
|
|
the local part of the name of the namespace node (which represents
|
|
the namespace prefix).</p>
|
|
</li>
|
|
<li>
|
|
<p>If the namespace node has no name (that is, it represents the
|
|
default namespace):
|
|
<code>namespace::*["http://www.w3.org/2005/xpath-functions":local-name()=""]</code></p>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODC0001" title=
|
|
"err:FODC0001">err:FODC0001</a>] if <code>$arg</code>, or the
|
|
context item if the second argument is absent, is a node in a tree
|
|
whose root is not a document node.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$e</code> :=</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
fn:parse-xml('<?xml version="1.0"?>
|
|
<p xmlns="http://example.com/one" xml:lang="de" author="Friedrich von Schiller">
|
|
Freude, schöner Götterfunken,<br/>
|
|
Tochter aus Elysium,<br/>
|
|
Wir betreten feuertrunken,<br/>
|
|
Himmlische, dein Heiligtum.</p>')
|
|
|
|
</pre></div>
|
|
<p>The expression <code>fn:path($e)</code> returns
|
|
<code>'/'</code>.</p>
|
|
<p>The expression <code>fn:path($e/*:p)</code> returns
|
|
<code>'/"http://example.com/one":p[1]'</code>.</p>
|
|
<p>The expression <code>fn:path($e/*:p/@xml:lang)</code> returns
|
|
<code>'/"http://example.com/one":p[1]/@"http://www.w3.org/XML/1998/namespace":lang'</code>.</p>
|
|
<p>The expression <code>fn:path($e/*:p/@author)</code> returns
|
|
<code>'/"http://example.com/one":p[1]/@author'</code>.</p>
|
|
<p>The expression <code>fn:path($e/*:p/*:br[2])</code> returns
|
|
<code>'/"http://example.com/one":p[1]/"http://example.com/one":br[2]'</code>.</p>
|
|
<p>The expression
|
|
<code>fn:path($e//text()[starts-with(normalize-space(),
|
|
'Tochter')])</code> returns
|
|
<code>'/"http://example.com/one":p[1]/text()[2]'</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-has-children" id="func-has-children"></a>13.10
|
|
fn:has-children</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the supplied node has one or more child nodes
|
|
(of any kind).</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:has-children</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></div>
|
|
</div>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:has-children</code>(<code class=
|
|
"arg">$node</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">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 the function call
|
|
<code>fn:has-children($node)</code> is defined to be the same as
|
|
the result of the expression <a href=
|
|
"#func-exists"><code>fn:exists($node/child::node())</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>The following errors may be raised when <code>$node</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>$node</code> is an empty sequence the result is
|
|
false.</p>
|
|
<p>The motivation for this function is to support streamed
|
|
evaluation. According to the streaming rules in <a href=
|
|
"#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a>, the
|
|
following construct is not streamable:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:if test="exists(row)">
|
|
<ul>
|
|
<xsl:for-each select="row">
|
|
<li><xsl:value-of select="."/></li>
|
|
</xsl:for-each>
|
|
</ul>
|
|
</xsl:if>
|
|
</pre></div>
|
|
<p>This is because it makes two downward selections to read the
|
|
child <code>row</code> elements. The use of
|
|
<code>fn:has-children</code> in the <code>xsl:if</code> conditional
|
|
is intended to circumvent this restriction.</p>
|
|
<p>Although the function was introduced to support streaming use
|
|
cases, it has general utility as a convenience function.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-innermost" id="func-innermost"></a>13.11
|
|
fn:innermost</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns every node within the input sequence that is not an
|
|
ancestor of another member of the input sequence; the nodes are
|
|
returned in document order with duplicates eliminated.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:innermost</code>(<code class=
|
|
"arg">$nodes</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">node()*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">node()*</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 effect of the function call
|
|
<code>fn:innermost($nodes)</code> is defined to be equivalent to
|
|
the result of the expression <code>$nodes except
|
|
$nodes/ancestor::node()</code>.</p>
|
|
<p>That is, the function takes as input a sequence of nodes, and
|
|
returns every node within the sequence that is not an ancestor of
|
|
another node within the sequence; the nodes are returned in
|
|
document order with duplicates eliminated.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>If the source document contains nested sections represented by
|
|
<code>div</code> elements, the expression
|
|
<code>innermost(//div)</code> returns those <code>div</code>
|
|
elements that do not contain further <code>div</code> elements.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-outermost" id="func-outermost"></a>13.12
|
|
fn:outermost</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns every node within the input sequence that has no
|
|
ancestor that is itself a member of the input sequence; the nodes
|
|
are returned in document order with duplicates eliminated.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:outermost</code>(<code class=
|
|
"arg">$nodes</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">node()*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">node()*</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 effect of the function call
|
|
<code>fn:outermost($nodes)</code> is defined to be equivalent to
|
|
the result of the expression <code>$nodes[not(ancestor::node()
|
|
intersect $nodes)]</code>.</p>
|
|
<p>That is, the function takes as input a sequence of nodes, and
|
|
returns every node within the sequence that <span>does not have
|
|
another node within the sequence as an ancestor</span>; the nodes
|
|
are returned in document order with duplicates eliminated.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The formulation <code>$nodes except
|
|
$nodes/descendant::node()</code> might appear to be simpler, but
|
|
does not correctly account for attribute nodes, as these are not
|
|
descendants of their parent element.</p>
|
|
<p>The motivation for the function was based on XSLT streaming use
|
|
cases; there are cases where the <a href="#xslt-30">[XSL
|
|
Transformations (XSLT) Version 3.0]</a> streaming rules allow the
|
|
construct <code>outermost(//section)</code> but do not allow
|
|
<code>//section</code>; the function can therefore be useful in
|
|
cases where it is known that sections will not be nested, as well
|
|
as cases where the application actually wishes to process all
|
|
sections except those that are nested within another.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>If the source document contains nested sections represented by
|
|
<code>div</code> elements, the expression
|
|
<code>outermost(//div)</code> returns those <code>div</code>
|
|
elements that <span>are not contained within</span> further
|
|
<code>div</code> elements.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="sequence-functions" id="sequence-functions"></a>14
|
|
Functions and operators on sequences</h2>
|
|
<p>A <code>sequence</code> is an ordered collection of zero or more
|
|
<code>items</code>. An <code>item</code> is either a node or an
|
|
atomic value. The terms <code>sequence</code> and <code>item</code>
|
|
are defined formally 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>.</p>
|
|
<div class="div2">
|
|
<h3><a name="general-seq-funcs" id="general-seq-funcs"></a>14.1
|
|
General functions and operators on sequences</h3>
|
|
<p>The following functions are defined on sequences. These
|
|
functions work on any sequence, without performing any operations
|
|
that are sensitive to the individual items in the sequence.</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-concatenate"><code>op:concatenate</code></a></td>
|
|
<td>Returns the concatenation of two sequences.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-empty"><code>fn:empty</code></a></td>
|
|
<td>Returns true if the argument is the empty sequence.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-exists"><code>fn:exists</code></a></td>
|
|
<td>Returns true if the argument is a non-empty sequence.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-head"><code>fn:head</code></a></td>
|
|
<td>Returns the first item in a sequence.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-tail"><code>fn:tail</code></a></td>
|
|
<td>Returns all but the first item in a sequence.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-insert-before"><code>fn:insert-before</code></a></td>
|
|
<td>Returns a sequence constructed by inserting an item or a
|
|
sequence of items at a given position within an existing
|
|
sequence.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-remove"><code>fn:remove</code></a></td>
|
|
<td>Returns a new sequence containing all the items of
|
|
<code>$target</code> except the item at position
|
|
<code>$position</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-reverse"><code>fn:reverse</code></a></td>
|
|
<td>Reverses the order of items in a sequence.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-subsequence"><code>fn:subsequence</code></a></td>
|
|
<td>Returns the contiguous sequence of items in the value of
|
|
<code>$sourceSeq</code> beginning at the position indicated by the
|
|
value of <code>$startingLoc</code> and continuing for the number of
|
|
items indicated by the value of <code>$length</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-unordered"><code>fn:unordered</code></a></td>
|
|
<td>Returns the items of <code>$sourceSeq</code> in an <a title=
|
|
"implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a> order.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>As in the previous section, for the illustrative examples below,
|
|
assume an XQuery or transformation operating on a non-empty
|
|
Purchase Order document containing a number of line-item elements.
|
|
The variable <code>$seq</code> is bound to the sequence of
|
|
line-item nodes in document order. The variables
|
|
<code>$item1</code>, <code>$item2</code>, etc. are bound to
|
|
separate, individual line-item nodes in the sequence.</p>
|
|
<div class="div3">
|
|
<h4><a name="func-concatenate" id="func-concatenate"></a>14.1.1
|
|
op:concatenate</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the concatenation of two sequences.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the infix operator ",".</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:concatenate</code>(<code class=
|
|
"arg">$seq1</code><code class=
|
|
"as"> as </code><code class="type">item()*</code>,
|
|
<code class="arg">$seq2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">item()*</code>)<code class=
|
|
"as"> as </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 a sequence consisting of all the items in
|
|
<code>$seq1</code> followed by all the items in
|
|
<code>$seq2</code>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If either sequence is the empty sequence, the other operand is
|
|
returned.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>op:concatenate((1, 2, 3), (4, 5))</code>
|
|
returns <code>(1, 2, 3, 4, 5)</code>.</p>
|
|
<p>The expression <code>op:concatenate((1, 2, 3), ())</code>
|
|
returns <code>(1, 2, 3)</code>.</p>
|
|
<p>The expression <code>op:concatenate((), ())</code> returns
|
|
<code>()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-empty" id="func-empty"></a>14.1.2 fn:empty</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the argument is the empty sequence.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:empty</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:boolean</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 the value of <code>$arg</code> is the empty sequence, the
|
|
function returns <code>true</code>; otherwise, the function returns
|
|
<code>false</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:empty((1,2,3)[10])</code> returns
|
|
<code>true()</code>.</p>
|
|
<p>The expression <code>fn:empty(fn:remove(("hello", "world"),
|
|
1))</code> returns <code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-exists" id="func-exists"></a>14.1.3
|
|
fn:exists</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns true if the argument is a non-empty sequence.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:exists</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:boolean</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 the value of <code>$arg</code> is a non-empty sequence, the
|
|
function returns <code>true</code>; otherwise, the function returns
|
|
<code>false</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:exists(fn:remove(("hello"), 1))</code>
|
|
returns <code>false()</code>.</p>
|
|
<p>The expression <code>fn:exists(fn:remove(("hello", "world"),
|
|
1))</code> returns <code>true()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-head" id="func-head"></a>14.1.4 fn:head</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the first item in a sequence.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:head</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">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 the expression
|
|
<code>$arg[1]</code></p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If <code>$arg</code> is the empty sequence, the empty sequence
|
|
is returned. Otherwise the first item in the sequence is
|
|
returned.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:head(1 to 5)</code> returns
|
|
<code>1</code>.</p>
|
|
<p>The expression <code>fn:head(("a", "b", "c"))</code> returns
|
|
<code>"a"</code>.</p>
|
|
<p>The expression <code>fn:head(())</code> returns
|
|
<code>()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-tail" id="func-tail"></a>14.1.5 fn:tail</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns all but the first item in a sequence.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:tail</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">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 the expression
|
|
<code>subsequence($arg, 2)</code></p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If <code>$arg</code> is the empty sequence, or a sequence
|
|
containing a single item, then the empty sequence is returned.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:tail(1 to 5)</code> returns <code>(2, 3,
|
|
4, 5)</code>.</p>
|
|
<p>The expression <code>fn:tail(("a", "b", "c"))</code> returns
|
|
<code>("b", "c")</code>.</p>
|
|
<p>The expression <code>fn:tail("a")</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>fn:tail(())</code> returns
|
|
<code>()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-insert-before" id="func-insert-before"></a>14.1.6
|
|
fn:insert-before</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a sequence constructed by inserting an item or a
|
|
sequence of items at a given position within an existing
|
|
sequence.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<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:insert-before</code>(</td>
|
|
<td valign="baseline"><code class="arg">$target</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$position</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">$inserts</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">item()*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">item()*</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>The value returned by the function consists of all items of
|
|
<code>$target</code> whose index is less than
|
|
<code>$position</code>, followed by all items of
|
|
<code>$inserts</code>, followed by the remaining elements of
|
|
<code>$target</code>, in that order.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If <code>$target</code> is the empty sequence,
|
|
<code>$inserts</code> is returned. If <code>$inserts</code> is the
|
|
empty sequence, <code>$target</code> is returned.</p>
|
|
<p>If <code>$position</code> is less than one (1), the first
|
|
position, the effective value of <code>$position</code> is one (1).
|
|
If <code>$position</code> is greater than the number of items in
|
|
<code>$target</code>, then the effective value of
|
|
<code>$position</code> is equal to the number of items in
|
|
<code>$target</code> plus 1.</p>
|
|
<p>The value of <code>$target</code> is not affected by the
|
|
sequence construction.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$abc</code> := <code>("a", "b", "c")</code></p>
|
|
<p>The expression <code>fn:insert-before($abc, 0, "z")</code>
|
|
returns <code>("z", "a", "b", "c")</code>.</p>
|
|
<p>The expression <code>fn:insert-before($abc, 1, "z")</code>
|
|
returns <code>("z", "a", "b", "c")</code>.</p>
|
|
<p>The expression <code>fn:insert-before($abc, 2, "z")</code>
|
|
returns <code>("a", "z", "b", "c")</code>.</p>
|
|
<p>The expression <code>fn:insert-before($abc, 3, "z")</code>
|
|
returns <code>("a", "b", "z", "c")</code>.</p>
|
|
<p>The expression <code>fn:insert-before($abc, 4, "z")</code>
|
|
returns <code>("a", "b", "c", "z")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-remove" id="func-remove"></a>14.1.7
|
|
fn:remove</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a new sequence containing all the items of
|
|
<code>$target</code> except the item at position
|
|
<code>$position</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:remove</code>(<code class=
|
|
"arg">$target</code><code class=
|
|
"as"> as </code><code class="type">item()*</code>,
|
|
<code class="arg">$position</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:integer</code>)<code class=
|
|
"as"> as </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 a sequence consisting of all items of
|
|
<code>$target</code> whose index is less than
|
|
<code>$position</code>, followed by all items of
|
|
<code>$target</code> whose index is greater than
|
|
<code>$position</code>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If <code>$position</code> is less than 1 or greater than the
|
|
number of items in <code>$target</code>, <code>$target</code> is
|
|
returned.</p>
|
|
<p>If <code>$target</code> is the empty sequence, the empty
|
|
sequence is returned.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$abc</code> := <code>("a", "b", "c")</code></p>
|
|
<p>The expression <code>fn:remove($abc, 0)</code> returns
|
|
<code>("a", "b", "c")</code>.</p>
|
|
<p>The expression <code>fn:remove($abc, 1)</code> returns
|
|
<code>("b", "c")</code>.</p>
|
|
<p>The expression <code>fn:remove($abc, 6)</code> returns
|
|
<code>("a", "b", "c")</code>.</p>
|
|
<p>The expression <code>fn:remove((), 3)</code> returns
|
|
<code>()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-reverse" id="func-reverse"></a>14.1.8
|
|
fn:reverse</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Reverses the order of items in a sequence.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:reverse</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">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 a sequence containing the items in
|
|
<code>$arg</code> in reverse order.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If <code>$arg</code> is the empty sequence, the empty sequence
|
|
is returned.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$abc</code> := <code>("a", "b", "c")</code></p>
|
|
<p>The expression <code>fn:reverse($abc)</code> returns <code>("c",
|
|
"b", "a")</code>.</p>
|
|
<p>The expression <code>fn:reverse(("hello"))</code> returns
|
|
<code>("hello")</code>.</p>
|
|
<p>The expression <code>fn:reverse(())</code> returns
|
|
<code>()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-subsequence" id="func-subsequence"></a>14.1.9
|
|
fn:subsequence</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the contiguous sequence of items in the value of
|
|
<code>$sourceSeq</code> beginning at the position indicated by the
|
|
value of <code>$startingLoc</code> and continuing for the number of
|
|
items indicated by the value of <code>$length</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:subsequence</code>(<code class=
|
|
"arg">$sourceSeq</code><code class=
|
|
"as"> as </code><code class="type">item()*</code>,
|
|
<code class="arg">$startingLoc</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:double</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">item()*</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:subsequence</code>(</td>
|
|
<td valign="baseline"><code class="arg">$sourceSeq</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$startingLoc</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:double</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$length</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:double</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">item()*</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>In the two-argument case, returns:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
$sourceSeq[fn:round($startingLoc) le position()]
|
|
</pre></div>
|
|
<p>In the three-argument case, returns:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
$sourceSeq[fn:round($startingLoc) le position()
|
|
and position() lt fn:round($startingLoc) + fn:round($length)]
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The first item of a sequence is located at position 1, not
|
|
position 0.</p>
|
|
<p>If <code>$sourceSeq</code> is the empty sequence, the empty
|
|
sequence is returned.</p>
|
|
<p>If <code>$startingLoc</code> is zero or negative, the
|
|
subsequence includes items from the beginning of the
|
|
<code>$sourceSeq</code>.</p>
|
|
<p>If <code>$length</code> is not specified, the subsequence
|
|
includes items to the end of <code>$sourceSeq</code>.</p>
|
|
<p>If <code>$length</code> is greater than the number of items in
|
|
the value of <code>$sourceSeq</code> following
|
|
<code>$startingLoc</code>, the subsequence includes items to the
|
|
end of <code>$sourceSeq</code>.</p>
|
|
<p>As an exception to the previous two notes, if
|
|
<code>$startingLoc</code> is <code>-INF</code> and
|
|
<code>$length</code> is <code>+INF</code>, then <a href=
|
|
"#func-round"><code>fn:round($startingLoc) +
|
|
fn:round($length)</code></a> is <code>NaN</code>; since
|
|
<code>position() lt NaN</code> is always false, the result is an
|
|
empty sequence.</p>
|
|
<p>The reason the function accepts arguments of type
|
|
<code>xs:double</code> is that many computations on untyped data
|
|
return an <code>xs:double</code> result; and the reason for the
|
|
rounding rules is to compensate for any imprecision in these
|
|
floating-point computations.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$seq</code> := <code>("item1", "item2", "item3",
|
|
"item4", "item5")</code></p>
|
|
<p>The expression <code>fn:subsequence($seq, 4)</code> returns
|
|
<code>("item4", "item5")</code>.</p>
|
|
<p>The expression <code>fn:subsequence($seq, 3, 2)</code> returns
|
|
<code>("item3", "item4")</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-unordered" id="func-unordered"></a>14.1.10
|
|
fn:unordered</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the items of <code>$sourceSeq</code> in an <a title=
|
|
"implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a> order.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:unordered</code>(<code class=
|
|
"arg">$sourceSeq</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">item()*</code>)<code class=
|
|
"as"> as </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 items of <code>$sourceSeq</code> in an
|
|
<a title="implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a> order.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Query optimizers may be able to do a better job if the order of
|
|
the output sequence is not specified. For example, when retrieving
|
|
prices from a purchase order, if an index exists on prices, it may
|
|
be more efficient to return the prices in index order rather than
|
|
in document order.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:unordered((1, 2, 3, 4, 5))</code>
|
|
returns some permutation of <code>(1, 2, 3, 4, 5)</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="comparing-sequences" id="comparing-sequences"></a>14.2
|
|
Functions that compare values in sequences</h3>
|
|
<p>The functions in this section rely on comparisons between the
|
|
items in one or more sequences.</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-distinct-values"><code>fn:distinct-values</code></a></td>
|
|
<td>Returns the values that appear in a sequence, with duplicates
|
|
eliminated.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-index-of"><code>fn:index-of</code></a></td>
|
|
<td>Returns a sequence of positive integers giving the positions
|
|
within the sequence <code>$seq</code> of items that are equal to
|
|
<code>$search</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-deep-equal"><code>fn:deep-equal</code></a></td>
|
|
<td>This function assesses whether two sequences are deep-equal to
|
|
each other. To be deep-equal, they must contain items that are
|
|
pairwise deep-equal; and for two items to be deep-equal, they must
|
|
either be atomic values that compare equal, or nodes of the same
|
|
kind, with the same name, whose children are deep-equal.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-distinct-values" id=
|
|
"func-distinct-values"></a>14.2.1 fn:distinct-values</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the values that appear in a sequence, with duplicates
|
|
eliminated.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:distinct-values</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType*</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="2"><code class=
|
|
"function">fn:distinct-values</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$collation</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:anyAtomicType*</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the sequence that results from removing
|
|
from <code>$arg</code> all but one of a set of values that are
|
|
equal to one another. Values are compared using the <code>eq</code>
|
|
operator, subject to the caveats defined below.</p>
|
|
<p>Values of type <code>xs:untypedAtomic</code> are compared as if
|
|
they were of type <code>xs:string</code>.</p>
|
|
<p>Values that cannot be compared, because the <code>eq</code>
|
|
operator is not defined for their types, are considered to be
|
|
distinct.</p>
|
|
<p>The collation used by this function is determined according to
|
|
the rules in <a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>. This collation is used when string comparison is
|
|
required.</p>
|
|
<p>For <code>xs:float</code> and <code>xs:double</code> values,
|
|
positive zero is equal to negative zero and, although
|
|
<code>NaN</code> does not equal itself, if <code>$arg</code>
|
|
contains multiple <code>NaN</code> values a single <code>NaN</code>
|
|
is returned.</p>
|
|
<p>If <code>xs:dateTime</code>, <code>xs:date</code> or
|
|
<code>xs:time</code> values do not have a timezone, they are
|
|
considered to have the implicit timezone provided by the dynamic
|
|
context for the purpose of comparison. Note that
|
|
<code>xs:dateTime</code>, <code>xs:date</code> or
|
|
<code>xs:time</code> values can compare equal even if their
|
|
timezones are different.</p>
|
|
<p>The order in which the sequence of values is returned is
|
|
<a title="implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>Which value of a set of values that compare equal is returned is
|
|
<a title="implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>If the input sequence contains values of different numeric types
|
|
that differ from each other by small amounts, then the eq operator
|
|
is not transitive, because of rounding effects occurring during
|
|
type promotion. In the situation where the input contains three
|
|
values <code>A</code>, <code>B</code>, and <code>C</code> such that
|
|
<code>A eq B</code>, <code>B eq C</code>, but <code>A ne C</code>,
|
|
then the number of items in the result of the function (as well as
|
|
the choice of which items are returned) is <a title=
|
|
"implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a>, subject only to the constraints that (a) no
|
|
two items in the result sequence compare equal to each other, and
|
|
(b) every input item that does not appear in the result sequence
|
|
compares equal to some item that does appear in the result
|
|
sequence.</p>
|
|
<p>For example, this arises when computing:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
distinct-values(
|
|
(xs:float('1.0'),
|
|
xs:decimal('1.0000000000100000000001',
|
|
xs:double( '1.00000000001'))
|
|
</pre></div>
|
|
<p>because the values of type <code>xs:float</code> and
|
|
<code>xs:double</code> both compare equal to the value of type
|
|
<code>xs:decimal</code> but not equal to each other.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If <code>$arg</code> is the empty sequence, the function returns
|
|
the empty sequence.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:distinct-values((1, 2.0, 3, 2))</code>
|
|
returns some permutation of <code>(1, 3, 2.0)</code>.</p>
|
|
<p>The expression
|
|
<code>fn:distinct-values((xs:untypedAtomic("cherry"),
|
|
xs:untypedAtomic("plum"), xs:untypedAtomic("plum")))</code> returns
|
|
some permutation of <code>(xs:untypedAtomic("cherry"),
|
|
xs:untypedAtomic("plum"))</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-index-of" id="func-index-of"></a>14.2.2
|
|
fn:index-of</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a sequence of positive integers giving the positions
|
|
within the sequence <code>$seq</code> of items that are equal to
|
|
<code>$search</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:index-of</code>(</td>
|
|
<td valign="baseline"><code class="arg">$seq</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$search</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer*</code></td>
|
|
</tr>
|
|
</table>
|
|
</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:index-of</code>(</td>
|
|
<td valign="baseline"><code class="arg">$seq</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$search</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$collation</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:integer*</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns a sequence of positive integers giving the
|
|
positions within the sequence <code>$seq</code> of items that are
|
|
equal to <code>$search</code>.</p>
|
|
<p>The collation used by this function is determined according to
|
|
the rules in <a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>. This collation is used when string comparison is
|
|
required.</p>
|
|
<p>The items in the sequence <code>$seq</code> are compared with
|
|
<code>$search</code> under the rules for the <code>eq</code>
|
|
operator. Values of type <code>xs:untypedAtomic</code> are compared
|
|
as if they were of type <code>xs:string</code>. Values that cannot
|
|
be compared, because the <code>eq</code> operator is not defined
|
|
for their types, are considered to be distinct. If an item compares
|
|
equal, then the position of that item in the sequence
|
|
<code>$seq</code> is included in the result.</p>
|
|
<p>The first item in a sequence is at position 1, not position
|
|
0.</p>
|
|
<p>The result sequence is in ascending numeric order.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If the value of <code>$seq</code> is the empty sequence, or if
|
|
no item in <code>$seq</code> matches <code>$search</code>, then the
|
|
function returns the empty sequence.</p>
|
|
<p>No error occurs if non-comparable values are encountered. So
|
|
when comparing two atomic values, the effective boolean value of
|
|
<code>fn:index-of($a, $b)</code> is true if <code>$a</code> and
|
|
<code>$b</code> are equal, false if they are not equal or not
|
|
comparable.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:index-of((10, 20, 30, 40), 35)</code>
|
|
returns <code>()</code>.</p>
|
|
<p>The expression <code>fn:index-of((10, 20, 30, 30, 20, 10),
|
|
20)</code> returns <code>(2, 5)</code>.</p>
|
|
<p>The expression <code>fn:index-of(("a", "sport", "and", "a",
|
|
"pastime"), "a")</code> returns <code>(1, 4)</code>.</p>
|
|
<p>The expression <code>fn:index-of(current-date(), 23)</code>
|
|
returns <code>()</code>.</p>
|
|
<p>If <code>@a</code> is an attribute of type
|
|
<code>xs:NMTOKENS</code> whose string value is <code>"red green
|
|
blue"</code>, and whose typed value is therefore <code>("red",
|
|
"green", "blue")</code>, then <code>fn:index-of(@a, "blue")</code>
|
|
returns <code>3</code>. This is because the function calling
|
|
mechanism atomizes the attribute node to produce a sequence of
|
|
three <code>xs:NMTOKEN</code> values.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-deep-equal" id="func-deep-equal"></a>14.2.3
|
|
fn:deep-equal</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>This function assesses whether two sequences are deep-equal to
|
|
each other. To be deep-equal, they must contain items that are
|
|
pairwise deep-equal; and for two items to be deep-equal, they must
|
|
either be atomic values that compare equal, or nodes of the same
|
|
kind, with the same name, whose children are deep-equal.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:deep-equal</code>(<code class=
|
|
"arg">$parameter1</code><code class=
|
|
"as"> as </code><code class="type">item()*</code>,
|
|
<code class="arg">$parameter2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">item()*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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:deep-equal</code>(</td>
|
|
<td valign="baseline"><code class="arg">$parameter1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$parameter2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$collation</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:boolean</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The <code>$collation</code> argument identifies a collation
|
|
which is used at all levels of recursion when strings are compared
|
|
(but not when names are compared), according to the rules in
|
|
<a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>.</p>
|
|
<p>If the two sequences are both empty, the function returns
|
|
<code>true</code>.</p>
|
|
<p>If the two sequences are of different lengths, the function
|
|
returns <code>false</code>.</p>
|
|
<p>If the two sequences are of the same length, the function
|
|
returns <code>true</code> if and only if every item in the sequence
|
|
<code>$parameter1</code> is deep-equal to the item at the same
|
|
position in the sequence <code>$parameter2</code>. The rules for
|
|
deciding whether two items are deep-equal follow.</p>
|
|
<p>Call the two items <code>$i1</code> and <code>$i2</code>
|
|
respectively.</p>
|
|
<p>If <code>$i1</code> and <code>$i2</code> are both atomic values,
|
|
they are deep-equal if and only if <code>($i1 eq $i2)</code> is
|
|
<code>true</code>, or if both values are <code>NaN</code>. If the
|
|
<code>eq</code> operator is not defined for <code>$i1</code> and
|
|
<code>$i2</code>, the function returns <code>false</code>.</p>
|
|
<p>If one of the pair <code>$i1</code> or <code>$i2</code> is an
|
|
atomic value and the other is not, the function returns
|
|
<code>false</code>.</p>
|
|
<p>If <code>$i1</code> and <code>$i2</code> are both nodes, they
|
|
are compared as described below:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>If the two nodes are of different kinds, the result is
|
|
<code>false</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the two nodes are both document nodes then they are
|
|
deep-equal if and only if the sequence <code>$i1/(*|text())</code>
|
|
is deep-equal to the sequence <code>$i2/(*|text())</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the two nodes are both element nodes then they are deep-equal
|
|
if and only if all of the following conditions are satisfied:</p>
|
|
<ol class="enumla">
|
|
<li>
|
|
<p>The two nodes have the same name, that is <code>(node-name($i1)
|
|
eq node-name($i2))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The two nodes are both annotated as having simple content or
|
|
both nodes are annotated as having complex content.</p>
|
|
</li>
|
|
<li>
|
|
<p>The two nodes have the same number of attributes, and for every
|
|
attribute <code>$a1</code> in <code>$i1/@*</code> there exists an
|
|
attribute <code>$a2</code> in <code>$i2/@*</code> such that
|
|
<code>$a1</code> and <code>$a2</code> are deep-equal.</p>
|
|
</li>
|
|
<li>
|
|
<p>One of the following conditions holds:</p>
|
|
<ul>
|
|
<li>
|
|
<p>Both element nodes have a type annotation that is simple
|
|
content, and the typed value of <code>$i1</code> is deep-equal to
|
|
the typed value of <code>$i2</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Both element nodes have a type annotation that is complex
|
|
content with elementOnly content, and each child element of
|
|
<code>$i1</code> is deep-equal to the corresponding child element
|
|
of <code>$i2</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Both element nodes have a type annotation that is complex
|
|
content with mixed content, and the sequence
|
|
<code>$i1/(*|text())</code> is deep-equal to the sequence
|
|
<code>$i2/(*|text())</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Both element nodes have a type annotation that is complex
|
|
content with empty content.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>
|
|
<p>If the two nodes are both attribute nodes then they are
|
|
deep-equal if and only if both the following conditions are
|
|
satisfied:</p>
|
|
<ol class="enumla">
|
|
<li>
|
|
<p>The two nodes have the same name, that is <code>(node-name($i1)
|
|
eq node-name($i2))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The typed value of <code>$i1</code> is deep-equal to the typed
|
|
value of <code>$i2</code>.</p>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>
|
|
<p>If the two nodes are both processing instruction nodes, then
|
|
they are deep-equal if and only if both the following conditions
|
|
are satisfied:</p>
|
|
<ol class="enumla">
|
|
<li>
|
|
<p>The two nodes have the same name, that is <code>(node-name($i1)
|
|
eq node-name($i2))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The string value of <code>$i1</code> is equal to the string
|
|
value of <code>$i2</code>.</p>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>
|
|
<p>If the two nodes are both namespace nodes, then they are
|
|
deep-equal if and only if both the following conditions are
|
|
satisfied:</p>
|
|
<ol class="enumla">
|
|
<li>
|
|
<p>The two nodes either have the same name or are both nameless,
|
|
that is <code>fn:deep-equal(node-name($i1),
|
|
node-name($i2))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The string value of <code>$i1</code> is equal to the string
|
|
value of <code>$i2</code> when compared using the Unicode codepoint
|
|
collation.</p>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>
|
|
<p>If the two nodes are both text nodes or comment nodes, then they
|
|
are deep-equal if and only if their string-values are equal.</p>
|
|
</li>
|
|
</ol>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFOTY0015" title=
|
|
"err:FOTY0015">err:FOTY0015</a>] if either input sequence contains
|
|
a function item.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The two nodes are not required to have the same type annotation,
|
|
and they are not required to have the same in-scope namespaces.
|
|
They may also differ in their parent, their base URI, and the
|
|
values returned by the <code>is-id</code> and
|
|
<code>is-idrefs</code> accessors (see <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id">Section 5.5
|
|
is-id Accessor</a> <sup><small>DM30</small></sup> and <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dm-is-idrefs">Section 5.6
|
|
is-idrefs Accessor</a> <sup><small>DM30</small></sup>). The order
|
|
of children is significant, but the order of attributes is
|
|
insignificant.</p>
|
|
<p>The contents of comments and processing instructions are
|
|
significant only if these nodes appear directly as items in the two
|
|
sequences being compared. The content of a comment or processing
|
|
instruction that appears as a descendant of an item in one of the
|
|
sequences being compared does not affect the result. However, the
|
|
presence of a comment or processing instruction, if it causes a
|
|
text node to be split into two text nodes, may affect the
|
|
result.</p>
|
|
<p>The result of <code>fn:deep-equal(1, current-dateTime())</code>
|
|
is <code>false</code>; it does not raise an error.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$at</code> :=</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<attendees> <name last='Parker'
|
|
first='Peter'/> <name last='Barker' first='Bob'/> <name last='Parker'
|
|
first='Peter'/> </attendees>
|
|
</pre></div>
|
|
<p>The expression <code>fn:deep-equal($at, $at/*)</code> returns
|
|
<code>false()</code>.</p>
|
|
<p>The expression <code>fn:deep-equal($at/name[1],
|
|
$at/name[2])</code> returns <code>false()</code>.</p>
|
|
<p>The expression <code>fn:deep-equal($at/name[1],
|
|
$at/name[3])</code> returns <code>true()</code>.</p>
|
|
<p>The expression <code>fn:deep-equal($at/name[1], 'Peter
|
|
Parker')</code> returns <code>false()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="cardinality-functions" id=
|
|
"cardinality-functions"></a>14.3 Functions that test the
|
|
cardinality of sequences</h3>
|
|
<p>The following functions test the cardinality of their sequence
|
|
arguments.</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-zero-or-one"><code>fn:zero-or-one</code></a></td>
|
|
<td>Returns <code>$arg</code> if it contains zero or one items.
|
|
Otherwise, raises an error.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-one-or-more"><code>fn:one-or-more</code></a></td>
|
|
<td>Returns <code>$arg</code> if it contains one or more items.
|
|
Otherwise, raises an error.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-exactly-one"><code>fn:exactly-one</code></a></td>
|
|
<td>Returns <code>$arg</code> if it contains exactly one item.
|
|
Otherwise, raises an error.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>The functions <a href=
|
|
"#func-zero-or-one"><code>fn:zero-or-one</code></a>, <a href=
|
|
"#func-one-or-more"><code>fn:one-or-more</code></a>, and <a href=
|
|
"#func-exactly-one"><code>fn:exactly-one</code></a> defined in this
|
|
section, check that the cardinality of a sequence is in the
|
|
expected range. They are particularly useful with regard to static
|
|
typing. For example, the function call <a href=
|
|
"#func-remove"><code>fn:remove($seq, fn:index-of($seq2,
|
|
'abc'))</code></a> requires the result of the call on <a href=
|
|
"#func-index-of"><code>fn:index-of</code></a> to be a singleton
|
|
integer, but the static type system cannot infer this; writing the
|
|
expression as <a href="#func-remove"><code>fn:remove($seq,
|
|
fn:exactly-one(fn:index-of($seq2, 'abc')))</code></a> will provide
|
|
a suitable static type at query analysis time, and ensures that the
|
|
length of the sequence is correct with a dynamic check at query
|
|
execution time.</p>
|
|
<p>The type signatures for these functions deliberately declare the
|
|
argument type as <code>item()*</code>, permitting a sequence of any
|
|
length. A more restrictive signature would defeat the purpose of
|
|
the function, which is to defer cardinality checking until query
|
|
execution time.</p>
|
|
<div class="div3">
|
|
<h4><a name="func-zero-or-one" id="func-zero-or-one"></a>14.3.1
|
|
fn:zero-or-one</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>$arg</code> if it contains zero or one items.
|
|
Otherwise, raises an error.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:zero-or-one</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">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>Except in error cases, the function returns <code>$arg</code>
|
|
unchanged.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFORG0003" title=
|
|
"err:FORG0003">err:FORG0003</a>] if <code>$arg</code> contains more
|
|
than one item.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-one-or-more" id="func-one-or-more"></a>14.3.2
|
|
fn:one-or-more</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>$arg</code> if it contains one or more items.
|
|
Otherwise, raises an error.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:one-or-more</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">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>Except in error cases, the function returns <code>$arg</code>
|
|
unchanged.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFORG0004" title=
|
|
"err:FORG0004">err:FORG0004</a>] if <code>$arg</code> is an empty
|
|
sequence.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-exactly-one" id="func-exactly-one"></a>14.3.3
|
|
fn:exactly-one</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns <code>$arg</code> if it contains exactly one item.
|
|
Otherwise, raises an error.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:exactly-one</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">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>Except in error cases, the function returns <code>$arg</code>
|
|
unchanged.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFORG0005" title=
|
|
"err:FORG0005">err:FORG0005</a>] if <code>$arg</code> is an empty
|
|
sequence or a sequence containing more than one item.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="union-intersection-except" id=
|
|
"union-intersection-except"></a>14.4 Union, intersection and
|
|
difference</h3>
|
|
<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-union"><code>op:union</code></a></td>
|
|
<td>Constructs a sequence containing every node that occurs in the
|
|
values of either <code>$arg1</code> or <code>$arg2</code>,
|
|
eliminating duplicates and sorting the result in document
|
|
order.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-intersect"><code>op:intersect</code></a></td>
|
|
<td>Constructs a sequence containing every node that occurs in the
|
|
values of both <code>$arg1</code> and <code>$arg2</code>,
|
|
eliminating duplicates and sorting the result in document
|
|
order.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-except"><code>op:except</code></a></td>
|
|
<td>Constructs a sequence containing every node that occurs in the
|
|
value of <code>$arg1</code> but not in the value of
|
|
<code>$arg2</code>, eliminating duplicates and sorting the result
|
|
in document order.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>As in the previous sections, for the illustrative examples
|
|
below, assume an XQuery or transformation operating on a Purchase
|
|
Order document containing a number of line-item elements. The
|
|
variables <code>$item1</code>, <code>$item2</code>, etc. are bound
|
|
to individual line-item nodes in the sequence. We use sequences of
|
|
these nodes in some of the examples below.</p>
|
|
<div class="div3">
|
|
<h4><a name="func-union" id="func-union"></a>14.4.1 op:union</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Constructs a sequence containing every node that occurs in the
|
|
values of either <code>$arg1</code> or <code>$arg2</code>,
|
|
eliminating duplicates and sorting the result in document
|
|
order.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "union" or "|" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:union</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">node()*</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">node()*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">node()*</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns a sequence containing every node that
|
|
occurs in the values of either <code>$arg1</code> or
|
|
<code>$arg2</code>, eliminating duplicate nodes. Nodes are returned
|
|
in document order.</p>
|
|
<p>Two nodes <code>$n1</code> and <code>$n2</code> are duplicates
|
|
if they satisfy <a href=
|
|
"#func-is-same-node"><code>op:is-same-node($n1,
|
|
$n2)</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If either operand is the empty sequence, the result is a
|
|
sequence containing the nodes in the other operand in document
|
|
order after eliminating duplicates.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$seq1</code> := <code>($item1, $item2)</code></p>
|
|
<p>let <code>$seq2</code> := <code>($item2, $item2,
|
|
$item1)</code></p>
|
|
<p>let <code>$seq3</code> := <code>($item2, $item3)</code></p>
|
|
<p>The expression <code>op:union($seq1, $seq1)</code> returns
|
|
<code>($item1, $item2)</code>.</p>
|
|
<p>The expression <code>op:union($seq2, $seq3)</code> returns
|
|
<code>($item1, $item2, $item3)</code>.</p>
|
|
<p>The expression <code>op:union($seq2, ())</code> returns
|
|
<code>($item1, $item2)</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-intersect" id="func-intersect"></a>14.4.2
|
|
op:intersect</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Constructs a sequence containing every node that occurs in the
|
|
values of both <code>$arg1</code> and <code>$arg2</code>,
|
|
eliminating duplicates and sorting the result in document
|
|
order.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "intersect" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:intersect</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">node()*</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">node()*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">node()*</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns a sequence containing every node that
|
|
occurs in the values of both <code>$arg1</code> and
|
|
<code>$arg2</code>, eliminating duplicate nodes. Nodes are returned
|
|
in document order.</p>
|
|
<p>Two nodes <code>$n1</code> and <code>$n2</code> are duplicates
|
|
if they satisfy <a href=
|
|
"#func-is-same-node"><code>op:is-same-node($n1,
|
|
$n2)</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If either operand is the empty sequence, the function returns
|
|
the empty sequence.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$seq1</code> := <code>($item1, $item2)</code></p>
|
|
<p>let <code>$seq2</code> := <code>($item2, $item2,
|
|
$item1)</code></p>
|
|
<p>let <code>$seq3</code> := <code>($item2, $item3)</code></p>
|
|
<p>The expression <code>op:intersect($seq1, $seq1)</code> returns
|
|
<code>($item1, $item2)</code>.</p>
|
|
<p>The expression <code>op:intersect($seq2, $seq3)</code> returns
|
|
<code>($item2)</code>.</p>
|
|
<p>The expression <code>op:intersect($seq2, ())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>op:intersect($item1, $item3)</code> returns
|
|
<code>()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-except" id="func-except"></a>14.4.3
|
|
op:except</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Constructs a sequence containing every node that occurs in the
|
|
value of <code>$arg1</code> but not in the value of
|
|
<code>$arg2</code>, eliminating duplicates and sorting the result
|
|
in document order.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "except" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">op:except</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">node()*</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">node()*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">node()*</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns a sequence containing every node that
|
|
occurs in the value of <code>$arg1</code> provided that it does not
|
|
occur in the value of <code>$arg2</code>. Duplicate nodes are
|
|
eliminated, and nodes are returned in document order.</p>
|
|
<p>Two nodes <code>$n1</code> and <code>$n2</code> are duplicates
|
|
if they satisfy <a href=
|
|
"#func-is-same-node"><code>op:is-same-node($n1,
|
|
$n2)</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If <code>$arg1</code> is the empty sequence, the empty sequence
|
|
is returned.</p>
|
|
<p>If <code>$arg2</code> is the empty sequence, a sequence is
|
|
returned containing the nodes in <code>$arg1</code> in document
|
|
order after eliminating duplicates.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$seq1</code> := <code>($item1, $item2)</code></p>
|
|
<p>let <code>$seq2</code> := <code>($item2, $item2,
|
|
$item1)</code></p>
|
|
<p>let <code>$seq3</code> := <code>($item2, $item3)</code></p>
|
|
<p>The expression <code>op:except($seq1, $seq1)</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>op:except($seq2, $seq1)</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>op:except($seq2, $seq3)</code> returns
|
|
<code>($item1)</code>.</p>
|
|
<p>The expression <code>op:except($seq2, ())</code> returns
|
|
<code>($item1, $item2)</code>.</p>
|
|
<p>The expression <code>op:except($seq3, $seq2)</code> returns
|
|
<code>($item3)</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="aggregate-functions" id="aggregate-functions"></a>14.5
|
|
Aggregate functions</h3>
|
|
<p>Aggregate functions take a sequence as argument and return a
|
|
single value computed from values in the sequence. Except for
|
|
<a href="#func-count"><code>fn:count</code></a>, the sequence must
|
|
consist of values of a single type or one if its subtypes, or they
|
|
must be numeric. <code>xs:untypedAtomic</code> values are permitted
|
|
in the input sequence and handled by special conversion rules. The
|
|
type of the items in the sequence must also support certain
|
|
operations.</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-count"><code>fn:count</code></a></td>
|
|
<td>Returns the number of items in a sequence.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-avg"><code>fn:avg</code></a></td>
|
|
<td>Returns the average of the values in the input sequence
|
|
<code>$arg</code>, that is, the sum of the values divided by the
|
|
number of values.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-max"><code>fn:max</code></a></td>
|
|
<td>Returns a value that is equal to the highest value appearing in
|
|
the input sequence.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-min"><code>fn:min</code></a></td>
|
|
<td>Returns a value that is equal to the lowest value appearing in
|
|
the input sequence.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-sum"><code>fn:sum</code></a></td>
|
|
<td>Returns a value obtained by adding together the values in
|
|
<code>$arg</code>.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-count" id="func-count"></a>14.5.1 fn:count</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the number of items in a sequence.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:count</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:integer</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 number of items in the value of
|
|
<code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Returns 0 if <code>$arg</code> is the empty sequence.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$seq1</code> := <code>($item1, $item2)</code></p>
|
|
<p>let <code>$seq2</code> := <code>(98.5, 98.3, 98.9)</code></p>
|
|
<p>let <code>$seq3</code> := <code>()</code></p>
|
|
<p>The expression <code>fn:count($seq1)</code> returns
|
|
<code>2</code>.</p>
|
|
<p>The expression <code>fn:count($seq3)</code> returns
|
|
<code>0</code>.</p>
|
|
<p>The expression <code>fn:count($seq2)</code> returns
|
|
<code>3</code>.</p>
|
|
<p>The expression <code>fn:count($seq2[. > 100])</code> returns
|
|
<code>0</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-avg" id="func-avg"></a>14.5.2 fn:avg</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the average of the values in the input sequence
|
|
<code>$arg</code>, that is, the sum of the values divided by the
|
|
number of values.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:avg</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType?</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 empty sequence
|
|
is returned.</p>
|
|
<p>If <code>$arg</code> contains values of type
|
|
<code>xs:untypedAtomic</code> they are cast to
|
|
<code>xs:double</code>.</p>
|
|
<p>Duration values must either all be
|
|
<code>xs:yearMonthDuration</code> values or must all be
|
|
<code>xs:dayTimeDuration</code> values. For numeric values, the
|
|
numeric promotion rules defined in <a href="#op.numeric"><b>4.2
|
|
Arithmetic operators on numeric values</b></a> are used to promote
|
|
all values to a single common type. After these operations,
|
|
<code>$arg</code> must contain items of a single type, which must
|
|
be one of the four numeric types, <code>xs:yearMonthDuration</code>
|
|
or <code>xs:dayTimeDuration</code> or one if its subtypes.</p>
|
|
<p>The function returns the average of the values as
|
|
<code>sum($arg) div count($arg)</code>; but the implementation may
|
|
use an otherwise equivalent algorithm that avoids arithmetic
|
|
overflow.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>A type error is raised [<a href="#ERRFORG0006" title=
|
|
"err:FORG0006">err:FORG0006</a>] if the input sequence contains
|
|
items of incompatible types, as described above.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$d1</code> :=
|
|
<code>xs:yearMonthDuration("P20Y")</code></p>
|
|
<p>let <code>$d2</code> :=
|
|
<code>xs:yearMonthDuration("P10M")</code></p>
|
|
<p>let <code>$seq3</code> := <code>(3, 4, 5)</code></p>
|
|
<p>The expression <code>fn:avg($seq3)</code> returns
|
|
<code>4.0</code>. <em>(The result is of type
|
|
<code>xs:decimal</code>.).</em></p>
|
|
<p>The expression <code>fn:avg(($d1, $d2))</code> returns
|
|
<code>xs:yearMonthDuration("P10Y5M")</code>.</p>
|
|
<p><code>fn:avg(($d1, $seq3))</code> raises a type error [<a href=
|
|
"#ERRFORG0006" title="err:FORG0006">err:FORG0006</a>].</p>
|
|
<p>The expression <code>fn:avg(())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>fn:avg((xs:float('INF'),
|
|
xs:float('-INF')))</code> returns <code>xs:float('NaN')</code>.</p>
|
|
<p>The expression <code>fn:avg(($seq3, xs:float('NaN')))</code>
|
|
returns <code>xs:float('NaN')</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-max" id="func-max"></a>14.5.3 fn:max</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a value that is equal to the highest value appearing in
|
|
the input sequence.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:max</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</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:max</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>, <code class=
|
|
"arg">$collation</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType?</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The following rules are applied to the input sequence
|
|
<code>$arg</code>:</p>
|
|
<ul>
|
|
<li>
|
|
<p>Values of type <code>xs:untypedAtomic</code> in
|
|
<code>$arg</code> are cast to <code>xs:double</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Numeric and <code>xs:anyURI</code> values are converted to the
|
|
least common type reachable by a combination of type promotion and
|
|
subtype substitution. See <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>.</p>
|
|
</li>
|
|
</ul>
|
|
<p>The items in the resulting sequence may be reordered in an
|
|
arbitrary order. The resulting sequence is referred to below as the
|
|
converted sequence. The function returns an item from the converted
|
|
sequence rather than the input sequence.</p>
|
|
<p>If the converted sequence is empty, the function returns the
|
|
empty sequence.</p>
|
|
<p>All items in the <span>converted sequence must be derived</span>
|
|
from a single base type for which the <code>le</code> operator is
|
|
defined. In addition, the values in the sequence must have a total
|
|
order. If date/time values do not have a timezone, they are
|
|
considered to have the implicit timezone provided by the dynamic
|
|
context for the purpose of comparison. Duration values must either
|
|
all be <code>xs:yearMonthDuration</code> values or must all be
|
|
<code>xs:dayTimeDuration</code> values.</p>
|
|
<p>If the converted sequence contains the value <code>NaN</code>,
|
|
the value <code>NaN</code> is returned.</p>
|
|
<p>If the items in the <span>converted sequence</span> are of type
|
|
<code>xs:string</code> or types derived by restriction from
|
|
<code>xs:string</code>, then the determination of the item with the
|
|
smallest value is made according to the collation that is used. If
|
|
the type of the items in the <span>converted sequence</span> is not
|
|
<code>xs:string</code> and <code>$collation</code> is specified,
|
|
the collation is ignored.</p>
|
|
<p>The collation used by this function is determined according to
|
|
the rules in <a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>.</p>
|
|
<p>The function returns the result of the expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
if (every $v in $c satisfies $c[1] ge $v)
|
|
then $c[1]
|
|
else fn:max(fn:subsequence($c, 2))
|
|
</pre></div>
|
|
<p>evaluated with <code>$collation</code> as the default collation
|
|
if specified, and with <code>$c</code> as the converted
|
|
sequence.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>A type error is raised [<a href="#ERRFORG0006" title=
|
|
"err:FORG0006">err:FORG0006</a>] if the input sequence contains
|
|
items of incompatible types, as described above.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Because the rules allow the sequence to be reordered, if there
|
|
are two or items that are "equal highest", the specific item whose
|
|
value is returned is <a title="implementation dependent" class=
|
|
"termref" href="#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a>. This can arise for example if two different
|
|
strings compare equal under the selected collation, or if two
|
|
different <code>xs:dateTime</code> values compare equal despite
|
|
being in different timezones.</p>
|
|
<p>If the converted sequence contains exactly one value then that
|
|
value is returned.</p>
|
|
<p>The default type when the <code>fn:max</code> function is
|
|
applied to <code>xs:untypedAtomic</code> values is
|
|
<code>xs:double</code>. This differs from the default type for
|
|
operators such as <code>gt</code>, and for sorting in XQuery and
|
|
XSLT, which is <code>xs:string</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:max((3,4,5))</code> returns
|
|
<code>5</code>.</p>
|
|
<p>The expression <code>fn:max((xs:integer(5), xs:float(5.0),
|
|
xs:double(0)))</code> returns <code>xs:double(5.0e0)</code>.</p>
|
|
<p><code>fn:max((3,4,"Zero"))</code> raises a type error [<a href=
|
|
"#ERRFORG0006" title="err:FORG0006">err:FORG0006</a>].</p>
|
|
<p>The expression <code>fn:max((fn:current-date(),
|
|
xs:date("2100-01-01")))</code> returns
|
|
<code>xs:date("2100-01-01")</code>. <em>(Assuming that the current
|
|
date is during the 21st century.).</em></p>
|
|
<p>The expression <code>fn:max(("a", "b", "c"))</code> returns
|
|
<code>"c"</code>. <em>(Assuming a typical default
|
|
collation.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-min" id="func-min"></a>14.5.4 fn:min</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a value that is equal to the lowest value appearing in
|
|
the input sequence.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:min</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</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:min</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>, <code class=
|
|
"arg">$collation</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType?</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The following rules are applied to the input sequence:</p>
|
|
<ul>
|
|
<li>
|
|
<p>Values of type <code>xs:untypedAtomic</code> in
|
|
<code>$arg</code> are cast to <code>xs:double</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Numeric and <code>xs:anyURI</code> values are converted to the
|
|
least common type reachable by a combination of type promotion and
|
|
subtype substitution. See <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>.</p>
|
|
</li>
|
|
</ul>
|
|
<p>The items in the resulting sequence may be reordered in an
|
|
arbitrary order. The resulting sequence is referred to below as the
|
|
converted sequence. The function returns an item from the converted
|
|
sequence rather than the input sequence.</p>
|
|
<p>If the converted sequence is empty, the empty sequence is
|
|
returned.</p>
|
|
<p>All items in the <span>converted sequence must be derived</span>
|
|
from a single base type for which the <code>le</code> operator is
|
|
defined. In addition, the values in the sequence must have a total
|
|
order. If date/time values do not have a timezone, they are
|
|
considered to have the implicit timezone provided by the dynamic
|
|
context for the purpose of comparison. Duration values must either
|
|
all be <code>xs:yearMonthDuration</code> values or must all be
|
|
<code>xs:dayTimeDuration</code> values.</p>
|
|
<p>If the converted sequence contains the value <code>NaN</code>,
|
|
the value <code>NaN</code> is returned.</p>
|
|
<p>If the items in the <span>converted sequence</span> are of type
|
|
<code>xs:string</code> or types derived by restriction from
|
|
<code>xs:string</code>, then the determination of the item with the
|
|
smallest value is made according to the collation that is used. If
|
|
the type of the items in the <span>converted sequence</span> is not
|
|
<code>xs:string</code> and <code>$collation</code> is specified,
|
|
the collation is ignored.</p>
|
|
<p>The collation used by this function is determined according to
|
|
the rules in <a href="#choosing-a-collation"><b>5.3.3 Choosing a
|
|
collation</b></a>.</p>
|
|
<p>The function returns the result of the expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
if (every $v in $c satisfies $c[1] le $v)
|
|
then $c[1]
|
|
else fn:min(fn:subsequence($c, 2))
|
|
</pre></div>
|
|
<p>evaluated with <code>$collation</code> as the default collation
|
|
if specified, and with <code>$c</code> as the converted
|
|
sequence.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>A type error is raised [<a href="#ERRFORG0006" title=
|
|
"err:FORG0006">err:FORG0006</a>] if the input sequence contains
|
|
items of incompatible types, as described above.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Because the rules allow the sequence to be reordered, if there
|
|
are two or items that are "equal lowest", the specific item whose
|
|
value is returned is <a title="implementation dependent" class=
|
|
"termref" href="#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a>. This can arise for example if two different
|
|
strings compare equal under the selected collation, or if two
|
|
different <code>xs:dateTime</code> values compare equal despite
|
|
being in different timezones.</p>
|
|
<p>If the converted sequence contains exactly one value then that
|
|
value is returned.</p>
|
|
<p>The default type when the <code>fn:min</code> function is
|
|
applied to <code>xs:untypedAtomic</code> values is
|
|
<code>xs:double</code>. This differs from the default type for
|
|
operators such as <code>lt</code>, and for sorting in XQuery and
|
|
XSLT, which is <code>xs:string</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:min((3,4,5))</code> returns
|
|
<code>3</code>.</p>
|
|
<p>The expression <code>fn:min((xs:integer(5), xs:float(5),
|
|
xs:double(10)))</code> returns <code>xs:double(5.0e0)</code>.</p>
|
|
<p><code>fn:min((3,4,"Zero"))</code> raises a type error [<a href=
|
|
"#ERRFORG0006" title="err:FORG0006">err:FORG0006</a>].</p>
|
|
<p><code>fn:min((xs:float(0.0E0), xs:float(-0.0E0)))</code> can
|
|
return either positive or negative zero. <span>The two items are
|
|
equal, so it is <a title="implementation dependent" class="termref"
|
|
href="#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a> which is returned.</span></p>
|
|
<p>The expression <code>fn:min((fn:current-date(),
|
|
xs:date("1900-01-01")))</code> returns
|
|
<code>xs:date("1900-01-01")</code>. <em>(Assuming that the current
|
|
date is set to a reasonable value.).</em></p>
|
|
<p>The expression <code>fn:min(("a", "b", "c"))</code> returns
|
|
<code>"a"</code>. <em>(Assuming a typical default
|
|
collation.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-sum" id="func-sum"></a>14.5.5 fn:sum</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a value obtained by adding together the values in
|
|
<code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:sum</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType</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="2"><code class=
|
|
"function">fn:sum</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$zero</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType?</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>Any values of type <code>xs:untypedAtomic</code> in
|
|
<code>$arg</code> are cast to <code>xs:double</code>. The items in
|
|
the resulting sequence may be reordered in an arbitrary order. The
|
|
resulting sequence is referred to below as the converted
|
|
sequence.</p>
|
|
<p>If the converted sequence is empty, then the single-argument
|
|
form of the function returns the <code>xs:integer</code> value
|
|
<code>0</code>; the two-argument form returns the value of the
|
|
argument <code>$zero</code>.</p>
|
|
<p>If the converted sequence contains the value <code>NaN</code>,
|
|
<code>NaN</code> is returned.</p>
|
|
<p>All items in <code>$arg</code> must be numeric or derived from a
|
|
single base type. In addition, the type must support addition.
|
|
Duration values must either all be
|
|
<code>xs:yearMonthDuration</code> values or must all be
|
|
<code>xs:dayTimeDuration</code> values. For numeric values, the
|
|
numeric promotion rules defined in <a href="#op.numeric"><b>4.2
|
|
Arithmetic operators on numeric values</b></a> are used to promote
|
|
all values to a single common type. The sum of a sequence of
|
|
integers will therefore be an integer, while the sum of a numeric
|
|
sequence that includes at least one <code>xs:double</code> will be
|
|
an <code>xs:double</code>.</p>
|
|
<p>The result of the function, using the second signature, is the
|
|
result of the expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
if (fn:count($c) eq 0) then
|
|
$zero
|
|
else if (fn:count($c) eq 1) then
|
|
$c[1]
|
|
else
|
|
$c[1] + fn:sum(subsequence($c, 2))
|
|
</pre></div>
|
|
<p>where <code>$c</code> is the converted sequence.</p>
|
|
<p>The result of the function, using the first signature, is the
|
|
result of the expression: <code>fn:sum($arg, 0)</code>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>A type error is raised [<a href="#ERRFORG0006" title=
|
|
"err:FORG0006">err:FORG0006</a>] if the input sequence contains
|
|
items of incompatible types, as described above.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The second argument allows an appropriate value to be defined to
|
|
represent the sum of an empty sequence. For example, when summing a
|
|
sequence of durations it would be appropriate to return a
|
|
zero-length duration of the appropriate type. This argument is
|
|
necessary because a system that does dynamic typing cannot
|
|
distinguish "an empty sequence of integers", for example, from "an
|
|
empty sequence of durations".</p>
|
|
<p>If the converted sequence contains exactly one value then that
|
|
value is returned.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$d1</code> :=
|
|
<code>xs:yearMonthDuration("P20Y")</code></p>
|
|
<p>let <code>$d2</code> :=
|
|
<code>xs:yearMonthDuration("P10M")</code></p>
|
|
<p>let <code>$seq1</code> := <code>($d1, $d2)</code></p>
|
|
<p>let <code>$seq3</code> := <code>(3, 4, 5)</code></p>
|
|
<p>The expression <code>fn:sum(($d1, $d2))</code> returns
|
|
<code>xs:yearMonthDuration("P20Y10M")</code>.</p>
|
|
<p>The expression <code>fn:sum($seq1[. lt
|
|
xs:yearMonthDuration('P3M')], xs:yearMonthDuration('P0M'))</code>
|
|
returns <code>xs:yearMonthDuration("P0M")</code>.</p>
|
|
<p>The expression <code>fn:sum($seq3)</code> returns
|
|
<code>12</code>.</p>
|
|
<p>The expression <code>fn:sum(())</code> returns
|
|
<code>0</code>.</p>
|
|
<p>The expression <code>fn:sum((),())</code> returns
|
|
<code>()</code>.</p>
|
|
<p>The expression <code>fn:sum((1 to 100)[. lt 0], 0)</code>
|
|
returns <code>0</code>.</p>
|
|
<p><code>fn:sum(($d1, 9E1))</code> raises an error [<a href=
|
|
"#ERRFORG0006" title="err:FORG0006">err:FORG0006</a>].</p>
|
|
<p>The expression <code>fn:sum(($d1, $d2), "ein Augenblick")</code>
|
|
returns <code>xs:yearMonthDuration("P20Y10M")</code>. <em>(There is
|
|
no requirement that the <code>$zero</code> value should be the same
|
|
type as the items in <code>$arg</code>, or even that it should
|
|
belong to a type that supports addition.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="fns-that-generate-sequences" id=
|
|
"fns-that-generate-sequences"></a>14.6 Functions and operators that
|
|
generate sequences</h3>
|
|
<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-to"><code>op:to</code></a></td>
|
|
<td>Returns a sequence of consecutive integers in a given
|
|
range.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-to" id="func-to"></a>14.6.1 op:to</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a sequence of consecutive integers in a given range.</p>
|
|
</dd>
|
|
<dt class="label">Operator Mapping</dt>
|
|
<dd>
|
|
<p>Defines the semantics of the "to" operator.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class="function">op:to</code>(<code class=
|
|
"arg">$firstval</code><code class=
|
|
"as"> as </code><code class="type">xs:integer</code>,
|
|
<code class="arg">$lastval</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:integer</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer*</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the sequence containing every
|
|
<code>xs:integer</code> whose value is between the value of
|
|
<code>$firstval</code> (inclusive) and the value of
|
|
<code>$lastval</code> (inclusive), in monotonic increasing
|
|
order.</p>
|
|
<p>If the value of the first operand is greater than the value of
|
|
the second, the function returns the empty sequence.</p>
|
|
<p>If the values of the two operands are equal, the function
|
|
returns a sequence containing a single <code>xs:integer</code>
|
|
equal to that value.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>1 to 3</code> returns <code>(1, 2,
|
|
3)</code>.</p>
|
|
<p>The expression <code>3 to 1</code> returns <code>()</code>.</p>
|
|
<p>The expression <code>5 to 5</code> returns <code>5</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="fns-on-identifiers" id="fns-on-identifiers"></a>14.7
|
|
Functions on node identifiers</h3>
|
|
<div class="div3">
|
|
<h4><a name="func-id" id="func-id"></a>14.7.1 fn:id</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the sequence of element nodes that have an
|
|
<code>ID</code> value matching the value of one or more of the
|
|
<code>IDREF</code> values supplied in <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class="function">fn:id</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">element()*</code></div>
|
|
</div>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class="function">fn:id</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string*</code>, <code class=
|
|
"arg">$node</code><code class="as"> as </code><code class="type">node()</code>)<code class="as"> as </code><code class="return-type">element()*</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Properties</dt>
|
|
<dd>
|
|
<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-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 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>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns a sequence, in document order with
|
|
duplicates eliminated, containing every element node <code>E</code>
|
|
that satisfies all the following conditions:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p><code>E</code> is in the target document. The target document is
|
|
the document containing <code>$node</code>, or the document
|
|
containing the context item (<code>.</code>) if the second argument
|
|
is omitted. The behavior of the function if <code>$node</code> is
|
|
omitted is exactly the same as if the context item had been passed
|
|
as <code>$node</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p><code>E</code> has an <code>ID</code> value equal to one of the
|
|
candidate <code>IDREF</code> values, where:</p>
|
|
<ul>
|
|
<li>
|
|
<p>An element has an <code>ID</code> value equal to <code>V</code>
|
|
if either or both of the following conditions are true:</p>
|
|
<ul>
|
|
<li>
|
|
<p>The <code>is-id</code> property (See <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id">Section 5.5
|
|
is-id Accessor</a> <sup><small>DM30</small></sup>.) of the element
|
|
node is true, and the typed value of the element node is equal to V
|
|
under the rules of the <code>eq</code> operator using the Unicode
|
|
codepoint collation
|
|
(<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
|
|
</li>
|
|
<li>
|
|
<p>The element has an attribute node whose <code>is-id</code>
|
|
property (See <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id">Section 5.5
|
|
is-id Accessor</a> <sup><small>DM30</small></sup>.) is true and
|
|
whose typed value is equal to <code>V</code> under the rules of the
|
|
<code>eq</code> operator using the Unicode code point collation
|
|
(<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if
|
|
it were of type <code>IDREFS</code>, that is, each
|
|
<code>xs:string</code> in <code>$arg</code> is treated as a
|
|
whitespace-separated sequence of tokens, each acting as an
|
|
<code>IDREF</code>. These tokens are then included in the list of
|
|
candidate <code>IDREF</code>s. If any of the tokens is not a
|
|
lexically valid <code>IDREF</code> (that is, if it is not lexically
|
|
an <code>xs:NCName</code>), it is ignored. Formally, the candidate
|
|
<code>IDREF</code> values are the strings in the sequence given by
|
|
the expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
for $s in $arg return
|
|
fn:tokenize(fn:normalize-space($s), ' ')[. castable as xs:IDREF]
|
|
</pre></div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>If several elements have the same <code>ID</code> value, then
|
|
<code>E</code> is the one that is first in document order.</p>
|
|
</li>
|
|
</ol>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODC0001" title=
|
|
"err:FODC0001">err:FODC0001</a>] if <code>$node</code>, or the
|
|
context item if the second argument is absent, is a node in a tree
|
|
whose root is not a document node.</p>
|
|
<p>If the second argument is the context item, or is omitted, 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>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The effect of this function is anomalous in respect of element
|
|
nodes with the <code>is-id</code> property. For legacy reasons,
|
|
this function returns the element that has the <code>is-id</code>
|
|
property, whereas it would be more appropriate to return its
|
|
parent, that being the element that is uniquely identified by the
|
|
ID. A new function <code>element-with-id</code> is being introduced
|
|
with the desired behavior.</p>
|
|
<p>If the data model is constructed from an Infoset, an attribute
|
|
will have the <code>is-id</code> property if the corresponding
|
|
attribute in the Infoset had an attribute type of <code>ID</code>:
|
|
typically this means the attribute was declared as an
|
|
<code>ID</code> in a DTD.</p>
|
|
<p>If the data model is constructed from a PSVI, an element or
|
|
attribute will have the <code>is-id</code> property if its typed
|
|
value is a single atomic value of type <code>xs:ID</code> or a type
|
|
derived by restriction from <code>xs:ID</code>.</p>
|
|
<p>No error is raised in respect of a candidate <code>IDREF</code>
|
|
value that does not match the <code>ID</code> of any element in the
|
|
document. If no candidate <code>IDREF</code> value matches the
|
|
<code>ID</code> value of any element, the function returns the
|
|
empty sequence.</p>
|
|
<p>It is not necessary that the supplied argument should have type
|
|
<code>xs:IDREF</code> or <code>xs:IDREFS</code>, or that it should
|
|
be derived from a node with the <code>is-idrefs</code>
|
|
property.</p>
|
|
<p>An element may have more than one <code>ID</code> value. This
|
|
can occur with synthetic data models or with data models
|
|
constructed from a PSVI where the element and one of its attributes
|
|
are both typed as <code>xs:ID</code>.</p>
|
|
<p>If the source document is well-formed but not valid, it is
|
|
possible for two or more elements to have the same <code>ID</code>
|
|
value. In this situation, the function will select the first such
|
|
element.</p>
|
|
<p>It is also possible in a well-formed but invalid document to
|
|
have an element or attribute that has the <code>is-id</code>
|
|
property but whose value does not conform to the lexical rules for
|
|
the <code>xs:ID</code> type. Such a node will never be selected by
|
|
this function.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$emp</code> :=</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<employee xml:id="ID21256">
|
|
<empnr>E21256</empnr>
|
|
<first>John</first>
|
|
<last>Brown</last>
|
|
</employee>
|
|
|
|
</pre></div>
|
|
<p>The expression <code>id('ID21256')/name()</code> returns
|
|
<code>employee</code>. <em>(The <code>xml:id</code> attribute has
|
|
the <code>is-id</code> property, so the employee element is
|
|
selected.).</em></p>
|
|
<p>The expression <code>id('E21256')/name()</code> returns
|
|
<code>empnr</code>. <em>(Assuming the <code>empnr</code> element is
|
|
given the type <code>xs:ID</code> as a result of schema validation,
|
|
the element will have the <code>is-id</code> property and is
|
|
therefore selected. Note the difference from the behavior of
|
|
<a href=
|
|
"#func-element-with-id"><code>fn:element-with-id</code></a>.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-element-with-id" id=
|
|
"func-element-with-id"></a>14.7.2 fn:element-with-id</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the sequence of element nodes that have an
|
|
<code>ID</code> value matching the value of one or more of the
|
|
<code>IDREF</code> values supplied in <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:element-with-id</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">element()*</code></div>
|
|
</div>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:element-with-id</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string*</code>, <code class=
|
|
"arg">$node</code><code class="as"> as </code><code class="type">node()</code>)<code class="as"> as </code><code class="return-type">element()*</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Properties</dt>
|
|
<dd>
|
|
<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-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 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>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>The effect of this function is identical to <code>fn:id</code>
|
|
in respect of elements that have an attribute with the
|
|
<code>is-id</code> property. However, it behaves differently in
|
|
respect of element nodes with the <code>is-id</code> property.
|
|
Whereas the <a href="#func-id"><code>fn:id</code></a>, for legacy
|
|
reasons, returns the element that has the <code>is-id</code>
|
|
property, this parent returns the element identified by the ID,
|
|
which is the parent of the element having the <code>is-id</code>
|
|
property.</p>
|
|
</div>
|
|
<p>The function returns a sequence, in document order with
|
|
duplicates eliminated, containing every element node <code>E</code>
|
|
that satisfies all the following conditions:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p><code>E</code> is in the target document. The target document is
|
|
the document containing <code>$node</code>, or the document
|
|
containing the context item (<code>.</code>) if the second argument
|
|
is omitted. The behavior of the function if <code>$node</code> is
|
|
omitted is exactly the same as if the context item had been passed
|
|
as <code>$node</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p><code>E</code> has an <code>ID</code> value equal to one of the
|
|
candidate <code>IDREF</code> values, where:</p>
|
|
<ul>
|
|
<li>
|
|
<p>An element has an <code>ID</code> value equal to <code>V</code>
|
|
if either or both of the following conditions are true:</p>
|
|
<ul>
|
|
<li>
|
|
<p>The element has an child element node whose <code>is-id</code>
|
|
property (See <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id">Section 5.5
|
|
is-id Accessor</a> <sup><small>DM30</small></sup>.) is true and
|
|
whose typed value is equal to <code>V</code> under the rules of the
|
|
<code>eq</code> operator using the Unicode code point collation
|
|
(<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
|
|
</li>
|
|
<li>
|
|
<p>The element has an attribute node whose <code>is-id</code>
|
|
property (See <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dm-is-id">Section 5.5
|
|
is-id Accessor</a> <sup><small>DM30</small></sup>.) is true and
|
|
whose typed value is equal to <code>V</code> under the rules of the
|
|
<code>eq</code> operator using the Unicode code point collation
|
|
(<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if
|
|
it were of type <code>IDREFS</code>, that is, each
|
|
<code>xs:string</code> in <code>$arg</code> is treated as a
|
|
whitespace-separated sequence of tokens, each acting as an
|
|
<code>IDREF</code>. These tokens are then included in the list of
|
|
candidate <code>IDREF</code>s. If any of the tokens is not a
|
|
lexically valid <code>IDREF</code> (that is, if it is not lexically
|
|
an <code>xs:NCName</code>), it is ignored. Formally, the candidate
|
|
<code>IDREF</code> values are the strings in the sequence given by
|
|
the expression:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
for $s in $arg return
|
|
fn:tokenize(fn:normalize-space($s), ' ')[. castable as xs:IDREF]
|
|
</pre></div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>If several elements have the same <code>ID</code> value, then
|
|
<code>E</code> is the one that is first in document order.</p>
|
|
</li>
|
|
</ol>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODC0001" title=
|
|
"err:FODC0001">err:FODC0001</a>] if <code>$node</code>, or the
|
|
context item if the second argument is omitted, is a node in a tree
|
|
whose root is not a document node.</p>
|
|
<p>If the second argument is the context item, or is omitted, 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>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>This function is equivalent to the <a href=
|
|
"#func-id"><code>fn:id</code></a> function except when dealing with
|
|
ID-valued element nodes. Whereas the <a href=
|
|
"#func-id"><code>fn:id</code></a> function selects the element
|
|
containing the identifier, this function selects its parent.</p>
|
|
<p>If the data model is constructed from an Infoset, an attribute
|
|
will have the <code>is-id</code> property if the corresponding
|
|
attribute in the Infoset had an attribute type of <code>ID</code>:
|
|
typically this means the attribute was declared as an
|
|
<code>ID</code> in a DTD.</p>
|
|
<p>If the data model is constructed from a PSVI, an element or
|
|
attribute will have the <code>is-id</code> property if its typed
|
|
value is a single atomic value of type <code>xs:ID</code> or a type
|
|
derived by restriction from <code>xs:ID</code>.</p>
|
|
<p>No error is raised in respect of a candidate <code>IDREF</code>
|
|
value that does not match the <code>ID</code> of any element in the
|
|
document. If no candidate <code>IDREF</code> value matches the
|
|
<code>ID</code> value of any element, the function returns the
|
|
empty sequence.</p>
|
|
<p>It is not necessary that the supplied argument should have type
|
|
<code>xs:IDREF</code> or <code>xs:IDREFS</code>, or that it should
|
|
be derived from a node with the <code>is-idrefs</code>
|
|
property.</p>
|
|
<p>An element may have more than one <code>ID</code> value. This
|
|
can occur with synthetic data models or with data models
|
|
constructed from a PSVI where the element and one of its attributes
|
|
are both typed as <code>xs:ID</code>.</p>
|
|
<p>If the source document is well-formed but not valid, it is
|
|
possible for two or more elements to have the same <code>ID</code>
|
|
value. In this situation, the function will select the first such
|
|
element.</p>
|
|
<p>It is also possible in a well-formed but invalid document to
|
|
have an element or attribute that has the <code>is-id</code>
|
|
property but whose value does not conform to the lexical rules for
|
|
the <code>xs:ID</code> type. Such a node will never be selected by
|
|
this function.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>let <code>$emp</code> :=</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<employee xml:id="ID21256">
|
|
<empnr>E21256</empnr>
|
|
<first>John</first>
|
|
<last>Brown</last>
|
|
</employee>
|
|
|
|
</pre></div>
|
|
<p>The expression <code>id('ID21256')/name()</code> returns
|
|
<code>"employee"</code>. <em>(The <code>xml:id</code> attribute has
|
|
the <code>is-id</code> property, so the employee element is
|
|
selected.).</em></p>
|
|
<p>The expression <code>id('E21256')/name()</code> returns
|
|
<code>"employee"</code>. <em>(Assuming the <code>empnr</code>
|
|
element is given the type <code>xs:ID</code> as a result of schema
|
|
validation, the element will have the <code>is-id</code> property
|
|
and is therefore its parent is selected. Note the difference from
|
|
the behavior of <a href=
|
|
"#func-id"><code>fn:id</code></a>.).</em></p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-idref" id="func-idref"></a>14.7.3 fn:idref</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the sequence of element or attribute nodes with an
|
|
<code>IDREF</code> value matching the value of one or more of the
|
|
<code>ID</code> values supplied in <code>$arg</code>.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:idref</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">node()*</code></div>
|
|
</div>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:idref</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string*</code>, <code class=
|
|
"arg">$node</code><code class="as"> as </code><code class="type">node()</code>)<code class="as"> as </code><code class="return-type">node()*</code></div>
|
|
</div>
|
|
</dd>
|
|
<dt class="label">Properties</dt>
|
|
<dd>
|
|
<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-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 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>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns a sequence, in document order with
|
|
duplicates eliminated, containing every element or attribute node
|
|
<code>$N</code> that satisfies all the following conditions:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p><code>$N</code> is in the target document. The target document
|
|
is the document containing <code>$node</code> or the document
|
|
containing the context item (<code>.</code>) if the second argument
|
|
is omitted. The behavior of the function if <code>$node</code> is
|
|
omitted is exactly the same as if the context item had been passed
|
|
as <code>$node</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p><code>$N</code> has an <code>IDREF</code> value equal to one of
|
|
the candidate <code>ID</code> values, where:</p>
|
|
<ul>
|
|
<li>
|
|
<p>A node <code>$N</code> has an <code>IDREF</code> value equal to
|
|
<code>V</code> if both of the following conditions are true:</p>
|
|
<ul>
|
|
<li>
|
|
<p>The <code>is-idrefs</code> property (see <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#dm-is-idrefs">Section 5.6
|
|
is-idrefs Accessor</a> <sup><small>DM30</small></sup>) of
|
|
<code>$N</code> is <code>true</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The sequence</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
fn:tokenize(fn:normalize-space(fn:string($N)), ' ')
|
|
</pre></div>
|
|
contains a string that is equal to <code>V</code> under the rules
|
|
of the <code>eq</code> operator using the Unicode code point
|
|
collation
|
|
(<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if
|
|
it were of lexically of type <code>xs:ID</code>. These
|
|
<code>xs:string</code>s are then included in the list of candidate
|
|
<code>xs:ID</code>s. If any of the strings in <code>$arg</code> is
|
|
not a lexically valid <code>xs:ID</code> (that is, if it is not
|
|
lexically an <code>xs:NCName</code>), it is ignored. More formally,
|
|
the candidate <code>ID</code> values are the strings in the
|
|
sequence:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
$arg[. castable as xs:NCName]
|
|
</pre></div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ol>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODC0001" title=
|
|
"err:FODC0001">err:FODC0001</a>] if <code>$node</code>, or the
|
|
context item if the second argument is omitted, is a node in a tree
|
|
whose root is not a document node.</p>
|
|
<p>If the second argument is the context item, or is omitted, 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>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>An element or attribute typically acquires the
|
|
<code>is-idrefs</code> property by being validated against the
|
|
schema type <code>xs:IDREF</code> or <code>xs:IDREFS</code>, or
|
|
(for attributes only) by being described as of type
|
|
<code>IDREF</code> or <code>IDREFS</code> in a DTD.</p>
|
|
<p>No error is raised in respect of a candidate <code>ID</code>
|
|
value that does not match the <code>IDREF</code> value of any
|
|
element or attribute in the document. If no candidate
|
|
<code>ID</code> value matches the <code>IDREF</code> value of any
|
|
element or attribute, the function returns the empty sequence.</p>
|
|
<p>It is possible for two or more nodes to have an
|
|
<code>IDREF</code> value that matches a given candidate
|
|
<code>ID</code> value. In this situation, the function will return
|
|
all such nodes. However, each matching node will be returned at
|
|
most once, regardless how many candidate <code>ID</code> values it
|
|
matches.</p>
|
|
<p>It is possible in a well-formed but invalid document to have a
|
|
node whose <code>is-idrefs</code> property is true but that does
|
|
not conform to the lexical rules for the <code>xs:IDREF</code>
|
|
type. The effect of the above rules is that ill-formed candidate
|
|
<code>ID</code> values and ill-formed <code>IDREF</code> values are
|
|
ignored.</p>
|
|
<p>If the data model is constructed from a PSVI, the typed value of
|
|
a node that has the <code>is-idrefs</code> property will contain at
|
|
least one atomic value of type <code>xs:IDREF</code> (or a type
|
|
derived by restriction from <code>xs:IDREF</code>). It may also
|
|
contain atomic values of other types. These atomic values are
|
|
treated as candidate <code>ID</code> values if their lexical form
|
|
is valid as an <code>xs:NCName</code>, and they are ignored
|
|
otherwise.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-generate-id" id="func-generate-id"></a>14.7.4
|
|
fn:generate-id</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>This function returns a string that uniquely identifies a given
|
|
node.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:generate-id</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:generate-id</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: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>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 the argument is the empty sequence, the result is the
|
|
zero-length string.</p>
|
|
<p>In other cases, the function returns a string that uniquely
|
|
identifies a given node.</p>
|
|
<p>The returned identifier <strong>must</strong> consist of ASCII
|
|
alphanumeric characters and <strong>must</strong> start with an
|
|
alphabetic character. Thus, the string is syntactically an XML
|
|
name.</p>
|
|
<p>An implementation is free to generate an identifier in any
|
|
convenient way provided that it always generates the same
|
|
identifier for the same node and that different identifiers are
|
|
always generated from different nodes. An implementation is under
|
|
no obligation to generate the same identifiers each time a document
|
|
is transformed or queried.</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>There is no guarantee that a generated unique identifier will be
|
|
distinct from any unique IDs specified in the source document.</p>
|
|
<p>There is no inverse to this function; it is not directly
|
|
possible to find the node with a given generated ID. Of course, it
|
|
is possible to search a given sequence of nodes using an expression
|
|
such as <code>$nodes[generate-id()=$id]</code>.</p>
|
|
<p>It is advisable, but not required, for implementations to
|
|
generate IDs that are distinct even when compared using a
|
|
case-blind collation.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The primary use case for this function is to generate
|
|
hyperlinks. For example, when generating HTML, an anchor for a
|
|
given section <code>$sect</code> can be generated by writing (in
|
|
either XSLT or XQuery):</p>
|
|
<p><code><a name="{generate-id($sect)}"/></code></p>
|
|
<p>and a link to that section can then be produced with code such
|
|
as:</p>
|
|
<p><code>see <a
|
|
href="#{generate-id($sect)}">here</a></code></p>
|
|
<p>Note that anchors generated in this way will not necessarily be
|
|
the same each time a document is republished.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="fns-on-docs" id="fns-on-docs"></a>14.8 Functions
|
|
giving access to external information</h3>
|
|
<div class="div3">
|
|
<h4><a name="func-doc" id="func-doc"></a>14.8.1 fn:doc</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Retrieves a document using a URI supplied as an
|
|
<code>xs:string</code>, and returns the corresponding document
|
|
node.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:doc</code>(<code class="arg">$uri</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">document-node()?</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-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 available-documents.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If <code>$uri</code> is the empty sequence, the result is an
|
|
empty sequence.</p>
|
|
<p>If <code>$uri</code> is a relative URI reference, it is resolved
|
|
relative to the value of the <span>Dynamic Base URI property from
|
|
the dynamic context</span>. The resulting absolute URI is promoted
|
|
to an <code>xs:string</code>.</p>
|
|
<p>If the <b>Available documents</b> described in <a href=
|
|
"http://www.w3.org/TR/xpath-30/#eval_context">Section 2.1.2 Dynamic
|
|
Context</a> <sup><small>XP30</small></sup> provides a mapping from
|
|
this string to a document node, the function returns that document
|
|
node.</p>
|
|
<p>The URI may include a fragment identifier.</p>
|
|
<p>By default, this function is <a title="" class="termref" href=
|
|
"#"><span class="arrow">·</span>deterministic<span class=
|
|
"arrow">·</span></a>. Two calls on this function return the same
|
|
document node if the same URI Reference (after resolution to an
|
|
absolute URI Reference) is supplied to both calls. Thus, the
|
|
following expression (if it does not raise an error) will always be
|
|
true:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
doc("foo.xml") is doc("foo.xml")
|
|
</pre></div>
|
|
<p>However, for performance reasons, implementations may provide a
|
|
user option to evaluate the function without a guarantee of
|
|
determinism. The manner in which any such option is provided is
|
|
implementation-defined. If the user has not selected such an
|
|
option, a call of the function must either return a deterministic
|
|
result or must raise an error [<a href="#ERRFODC0003" title=
|
|
"err:FODC0003">err:FODC0003</a>].</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>If <code>$uri</code> is read from a source document, it is
|
|
generally appropriate to resolve it relative to the base URI
|
|
property of the relevant node in the source document. This can be
|
|
achieved by calling the <a href=
|
|
"#func-resolve-uri"><code>fn:resolve-uri</code></a> function, and
|
|
passing the resulting absolute URI as an argument to the
|
|
<code>fn:doc</code> function.</p>
|
|
</div>
|
|
<p>If two calls to this function supply different absolute URI
|
|
References as arguments, the same document node may be returned if
|
|
the implementation can determine that the two arguments refer to
|
|
the same resource.</p>
|
|
<p>By defining the semantics of this function in terms of a
|
|
string-to-document-node mapping in the dynamic context, the
|
|
specification is acknowledging that the results of this function
|
|
are outside the purview of the language specification itself, and
|
|
depend entirely on the run-time environment in which the expression
|
|
is evaluated. This run-time environment includes not only an
|
|
unpredictable collection of resources ("the web"), but configurable
|
|
machinery for locating resources and turning their contents into
|
|
document nodes within the XPath data model. Both the set of
|
|
resources that are reachable, and the mechanisms by which those
|
|
resources are parsed and validated, are <a title=
|
|
"implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>One possible processing model for this function is as follows.
|
|
The resource identified by the URI Reference is retrieved. If the
|
|
resource cannot be retrieved, an error is raised [<a href=
|
|
"#ERRFODC0002" title="err:FODC0002">err:FODC0002</a>]. The data
|
|
resulting from the retrieval action is then parsed as an XML
|
|
document and a tree is constructed in accordance with the <a href=
|
|
"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>.
|
|
If the top-level media type is known and is "text", the content is
|
|
parsed in the same way as if the media type were text/xml;
|
|
otherwise, it is parsed in the same way as if the media type were
|
|
application/xml. If the contents cannot be parsed successfully, an
|
|
error is raised [<a href="#ERRFODC0002" title=
|
|
"err:FODC0002">err:FODC0002</a>]. Otherwise, the result of the
|
|
function is the document node at the root of the resulting tree.
|
|
This tree is then optionally validated against a schema.</p>
|
|
<p>Various aspects of this processing are <a title=
|
|
"implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>. Implementations may provide external
|
|
configuration options that allow any aspect of the processing to be
|
|
controlled by the user. In particular:</p>
|
|
<ul>
|
|
<li>
|
|
<p>The set of URI schemes that the implementation recognizes is
|
|
implementation-defined. Implementations may allow the mapping of
|
|
URIs to resources to be configured by the user, using mechanisms
|
|
such as catalogs or user-written URI handlers.</p>
|
|
</li>
|
|
<li>
|
|
<p>The handling of non-XML media types is implementation-defined.
|
|
Implementations may allow instances of the data model to be
|
|
constructed from non-XML resources, under user control.</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 DTD validation and/or schema
|
|
validation is applied to the source document.</p>
|
|
</li>
|
|
<li>
|
|
<p>Implementations may provide user-defined error handling options
|
|
that allow processing to continue following an error in retrieving
|
|
a resource, or in parsing and validating its content. When errors
|
|
have been handled in this way, the function may return either an
|
|
empty sequence, or a fallback document provided by the error
|
|
handler.</p>
|
|
</li>
|
|
<li>
|
|
<p>Implementations may provide user options that relax the
|
|
requirement for the function to return deterministic results.</p>
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error <strong>may</strong> be raised [<a href="#ERRFODC0005"
|
|
title="err:FODC0005">err:FODC0005</a>] if <code>$uri</code> is not
|
|
a valid URI.</p>
|
|
<p>An error is raised [<a href="#ERRFODC0002" title=
|
|
"err:FODC0002">err:FODC0002</a>] if the <b>available documents</b>
|
|
provides no mapping for the absolutized URI.</p>
|
|
<p>An error is raised [<a href="#ERRFODC0002" title=
|
|
"err:FODC0002">err:FODC0002</a>] if the resource cannot be
|
|
retrieved or cannot be parsed successfully as XML.</p>
|
|
<p>An error is raised [<a href="#ERRFODC0003" title=
|
|
"err:FODC0003">err:FODC0003</a>] if the implementation is not able
|
|
to guarantee that the result of the function will be deterministic,
|
|
and the user has not indicated that an unstable result is
|
|
acceptable.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-doc-available" id="func-doc-available"></a>14.8.2
|
|
fn:doc-available</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>The function returns true if and only if the function call
|
|
<a href="#func-doc"><code>fn:doc($uri)</code></a> would return a
|
|
document node.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:doc-available</code>(<code class=
|
|
"arg">$uri</code><code class="as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If <code>$uri</code> is an empty sequence, this function returns
|
|
<code>false</code>.</p>
|
|
<p>If a call on <a href="#func-doc"><code>fn:doc($uri)</code></a>
|
|
would return a document node, this function returns
|
|
<code>true</code>.</p>
|
|
<p>An error is raised [<a href="#ERRFODC0005" title=
|
|
"err:FODC0005">err:FODC0005</a>] if <code>$uri</code> is not a
|
|
valid URI according to the rules applied by the implementation of
|
|
<a href="#func-doc"><code>fn:doc</code></a>.</p>
|
|
<p>Otherwise, this function returns <code>false</code>.</p>
|
|
<p>If this function returns <code>true</code>, then calling
|
|
<a href="#func-doc"><code>fn:doc($uri)</code></a> within the same
|
|
<a title="execution scope" class="termref" href=
|
|
"#execution-scope"><span class="arrow">·</span>execution
|
|
scope<span class="arrow">·</span></a> must return a document node.
|
|
However, if nondeterministic processing has been selected for the
|
|
<a href="#func-doc"><code>fn:doc</code></a> function, this
|
|
guarantee is lost.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-collection" id="func-collection"></a>14.8.3
|
|
fn:collection</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a sequence of nodes representing a collection of
|
|
documents indentified by a collection URI; or a default collection
|
|
if no URI is supplied.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:collection</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">node()*</code></div>
|
|
</div>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:collection</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">node()*</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-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 available-collections.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>This function takes an <code>xs:string</code> as argument and
|
|
returns a sequence of nodes obtained by interpreting
|
|
<code>$arg</code> as an <code>xs:anyURI</code> and resolving it
|
|
according to the mapping specified in <b>Available collections</b>
|
|
described in <a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
|
|
Section C.2 Dynamic Context Components</a>
|
|
<sup><small>XP30</small></sup>.</p>
|
|
<p>If <b>Available collections</b> provides a mapping from this
|
|
string to a sequence of nodes, the function returns that sequence.
|
|
If <b>Available collections</b> maps the string to an empty
|
|
sequence, then the function returns an empty sequence.</p>
|
|
<p>If <code>$arg</code> is not specified, the function returns the
|
|
sequence of the nodes in the default collection in the dynamic
|
|
context. See <a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
|
|
Section C.2 Dynamic Context Components</a>
|
|
<sup><small>XP30</small></sup>.</p>
|
|
<p>If the value of <code>$arg</code> is a relative
|
|
<code>xs:anyURI</code>, it is resolved against the value of the
|
|
base-URI property from the static context.</p>
|
|
<p>If <code>$arg</code> is the empty sequence, the function behaves
|
|
as if it had been called without an argument. See above.</p>
|
|
<p>By default, this function is <a title="" class="termref" href=
|
|
"#"><span class="arrow">·</span>deterministic<span class=
|
|
"arrow">·</span></a>. This means that repeated calls on the
|
|
function with the same argument will return the same result.
|
|
However, for performance reasons, implementations may provide a
|
|
user option to evaluate the function without a guarantee of
|
|
determinism. The manner in which any such option is provided is
|
|
<a title="implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>. If the user has not selected such an option,
|
|
a call to this function must either return a deterministic result
|
|
or must raise an error [<a href="#ERRFODC0003" title=
|
|
"err:FODC0003">err:FODC0003</a>].</p>
|
|
<p>There is no requirement that the returned nodes should be in
|
|
document order, nor is there a requirement that the result should
|
|
contain no duplicates.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODC0002" title=
|
|
"err:FODC0002">err:FODC0002</a>] if no URI is supplied and the
|
|
value of the default collection 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="#ERRFODC0002" title=
|
|
"err:FODC0002">err:FODC0002</a>] if <b>available collections</b>
|
|
provides no mapping for the absolutized URI.</p>
|
|
<p>An error is raised [<a href="#ERRFODC0004" title=
|
|
"err:FODC0004">err:FODC0004</a>] if <code>$arg</code> is not a
|
|
valid <code>xs:anyURI</code>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>This function provides a facility for users to work with a
|
|
collection of documents which may be contained in a directory or
|
|
rows of a Relational table or other implementation-specific
|
|
construct. An implementation may also use external variables to
|
|
identify external resources, but <code>fn:collection</code>
|
|
provides functionality not provided by external variables.
|
|
Specifying resources using URIs is useful because URIs are dynamic,
|
|
can be parameterized, and do not rely on an external
|
|
environment.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-uri-collection" id=
|
|
"func-uri-collection"></a>14.8.4 fn:uri-collection</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a sequence of <code>xs:anyURI</code> values representing
|
|
the document URIs of the documents in a collection.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:uri-collection</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:uri-collection</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyURI*</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-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 available-collections.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>A collection, as returned by the <code>fn:collection</code>
|
|
function, is in general a sequence of nodes. Some of these nodes
|
|
may be document nodes, and some of these document nodes may have a
|
|
non-empty document URI, accessible using the
|
|
<code>fn:document-uri</code> function. The
|
|
<code>fn:uri-collection</code> function returns a sequence of URIs,
|
|
being the document URIs of those nodes in the collection that are
|
|
document nodes and that have a document URI (other nodes in the
|
|
collection are ignored). That is, in the absence of errors,
|
|
<code>fn:uri-collection(X)</code> returns the same set of URIs as
|
|
<a href=
|
|
"#func-collection"><code>fn:collection(X)/fn:document-uri()</code></a>,
|
|
though not necessarily in the same order.</p>
|
|
<p>The purpose in providing the function, however, is to allow the
|
|
URIs of the documents in a collection to be retrieved without
|
|
incurring the cost (which might be significant in some
|
|
implementations) of dereferencing the URIs to obtain the actual
|
|
nodes. Where required, the returned URIs can then be dereferenced
|
|
by calling the <code>fn:doc</code> function.</p>
|
|
<p>The zero-argument form of the function returns the document URIs
|
|
of the document nodes in the default collection.</p>
|
|
<p>The single-argument form returns the document URIs of the
|
|
document nodes in the collection with a given collection URI. If
|
|
the value of the argument is an empty sequence, the action is as
|
|
for the zero-argument form of the function. If the argument is a
|
|
relative URI reference, it is resolved against the <span>Dynamic
|
|
Base URI property from the dynamic context</span>.</p>
|
|
<p>There is no requirement that the nodes in a collection should
|
|
all be distinct, and therefore no requirement that the URIs in the
|
|
result of this function should all be distinct.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODC0002" title=
|
|
"err:FODC0002">err:FODC0002</a>] if no URI is supplied and the
|
|
value of the default collection is absent.</p>
|
|
<p>An error is raised [<a href="#ERRFODC0004" title=
|
|
"err:FODC0004">err:FODC0004</a>] if <b>available collections</b>
|
|
provides no mapping for the absolutized URI.</p>
|
|
<p>An error is raised [<a href="#ERRFODC0004" title=
|
|
"err:FODC0004">err:FODC0004</a>] if <code>$arg</code> is not a
|
|
valid <code>xs:anyURI</code>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p><em>This explanation of the function is confusing and needs to
|
|
be improved: it is the subject of an open bug report (<a href=
|
|
"https://www.w3.org/Bugs/Public/show_bug.cgi?id=14971">#14971</a>).
|
|
In particular, the description of how it works is not supportive
|
|
one of the use cases, which is to access a collection of unparsed
|
|
text files.</em></p>
|
|
<p>There are several reasons it might be appriopriate to retrieve
|
|
the URIs of the documents in a collection without retrieving the
|
|
documents themselves. For example:</p>
|
|
<ul>
|
|
<li>
|
|
<p>In XSLT it allows the documents to be processed in streaming
|
|
mode using the <code>xsl:stream</code> instruction.</p>
|
|
</li>
|
|
<li>
|
|
<p>It allows recovery from failures to read, parse, or validate
|
|
individual documents, by calling the <a href=
|
|
"#func-doc"><code>fn:doc</code></a> function within the scope of
|
|
try/catch.</p>
|
|
</li>
|
|
<li>
|
|
<p>It allows selection of which documents to read based on their
|
|
URI, for example they can be filtered to select those whose URIs
|
|
end in <code>.xml</code>.</p>
|
|
</li>
|
|
</ul>
|
|
<p>However, there may be collections that cannot be processed in
|
|
this way: specifically, those that contain nodes other than
|
|
document nodes, and those that contain document nodes having no
|
|
document URI.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-unparsed-text" id="func-unparsed-text"></a>14.8.5
|
|
fn:unparsed-text</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>The <code>fn:unparsed-text</code> function reads an external
|
|
resource (for example, a file) and returns its contents as a
|
|
string.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:unparsed-text</code>(<code class=
|
|
"arg">$href</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"><code class=
|
|
"function">fn:unparsed-text</code>(<code class=
|
|
"arg">$href</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$encoding</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>
|
|
</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-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 base-uri.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The <code>$href</code> argument <strong>must</strong> be a
|
|
string in the form of a URI reference, which <strong>must</strong>
|
|
contain no fragment identifier, and <strong>must</strong> identify
|
|
a resource that can be read as text. If the URI is a relative URI
|
|
reference, then it is resolved relative to the <span>Dynamic Base
|
|
URI property from the dynamic context</span>.</p>
|
|
<p>If the value of the <code>$href</code> argument is an empty
|
|
sequence, the function returns an empty sequence.</p>
|
|
<p>The <code>$encoding</code> argument, if present, is the name of
|
|
an encoding. The values for this attribute follow the same rules as
|
|
for the <code>encoding</code> attribute in an XML declaration. The
|
|
only values which every <a title="" class="termref" href=
|
|
"#"><span class="arrow">·</span>implementation<span class=
|
|
"arrow">·</span></a> is <strong>required</strong> to recognize are
|
|
<code>utf-8</code> and <code>utf-16</code>.</p>
|
|
<p>The encoding of the external resource is determined as
|
|
follows:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>external encoding information is used if available,
|
|
otherwise</p>
|
|
</li>
|
|
<li>
|
|
<p>if the media type of the resource is <code>text/xml</code> or
|
|
<code>application/xml</code> (see <a href="#rfc2376">[RFC
|
|
2376]</a>), or if it matches the conventions
|
|
<code>text/*+xml</code> or <code>application/*+xml</code> (see
|
|
<a href="#rfc3023">[RFC 3023]</a> and/or its successors), then the
|
|
encoding is recognized as specified in <a href=
|
|
"#REC-xml">[REC-xml]</a>, otherwise</p>
|
|
</li>
|
|
<li>
|
|
<p>the value of the <code>$encoding</code> argument is used if
|
|
present, otherwise</p>
|
|
</li>
|
|
<li>
|
|
<p>the processor <strong>may</strong> use <a title=
|
|
"implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> heuristics to determine the likely encoding,
|
|
otherwise</p>
|
|
</li>
|
|
<li>
|
|
<p>UTF-8 is assumed.</p>
|
|
</li>
|
|
</ol>
|
|
<p>The result of the function is a string containing the text of
|
|
the resource retrieved using the URI.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFOUT1170" title=
|
|
"err:FOUT1170">err:FOUT1170</a>] if <code>$href</code> contains a
|
|
fragment identifier, or if it cannot be used to retrieve a resource
|
|
containing text.</p>
|
|
<p>An error is raised [<a href="#ERRFOUT1190" title=
|
|
"err:FOUT1190">err:FOUT1190</a>] if the retrieved resource contains
|
|
octets that cannot be decoded into Unicode <a title="character"
|
|
class="termref" href="#character"><span class=
|
|
"arrow">·</span>characters<span class="arrow">·</span></a> using
|
|
the specified encoding, or if the resulting characters are not
|
|
permitted XML characters. This includes the case where the
|
|
<a title="" class="termref" href="#"><span class=
|
|
"arrow">·</span>processor<span class="arrow">·</span></a> does not
|
|
support the requested encoding.</p>
|
|
<p>An error is raised [<a href="#ERRFOUT1200" title=
|
|
"err:FOUT1200">err:FOUT1200</a>] if <code>$encoding</code> is
|
|
absent and the <a title="" class="termref" href="#"><span class=
|
|
"arrow">·</span>processor<span class="arrow">·</span></a> cannot
|
|
infer the encoding using external information and the encoding is
|
|
not UTF-8.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>If it is appropriate to use a base URI other than the
|
|
<span>dynamic</span> base URI (for example, when resolving a
|
|
relative URI reference read from a source document) then it is
|
|
advisable to resolve the relative URI reference using the <a href=
|
|
"#func-resolve-uri"><code>fn:resolve-uri</code></a> function before
|
|
passing it to the <code>fn:unparsed-text</code> function.</p>
|
|
<p>The rules for determining the encoding are chosen for
|
|
consistency with <a href="#xinclude">[XML Inclusions (XInclude)
|
|
Version 1.0 (Second Edition)]</a>. Files with an XML media type are
|
|
treated specially because there are use cases for this function
|
|
where the retrieved text is to be included as unparsed XML within a
|
|
CDATA section of a containing document, and because processors are
|
|
likely to be able to reuse the code that performs encoding
|
|
detection for XML external entities.</p>
|
|
<p>If the text file contains characters such as <code><</code>
|
|
and <code>&</code>, these will typically be output as
|
|
<code>&lt;</code> and <code>&amp;</code> if the string is
|
|
serialized as XML or HTML. If these characters actually represent
|
|
markup (for example, if the text file contains HTML), then an XSLT
|
|
stylesheet can attempt to write them as markup to the output file
|
|
using the <code>disable-output-escaping</code> attribute of the
|
|
<code>xsl:value-of</code> instruction. Note, however, that XSLT
|
|
implementations are not required to support this feature.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>This XSLT example attempts to read a file containing
|
|
'boilerplate' HTML and copy it directly to the serialized output
|
|
file:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:output method="html"/>
|
|
|
|
<xsl:template match="/">
|
|
<xsl:value-of select="unparsed-text('header.html', 'iso-8859-1')"
|
|
disable-output-escaping="yes"/>
|
|
<xsl:apply-templates/>
|
|
<xsl:value-of select="unparsed-text('footer.html', 'iso-8859-1')"
|
|
disable-output-escaping="yes"/>
|
|
</xsl:template>
|
|
</pre></div>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-unparsed-text-lines" id=
|
|
"func-unparsed-text-lines"></a>14.8.6 fn:unparsed-text-lines</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>The <code>fn:unparsed-text-lines</code> function reads an
|
|
external resource (for example, a file) and returns its contents as
|
|
a sequence of strings, one for each line of text in the file.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:unparsed-text-lines</code>(<code class=
|
|
"arg">$href</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="2"><code class=
|
|
"function">fn:unparsed-text-lines</code>(</td>
|
|
<td valign="baseline"><code class="arg">$href</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">$encoding</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">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-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 base-uri.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The <code>unparsed-text-lines</code> function reads an external
|
|
resource (for example, a file) and returns its contents as a
|
|
sequence of strings, separated at newline boundaries.</p>
|
|
<p>The result of the single-argument function is the same as the
|
|
result of the expression <a href=
|
|
"#func-tokenize"><code>fn:tokenize(fn:unparsed-text($href),
|
|
'\r\n|\r|\n')[not(position()=last() and .='')]</code></a>. The
|
|
result of the two-argument function is the same as the result of
|
|
the expression <a href=
|
|
"#func-tokenize"><code>fn:tokenize(fn:unparsed-text($href,
|
|
$encoding), '\r\n|\r|\n'))[not(position()=last() and
|
|
.='')]</code></a>.</p>
|
|
<p>The result is a thus a sequence of strings containing the text
|
|
of the resource retrieved using the URI, each string representing
|
|
one line of text. Lines are separated by one of the sequences x0A,
|
|
x0D, or x0Dx0A. The characters representing the newline are not
|
|
included in the returned strings. If there are two adjacent newline
|
|
sequences, a zero-length string will be returned to represent the
|
|
empty line; but if the external resource ends with a newline
|
|
sequence, no zero-length string will be returned as the last item
|
|
in the result.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>Error conditions are the same as for the <a href=
|
|
"#func-unparsed-text"><code>fn:unparsed-text</code></a>
|
|
function.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>See the notes for <a href=
|
|
"#func-unparsed-text"><code>fn:unparsed-text</code></a>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-unparsed-text-available" id=
|
|
"func-unparsed-text-available"></a>14.8.7
|
|
fn:unparsed-text-available</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Because errors in evaluating the <code>fn:unparsed-text</code>
|
|
function are non-recoverable, these two functions are provided to
|
|
allow an application to determine whether a call with particular
|
|
arguments would succeed.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:unparsed-text-available</code>(<code class=
|
|
"arg">$href</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>)<code class="as"> as </code><code class="return-type">xs:boolean</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="2"><code class=
|
|
"function">fn:unparsed-text-available</code>(</td>
|
|
<td valign="baseline"><code class="arg">$href</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">$encoding</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:boolean</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-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 base-uri.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The <code>fn:unparsed-text-available</code> function determines
|
|
whether a call on the <code>fn:unparsed-text</code> function with
|
|
identical arguments would return a string.</p>
|
|
<p>If the first argument is an empty sequence, the function returns
|
|
false. If the second argument is an empty sequence, the function
|
|
behaves as if the second argument were omitted.</p>
|
|
<p>In other cases, the function returns true if a call on
|
|
<code>fn:unparsed-text</code> with the same arguments would
|
|
succeed, and false if a call on <code>fn:unparsed-text</code> with
|
|
the same arguments would fail with a non-recoverable dynamic
|
|
error.</p>
|
|
<p>The functions <code>fn:unparsed-text</code> and
|
|
<code>fn:unparsed-text-available</code> have the same requirement
|
|
for <a title="" class="termref" href="#"><span class=
|
|
"arrow">·</span>determinism<span class="arrow">·</span></a> as the
|
|
functions <a href="#func-doc"><code>fn:doc</code></a> and <a href=
|
|
"#func-doc-available"><code>fn:doc-available</code></a>. This means
|
|
that unless the user has explicitly stated a requirement for a
|
|
reduced level of determinism, either of these functions if called
|
|
twice with the same arguments during the course of a transformation
|
|
<strong>must</strong> return the same results each time; moreover,
|
|
the results of a call on <code>fn:unparsed-text-available</code>
|
|
<strong>must</strong> be consistent with the results of a
|
|
subsequent call on <code>unparsed-text</code> with the same
|
|
arguments.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>This requires that the <code>unparsed-text-available</code>
|
|
function should actually attempt to read the resource identified by
|
|
the URI, and check that it is correctly encoded and contains no
|
|
characters that are invalid in XML. Implementations may avoid the
|
|
cost of repeating these checks for example by caching the validated
|
|
contents of the resource, to anticipate a subsequent call on the
|
|
<code>unparsed-text</code> <span>or
|
|
<code>unparsed-text-lines</code></span> function. Alternatively,
|
|
implementations may be able to rewrite an expression such as
|
|
<code>if (unparsed-text-available(A)) then unparsed-text(A) else
|
|
...</code> to generate a single call internally.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-environment-variable" id=
|
|
"func-environment-variable"></a>14.8.8 fn:environment-variable</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the value of a system environment variable, if it
|
|
exists.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:environment-variable</code>(<code class=
|
|
"arg">$name</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>
|
|
</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-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 environment-variables.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The set of available <a href=
|
|
"http://www.w3.org/TR/xpath-30/#dt-environment-variables">environment
|
|
variables</a><sup><small>XP30</small></sup> is a set of (name,
|
|
value) pairs forming part of the dynamic context, in which the name
|
|
is unique within the set of pairs. The name and value are arbitrary
|
|
strings.</p>
|
|
<p>If the <code>$name</code> argument matches the name of one of
|
|
these pairs, the function returns the corresponding value.</p>
|
|
<p>If there is no environment variable with a matching name, the
|
|
function returns the empty sequence.</p>
|
|
<p>The collation used for matching names is <a title=
|
|
"implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>, but must be the same as the collation used to
|
|
ensure that the names of all environment variables are unique.</p>
|
|
<p>The function is <a title="deterministic" class="termref" href=
|
|
"#dt-deterministic"><span class=
|
|
"arrow">·</span>deterministic<span class="arrow">·</span></a>,
|
|
which means that if it is called several times within the same
|
|
<a title="" class="termref" href="#"><span class=
|
|
"arrow">·</span>execution scope<span class="arrow">·</span></a>,
|
|
with the same arguments, it must return the same result.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>On many platforms, the term "environment variable" has a natural
|
|
meaning in terms of facilities provided by the operating system.
|
|
This interpretation of the concept does not exclude other
|
|
interpretations, such as a mapping to a set of configuration
|
|
parameters in a database system.</p>
|
|
<p>Environment variable names are usually case sensitive. Names are
|
|
usually of the form <code>(letter|_) (letter|_|digit)*</code>, but
|
|
this varies by platform.</p>
|
|
<p>On some platforms, there may sometimes be multiple environment
|
|
variables with the same name; in this case, it is
|
|
implementation-dependent as to which is returned; see for example
|
|
<a href="#POSIX.1-2008">[POSIX.1-2008]</a> (Chapter 8, Environment
|
|
Variables). Implementations <strong>may</strong> use prefixes or
|
|
other naming conventions to disambiguate the names.</p>
|
|
<p>The requirement to ensure that the function is deterministic
|
|
means in practice that the implementation must make a snapshot of
|
|
the environment variables at some time during execution, and return
|
|
values obtained from this snapshot, rather than using live values
|
|
that are subject to change at any time.</p>
|
|
<p>Operating system environment variables may be associated with a
|
|
particular process, while queries and stylesheets may execute
|
|
across multiple processes (or multiple machines). In such
|
|
circumstances implementations <strong>may</strong> choose to
|
|
provide access to the environment variables associated with the
|
|
process in which the query or stylesheet processing was
|
|
initiated.</p>
|
|
<p>Security advice: Queries from untrusted sources should not be
|
|
permitted unrestricted access to environment variables. For
|
|
example, the name of the account under which the query is running
|
|
may be useful information to a would-be intruder. An implementation
|
|
may therefore choose to restrict access to the environment, or may
|
|
provide a facility to make <code>fn:environment-variable</code>
|
|
always return the empty sequence.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-available-environment-variables" id=
|
|
"func-available-environment-variables"></a>14.8.9
|
|
fn:available-environment-variables</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns a list of environment variable names that are suitable
|
|
for passing to <a href=
|
|
"#func-environment-variable"><code>fn:environment-variable</code></a>,
|
|
as a (possibly empty) sequence of strings.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:available-environment-variables</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string*</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-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 environment-variables.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns a sequence of strings, being the names of
|
|
the environment variables in the dynamic context in some <a title=
|
|
"implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation-dependent<span class=
|
|
"arrow">·</span></a> order.</p>
|
|
<p>The function is <a title="deterministic" class="termref" href=
|
|
"#dt-deterministic"><span class=
|
|
"arrow">·</span>deterministic<span class="arrow">·</span></a>: that
|
|
is, the set of available environment variables does not vary during
|
|
evaluation.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The function returns a list of strings, containing no
|
|
duplicates.</p>
|
|
<p>It is intended that the strings in this list should be suitable
|
|
for passing to <a href=
|
|
"#func-environment-variable"><code>fn:environment-variable</code></a>.</p>
|
|
<p>See also the note on security under the definition of the
|
|
<a href=
|
|
"#func-environment-variable"><code>fn:environment-variable</code></a>
|
|
function. If access to environment variables has been disabled,
|
|
<code>fn:available-environment-variables</code> always returns the
|
|
empty sequence.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="parsing-and-serializing" id=
|
|
"parsing-and-serializing"></a>14.9 Parsing and serializing</h3>
|
|
<div class="div3">
|
|
<h4><a name="func-parse-xml" id="func-parse-xml"></a>14.9.1
|
|
fn:parse-xml</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>This function takes as input an XML document represented as a
|
|
string, and returns the document node at the root of an XDM tree
|
|
representing the parsed document.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:parse-xml</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">document-node(element(*))</code></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-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 base-uri.</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>The precise process used to construct the XDM instance is
|
|
<a title="implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>. In particular, it is implementation-defined
|
|
whether DTD and/or schema validation is invoked, and it is
|
|
implementation-defined whether an XML 1.0 or XML 1.1 parser is
|
|
used.</p>
|
|
<p>The Dynamic Base URI property from the dynamic context of the
|
|
<code>fn:parse-xml</code> function call is used both as the base
|
|
URI used by the XML parser to resolve relative entity references
|
|
within the document, and as the base URI of the document node that
|
|
is returned.</p>
|
|
<p>The document URI of the returned node is <a title="" class=
|
|
"termref" href="#"><span class="arrow">·</span>absent<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>The function is <em>not</em> <a title="" class="termref" href=
|
|
"#"><span class="arrow">·</span>deterministic<span class=
|
|
"arrow">·</span></a>: that is, if the function is called twice with
|
|
the same arguments, it is <a title="implementation dependent"
|
|
class="termref" href="#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation-dependent<span class=
|
|
"arrow">·</span></a> whether the same node is returned on both
|
|
occasions.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODC0006" title=
|
|
"err:FODC0006">err:FODC0006</a>] if the content of
|
|
<code>$arg</code> is not a well-formed and namespace-well-formed
|
|
XML document.</p>
|
|
<p>An error is raised [<a href="#ERRFODC0006" title=
|
|
"err:FODC0006">err:FODC0006</a>] if DTD-based validation is carried
|
|
out and the content of <code>$arg</code> is not valid against its
|
|
DTD.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>Since the XML document is presented to the parser as a string,
|
|
rather than as a sequence of octets, the encoding specified within
|
|
the XML declaration has no meaning. If the XML parser accepts input
|
|
only in the form of a sequence of octets, then the processor must
|
|
ensure that the string is encoded as octets in a way that is
|
|
consistent with rules used by the XML parser to detect the
|
|
encoding.</p>
|
|
<p>The primary use case for this function is to handle input
|
|
documents that contain nested XML documents embedded within CDATA
|
|
sections. Since the content of the CDATA section are exposed as
|
|
text, the receiving query or stylesheet may pass this text to the
|
|
<code>fn:parse-xml</code> function to create a tree representation
|
|
of the nested document.</p>
|
|
<p>Similarly, nested XML within comments is sometimes encountered,
|
|
and lexical XML is sometimes returned by extension functions, for
|
|
example, functions that access web services or read from
|
|
databases.</p>
|
|
<p>A use case arises in XSLT where there is a need to preprocess an
|
|
input document before parsing. For example, an application might
|
|
wish to edit the document to remove its DOCTYPE declaration. This
|
|
can be done by reading the raw text using the <a href=
|
|
"#func-unparsed-text"><code>fn:unparsed-text</code></a> function,
|
|
editing the resulting string, and then passing it to the
|
|
<code>fn:parse-xml</code> function.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:parse-xml("<alpha>abcd</alpha>")</code>
|
|
returns a newly created document node, having an <code>alpha</code>
|
|
element as its only child; the <code>alpha</code> element in turn
|
|
is the parent of a text node whose string value is
|
|
<code>"abcd"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-parse-xml-fragment" id=
|
|
"func-parse-xml-fragment"></a>14.9.2 fn:parse-xml-fragment</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>This function takes as input an XML external entity represented
|
|
as a string, and returns the document node at the root of an XDM
|
|
tree representing the parsed document fragment.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:parse-xml-fragment</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">document-node()?</code></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-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 base-uri.</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>The input must be a namespace-well-formed external general
|
|
parsed entity. More specifically, it must be a string conforming to
|
|
the production rule <a href="http://www.w3.org/TR/REC-xml/#">[NT IN
|
|
xml]extParsedEnt</a><sup><small>xml</small></sup> in <a href=
|
|
"#REC-xml">[REC-xml]</a>, it must contain no entity references
|
|
other that references to predefined entities, and it must satisfy
|
|
all the rules of <a href="#REC-xml-names">[Namespaces in XML]</a>
|
|
for namespace-well-formed documents with the exception that the
|
|
rule requiring it to be a well-formed document is replaced by the
|
|
rule requiring it to be a well-formed external general parsed
|
|
entity.</p>
|
|
<p>The string is parsed to form a sequence of nodes which become
|
|
children of the new document node, in the same way as the content
|
|
of any element is converted into a sequence of children for the
|
|
resulting element node.</p>
|
|
<p>Schema validation is <em>not</em> invoked, which means that the
|
|
nodes in the returned document will all be untyped.</p>
|
|
<p>The precise process used to construct the XDM instance is
|
|
<a title="implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>. In particular, it is implementation-defined
|
|
whether whether an XML 1.0 or XML 1.1 parser is used.</p>
|
|
<p>The Dynamic Base URI from the dynamic context of the
|
|
<code>fn:parse-xml-fragment</code> function call is used both as
|
|
the base URI used by the XML parser to resolve relative entity
|
|
references within the document, and as the base URI of the document
|
|
node that is returned.</p>
|
|
<p>The document URI of the returned node is <a title="" class=
|
|
"termref" href="#"><span class="arrow">·</span>absent<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>The function is <em>not</em> <a title="" class="termref" href=
|
|
"#"><span class="arrow">·</span>deterministic<span class=
|
|
"arrow">·</span></a>: that is, if the function is called twice with
|
|
the same arguments, it is <a title="implementation dependent"
|
|
class="termref" href="#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation-dependent<span class=
|
|
"arrow">·</span></a> whether the same node is returned on both
|
|
occasions.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>An error is raised [<a href="#ERRFODC0006" title=
|
|
"err:FODC0006">err:FODC0006</a>] if the content of
|
|
<code>$arg</code> is not a well-formed external general parsed
|
|
entity, if it contains entity references other than references to
|
|
predefined entities, or if a document that incorporates this
|
|
well-formed parsed entity would not be namespace-well-formed.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>See also the notes for the <a href=
|
|
"#func-parse-xml"><code>fn:parse-xml</code></a> function.</p>
|
|
<p>The main differences between <a href=
|
|
"#func-parse-xml"><code>fn:parse-xml</code></a> and
|
|
<code>fn:parse-xml-fragment</code> are that for <a href=
|
|
"#func-parse-xml"><code>fn:parse-xml</code></a>, the children of
|
|
the resulting document node must contain exactly one element node
|
|
and no text nodes, wheras for <code>fn:parse-xml-fragment</code>,
|
|
the resulting document node can have any number (including zero) of
|
|
element and text nodes among its children. An additional difference
|
|
is that the <em>text declaration</em> at the start of an external
|
|
entity has slightly different syntax from the <em>XML
|
|
declaration</em> at the start of a well-formed document.</p>
|
|
<p>Note that all whitespace outside the <em>text declaration</em>
|
|
is significant, including whitespace that precedes the first
|
|
element node.</p>
|
|
<p>One use case for this function is to handle XML fragments stored
|
|
in databases, which frequently allow zero-or-more top level element
|
|
nodes. Another use case is to parse the contents of a
|
|
<code>CDATA</code> section embedded within another XML
|
|
document.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:parse-xml-fragment("<alpha>abcd</alpha><beta>abcd</beta>")</code>
|
|
returns a newly created document node, having two elements named
|
|
<code>alpha</code> and <code>beta</code> as its children; each of
|
|
these elements in turn is the parent of a text node.</p>
|
|
<p>The expression <code>fn:parse-xml-fragment("He was
|
|
<i>so</i> kind")</code> returns a newly created
|
|
document node having three children: a text node whose string value
|
|
is <code>"He was "</code>, an element node named <code>i</code>
|
|
having a child text node with string value <code>"so"</code>, and a
|
|
text node whose string value is <code>" kind"</code>.</p>
|
|
<p>The expression <code>fn:parse-xml-fragment("")</code> returns a
|
|
document node having no children.</p>
|
|
<p>The expression <code>fn:parse-xml-fragment(" ")</code> returns a
|
|
document node whose children comprise a single text node whose
|
|
string value is a single space.</p>
|
|
<p>The expression <code>fn:parse-xml-fragment('<xml
|
|
version="1.0" encoding="utf8"
|
|
standalone="yes"?></a>")</code> results in an error
|
|
[<a href="#ERRFODC0006" title="err:FODC0006">err:FODC0006</a>]
|
|
because the "standalone" keyword is not permitted in the text
|
|
declaration that appears at the start of an external general parsed
|
|
entity. (Thus, it is not the case that any input accepted by the
|
|
<a href="#func-parse-xml"><code>fn:parse-xml</code></a> function
|
|
will also be accepted by <code>fn:parse-xml-fragment</code>.)</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-serialize" id="func-serialize"></a>14.9.3
|
|
fn:serialize</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>This function serializes the supplied <span>input
|
|
sequence</span> <code>$arg</code> as described in <a href=
|
|
"#xslt-xquery-serialization-30">[XSLT and XQuery Serialization
|
|
3.0]</a>, returning the serialized <span>representation of the
|
|
sequence</span> as a string.</p>
|
|
</dd>
|
|
<dt class="label">Signatures</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:serialize</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>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:serialize</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$params</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">element(output:serialization-parameters)?</code>)<code class="as"> as </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>The value of <code>$arg</code> acts as the input sequence to the
|
|
serialization process, which starts with sequence
|
|
normalization.</p>
|
|
<p>The single-argument version of this function has the same effect
|
|
as the two-argument version called with <code>$params</code> set to
|
|
an empty sequence. This in turn is the same as the effect of
|
|
passing an <code>output:serialization-parameters</code> element
|
|
with no child elements.</p>
|
|
<p>The <code>$params</code> argument is used to identify a set of
|
|
serialization parameters. These are supplied in the form of an
|
|
<code>output:serialization-parameters</code> element, having the
|
|
format described in <a href=
|
|
"http://www.w3.org/TR/xslt-xquery-serialization-30/#serparams-in-xdm-instance">
|
|
Section 3.1 Setting Serialization Parameters by Means of a Data
|
|
Model Instance</a> <sup><small>SER30</small></sup>.</p>
|
|
<p>The final stage of serialization, that is, encoding, is skipped.
|
|
If the serializer does not allow this phase to be skipped, then the
|
|
sequence of octets returned by the serializer is decoded into a
|
|
string by reversing the character encoding performed in the final
|
|
stage.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>The serialization process will raise an error if
|
|
<code>$arg</code> is an attribute or namespace node.</p>
|
|
<p>If any serialization error occurs, including the detection of an
|
|
invalid value for a serialization parameter, this results in the
|
|
<code>fn:serialize</code> call failing with a dynamic error.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>One use case for this function arises when there is a need to
|
|
construct an XML document containing nested XML documents within a
|
|
CDATA section (or on occasions within a comment). See <a href=
|
|
"#func-parse-xml"><code>fn:parse-xml</code></a> for further
|
|
details.</p>
|
|
<p>Another use case arises when there is a need to call an
|
|
extension function that expects a lexical XML document as
|
|
input.</p>
|
|
<p>There are also use cases where the application wants to
|
|
post-process the output of a query or transformation, for example
|
|
by adding an internal DTD subset, or by inserting proprietary
|
|
markup delimiters such as the <code><% ... %></code> used by
|
|
some templating languages.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>Given the output parameters:</p>
|
|
<p>let <code>$params</code> :=</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<output:serialization-parameters>
|
|
<output:omit-xml-declaration>yes</output:omit-xml-declaration>
|
|
</output:serialization-parameters>
|
|
|
|
</pre></div>
|
|
<p>let <code>$data</code> :=</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<a b='3'/>
|
|
|
|
</pre></div>
|
|
<p>The following call might produce the output shown:</p>
|
|
<p>The expression <code>fn:serialize($data, $params)</code> returns
|
|
<code>'<a b="3"/>'</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="context" id="context"></a>15 Context functions</h2>
|
|
<p>The following functions are defined to obtain information from
|
|
the dynamic context.</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-position"><code>fn:position</code></a></td>
|
|
<td>Returns the context position from the dynamic context.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-last"><code>fn:last</code></a></td>
|
|
<td>Returns the context size from the dynamic context.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-current-dateTime"><code>fn:current-dateTime</code></a></td>
|
|
<td>Returns the current date and time (with timezone).</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-current-date"><code>fn:current-date</code></a></td>
|
|
<td>Returns the current date.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-current-time"><code>fn:current-time</code></a></td>
|
|
<td>Returns the current time.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-implicit-timezone"><code>fn:implicit-timezone</code></a></td>
|
|
<td>Returns the value of the implicit timezone property from the
|
|
dynamic context.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-default-collation"><code>fn:default-collation</code></a></td>
|
|
<td>Returns the value of the default collation property from the
|
|
static context.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-static-base-uri"><code>fn:static-base-uri</code></a></td>
|
|
<td>Despite its name, this function returns the value of the
|
|
Dynamic Base URI property from the dynamic context.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div2">
|
|
<h3><a name="func-position" id="func-position"></a>15.1
|
|
fn:position</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the context position from the dynamic context.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:position</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer</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-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>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>Returns the context position from the dynamic context. (See
|
|
<a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
|
|
Section C.2 Dynamic Context Components</a>
|
|
<sup><small>XP30</small></sup>.)</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 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>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-last" id="func-last"></a>15.2 fn:last</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the context size from the dynamic context.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:last</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer</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-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>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>Returns the context size from the dynamic context. (See <a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
|
|
Section C.2 Dynamic Context Components</a>
|
|
<sup><small>XP30</small></sup>.)</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 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">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>(1 to 20)[fn:last() - 1]</code> returns
|
|
<code>19</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-current-dateTime" id=
|
|
"func-current-dateTime"></a>15.3 fn:current-dateTime</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the current date and time (with timezone).</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:current-dateTime</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dateTimeStamp</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>Returns the current dateTime (with timezone) from the dynamic
|
|
context. (See <a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
|
|
Section C.2 Dynamic Context Components</a>
|
|
<sup><small>XP30</small></sup>.) This is an
|
|
<code>xs:dateTime</code> that is current at some time during the
|
|
evaluation of a query or transformation in which
|
|
<code>fn:current-dateTime</code> is executed.</p>
|
|
<p>This function is <a title="" class="termref" href=
|
|
"#"><span class="arrow">·</span><span class="arrow">·</span></a>.
|
|
The precise instant during the query or transformation represented
|
|
by the value of <code>fn:current-dateTime()</code> is <a title=
|
|
"implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>If the implementation supports data types from XSD 1.1 then the
|
|
returned value will be an instance of
|
|
<code>xs:dateTimeStamp</code>. Otherwise, the only guarantees are
|
|
that it will be an instance of <code>xs:dateTime</code> and will
|
|
have a timezone component.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The returned <code>xs:dateTime</code> will always have an
|
|
associated timezone, which will always be the same as the implicit
|
|
timezone in the dynamic context</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p><code>fn:current-dateTime()</code> returns an
|
|
<code>xs:dateTimeStamp</code> corresponding to the current date and
|
|
time. For example, a call of <code>fn:current-dateTime()</code>
|
|
might return <code>2004-05-12T18:17:15.125Z</code> corresponding to
|
|
the current time on May 12, 2004 in timezone <code>Z</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-current-date" id="func-current-date"></a>15.4
|
|
fn:current-date</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the current date.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:current-date</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:date</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>Returns <code>xs:date(fn:current-dateTime())</code>. This is an
|
|
<code>xs:date</code> (with timezone) that is current at some time
|
|
during the evaluation of a query or transformation in which
|
|
<code>fn:current-date</code> is executed.</p>
|
|
<p>This function is <a title="" class="termref" href=
|
|
"#"><span class="arrow">·</span><span class="arrow">·</span></a>.
|
|
The precise instant during the query or transformation represented
|
|
by the value of <code>fn:current-date</code> 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">Notes</dt>
|
|
<dd>
|
|
<p>The returned date will always have an associated timezone, which
|
|
will always be the same as the implicit timezone in the dynamic
|
|
context</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p><code>fn:current-date()</code> returns an <code>xs:date</code>
|
|
corresponding to the current date. For example, a call of
|
|
<code>fn:current-date()</code> might return
|
|
<code>2004-05-12+01:00</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-current-time" id="func-current-time"></a>15.5
|
|
fn:current-time</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the current time.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:current-time</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:time</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>Returns <code>xs:time(fn:current-dateTime())</code>. This is an
|
|
<code>xs:time</code> (with timezone) that is current at some time
|
|
during the evaluation of a query or transformation in which
|
|
<code>fn:current-time</code> is executed.</p>
|
|
<p>This function is <a title="" class="termref" href=
|
|
"#"><span class="arrow">·</span><span class="arrow">·</span></a>.
|
|
The precise instant during the query or transformation represented
|
|
by the value of <code>fn:current-time()</code> 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">Notes</dt>
|
|
<dd>
|
|
<p>The returned time will always have an associated timezone, which
|
|
will always be the same as the implicit timezone in the dynamic
|
|
context</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p><code>fn:current-time()</code> returns an <code>xs:time</code>
|
|
corresponding to the current time. For example, a call of
|
|
<code>fn:current-time()</code> might return
|
|
<code>23:17:00.000-05:00</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-implicit-timezone" id=
|
|
"func-implicit-timezone"></a>15.6 fn:implicit-timezone</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the value of the implicit timezone property from the
|
|
dynamic context.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:implicit-timezone</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration</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-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 implicit-timezone.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>Returns the value of the implicit timezone property from the
|
|
dynamic context. Components of the dynamic context are discussed in
|
|
<a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-xp-evaluation-context-components">
|
|
Section C.2 Dynamic Context Components</a>
|
|
<sup><small>XP30</small></sup>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-default-collation" id=
|
|
"func-default-collation"></a>15.7 fn:default-collation</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the value of the default collation property from the
|
|
static context.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:default-collation</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string</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-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 collations.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>Returns the value of the default collation property from the
|
|
static context. Components of the static context are discussed in
|
|
<a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-xp-static-context-components">Section
|
|
C.1 Static Context Components</a>
|
|
<sup><small>XP30</small></sup>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The default collation property can never be absent. If it is not
|
|
explicitly defined, a system defined default can be invoked. If
|
|
this is not provided, the Unicode codepoint collation
|
|
(<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>)
|
|
is used.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-static-base-uri" id=
|
|
"func-static-base-uri"></a>15.8 fn:static-base-uri</h3>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Despite its name, this function returns the value of the Dynamic
|
|
Base URI property from the dynamic context.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:static-base-uri</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyURI?</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-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 base-uri.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>The function returns the value of the Dynamic Base URI property
|
|
from the dynamic context. If the property is absent, the empty
|
|
sequence is returned.</p>
|
|
<p>Components of the dynamic context are discussed in [TITLE OF
|
|
XP30 SPEC, TITLE OF id-xp-eval-context
|
|
SECTION]<sup><small>XP30</small></sup> .</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The name of this function is misleading. In Query 1.0 and XPath
|
|
2.0, no distinction was made between the static base URI and the
|
|
dynamic base URI; it was assumed that the location where a query is
|
|
compiled and the location where it is executed would be the same.
|
|
In the 3.0 specifications it is acknowledged that these locations
|
|
may be different. References to resources used during analysis (for
|
|
example, module location hints in XQuery) are interpreted as
|
|
relative to the static base URI, while references to resources used
|
|
during evaluation (for example, URIs passed to the <a href=
|
|
"#func-doc"><code>fn:doc</code></a> or <a href=
|
|
"#func-collection"><code>fn:collection</code></a> functions) are
|
|
interpreted as relative to the dynamic base URI. Since the use
|
|
cases for this function relate primarily to the need to locate
|
|
resources during evaluation, it has been defined in this release to
|
|
access the dynamic base URI, despite the choice of function
|
|
name.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="higher-order-functions" id=
|
|
"higher-order-functions"></a>16 Higher-order functions</h2>
|
|
<div class="div2">
|
|
<h3><a name="functions-on-functions" id=
|
|
"functions-on-functions"></a>16.1 Functions on functions</h3>
|
|
<p>The following functions operate on function items, that is,
|
|
values referring to a function.</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-function-lookup"><code>fn:function-lookup</code></a></td>
|
|
<td>Returns the function having a given name and arity, if there is
|
|
one.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-function-name"><code>fn:function-name</code></a></td>
|
|
<td>Returns the name of the function identified by a function
|
|
item.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href=
|
|
"#func-function-arity"><code>fn:function-arity</code></a></td>
|
|
<td>Returns the arity of the function identified by a function
|
|
item.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-function-lookup" id=
|
|
"func-function-lookup"></a>16.1.1 fn:function-lookup</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the function having a given name and arity, if there is
|
|
one.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:function-lookup</code>(<code class=
|
|
"arg">$name</code><code class=
|
|
"as"> as </code><code class="type">xs:QName</code>,
|
|
<code class="arg">$arity</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:integer</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">function()?</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-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>.</p>
|
|
</dd>
|
|
<dt class="label">Rules</dt>
|
|
<dd>
|
|
<p>If <code>$function-name</code> and <code>$function-arity</code>
|
|
identify a named function that is present in the dynamic context,
|
|
then a function item corresponding to that named function is
|
|
returned.</p>
|
|
<p>Otherwise (if no known function can be identified by name and
|
|
arity), an empty sequence is returned.</p>
|
|
<p>If the arguments to <code>fn:function-lookup</code> identify a
|
|
function that is present in the static context of the function
|
|
call, the function will always return the same function that a
|
|
static reference to this function would bind to. If there is no
|
|
such function in the static context, then the results depend on
|
|
what is present in the dynamic context, which is <a title=
|
|
"implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>.</p>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>If the function that is identified is <a title=
|
|
"context-dependent" class="termref" href=
|
|
"#dt-context-dependent"><span class=
|
|
"arrow">·</span>context-dependent<span class="arrow">·</span></a>,
|
|
<code>fn:function-lookup</code> returns a function whose name and
|
|
signature match those of the requested function, but whose
|
|
implementation is a call on the <a href=
|
|
"#func-error"><code>fn:error</code></a> function, so that any
|
|
attempt to call the returned function fails with a dynamic error
|
|
[<a href="#ERRFOFL0001" title="err:FOFL0001">err:FOFL0001</a>]
|
|
occurs</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>This function can be useful where there is a need to make a
|
|
dynamic decision on which of several statically-known functions to
|
|
call. It can thus be used as a substitute for polymorphism, in the
|
|
case where the application has been designed so several functions
|
|
implement the same interface.</p>
|
|
<p>The function can also be useful in cases where a query or
|
|
stylesheet module is written to work with alternative versions of a
|
|
library module. In such cases the author of the main module might
|
|
wish to test whether an imported library module contains or does
|
|
not contain a particular function, and to call a function in that
|
|
module only if it is available in the version that was imported. A
|
|
static call would cause a static error if the function is not
|
|
available, whereas getting the function using
|
|
<code>fn:function-lookup</code> allows the caller to take fallback
|
|
action in this situation.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression
|
|
<code>fn:function-lookup(xs:QName('fn:substring'), 2)('abcd',
|
|
2)</code> returns <code>'bcd'</code>.</p>
|
|
<p>The expression
|
|
<code>(fn:function-lookup(xs:QName('xs:dateTimeStamp'), 1),
|
|
xs:dateTime#1)[1] ('2011-11-11T11:11:11Z')</code> returns an
|
|
<code>xs:dateTime</code> value set to the specified date, time, and
|
|
timezone; if the implementation supports XSD 1.1 then the result
|
|
will be an instance of the derived type
|
|
<code>xs:dateTimeStamp</code>. The query is written to ensure that
|
|
no failure occurs when the implementation does not recognize the
|
|
type <code>xs:dateTimeStamp</code>.</p>
|
|
<p>The expression <code>(let $f :=
|
|
fn:function-lookup(xs:QName('zip:binary-entry', 2) return if
|
|
(exists($f)) then $f($href, $entry) else ()</code> returns the
|
|
result of calling <code>zip:binary-entry($href, $entry)</code> if
|
|
the function is available, or an empty sequence otherwise.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-function-name" id="func-function-name"></a>16.1.2
|
|
fn:function-name</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the name of the function identified by a function
|
|
item.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:function-name</code>(<code class=
|
|
"arg">$func</code><code class=
|
|
"as"> as </code><code class="type">function(*)</code>)<code class="as"> as </code><code class="return-type">xs:QName?</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>$func</code> refers to a named function,
|
|
<code>fn:function-name($func)</code> returns the name of that
|
|
function.</p>
|
|
<p>Otherwise (<code>$func</code> refers to an anonymous function),
|
|
<code>fn:function-name($func)</code> returns an empty sequence.</p>
|
|
<p>The prefix part of the returned QName 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>The expression <code>fn:function-name(fn:substring#2)</code>
|
|
returns <a href=
|
|
"#func-QName"><code>fn:QName("http://www.w3.org/2005/xpath-functions",
|
|
"fn:substring")</code></a>. <em>(The namespace prefix of the
|
|
returned QName is not predictable.).</em></p>
|
|
<p>The expression
|
|
<code>fn:function-name(function($node){count($node/*)})</code>
|
|
returns <code>()</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-function-arity" id=
|
|
"func-function-arity"></a>16.1.3 fn:function-arity</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns the arity of the function identified by a function
|
|
item.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:function-arity</code>(<code class=
|
|
"arg">$func</code><code class=
|
|
"as"> as </code><code class="type">function(*)</code>)<code class="as"> as </code><code class="return-type">xs:integer</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 <code>fn:function-arity</code> function returns the arity
|
|
(number of arguments) of the function identified by
|
|
<code>$func</code>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:function-arity(fn:substring#2)</code>
|
|
returns <code>2</code>.</p>
|
|
<p>The expression
|
|
<code>fn:function-arity(function($node){name($node)})</code>
|
|
returns <code>1</code>.</p>
|
|
<p>The expression <code>let $initial := fn:substring(?, 1, 1)
|
|
return fn:function-arity($initial)</code> returns
|
|
<code>1</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="basic-hofs" id="basic-hofs"></a>16.2 Basic
|
|
higher-order functions</h3>
|
|
<p>The following functions take function items as an argument.</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-map"><code>fn:map</code></a></td>
|
|
<td>Applies the function item <var>$f</var> to every item from the
|
|
sequence <var>$seq</var> in turn, returning the concatenation of
|
|
the resulting sequences in order.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-filter"><code>fn:filter</code></a></td>
|
|
<td>Returns those items from the sequence <var>$seq</var> for which
|
|
the supplied function <var>$f</var> returns true.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-fold-left"><code>fn:fold-left</code></a></td>
|
|
<td>Processes the supplied sequence from left to right, applying
|
|
the supplied function repeatedly to each item in turn, together
|
|
with an accumulated result value.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-fold-right"><code>fn:fold-right</code></a></td>
|
|
<td>Processes the supplied sequence from right to left, applying
|
|
the supplied function repeatedly to each item in turn, together
|
|
with an accumulated result value.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><a href="#func-map-pairs"><code>fn:map-pairs</code></a></td>
|
|
<td>Applies the function item <var>$f</var> to successive pairs of
|
|
items taken one from <var>$seq1</var> and one from
|
|
<var>$seq2</var>, returning the concatenation of the resulting
|
|
sequences in order.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="func-map" id="func-map"></a>16.2.1 fn:map</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Applies the function item <var>$f</var> to every item from the
|
|
sequence <var>$seq</var> in turn, returning the concatenation of
|
|
the resulting sequences in order.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:map</code>(<code class="arg">$f</code><code class=
|
|
"as"> as </code><code class="type">function(item()) as
|
|
item()*</code>, <code class="arg">$seq</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">item()*</code>)<code class=
|
|
"as"> as </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 effect of the function is equivalent to the following
|
|
implementation in XQuery:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function fn:map($f, $seq) {
|
|
if (fn:empty($seq))
|
|
then ()
|
|
else $f(fn:head($seq)), fn:map($f, fn:tail($seq))
|
|
};
|
|
</pre></div>
|
|
<p>or its equivalent in XSLT:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="fn:map">
|
|
<xsl:param name="f"/>
|
|
<xsl:param name="seq/>
|
|
<xsl:if test="fn:exists($seq)">
|
|
<xsl:sequence select="$f(fn:head($seq)), fn:map($f, fn:tail($seq))"/>
|
|
</xsl:if>
|
|
</xsl:function>
|
|
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The function call <code>fn:map($F, $SEQ)</code> is equivalent to
|
|
the expression <code>for $i in $SEQ return $F($i)</code><span>,
|
|
assuming that ordering mode is <code>ordered</code>.</span></p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:map(function($a) { $a * $a }, 1 to
|
|
5)</code> returns <code>(1, 4, 9, 16, 25)</code>.</p>
|
|
<p>The expression <code>fn:map(fn:string-to-codepoints#1, ("john",
|
|
"jane"))</code> returns <code>(106, 111, 104, 110, 106, 97, 110,
|
|
101)</code>.</p>
|
|
<p>The expression <code>fn:map(xs:int#1, ("23", "29"))</code>
|
|
returns <code>(23, 29)</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-filter" id="func-filter"></a>16.2.2
|
|
fn:filter</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Returns those items from the sequence <var>$seq</var> for which
|
|
the supplied function <var>$f</var> returns true.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:filter</code>(<code class="arg">$f</code><code class=
|
|
"as"> as </code><code class="type">function(item()) as
|
|
xs:boolean</code>, <code class="arg">$seq</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">item()*</code>)<code class=
|
|
"as"> as </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 effect of the function is equivalent to the following
|
|
implementation in XQuery:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function fn:filter(
|
|
$f as function(item()) as xs:boolean,
|
|
$seq as item()*)
|
|
as item()* {
|
|
if (fn:empty($seq))
|
|
then ()
|
|
else ( fn:head($seq)[$f(.) eq fn:true()],
|
|
fn:filter($f, fn:tail($seq))
|
|
)
|
|
};
|
|
</pre></div>
|
|
<p>or its equivalent in XSLT:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="fn:filter" as="item()*">
|
|
<xsl:param name="f" as="function(item()) as xs:boolean"/>
|
|
<xsl:param name="seq" as="item()*"/>
|
|
<xsl:if test="fn:exists($seq)">
|
|
<xsl:sequence select="fn:head($seq)[$f(.) eq fn:true()], fn:filter($f, fn:tail($seq))"/>
|
|
</xsl:if>
|
|
</xsl:function>
|
|
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>As a consequence of the function signature and the function
|
|
calling rules, a type error occurs if the supplied function
|
|
<var>$f</var> returns anything other than a single
|
|
<code>xs:boolean</code> item; there is no conversion to an
|
|
effective boolean value.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>The function call <code>fn:filter($F, $SEQ)</code> has a very
|
|
similar effect to the expression <code>$SEQ[$F(.)]</code>. There
|
|
are some differences, however. In the case of
|
|
<code>fn:filter</code>, the function <code>$F</code> is required to
|
|
return a boolean; there is no special treatment for numeric
|
|
predicate values, and no conversion to an effective boolean value.
|
|
Also, with a filter expression <code>$SEQ[$F(.)]</code>, the focus
|
|
within the predicate is different from that outside; this means
|
|
that the use of a context-sensitive function such as <a href=
|
|
"#func-lang"><code>fn:lang#1</code></a> will give different results
|
|
in the two cases.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:filter(function($a) {$a mod 2 = 0}, 1 to
|
|
10)</code> returns <code>(2, 4, 6, 8, 10)</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-fold-left" id="func-fold-left"></a>16.2.3
|
|
fn:fold-left</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Processes the supplied sequence from left to right, applying the
|
|
supplied function repeatedly to each item in turn, together with an
|
|
accumulated result value.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<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:fold-left</code>(</td>
|
|
<td valign="baseline"><code class="arg">$f</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">function(item()*,
|
|
item()) as item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$zero</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$seq</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">item()*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">item()*</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>The effect of the function is equivalent to the following
|
|
implementation in XQuery:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function fn:fold-left(
|
|
$f as function(item()*, item()) as item()*,
|
|
$zero as item()*,
|
|
$seq as item()*)
|
|
as item()* {
|
|
if (fn:empty($seq))
|
|
then $zero
|
|
else fn:fold-left($f, $f($zero, fn:head($seq)), fn:tail($seq))
|
|
};
|
|
</pre></div>
|
|
<p>or its equivalent in XSLT:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="fn:fold-left" as="item()*">
|
|
<xsl:param name="f" as="function(item()*, item()) as item()*"/>
|
|
<xsl:param name="zero" as="item()*"/>
|
|
<xsl:param name="seq" as="item()*"/>
|
|
<xsl:choose>
|
|
<xsl:when test="fn:empty($seq)">
|
|
<xsl:sequence select="$zero"/>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:sequence select="fn:fold-left($f, $f($zero, fn:head($seq)), fn:tail($seq))"/>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:function>
|
|
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>As a consequence of the function signature and the function
|
|
calling rules, a type error occurs if the supplied function
|
|
<var>$f</var> cannot be applied to two arguments, where the first
|
|
argument is either the value of <var>$zero</var> or the result of a
|
|
previous application of <var>$f</var>, and the second is
|
|
<var>$seq</var> or any trailing subsequence of <var>$seq</var>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>This operation is often referred to in the functional
|
|
programming literature as "folding" or "reducing" a sequence. It
|
|
takes a function that operates on a pair of values, and applies it
|
|
repeatedly, with an accumulated result as the first argument, and
|
|
the next item in the sequence as the second argument. The
|
|
accumulated result is initially set to the value of the
|
|
<var>$zero</var> argument, which is conventionally a value (such as
|
|
zero in the case of addition, one in the case of multiplication, or
|
|
a zero-length string in the case of string concatenation) that
|
|
causes the function to return the value of the other argument
|
|
unchanged.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:fold-left(function($a, $b) { $a + $b },
|
|
0, 1 to 5)</code> returns <code>15</code>. <em>(This returns the
|
|
sum of the items in the sequence).</em></p>
|
|
<p>The expression <code>fn:fold-left(function($a, $b) { $a * $b },
|
|
1, (2,3,5,7))</code> returns <code>210</code>. <em>(This returns
|
|
the product of the items in the sequence).</em></p>
|
|
<p>The expression <code>fn:fold-left(function($a, $b) { $a or $b },
|
|
false(), (true(), false(), false()))</code> returns
|
|
<code>true()</code>. <em>(This returns true if any item in the
|
|
sequence has an effective boolean value of true).</em></p>
|
|
<p>The expression <code>fn:fold-left(function($a, $b) { $a and $b
|
|
}, false(), (true(), false(), false()))</code> returns
|
|
<code>false()</code>. <em>(This returns true only if every item in
|
|
the sequence has an effective boolean value of true).</em></p>
|
|
<p>The expression <code>fn:fold-left(function($a, $b) {($b, $a)},
|
|
(), 1 to 5)</code> returns <code>(5,4,3,2,1)</code>. <em>(This
|
|
reverses the order of the items in a sequence).</em></p>
|
|
<p>The expression <code>fn:fold-left(fn:concat(?, ".", ?), "", 1 to
|
|
5)</code> returns <code>".1.2.3.4.5"</code>.</p>
|
|
<p>The expression <code>fn:fold-left(fn:concat("$f(", ?, ", ", ?,
|
|
")"), "$zero", 1 to 5)</code> returns <code>"$f($f($f($f($f($zero,
|
|
1), 2), 3), 4), 5)"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-fold-right" id="func-fold-right"></a>16.2.4
|
|
fn:fold-right</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Processes the supplied sequence from right to left, applying the
|
|
supplied function repeatedly to each item in turn, together with an
|
|
accumulated result value.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<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:fold-right</code>(</td>
|
|
<td valign="baseline"><code class="arg">$f</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">function(item(),
|
|
item()*) as item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$zero</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$seq</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">item()*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">item()*</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>The effect of the function is equivalent to the following
|
|
implementation in XQuery:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function fn:fold-right(
|
|
$f as function(item(), item()*) as item()*,
|
|
$zero as item()*,
|
|
$seq as item()*)
|
|
as item()* {
|
|
if (fn:empty($seq))
|
|
then $zero
|
|
else $f(fn:head($seq), fn:fold-right($f, $zero, fn:tail($seq)))
|
|
};
|
|
</pre></div>
|
|
<p>or its equivalent in XSLT:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="fn:fold-right" as="item()*">
|
|
<xsl:param name="f" as="function(item(), item()*) as item()*"/>
|
|
<xsl:param name="zero" as="item()*"/>
|
|
<xsl:param name="seq" as="item()*"/>
|
|
<xsl:choose>
|
|
<xsl:when test="fn:empty($seq)">
|
|
<xsl:sequence select="$zero"/>
|
|
</xsl:when>
|
|
<xsl:otherwise>
|
|
<xsl:sequence select="$f(fn:head($seq), fn:fold-right($f, $zero, fn:tail($seq))"/>
|
|
</xsl:otherwise>
|
|
</xsl:choose>
|
|
</xsl:function>
|
|
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Error Conditions</dt>
|
|
<dd>
|
|
<p>As a consequence of the function signature and the function
|
|
calling rules, a type error occurs if the supplied function
|
|
<var>$f</var> cannot be applied to two arguments, where the first
|
|
argument is any item in the sequence <var>$seq</var>, and the
|
|
second is either the value of <var>$zero</var> or the result of a
|
|
previous application of <var>$f</var>.</p>
|
|
</dd>
|
|
<dt class="label">Notes</dt>
|
|
<dd>
|
|
<p>This operation is often referred to in the functional
|
|
programming literature as "folding" or "reducing" a sequence. It
|
|
takes a function that operates on a pair of values, and applies it
|
|
repeatedly, with the next item in the sequence as the first
|
|
argument, and the result of processing the remainder of the
|
|
sequence as the second argument. The accumulated result is
|
|
initially set to the value of the <var>$zero</var> argument, which
|
|
is conventionally a value (such as zero in the case of addition,
|
|
one in the case of multiplication, or a zero-length string in the
|
|
case of string concatenation) that causes the function to return
|
|
the value of the other argument unchanged.</p>
|
|
<p>In cases where the function performs an associative operation on
|
|
its two arguments (such as addition or multiplication),
|
|
<code>fn:fold-right</code> produces the same result as <a href=
|
|
"#func-fold-left"><code>fn:fold-left</code></a>.</p>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:fold-right(function($a, $b) { $a + $b },
|
|
0, 1 to 5)</code> returns <code>15</code>. <em>(This returns the
|
|
sum of the items in the sequence).</em></p>
|
|
<p>The expression <code>fn:fold-right(fn:concat(?, ".", ?), "", 1
|
|
to 5)</code> returns <code>"1.2.3.4.5."</code>.</p>
|
|
<p>The expression <code>fn:fold-right(concat("$f(", ?, ", ", ?,
|
|
")"), "$zero", 1 to 5)</code> returns <code>"$f(1, $f(2, $f(3,
|
|
$f(4, $f(5, $zero)))))"</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="func-map-pairs" id="func-map-pairs"></a>16.2.5
|
|
fn:map-pairs</h4>
|
|
<dl>
|
|
<dt class="label">Summary</dt>
|
|
<dd>
|
|
<p>Applies the function item <var>$f</var> to successive pairs of
|
|
items taken one from <var>$seq1</var> and one from
|
|
<var>$seq2</var>, returning the concatenation of the resulting
|
|
sequences in order.</p>
|
|
</dd>
|
|
<dt class="label">Signature</dt>
|
|
<dd>
|
|
<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:map-pairs</code>(</td>
|
|
<td valign="baseline"><code class="arg">$f</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">function(item(),
|
|
item()) as item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$seq1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">item()*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$seq2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">item()*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">item()*</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>The effect of the function is equivalent to the following
|
|
implementation in XQuery:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function fn:map-pairs($f, $seq1, $seq2)
|
|
{
|
|
if(fn:exists($seq1) and fn:exists($seq2))
|
|
then (
|
|
$f(fn:head($seq1), fn:head($seq2)),
|
|
fn:map-pairs($f, fn:tail($seq1), fn:tail($seq2))
|
|
)
|
|
else ()
|
|
};
|
|
</pre></div>
|
|
<p>or its equivalent in XSLT:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="fn:map-pairs">
|
|
<xsl:param name="f"/>
|
|
<xsl:param name="seq1/>
|
|
<xsl:param name="seq2/>
|
|
<xsl:if test="fn:exists($seq1) and fn:exists($seq2">
|
|
<xsl:sequence select="$f(fn:head($seq1), fn:head($seq2))"/>
|
|
<xsl:sequence select="fn:map-pairs($f, fn:tail($seq1), fn:tail($seq2))"/>
|
|
</xsl:if>
|
|
</xsl:function>
|
|
|
|
</pre></div>
|
|
</dd>
|
|
<dt class="label">Examples</dt>
|
|
<dd>
|
|
<p>The expression <code>fn:map-pairs(concat#2, ("a", "b", "c"),
|
|
("x", "y", "z"))</code> returns <code>("ax", "by",
|
|
"cz")</code>.</p>
|
|
<p>The expression <code>fn:map-pairs(function($a, $b){10*$a + $b},
|
|
1 to 5, 1 to 5)</code> returns <code>(11, 22, 33, 44,
|
|
55)</code>.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="constructor-functions" id=
|
|
"constructor-functions"></a>17 Constructor functions</h2>
|
|
<div class="div2">
|
|
<h3><a name="constructor-functions-for-xsd-types" id=
|
|
"constructor-functions-for-xsd-types"></a>17.1 Constructor
|
|
functions for XML Schema built-in types</h3>
|
|
<p>Every built-in atomic type that is defined in <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>,
|
|
except <code>xs:anyAtomicType</code> and <code>xs:NOTATION</code>,
|
|
has an associated constructor function.
|
|
<code>xs:untypedAtomic</code>, defined in <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#types">Section 2.7 Schema
|
|
Information</a> <sup><small>DM30</small></sup> and the two derived
|
|
types <code>xs:yearMonthDuration</code> and
|
|
<code>xs:dayTimeDuration</code> defined in <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#types">Section 2.7 Schema
|
|
Information</a> <sup><small>DM30</small></sup> also have associated
|
|
constructor functions. <span>Implementations <strong>may</strong>
|
|
additionally provide constructor functions for new data types
|
|
introduced in <a href="#xmlschema11-2">[XML Schema 1.1 Part 2:
|
|
Datatypes]</a>.</span></p>
|
|
<p>A constructor function is not defined for
|
|
<code>xs:anyAtomicType</code> as there are no atomic values with
|
|
type annotation <code>xs:anyAtomicType</code> at runtime, although
|
|
this can be a statically inferred type. A constructor function is
|
|
not defined for <code>xs:NOTATION</code> since it is defined as an
|
|
abstract type in <a href="#xmlschema-2">[XML Schema Part 2:
|
|
Datatypes Second Edition]</a>. If the static context (See <a href=
|
|
"http://www.w3.org/TR/xpath-30/#static_context">Section 2.1.1
|
|
Static Context</a> <sup><small>XP30</small></sup>) contains a type
|
|
derived from <code>xs:NOTATION</code> then a constructor function
|
|
is defined for it. See <a href=
|
|
"#constructor-functions-for-user-defined-types"><b>17.3 Constructor
|
|
functions for user-defined types</b></a>.</p>
|
|
<p>The form of the constructor function for a type
|
|
<em>prefix:TYPE</em> is:</p>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:prefix:TYPE</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">prefix:TYPE?</code></div>
|
|
</div>
|
|
<p>If <code>$arg</code> is the empty sequence, the empty sequence
|
|
is returned. For example, the signature of the constructor function
|
|
corresponding to the <code>xs:unsignedInt</code> type defined in
|
|
<a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a> is:</p>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:unsignedInt</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:unsignedInt?</code></div>
|
|
</div>
|
|
<p>Calling the constructor function <code>xs:unsignedInt(12)</code>
|
|
returns the <code>xs:unsignedInt</code> value 12. Another call of
|
|
that constructor function that returns the same
|
|
<code>xs:unsignedInt</code> value is
|
|
<code>xs:unsignedInt("12")</code>. The same result would also be
|
|
returned if the constructor function were to be called with a node
|
|
that had a typed value equal to the <code>xs:unsignedInt</code> 12.
|
|
The standard features described in <a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-atomization">Section 2.4.2
|
|
Atomization</a> <sup><small>XP30</small></sup> would atomize the
|
|
node to extract its typed value and then call the constructor with
|
|
that value. If the value passed to a constructor is not in the
|
|
lexical space of the datatype to be constructed, and cannot be
|
|
converted to a value in the value space of the datatype under the
|
|
rules in this specification, then an error is raised [<a href=
|
|
"#ERRFORG0001" title="err:FORG0001">err:FORG0001</a>].</p>
|
|
<p>The semantics of the constructor function "
|
|
<code>xs:TYPE(arg)</code> " are identical to the semantics of "
|
|
<code>arg</code> cast as <code>xs:TYPE?</code> ". See <a href=
|
|
"#casting"><b>18 Casting</b></a>.</p>
|
|
<p>If the argument to a constructor function is a literal, the
|
|
result of the function <strong>may</strong> be evaluated
|
|
statically; if an error is found during such evaluation, it may be
|
|
reported as a static error.</p>
|
|
<p>Special rules apply to constructor functions for
|
|
<code>xs:QName</code> and types derived from <code>xs:QName</code>
|
|
and <code>xs:NOTATION</code>. See <a href=
|
|
"#constructor-qname-notation"><b>17.2 Constructor functions for
|
|
xs:QName and xs:NOTATION</b></a>.</p>
|
|
<p>The following constructor functions for the built-in types are
|
|
supported:</p>
|
|
<ul>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:string</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:boolean</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:decimal</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:decimal?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:float</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:float?</code></div>
|
|
<p>Implementations <strong>should</strong> return negative zero for
|
|
<code>xs:float("-0.0E0")</code>. But because <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
does not distinguish between the values positive zero and negative
|
|
zero. implementations <a title="may" class="termref" href=
|
|
"#may"><span class="arrow">·</span>may<span class=
|
|
"arrow">·</span></a> return positive zero in this case.</p>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:double</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:double?</code></div>
|
|
<p>Implementations <strong>should</strong> return negative zero for
|
|
<code>xs:double("-0.0E0")</code>. But because <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
does not distinguish between the values positive zero and negative
|
|
zero. implementations <a title="may" class="termref" href=
|
|
"#may"><span class="arrow">·</span>may<span class=
|
|
"arrow">·</span></a> return positive zero in this case.</p>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:duration</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:duration?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:dateTime</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dateTime?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:time</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:time?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:date</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:date?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:gYearMonth</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:gYearMonth?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:gYear</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:gYear?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:gMonthDay</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:gMonthDay?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:gDay</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:gDay?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:gMonth</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:gMonth?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:hexBinary</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:hexBinary?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:base64Binary</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:base64Binary?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:anyURI</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyURI?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:QName</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:QName?</code></div>
|
|
<p>See <a href="#constructor-qname-notation"><b>17.2 Constructor
|
|
functions for xs:QName and xs:NOTATION</b></a> for special
|
|
rules.</p>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:normalizedString</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:normalizedString?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:token</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:token?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:language</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:language?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:NMTOKEN</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:NMTOKEN?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:Name</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:Name?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:NCName</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:NCName?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class="function">fn:ID</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:ID?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:IDREF</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:IDREF?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:ENTITY</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:ENTITY?</code></div>
|
|
<p>See <a href="#casting-to-ENTITY"><b>18.1.9 Casting to
|
|
xs:ENTITY</b></a> for rules related to constructing values of type
|
|
<code>xs:ENTITY</code> and types derived from it.</p>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:integer</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:nonPositiveInteger</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:nonPositiveInteger?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:negativeInteger</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:negativeInteger?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:long</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:long?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:int</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:int?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:short</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:short?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:byte</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:byte?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:nonNegativeInteger</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:nonNegativeInteger?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:unsignedLong</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:unsignedLong?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:unsignedInt</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:unsignedInt?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:unsignedShort</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:unsignedShort?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:unsignedByte</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:unsignedByte?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:positiveInteger</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:positiveInteger?</code></div>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:yearMonthDuration</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:yearMonthDuration?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:dayTimeDuration</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dayTimeDuration?</code></div>
|
|
</li>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:untypedAtomic</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:untypedAtomic?</code></div>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li>
|
|
<div class="proto"><code class=
|
|
"function">fn:dateTimeStamp</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:dateTimeStamp?</code></div>
|
|
<p><em>Available only if the implementation supports XSD
|
|
1.1.</em></p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="constructor-qname-notation" id=
|
|
"constructor-qname-notation"></a>17.2 Constructor functions for
|
|
xs:QName and xs:NOTATION</h3>
|
|
<p>Special rules apply to constructor functions for the types
|
|
<code>xs:QName</code> and <code>xs:NOTATION</code>, for two
|
|
reasons:</p>
|
|
<ul>
|
|
<li>
|
|
<p>Values cannot belong directly to the type
|
|
<code>xs:NOTATION</code>, only to its subtypes.</p>
|
|
</li>
|
|
<li>
|
|
<p>The lexical representation of these types uses namespace
|
|
prefixes, whose meaning is context-dependent.</p>
|
|
</li>
|
|
</ul>
|
|
<p>These constraints result in the following rules:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>There is no constructor function for <code>xs:NOTATION</code>.
|
|
Constructors are defined, however, for <code>xs:QName</code>, for
|
|
types derived from <code>xs:QName</code>, and for types derived
|
|
from <code>xs:NOTATION</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>When converting from an <code>xs:string</code>, the prefix
|
|
within the lexical <code>xs:QName</code> supplied as the argument
|
|
is resolved to a namespace URI using the statically known
|
|
namespaces from the static context. If the lexical
|
|
<code>xs:QName</code> has no prefix, the namespace URI of the
|
|
resulting expanded-QName is the default element/type namespace from
|
|
the static context. Components of the static context are defined in
|
|
<a href="http://www.w3.org/TR/xpath-30/#static_context">Section
|
|
2.1.1 Static Context</a> <sup><small>XP30</small></sup>. A static
|
|
error is raised [<a href="#ERRFONS0004" title=
|
|
"err:FONS0004">err:FONS0004</a>] if the prefix is not bound in the
|
|
static context. As described in <a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/#terminology">Section 2.1
|
|
Terminology</a> <sup><small>DM30</small></sup>, the supplied prefix
|
|
is retained as part of the expanded-QName value.</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="constructor-functions-for-user-defined-types" id=
|
|
"constructor-functions-for-user-defined-types"></a>17.3 Constructor
|
|
functions for user-defined types</h3>
|
|
<p><span>For every user-defined simple type in the static context
|
|
(See <a href=
|
|
"http://www.w3.org/TR/xpath-30/#static_context">Section 2.1.1
|
|
Static Context</a> <sup><small>XP30</small></sup>)</span>, there is
|
|
a constructor function whose name is the same as the name of the
|
|
type and whose effect is to create a value of that type from the
|
|
supplied argument. The rules for constructing user-defined types
|
|
are defined in the same way as the rules for constructing built-in
|
|
derived types defined in <a href=
|
|
"#constructor-functions-for-xsd-types"><b>17.1 Constructor
|
|
functions for XML Schema built-in types</b></a>.</p>
|
|
<p>Special rules apply to constructor functions for
|
|
namespace-sensitive types, that is, atomic types derived from
|
|
<code>xs:QName</code> and <code>xs:NOTATION</code>, list types that
|
|
have a namespace-sensitive item type, and union types that have a
|
|
namespace-sensitive member type. See <a href=
|
|
"#constructor-qname-notation"><b>17.2 Constructor functions for
|
|
xs:QName and xs:NOTATION</b></a>.</p>
|
|
<p>Consider a situation where the static context contains a type
|
|
called <code>hatSize</code> defined in a schema whose target
|
|
namespace is bound to the prefix <code>my</code>. In such a case
|
|
the following constructor function is available to users:</p>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:my:hatSize</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">my:hatSize?</code></div>
|
|
</div>
|
|
<p>To construct an instance of <span>a user-defined</span> type
|
|
that is not in a namespace, it is necessary to use a cast
|
|
expression or undeclare the default function namespace. For
|
|
example, if the user-defined type <code>apple</code> is derived
|
|
from <code>xs:integer</code> but is not in a namespace, an instance
|
|
of this type can be constructed as follows using a cast expression
|
|
(this requires that the default element/type namespace is no
|
|
namespace):</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
17 cast as apple
|
|
</pre></div>
|
|
<p>The following shows the use of the constructor function:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare default function namespace ""; apple(17)
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="casting" id="casting"></a>18 Casting</h2>
|
|
<p>Constructor functions and cast expressions accept an expression
|
|
and return a value of a given type. They both convert a source
|
|
value, <em>SV</em>, of a source type, <em>ST</em>, to a target
|
|
value, <em>TV</em>, of the given target type, <em>TT</em>, with
|
|
identical semantics and different syntax. The name of the
|
|
constructor function is the same as the name of the built-in
|
|
<a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a> datatype or the datatype 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 <a href=
|
|
"#xpath-datamodel-30">[XQuery and XPath Data Model (XDM) 3.0]</a>
|
|
(see <a href="#constructor-functions-for-xsd-types"><b>17.1
|
|
Constructor functions for XML Schema built-in types</b></a>) or the
|
|
user-derived datatype (see <a href=
|
|
"#constructor-functions-for-user-defined-types"><b>17.3 Constructor
|
|
functions for user-defined types</b></a>) that is the target for
|
|
the conversion, and the semantics are exactly the same as for a
|
|
cast expression; for example," <code>xs:date("2003-01-01")</code> "
|
|
means exactly the same as " <code>"2003-01-01"</code> cast as
|
|
<code>xs:date?</code> ".</p>
|
|
<p>The cast expression takes a type name to indicate the target
|
|
type of the conversion. See <a href=
|
|
"http://www.w3.org/TR/xpath-30/#id-cast">Section 3.13.2 Cast</a>
|
|
<sup><small>XP30</small></sup>. If the type name allows the empty
|
|
sequence and the expression to be cast is the empty sequence, the
|
|
empty sequence is returned. If the type name does not allow the
|
|
empty sequence and the expression to be cast is the empty sequence,
|
|
a type error is raised [<a href=
|
|
"http://www.w3.org/TR/xpath20/#ERRXPTY0004" title=
|
|
"err:XPTY0004">err:XPTY0004</a>]<sup><small>XP</small></sup>.</p>
|
|
<p>Where the argument to a cast is a literal, the result of the
|
|
function <strong>may</strong> be evaluated statically; if an error
|
|
is encountered during such evaluation, it <strong>may</strong> be
|
|
reported as a static error.</p>
|
|
<p>The general rules for casting from primitive types to primitive
|
|
types are defined in <a href=
|
|
"#casting-from-primitive-to-primitive"><b>18.1 Casting from
|
|
primitive types to primitive types</b></a>, and subsections
|
|
describe the rules for specific target types. The general rules for
|
|
casting from <code>xs:string</code> (and
|
|
<code>xs:untypedAtomic</code>) follow in <a href=
|
|
"#casting-from-strings"><b>18.2 Casting from xs:string and
|
|
xs:untypedAtomic</b></a>. Casting to non-primitive types, including
|
|
atomic types derived by resctriction, union types, and list types,
|
|
is described in <a href="#casting-non-primitive-types"><b>18.3
|
|
Casting involving non-primitive types</b></a>. Casting from derived
|
|
types is defined in <a href=
|
|
"#casting-from-derived-to-parent"><b>18.3.2 Casting from derived
|
|
types to parent types</b></a>, <a href=
|
|
"#casting-within-branch"><b>18.3.3 Casting within a branch of the
|
|
type hierarchy</b></a> and <a href=
|
|
"#casting-across-hierarchy"><b>18.3.4 Casting across the type
|
|
hierarchy</b></a>.</p>
|
|
<p>When casting from <code>xs:string</code> or
|
|
<code>xs:untypedAtomic</code> the semantics in <a href=
|
|
"#casting-from-strings"><b>18.2 Casting from xs:string and
|
|
xs:untypedAtomic</b></a> apply, regardless of target type.</p>
|
|
<div class="div2">
|
|
<h3><a name="casting-from-primitive-to-primitive" id=
|
|
"casting-from-primitive-to-primitive"></a>18.1 Casting from
|
|
primitive types to primitive types</h3>
|
|
<p>This section defines casting between the 19 primitive types
|
|
defined in <a href="#xmlschema-2">[XML Schema Part 2: Datatypes
|
|
Second Edition]</a> as well as <code>xs:untypedAtomic</code>,
|
|
<code>xs:integer</code> and the two derived types of
|
|
<code>xs:duration</code> (<code>xs:yearMonthDuration</code> and
|
|
<code>xs:dayTimeDuration</code>). These four types are not
|
|
primitive types but they are treated as primitive types in this
|
|
section. The type conversions that are supported between primitive
|
|
atomic types are indicated in the table below; casts between other
|
|
(non-primitive) types are defined in terms of these primitives.</p>
|
|
<p>In this table, there is a row for each primitive type acting as
|
|
the source of the conversion and there is a column for each
|
|
primitive type acting as the target of the conversion. The
|
|
intersections of rows and columns contain one of three characters:
|
|
"Y" indicates that a conversion from values of the type to which
|
|
the row applies to the type to which the column applies is
|
|
supported; "N" indicates that there are no supported conversions
|
|
from values of the type to which the row applies to the type to
|
|
which the column applies; and "M" indicates that a conversion from
|
|
values of the type to which the row applies to the type to which
|
|
the column applies may succeed for some values in the value space
|
|
and fail for others.</p>
|
|
<p><a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a> defines <code>xs:NOTATION</code> as an abstract type.
|
|
Thus, casting to <code>xs:NOTATION</code> from any other type
|
|
including <code>xs:NOTATION</code> is not permitted and raises
|
|
[<a href="http://www.w3.org/TR/xpath20/#ERRXPST0080" title=
|
|
"err:XPST0080">err:XPST0080</a>]<sup><small>XP</small></sup>.
|
|
However, casting from one subtype of <code>xs:NOTATION</code> to
|
|
another subtype of <code>xs:NOTATION</code> is permitted.</p>
|
|
<p>Casting is not supported to or from
|
|
<code>xs:anySimpleType</code>. Thus, there is no row or column for
|
|
this type in the table below. For any node that has not been
|
|
validated or has been validated as <code>xs:anySimpleType</code>,
|
|
the typed value of the node is an atomic value of type
|
|
<code>xs:untypedAtomic</code>. There are no atomic values with the
|
|
type annotation <code>xs:anySimpleType</code> at runtime. Casting
|
|
to a type that is not atomic raises [<a href=
|
|
"http://www.w3.org/TR/xpath20/#ERRXPST0051" title=
|
|
"err:XPST0051">err:XPST0051</a>]<sup><small>XP</small></sup>.</p>
|
|
<p>Similarly, casting is not supported to or from
|
|
<code>xs:anyAtomicType</code> and will raise error [<a href=
|
|
"http://www.w3.org/TR/xpath20/#ERRXPST0080" title=
|
|
"err:XPST0080">err:XPST0080</a>]<sup><small>XP</small></sup>. There
|
|
are no atomic values with the type annotation
|
|
<code>xs:anyAtomicType</code> at runtime, although this can be a
|
|
statically inferred type.</p>
|
|
<p>If casting is attempted from an <em>ST</em> to a <em>TT</em> for
|
|
which casting is not supported, as defined in the table below, a
|
|
type error is raised [<a href=
|
|
"http://www.w3.org/TR/xpath20/#ERRXPTY0004" title=
|
|
"err:XPTY0004">err:XPTY0004</a>]<sup><small>XP</small></sup>.</p>
|
|
<p>In the following table, the columns and rows are identified by
|
|
short codes that identify simple types as follows:</p>
|
|
<blockquote>
|
|
<p>uA = xs:untypedAtomic<br />
|
|
aURI = xs:anyURI<br />
|
|
b64 = xs:base64Binary<br />
|
|
bool = xs:boolean<br />
|
|
dat = xs:date<br />
|
|
gDay = xs:gDay<br />
|
|
dbl = xs:double<br />
|
|
dec = xs:decimal<br />
|
|
dT = xs:dateTime<br />
|
|
dTD = xs:dayTimeDuration<br />
|
|
dur = xs:duration<br />
|
|
flt = xs:float<br />
|
|
hxB = xs:hexBinary<br />
|
|
gMD = xs:gMonthDay<br />
|
|
gMon = xs:gMonth<br />
|
|
int = xs:integer<br />
|
|
NOT = xs:NOTATION<br />
|
|
QN = xs:QName<br />
|
|
str = xs:string<br />
|
|
tim = xs:time<br />
|
|
gYM = xs:gYearMonth<br />
|
|
yMD = xs:yearMonthDuration<br />
|
|
gYr = xs:gYear</p>
|
|
</blockquote>
|
|
<p>In the following table, the notation "S\T" indicates that the
|
|
source ("S") of the conversion is indicated in the column below the
|
|
notation and that the target ("T") is indicated in the row to the
|
|
right of the notation.</p>
|
|
<table class="casting" summary="Casting table" border="1"
|
|
cellpadding="1" id="casting-to-primitives-table">
|
|
<col width="5%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<col width="3%" span="1" />
|
|
<thead>
|
|
<tr>
|
|
<th><span class="cancast" title="S\T">S\T</span></th>
|
|
<th><span class="cancast" title="untypedAtomic">uA</span></th>
|
|
<th><span class="cancast" title="string">str</span></th>
|
|
<th><span class="cancast" title="float">flt</span></th>
|
|
<th><span class="cancast" title="double">dbl</span></th>
|
|
<th><span class="cancast" title="decimal">dec</span></th>
|
|
<th><span class="cancast" title="integer">int</span></th>
|
|
<th><span class="cancast" title="duration">dur</span></th>
|
|
<th><span class="cancast" title="yearMonthDuration">yMD</span></th>
|
|
<th><span class="cancast" title="dayTimeDuration">dTD</span></th>
|
|
<th><span class="cancast" title="dateTime">dT</span></th>
|
|
<th><span class="cancast" title="time">tim</span></th>
|
|
<th><span class="cancast" title="date">dat</span></th>
|
|
<th><span class="cancast" title="gYearMonth">gYM</span></th>
|
|
<th><span class="cancast" title="gYear">gYr</span></th>
|
|
<th><span class="cancast" title="gMonthDay">gMD</span></th>
|
|
<th><span class="cancast" title="gDay">gDay</span></th>
|
|
<th><span class="cancast" title="gMonth">gMon</span></th>
|
|
<th><span class="cancast" title="boolean">bool</span></th>
|
|
<th><span class="cancast" title="base64Binary">b64</span></th>
|
|
<th><span class="cancast" title="hexBinary">hxB</span></th>
|
|
<th><span class="cancast" title="anyURI">aURI</span></th>
|
|
<th><span class="cancast" title="QName">QN</span></th>
|
|
<th><span class="cancast" title="NOTATION">NOT</span></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<th><span class="cancast" title="untypedAtomic">uA</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast untypedAtomic to string? Yes">Y</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast untypedAtomic to float? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast untypedAtomic to double? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to decimal? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to integer? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to duration? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to yearMonthDuration? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to dayTimeDuration? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to dateTime? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast untypedAtomic to time? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast untypedAtomic to date? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to gYearMonth? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast untypedAtomic to gYear? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to gMonthDay? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast untypedAtomic to gDay? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast untypedAtomic to gMonth? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to boolean? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to base64Binary? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to hexBinary? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast untypedAtomic to anyURI? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast untypedAtomic to QName? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast untypedAtomic to NOTATION? Maybe">M</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="string">str</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to string? Yes">Y</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to float? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to double? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to decimal? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to integer? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to duration? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast string to yearMonthDuration? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast string to dayTimeDuration? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to dateTime? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to time? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to date? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to gYearMonth? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to gYear? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to gMonthDay? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to gDay? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to gMonth? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to boolean? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to base64Binary? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to hexBinary? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to anyURI? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to QName? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast string to NOTATION? Maybe">M</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="float">flt</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to string? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to float? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to double? Yes">Y</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to decimal? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to integer? Maybe">M</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to gMonth? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to boolean? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast float to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="double">dbl</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to string? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to float? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to double? Yes">Y</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to decimal? Maybe">M</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to integer? Maybe">M</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast double to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to gMonth? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to boolean? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast double to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="decimal">dec</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to string? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to float? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to double? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to decimal? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to integer? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast decimal to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to gMonth? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to boolean? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast decimal to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="integer">int</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to string? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to float? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to double? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to decimal? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to integer? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast integer to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to gMonth? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to boolean? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast integer to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="duration">dur</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to integer? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to duration? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast duration to yearMonthDuration? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast duration to dayTimeDuration? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast duration to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="yearMonthDuration">yMD</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast yearMonthDuration to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to integer? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to duration? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to yearMonthDuration? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to dayTimeDuration? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast yearMonthDuration to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast yearMonthDuration to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast yearMonthDuration to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast yearMonthDuration to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast yearMonthDuration to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast yearMonthDuration to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="dayTimeDuration">dTD</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dayTimeDuration to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to integer? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dayTimeDuration to duration? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dayTimeDuration to yearMonthDuration? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dayTimeDuration to dayTimeDuration? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dayTimeDuration to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dayTimeDuration to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dayTimeDuration to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dayTimeDuration to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dayTimeDuration to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dayTimeDuration to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dayTimeDuration to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="dateTime">dT</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dateTime to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast dateTime to dayTimeDuration? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to dateTime? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to time? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to date? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to gYearMonth? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to gYear? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to gMonthDay? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to gDay? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to gMonth? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast dateTime to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="time">tim</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to dateTime? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to time? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast time to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="date">dat</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to dayTimeDuration? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to dateTime? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to time? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to date? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to gYearMonth? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to gYear? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to gMonthDay? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to gDay? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to gMonth? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast date to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="gYearMonth">gYM</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast gYearMonth to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast gYearMonth to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast gYearMonth to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to date? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to gYearMonth? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYearMonth to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="gYear">gYr</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to gYearMonth? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to gYear? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gYear to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="gMonthDay">gMD</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast gMonthDay to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast gMonthDay to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast gMonthDay to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to gYear? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to gMonthDay? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonthDay to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="gDay">gDay</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to gMonthDay? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to gDay? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gDay to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="gMonth">gMon</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast gMonth to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to gDay? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to gMonth? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast gMonth to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="boolean">bool</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to string? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to float? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to double? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to decimal? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to integer? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast boolean to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to gMonth? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to boolean? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast boolean to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="base64Binary">b64</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast base64Binary to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast base64Binary to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast base64Binary to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to boolean? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast base64Binary to base64Binary? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to hexBinary? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast base64Binary to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="hexBinary">hxB</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast hexBinary to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast hexBinary to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast hexBinary to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to boolean? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to base64Binary? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to hexBinary? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to anyURI? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast hexBinary to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="anyURI">aURI</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast anyURI to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to hexBinary? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to anyURI? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to QName? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast anyURI to NOTATION? No">N</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="QName">QN</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to anyURI? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to QName? Yes">Y</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast QName to NOTATION? Maybe">M</span></td>
|
|
</tr>
|
|
<tr>
|
|
<th><span class="cancast" title="NOTATION">NOT</span></th>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to untypedAtomic? Yes">Y</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to string? Yes">Y</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to float? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to double? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to decimal? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to integer? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to duration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast NOTATION to yearMonthDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title=
|
|
"Cast NOTATION to dayTimeDuration? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to dateTime? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to time? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to date? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to gYearMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to gYear? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to gMonthDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to gDay? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to gMonth? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to boolean? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to base64Binary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to hexBinary? No">N</span></td>
|
|
<td class="castN" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to anyURI? No">N</span></td>
|
|
<td class="castY" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to QName? Yes">Y</span></td>
|
|
<td class="castM" align="center" valign="middle"><span class=
|
|
"cancast" title="Cast NOTATION to NOTATION? Maybe">M</span></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-string" id="casting-to-string"></a>18.1.1
|
|
Casting to xs:string and xs:untypedAtomic</h4>
|
|
<p>Casting is permitted from any primitive type to the primitive
|
|
types <code>xs:string</code> and <code>xs:untypedAtomic</code>.</p>
|
|
<p>When a value of any simple type is cast as
|
|
<code>xs:string</code>, the derivation of the
|
|
<code>xs:string</code> value <em>TV</em> depends on the <em>ST</em>
|
|
and on the <em>SV</em>, as follows.</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:string</code> or a type derived from
|
|
<code>xs:string</code>, <em>TV</em> is <em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:anyURI</code>, the type conversion is
|
|
performed without escaping any characters.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:QName</code> or
|
|
<code>xs:NOTATION</code>:</p>
|
|
<ul>
|
|
<li>
|
|
<p>if the qualified name has a prefix, then <em>TV</em> is the
|
|
concatenation of the prefix of <em>SV</em>, a single colon (:), and
|
|
the local name of <em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>otherwise <em>TV</em> is the local-name.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is a numeric type, the following rules apply:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:integer</code>, <em>TV</em> is the
|
|
canonical lexical representation of <em>SV</em> as defined in
|
|
<a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a>. There is no decimal point.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:decimal</code>, then:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>SV</em> is in the value space of <code>xs:integer</code>,
|
|
that is, if there are no significant digits after the decimal
|
|
point, then the value is converted from an <code>xs:decimal</code>
|
|
to an <code>xs:integer</code> and the resulting
|
|
<code>xs:integer</code> is converted to an <code>xs:string</code>
|
|
using the rule above.</p>
|
|
</li>
|
|
<li>
|
|
<p>Otherwise, the canonical lexical representation of <em>SV</em>
|
|
is returned, as defined in <a href="#xmlschema-2">[XML Schema Part
|
|
2: Datatypes Second Edition]</a>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:float</code> or
|
|
<code>xs:double</code>, then:</p>
|
|
<ul>
|
|
<li>
|
|
<p><em>TV</em> will be an <code>xs:string</code> in the lexical
|
|
space of <code>xs:double</code> or <code>xs:float</code> that when
|
|
converted to an <code>xs:double</code> or <code>xs:float</code>
|
|
under the rules of <a href="#casting-from-strings"><b>18.2 Casting
|
|
from xs:string and xs:untypedAtomic</b></a> produces a value that
|
|
is equal to <em>SV</em>, or is "NaN" if <em>SV</em> is
|
|
<code>NaN</code>. In addition, <em>TV</em> must satisfy the
|
|
constraints in the following sub-bullets.</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>SV</em> has an absolute value that is greater than or
|
|
equal to 0.000001 (one millionth) and less than 1000000 (one
|
|
million), then the value is converted to an <code>xs:decimal</code>
|
|
and the resulting <code>xs:decimal</code> is converted to an
|
|
<code>xs:string</code> according to the rules above, as though
|
|
using an implementation of <code>xs:decimal</code> that imposes no
|
|
limits on the <code>totalDigits</code> or
|
|
<code>fractionDigits</code> facets.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>SV</em> has the value positive or negative zero,
|
|
<em>TV</em> is "0" or "-0" respectively.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>SV</em> is positive or negative infinity, <em>TV</em> is
|
|
the string "<code>INF</code>" or "<code>-INF</code>"
|
|
respectively.</p>
|
|
</li>
|
|
<li>
|
|
<p>In other cases, the result consists of a mantissa, which has the
|
|
lexical form of an <code>xs:decimal</code>, followed by the letter
|
|
"E", followed by an exponent which has the lexical form of an
|
|
<code>xs:integer</code>. Leading zeroes and "+" signs are
|
|
prohibited in the exponent. For the mantissa, there must be a
|
|
decimal point, and there must be exactly one digit before the
|
|
decimal point, which must be non-zero. The "+" sign is prohibited.
|
|
There must be at least one digit after the decimal point. Apart
|
|
from this mandatory digit, trailing zero digits are prohibited.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>The above rules allow more than one representation of the same
|
|
value. For example, the <code>xs:float</code> value whose exact
|
|
decimal representation is 1.26743223E15 might be represented by any
|
|
of the strings "1.26743223E15", "1.26743222E15" or "1.26743224E15"
|
|
(inter alia). It is implementation-dependent which of these
|
|
representations is chosen.</p>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:dateTime</code>, <code>xs:date</code>
|
|
or <code>xs:time</code>, <em>TV</em> is the local value. The
|
|
components of <em>TV</em> are individually cast to
|
|
<code>xs:string</code> using the functions described in <a href=
|
|
"#casting-to-datetimes">[casting-to-datetimes]</a> and the results
|
|
are concatenated together. The <code>year</code> component is cast
|
|
to <code>xs:string</code> using
|
|
<code>eg:convertYearToString</code>. The <code>month</code>,
|
|
<code>day</code>, <code>hour</code> and <code>minute</code>
|
|
components are cast to <code>xs:string</code> using
|
|
<code>eg:convertTo2CharString</code>. The <code>second</code>
|
|
component is cast to <code>xs:string</code> using
|
|
<code>eg:convertSecondsToString</code>. The timezone component, if
|
|
present, is cast to <code>xs:string</code> using
|
|
<code>eg:convertTZtoString</code>.</p>
|
|
<p>Note that the hours component of the resulting string will never
|
|
be <code>"24"</code>. Midnight is always represented as
|
|
<code>"00:00:00"</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:yearMonthDuration</code> or
|
|
<code>xs:dayTimeDuration</code>, <em>TV</em> is the canonical
|
|
representation of <em>SV</em> as defined in <a href=
|
|
"#dt-yearMonthDuration"><b>8.1.1 xs:yearMonthDuration</b></a> or
|
|
<a href="#dt-dayTimeDuration"><b>8.1.2 xs:dayTimeDuration</b></a>,
|
|
respectively.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:duration</code> then let <em>SYM</em>
|
|
be <em><code>SV</code></em> <code>cast as
|
|
xs:yearMonthDuration</code>, and let <em>SDT</em> be
|
|
<em><code>SV</code></em> <code>cast as xs:dayTimeDuration</code>;
|
|
Now, let the next intermediate value, <em>TYM</em>, be
|
|
<em><code>SYM</code></em> <code>cast as</code>
|
|
<em><code>TT</code></em> , and let <em>TDT</em> be
|
|
<em><code>SDT</code></em> <code>cast as</code>
|
|
<em><code>TT</code></em> . If <em>TYM</em> is "P0M", then
|
|
<em>TV</em> is <em>TDT</em>. Otherwise, <em>TYM</em> and
|
|
<em>TDT</em> are merged according to the following rules:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>If <em>TDT</em> is "PT0S", then <em>TV</em> is <em>TYM</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Otherwise, <em>TV</em> is the concatenation of all the
|
|
characters in <em>TYM</em> and all the characters except the first
|
|
"P" and the optional negative sign in <em>TDT</em>.</p>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>
|
|
<p>In all other cases, <em>TV</em> is the <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
canonical representation of <em>SV</em>. For datatypes that do not
|
|
have a canonical lexical representation defined an <a title=
|
|
"implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a> canonical representation may be used.</p>
|
|
</li>
|
|
</ul>
|
|
<p>To cast as <code>xs:untypedAtomic</code> the value is cast as
|
|
<code>xs:string</code>, as described above, and the type annotation
|
|
changed to <code>xs:untypedAtomic</code>.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>The string representations of numeric values are backwards
|
|
compatible with XPath 1.0 except for the special values positive
|
|
and negative infinity, negative zero and values outside the range
|
|
<code>1.0e-6</code> to <code>1.0e+6</code>.</p>
|
|
</div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-numerics" id=
|
|
"casting-to-numerics"></a>18.1.2 Casting to numeric types</h4>
|
|
<div class="div4">
|
|
<h5><a name="casting-to-float" id="casting-to-float"></a>18.1.2.1
|
|
Casting to xs:float</h5>
|
|
<p>When a value of any simple type is cast as
|
|
<code>xs:float</code>, the <code>xs:float</code> <em>TV</em> is
|
|
derived from the <em>ST</em> and the <em>SV</em> as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:float</code>, then <em>TV</em> is
|
|
<em>SV</em> and the conversion is complete.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:double</code>, then <em>TV</em> is
|
|
obtained as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>if <em>SV</em> is the <code>xs:double</code> value
|
|
<code>INF</code>, <code>-INF</code>, <code>NaN</code>, positive
|
|
zero, or negative zero, then <em>TV</em> is the
|
|
<code>xs:float</code> value <code>INF</code>, <code>-INF</code>,
|
|
<code>NaN</code>, positive zero, or negative zero respectively.</p>
|
|
</li>
|
|
<li>
|
|
<p>otherwise, <em>SV</em> can be expressed in the form <code>m ×
|
|
2^e</code> where the mantissa <code>m</code> and exponent
|
|
<code>e</code> are signed <code>xs:integer</code>s whose value
|
|
range is defined in <a href="#xmlschema-2">[XML Schema Part 2:
|
|
Datatypes Second Edition]</a>, and the following rules apply:</p>
|
|
<ul>
|
|
<li>
|
|
<p>if <code>m</code> (the mantissa of <em>SV</em>) is outside the
|
|
permitted range for the mantissa of an <code>xs:float</code> value
|
|
<code>(-2^24-1 to +2^24-1)</code>, then it is divided by
|
|
<code>2^N</code> where <code>N</code> is the lowest positive
|
|
<code>xs:integer</code> that brings the result of the division
|
|
within the permitted range, and the exponent <code>e</code> is
|
|
increased by <code>N</code>. This is integer division (in effect,
|
|
the binary value of the mantissa is truncated on the right). Let
|
|
<code>M</code> be the mantissa and <code>E</code> the exponent
|
|
after this adjustment.</p>
|
|
</li>
|
|
<li>
|
|
<p>if <code>E</code> exceeds <code>104</code> (the maximum exponent
|
|
value in the value space of <code>xs:float</code>) then <em>TV</em>
|
|
is the <code>xs:float</code> value <code>INF</code> or
|
|
<code>-INF</code> depending on the sign of <code>M</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>if <code>E</code> is less than <code>-149</code> (the minimum
|
|
exponent value in the value space of <code>xs:float</code>) then
|
|
<em>TV</em> is the <code>xs:float</code> value positive or negative
|
|
zero depending on the sign of <code>M</code></p>
|
|
</li>
|
|
<li>
|
|
<p>otherwise, <em>TV</em> is the <code>xs:float</code> value
|
|
<code>M × 2^E</code>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:decimal</code>, or
|
|
<code>xs:integer</code>, then <em>TV</em> is <code>xs:float(</code>
|
|
<em>SV</em> <code>cast as xs:string)</code> and the conversion is
|
|
complete.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:boolean</code>, <em>SV</em> is
|
|
converted to <code>1.0E0</code> if <em>SV</em> is <code>true</code>
|
|
and to <code>0.0E0</code> if <em>SV</em> is <code>false</code> and
|
|
the conversion is complete.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>XSD 1.1 adds the value <code>+INF</code> to the lexical space,
|
|
as an alternative to <code>INF</code>. XSD 1.1 also adds negative
|
|
zero to the value space.</p>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>Implementations <strong>should</strong> return negative zero for
|
|
<code>xs:float("-0.0E0")</code>. But because <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
does not distinguish between the values positive zero and negative
|
|
zero. implementations <a title="may" class="termref" href=
|
|
"#may"><span class="arrow">·</span>may<span class=
|
|
"arrow">·</span></a> return positive zero in this case.</p>
|
|
</div>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="casting-to-double" id="casting-to-double"></a>18.1.2.2
|
|
Casting to xs:double</h5>
|
|
<p>When a value of any simple type is cast as
|
|
<code>xs:double</code>, the <code>xs:double</code> value
|
|
<em>TV</em> is derived from the <em>ST</em> and the <em>SV</em> as
|
|
follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:double</code>, then <em>TV</em> is
|
|
<em>SV</em> and the conversion is complete.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:float</code> or a type derived from
|
|
<code>xs:float</code>, then <em>TV</em> is obtained as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>if <em>SV</em> is the <code>xs:float</code> value
|
|
<code>INF</code>, <code>-INF</code>, <code>NaN</code>, positive
|
|
zero, or negative zero, then <em>TV</em> is the
|
|
<code>xs:double</code> value <code>INF</code>, <code>-INF</code>,
|
|
<code>NaN</code>, positive zero, or negative zero respectively.</p>
|
|
</li>
|
|
<li>
|
|
<p>otherwise, <em>SV</em> can be expressed in the form <code>m ×
|
|
2^e</code> where the mantissa <code>m</code> and exponent
|
|
<code>e</code> are signed <code>xs:integer</code> values whose
|
|
value range is defined in <a href="#xmlschema-2">[XML Schema Part
|
|
2: Datatypes Second Edition]</a>, and <em>TV</em> is the
|
|
<code>xs:double</code> value <code>m × 2^e</code>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:decimal</code> or
|
|
<code>xs:integer</code>, then <em>TV</em> is
|
|
<code>xs:double(</code> <em>SV</em> <code>cast as xs:string)</code>
|
|
and the conversion is complete.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:boolean</code>, <em>SV</em> is
|
|
converted to <code>1.0E0</code> if <em>SV</em> is <code>true</code>
|
|
and to <code>0.0E0</code> if <em>SV</em> is <code>false</code> and
|
|
the conversion is complete.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>XSD 1.1 adds the value <code>+INF</code> to the lexical space,
|
|
as an alternative to <code>INF</code>. XSD 1.1 also adds negative
|
|
zero to the value space.</p>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>Implementations <strong>should</strong> return negative zero for
|
|
<code>xs:double("-0.0E0")</code>. But because <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
does not distinguish between the values positive zero and negative
|
|
zero. implementations <a title="may" class="termref" href=
|
|
"#may"><span class="arrow">·</span>may<span class=
|
|
"arrow">·</span></a> return positive zero in this case.</p>
|
|
</div>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="casting-to-decimal" id=
|
|
"casting-to-decimal"></a>18.1.2.3 Casting to xs:decimal</h5>
|
|
<p>When a value of any simple type is cast as
|
|
<code>xs:decimal</code>, the <code>xs:decimal</code> value
|
|
<em>TV</em> is derived from <em>ST</em> and <em>SV</em> as
|
|
follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:decimal</code>,
|
|
<code>xs:integer</code> or a type derived from them, then
|
|
<em>TV</em> is <em>SV</em>, converted to an <code>xs:decimal</code>
|
|
value if need be, and the conversion is complete.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:float</code> or
|
|
<code>xs:double</code>, then <em>TV</em> is the
|
|
<code>xs:decimal</code> value, within the set of
|
|
<code>xs:decimal</code> values that the implementation is capable
|
|
of representing, that is numerically closest to <em>SV</em>. If two
|
|
values are equally close, then the one that is closest to zero is
|
|
chosen. If <em>SV</em> is too large to be accommodated as an
|
|
<code>xs:decimal</code>, (see <a href="#xmlschema-2">[XML Schema
|
|
Part 2: Datatypes Second Edition]</a> for <a title=
|
|
"implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> limits on numeric values) an error is raised
|
|
[<a href="#ERRFOCA0001" title="err:FOCA0001">err:FOCA0001</a>]. If
|
|
<em>SV</em> is one of the special <code>xs:float</code> or
|
|
<code>xs:double</code> values <code>NaN</code>, <code>INF</code>,
|
|
or <code>-INF</code>, an error is raised [<a href="#ERRFOCA0002"
|
|
title="err:FOCA0002">err:FOCA0002</a>].</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:boolean</code>, <em>SV</em> is
|
|
converted to <code>1.0</code> if <em>SV</em> is <code>1</code> or
|
|
<code>true</code> and to <code>0.0</code> if <em>SV</em> is
|
|
<code>0</code> or <code>false</code> and the conversion is
|
|
complete.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="div4">
|
|
<h5><a name="casting-to-integer" id=
|
|
"casting-to-integer"></a>18.1.2.4 Casting to xs:integer</h5>
|
|
<p>When a value of any simple type is cast as
|
|
<code>xs:integer</code>, the <code>xs:integer</code> value
|
|
<em>TV</em> is derived from <em>ST</em> and <em>SV</em> as
|
|
follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:integer</code>, or a type derived
|
|
from <code>xs:integer</code>, then <em>TV</em> is <em>SV</em>,
|
|
converted to an <code>xs:integer</code> value if need be, and the
|
|
conversion is complete.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:decimal</code>, <code>xs:float</code>
|
|
or <code>xs:double</code>, then <em>TV</em> is <em>SV</em> with the
|
|
fractional part discarded and the value converted to
|
|
<code>xs:integer</code>. Thus, casting <code>3.1456</code> returns
|
|
<code>3</code> and <code>-17.89</code> returns <code>-17</code>.
|
|
Casting <code>3.124E1</code> returns <code>31</code>. If
|
|
<em>SV</em> is too large to be accommodated as an integer, (see
|
|
<a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a> for <a title="implementation-defined" class="termref"
|
|
href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> limits on numeric values) an error is raised
|
|
[<a href="#ERRFOCA0003" title="err:FOCA0003">err:FOCA0003</a>]. If
|
|
<em>SV</em> is one of the special <code>xs:float</code> or
|
|
<code>xs:double</code> values <code>NaN</code>, <code>INF</code>,
|
|
or <code>-INF</code>, an error is raised [<a href="#ERRFOCA0002"
|
|
title="err:FOCA0002">err:FOCA0002</a>].</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:boolean</code>, <em>SV</em> is
|
|
converted to <code>1</code> if <em>SV</em> is <code>1</code> or
|
|
<code>true</code> and to <code>0</code> if <em>SV</em> is
|
|
<code>0</code> or <code>false</code> and the conversion is
|
|
complete.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-durations" id=
|
|
"casting-to-durations"></a>18.1.3 Casting to duration types</h4>
|
|
<p>When a value of type <code>xs:untypedAtomic</code>,
|
|
<code>xs:string</code>, a type derived from <code>xs:string</code>,
|
|
<code>xs:yearMonthDuration</code> or
|
|
<code>xs:dayTimeDuration</code> is cast as
|
|
<code>xs:duration</code>, <code>xs:yearMonthDuration</code> or
|
|
<code>xs:dayTimeDuration</code>, <em>TV</em> is derived from
|
|
<em>ST</em> and <em>SV</em> as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is the same as <em>TT</em>, then <em>TV</em> is
|
|
<em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:duration</code>, or a type derived
|
|
from <code>xs:duration</code>, but not
|
|
<code>xs:dayTimeDuration</code> or a type derived from
|
|
<code>xs:dayTimeDuration</code>, and <em>TT</em> is
|
|
<code>xs:yearMonthDuration</code>, then <em>TV</em> is derived from
|
|
<em>SV</em> by removing the day, hour, minute and second components
|
|
from <em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:duration</code>, or a type derived
|
|
from <code>duration</code>, but not
|
|
<code>xs:yearMonthDuration</code> or a type derived from
|
|
<code>xs:yearMonthDuration</code>, and <em>TT</em> is
|
|
<code>xs:dayTimeDuration</code>, then <em>TV</em> is derived from
|
|
<em>SV</em> by removing the year and month components from
|
|
<em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:yearMonthDuration</code> or
|
|
<code>xs:dayTimeDuration</code>, and <em>TT</em> is
|
|
<code>xs:duration</code>, then <em>TV</em> is derived from
|
|
<em>SV</em> as defined in <a href=
|
|
"#casting-from-derived-to-parent"><b>18.3.2 Casting from derived
|
|
types to parent types</b></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:yearMonthDuration</code> and
|
|
<em>TT</em> is <code>xs:dayTimeDuration</code>, the cast is
|
|
permitted and returns a <code>xs:dayTimeDuration</code> with value
|
|
0.0 seconds.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:dayTimeDuration</code> and
|
|
<em>TT</em> is <code>xs:yearMonthDuration</code>, the cast is
|
|
permitted and returns a <code>xs:yearMonthDuration</code> with
|
|
value 0 months.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
<p>Note that casting from <code>xs:duration</code> to
|
|
<code>xs:yearMonthDuration</code> or
|
|
<code>xs:dayTimeDuration</code> loses information. To avoid this,
|
|
users can cast the <code>xs:duration</code> value to both an
|
|
<code>xs:yearMonthDuration</code> and an
|
|
<code>xs:dayTimeDuration</code> and work with both values.</p>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-datetimes" id=
|
|
"casting-to-datetimes"></a>18.1.4 Casting to date and time
|
|
types</h4>
|
|
<p>In several situations, casting to date and time types requires
|
|
the extraction of a component from <em>SV</em> or from the result
|
|
of <a href=
|
|
"#func-current-dateTime"><code>fn:current-dateTime</code></a> and
|
|
converting it to an <code>xs:string</code>. These conversions must
|
|
follow certain rules. For example, converting an
|
|
<code>xs:integer</code> year value requires converting to an
|
|
<code>xs:string</code> with four or more characters, preceded by a
|
|
minus sign if the value is negative.</p>
|
|
<p>This document defines four functions to perform these
|
|
conversions. These functions are for illustrative purposes only and
|
|
make no recommendations as to style or efficiency. References to
|
|
these functions from the following text are not normative.</p>
|
|
<p>The arguments to these functions come from functions defined in
|
|
this document. Thus, the functions below assume that they are
|
|
correct and do no range checking on them.</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:convertYearToString($year as xs:integer) as xs:string
|
|
{
|
|
let $plusMinus := if ($year >= 0) then "" else "-"
|
|
let $yearString := fn:abs($year) cast as xs:string
|
|
let $length := fn:string-length($yearString)
|
|
return
|
|
if ($length = 1) then fn:concat($plusMinus, "000", $yearString)
|
|
else
|
|
if ($length = 2) then fn:concat($plusMinus, "00", $yearString)
|
|
else
|
|
if ($length = 3) then fn:concat($plusMinus, "0", $yearString)
|
|
else fn:concat($plusMinus, $yearString)
|
|
}
|
|
|
|
</pre></div>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:convertTo2CharString($value as xs:integer) as xs:string
|
|
{
|
|
let $string := $value cast as xs:string
|
|
return
|
|
if (fn:string-length($string) = 1) then fn:concat("0", $string)
|
|
else $string
|
|
}
|
|
|
|
</pre></div>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:convertSecondsToString($seconds as xs:decimal) as xs:string
|
|
{
|
|
let $string := $seconds cast as xs:string
|
|
let $intLength := fn:string-length(($seconds cast as xs:integer) cast as xs:string)
|
|
return
|
|
if ($intLength = 1) then fn:concat("0", $string)
|
|
else $string
|
|
}
|
|
|
|
</pre></div>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:convertTZtoString($tz as xs:dayTimeDuration?) as xs:string
|
|
{
|
|
if (empty($tz))
|
|
then ""
|
|
else if ($tz eq xs:dayTimeDuration('PT0S'))
|
|
then "Z"
|
|
else
|
|
let $tzh := fn:hours-from-duration($tz)
|
|
let $tzm := fn:minutes-from-duration($tz)
|
|
let $plusMinus := if ($tzh >= 0) then "+" else "-"
|
|
let $tzhString := eg:convertTo2CharString(fn:abs($tzh))
|
|
let $tzmString := eg:convertTo2CharString(fn:abs($tzm))
|
|
return fn:concat($plusMinus, $tzhString, ":", $tzmString)
|
|
}
|
|
|
|
|
|
</pre></div>
|
|
<p>Conversion from primitive types to date and time types follows
|
|
the rules below.</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>When a value of any primitive type is cast as
|
|
<code>xs:dateTime</code>, the <code>xs:dateTime</code> value
|
|
<em>TV</em> is derived from <em>ST</em> and <em>SV</em> as
|
|
follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:dateTime</code>, then <em>TV</em> is
|
|
<em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:date</code>, then let <em>SYR</em> be
|
|
<code>eg:convertYearToString( fn:year-from-date(</code> <em>SV</em>
|
|
<code>))</code>, let <em>SMO</em> be <code>eg:convertTo2CharString(
|
|
fn:month-from-date(</code> <em>SV</em> <code>))</code>, let
|
|
<em>SDA</em> be <code>eg:convertTo2CharString(
|
|
fn:day-from-date(</code> <em>SV</em> <code>))</code> and let
|
|
<em>STZ</em> be <code>eg:convertTZtoString(
|
|
fn:timezone-from-date(</code> <em>SV</em> <code>))</code>;
|
|
<em>TV</em> is <code>xs:dateTime( fn:concat(</code> <em>SYR</em>
|
|
<code>, '-',</code> <em>SMO</em> <code>, '-',</code> <em>SDA</em>
|
|
<code>, 'T00:00:00 '</code>, <em>STZ</em> <code>) )</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>When a value of any primitive type is cast as
|
|
<code>xs:time</code>, the <code>xs:time</code> value <em>TV</em> is
|
|
derived from <em>ST</em> and <em>SV</em> as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:time</code>, then <em>TV</em> is
|
|
<em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:dateTime</code>, then <em>TV</em> is
|
|
<code>xs:time( fn:concat( eg:convertTo2CharString(
|
|
fn:hours-from-dateTime(</code> <em>SV</em> <code>)), ':',
|
|
eg:convertTo2CharString( fn:minutes-from-dateTime(</code>
|
|
<em>SV</em> <code>)), ':', eg:convertSecondsToString(
|
|
fn:seconds-from-dateTime(</code> <em>SV</em> <code>)),
|
|
eg:convertTZtoString( fn:timezone-from-dateTime(</code> <em>SV</em>
|
|
<code>)) ))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>When a value of any primitive type is cast as
|
|
<code>xs:date</code>, the <code>xs:date</code> value <em>TV</em> is
|
|
derived from <em>ST</em> and <em>SV</em> as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:date</code>, then <em>TV</em> is
|
|
<em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:dateTime</code>, then let
|
|
<em>SYR</em> be <code>eg:convertYearToString(
|
|
fn:year-from-dateTime(</code> <em>SV</em> <code>))</code>, let
|
|
<em>SMO</em> be <code>eg:convertTo2CharString(
|
|
fn:month-from-dateTime(</code> <em>SV</em> <code>))</code>, let
|
|
<em>SDA</em> be <code>eg:convertTo2CharString(
|
|
fn:day-from-dateTime(</code> <em>SV</em> <code>))</code> and let
|
|
<em>STZ</em> be
|
|
<code>eg:convertTZtoString(fn:timezone-from-dateTime(</code>
|
|
<em>SV</em> <code>))</code>; <em>TV</em> is <code>xs:date(
|
|
fn:concat(</code> <em>SYR</em> <code>, '-',</code> <em>SMO</em>
|
|
<code>, '-',</code> <em>SDA</em>, <em>STZ</em> <code>)
|
|
)</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>When a value of any primitive type is cast as
|
|
<code>xs:gYearMonth</code>, the <code>xs:gYearMonth</code> value
|
|
<em>TV</em> is derived from <em>ST</em> and <em>SV</em> as
|
|
follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:gYearMonth</code>, then <em>TV</em>
|
|
is <em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:dateTime</code>, then let
|
|
<em>SYR</em> be <code>eg:convertYearToString(
|
|
fn:year-from-dateTime(</code> <em>SV</em> <code>))</code>, let
|
|
<em>SMO</em> be <code>eg:convertTo2CharString(
|
|
fn:month-from-dateTime(</code> <em>SV</em> <code>))</code> and let
|
|
<em>STZ</em> be <code>eg:convertTZtoString(
|
|
fn:timezone-from-dateTime(</code> <em>SV</em> <code>))</code>;
|
|
<em>TV</em> is <code>xs:gYearMonth( fn:concat(</code> <em>SYR</em>
|
|
<code>, '-',</code> <em>SMO</em>, <em>STZ</em> <code>)
|
|
)</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:date</code>, then let <em>SYR</em> be
|
|
<code>eg:convertYearToString( fn:year-from-date(</code> <em>SV</em>
|
|
<code>))</code>, let <em>SMO</em> be <code>eg:convertTo2CharString(
|
|
fn:month-from-date(</code> <em>SV</em> <code>))</code> and let
|
|
<em>STZ</em> be <code>eg:convertTZtoString(
|
|
fn:timezone-from-date(</code> <em>SV</em> <code>))</code>;
|
|
<em>TV</em> is <code>xs:gYearMonth( fn:concat(</code> <em>SYR</em>
|
|
<code>, '-',</code> <em>SMO</em>, <em>STZ</em> <code>)
|
|
)</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>When a value of any primitive type is cast as
|
|
<code>xs:gYear</code>, the <code>xs:gYear</code> value <em>TV</em>
|
|
is derived from <em>ST</em> and <em>SV</em> as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:gYear</code>, then <em>TV</em> is
|
|
<em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:dateTime</code>, let <em>SYR</em> be
|
|
<code>eg:convertYearToString( fn:year-from-dateTime(</code>
|
|
<em>SV</em> <code>))</code> and let <em>STZ</em> be
|
|
<code>eg:convertTZtoString( fn:timezone-from-dateTime(</code>
|
|
<em>SV</em> <code>))</code>; <em>TV</em> is
|
|
<code>xs:gYear(fn:concat(</code> <em>SYR</em>, <em>STZ</em>
|
|
<code>))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:date</code>, let <em>SYR</em> be
|
|
<code>eg:convertYearToString( fn:year-from-date(</code> <em>SV</em>
|
|
<code>))</code>; and let <em>STZ</em> be
|
|
<code>eg:convertTZtoString( fn:timezone-from-date(</code>
|
|
<em>SV</em> <code>))</code>; <em>TV</em> is
|
|
<code>xs:gYear(fn:concat(</code> <em>SYR</em>, <em>STZ</em>
|
|
<code>))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>When a value of any primitive type is cast as
|
|
<code>xs:gMonthDay</code>, the <code>xs:gMonthDay</code> value
|
|
<em>TV</em> is derived from <em>ST</em> and <em>SV</em> as
|
|
follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:gMonthDay</code>, then <em>TV</em> is
|
|
<em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:dateTime</code>, then let
|
|
<em>SMO</em> be <code>eg:convertTo2CharString(
|
|
fn:month-from-dateTime(</code> <em>SV</em> <code>))</code>, let
|
|
<em>SDA</em> be <code>eg:convertTo2CharString(
|
|
fn:day-from-dateTime(</code> <em>SV</em> <code>))</code> and let
|
|
<em>STZ</em> be <code>eg:convertTZtoString(
|
|
fn:timezone-from-dateTime(</code> <em>SV</em> <code>))</code>;
|
|
<em>TV</em> is <code>xs:gYearMonth( fn:concat(</code>
|
|
<code>'--',</code> <em>SMO</em> <code>'-',</code> <em>SDA</em>,
|
|
<em>STZ</em> <code>) )</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:date</code>, then let <em>SMO</em> be
|
|
<code>eg:convertTo2CharString( fn:month-from-date(</code>
|
|
<em>SV</em> <code>))</code>, let <em>SDA</em> be
|
|
<code>eg:convertTo2CharString( fn:day-from-date(</code> <em>SV</em>
|
|
<code>))</code> and let <em>STZ</em> be <code>eg:convertTZtoString(
|
|
fn:timezone-from-date(</code> <em>SV</em> <code>))</code>;
|
|
<em>TV</em> is <code>xs:gYearMonth( fn:concat(</code>
|
|
<code>'--',</code> <em>SMO</em> <code>, '-',</code> <em>SDA</em>,
|
|
<em>STZ</em> <code>) )</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>When a value of any primitive type is cast as
|
|
<code>xs:gDay</code>, the <code>xs:gDay</code> value <em>TV</em> is
|
|
derived from <em>ST</em> and <em>SV</em> as follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:gDay</code>, then <em>TV</em> is
|
|
<em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:dateTime</code>, then let
|
|
<em>SDA</em> be <code>eg:convertTo2CharString(
|
|
fn:day-from-dateTime(</code> <em>SV</em> <code>))</code> and let
|
|
<em>STZ</em> be <code>eg:convertTZtoString(
|
|
fn:timezone-from-dateTime(</code> <em>SV</em> <code>))</code>;
|
|
<em>TV</em> is <code>xs:gDay( fn:concat( '---'</code>,
|
|
<em>SDA</em>, <em>STZ</em> <code>))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:date</code>, then let <em>SDA</em> be
|
|
<code>eg:convertTo2CharString( fn:day-from-date(</code> <em>SV</em>
|
|
<code>))</code> and let <em>STZ</em> be <code>eg:convertTZtoString(
|
|
fn:timezone-from-date(</code> <em>SV</em> <code>))</code>;
|
|
<em>TV</em> is <code>xs:gDay( fn:concat( '---'</code>,
|
|
<em>SDA</em>, <em>STZ</em> <code>))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>When a value of any primitive type is cast as
|
|
<code>xs:gMonth</code>, the <code>xs:gMonth</code> value
|
|
<em>TV</em> is derived from <em>ST</em> and <em>SV</em> as
|
|
follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:gMonth</code>, then <em>TV</em> is
|
|
<em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:dateTime</code>, then let
|
|
<em>SMO</em> be <code>eg:convertTo2CharString(
|
|
fn:month-from-dateTime(</code> <em>SV</em> <code>))</code> and let
|
|
<em>STZ</em> be <code>eg:convertTZtoString(
|
|
fn:timezone-from-dateTime(</code> <em>SV</em> <code>))</code>;
|
|
<em>TV</em> is <code>xs:gMonth( fn:concat( '--'</code> ,
|
|
<em>SMO</em>, <em>STZ</em> <code>))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:date</code>, then let <em>SMO</em> be
|
|
<code>eg:convertTo2CharString( fn:month-from-date(</code>
|
|
<em>SV</em> <code>))</code> and let <em>STZ</em> be
|
|
<code>eg:convertTZtoString( fn:timezone-from-date(</code>
|
|
<em>SV</em> <code>))</code>; <em>TV</em> is <code>xs:gMonth(
|
|
fn:concat( '--'</code>, <em>SMO</em>, <em>STZ</em>
|
|
<code>))</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-boolean" id="casting-boolean"></a>18.1.5
|
|
Casting to xs:boolean</h4>
|
|
<p>When a value of any primitive type is cast as
|
|
<code>xs:boolean</code>, the <code>xs:boolean</code> value
|
|
<em>TV</em> is derived from <em>ST</em> and <em>SV</em> as
|
|
follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:boolean</code>, then <em>TV</em> is
|
|
<em>SV</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:float</code>, <code>xs:double</code>,
|
|
<code>xs:decimal</code> or <code>xs:integer</code> and <em>SV</em>
|
|
is <code>0</code>, <code>+0</code>, <code>-0</code>,
|
|
<code>0.0</code>, <code>0.0E0</code> or <code>NaN</code>, then
|
|
<em>TV</em> is <code>false</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:float</code>, <code>xs:double</code>,
|
|
<code>xs:decimal</code> or <code>xs:integer</code> and <em>SV</em>
|
|
is not one of the above values, then <em>TV</em> is
|
|
<code>true</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>, see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-binary" id="casting-to-binary"></a>18.1.6
|
|
Casting to xs:base64Binary and xs:hexBinary</h4>
|
|
<p>Values of type <code>xs:base64Binary</code> can be cast as
|
|
<code>xs:hexBinary</code> and vice versa, since the two types have
|
|
the same value space. Casting to <code>xs:base64Binary</code> and
|
|
<code>xs:hexBinary</code> is also supported from the same type and
|
|
from <code>xs:untypedAtomic</code>, <code>xs:string</code> and
|
|
subtypes of <code>xs:string</code> using <a href=
|
|
"#xmlschema-2">[XML Schema Part 2: Datatypes Second Edition]</a>
|
|
semantics.</p>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-anyuri" id="casting-to-anyuri"></a>18.1.7
|
|
Casting to xs:anyURI</h4>
|
|
<p>Casting to <code>xs:anyURI</code> is supported only from the
|
|
same type, <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code>.</p>
|
|
<p>When a value of any primitive type is cast as
|
|
<code>xs:anyURI</code>, the <code>xs:anyURI</code> value
|
|
<em>TV</em> is derived from the <em>ST</em> and <em>SV</em> as
|
|
follows:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>ST</em> is <code>xs:untypedAtomic</code> or
|
|
<code>xs:string</code> see <a href="#casting-from-strings"><b>18.2
|
|
Casting from xs:string and xs:untypedAtomic</b></a>.</p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-qname-and-notation" id=
|
|
"casting-to-qname-and-notation"></a>18.1.8 Casting to xs:QName and
|
|
xs:NOTATION</h4>
|
|
<p>Casting from <code>xs:string</code> or
|
|
<code>xs:untypedAtomic</code> to <code>xs:QName</code> or
|
|
<code>xs:NOTATION</code> is described in <a href=
|
|
"#casting-from-strings"><b>18.2 Casting from xs:string and
|
|
xs:untypedAtomic</b></a>.</p>
|
|
<p>It is also possible to cast from <code>xs:NOTATION</code> to
|
|
<code>xs:QName</code>, or from <code>xs:QName</code> to any type
|
|
derived by restriction from <code>xs:NOTATION</code>. (Casting to
|
|
<code>xs:NOTATION</code> itself is not allowed, because
|
|
<code>xs:NOTATION</code> is an abstract type.) The resulting
|
|
<code>xs:QName</code> or <code>xs:NOTATION</code> has the same
|
|
prefix, local name, and namespace URI parts as the supplied
|
|
value.</p>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-ENTITY" id="casting-to-ENTITY"></a>18.1.9
|
|
Casting to xs:ENTITY</h4>
|
|
<p><a href="#xmlschema-2">[XML Schema Part 2: Datatypes Second
|
|
Edition]</a> says that "The value space of ENTITY is the set of all
|
|
strings that match the NCName production ... and have been declared
|
|
as an unparsed entity in a document type definition." However,
|
|
<a href="#xslt-30">[XSL Transformations (XSLT) Version 3.0]</a> and
|
|
<a href="#xquery-30">[XQuery 3.0: An XML Query Language]</a> do not
|
|
check that constructed values of type <code>xs:ENTITY</code> match
|
|
declared unparsed entities. Thus, this rule is relaxed in this
|
|
specification and, in casting to <code>xs:ENTITY</code> and types
|
|
derived from it, no check is made that the values correspond to
|
|
declared unparsed entities.</p>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="casting-from-strings" id=
|
|
"casting-from-strings"></a>18.2 Casting from xs:string and
|
|
xs:untypedAtomic</h3>
|
|
<p>This section applies when the supplied value <var>SV</var> is an
|
|
instance of <code>xs:string</code> or
|
|
<code>xs:untypedAtomic</code>, including types derived from these
|
|
by restriction. If the value is <code>xs:untypedAtomic</code>, it
|
|
is treated in exactly the same way as a string containing the same
|
|
sequence of characters.</p>
|
|
<p>The supplied string is mapped to a typed value of the target
|
|
type as defined in <a href="#xmlschema-2">[XML Schema Part 2:
|
|
Datatypes Second Edition]</a>. Whitespace normalization is applied
|
|
as indicated by the <code>whiteSpace</code> facet for the datatype.
|
|
The resulting whitespace-normalized string must be a valid lexical
|
|
form for the datatype. The semantics of casting follow the rules of
|
|
XML Schema validation. For example, <code>"13" cast as
|
|
xs:unsignedInt</code> returns the <code>xs:unsignedInt</code> typed
|
|
value <code>13</code>. This could also be written
|
|
<code>xs:unsignedInt("13")</code>.</p>
|
|
<p>The target type can be any simple type other than an abstract
|
|
type. Specifically, it can be a type whose variety is atomic,
|
|
union, or list. In each case the effect of casting to the target
|
|
type is the same as constructing an element with the supplied value
|
|
as its content, validating the element using the target type as the
|
|
governing type, and atomizing the element to obtain its typed
|
|
value.</p>
|
|
<p>When the target type is a derived type that is restricted by a
|
|
pattern facet, the lexical form is first checked against the
|
|
pattern before further casting is attempted (See <a href=
|
|
"#casting-to-derived-types"><b>18.3.1 Casting to derived
|
|
types</b></a>). If the lexical form does not conform to the
|
|
pattern, error [<a href="#ERRFORG0001" title=
|
|
"err:FORG0001">err:FORG0001</a>] is raised.</p>
|
|
<p>For example, consider a user-defined type
|
|
<code>my:boolean</code> which is derived by restriction from
|
|
<code>xs:boolean</code> and specifies the pattern facet
|
|
<code>value="0|1"</code>. The expression <code>"true" cast as
|
|
my:boolean</code> would fail with [<a href="#ERRFORG0001" title=
|
|
"err:FORG0001">err:FORG0001</a>].</p>
|
|
<p>Facets other than <code>pattern</code> are checked
|
|
<em>after</em> the conversion. For example if there is a
|
|
user-defined datatype called <code>my:height</code> defined as a
|
|
restriction of <code>xs:integer</code> with the facet
|
|
<code><maxInclusive value="84"/></code>, then the expression
|
|
<code>"100" cast as my:height</code> would fail with [<a href=
|
|
"#ERRFORG0001" title="err:FORG0001">err:FORG0001</a>].</p>
|
|
<p>Casting to the types <code>xs:NOTATION</code>,
|
|
<code>xs:anySimpleType</code>, or <code>xs:anyAtomicType</code> is
|
|
not permitted because these types are abstract (they have no
|
|
immediate instances).</p>
|
|
<p>Special rules apply when casting to namespace-sensitive types.
|
|
The types <code>xs:QName</code> and <code>xs:NOTATION</code> are
|
|
namespace-sensitive. Any type derived by restriction from a
|
|
namespace-sensitive type is itself namespace-sensitive, as is any
|
|
union type having a namespace-sensitive type among its members, and
|
|
any list type having a namespace-sensitive type as its item type.
|
|
For details, see <a href="#constructor-qname-notation"><b>17.2
|
|
Constructor functions for xs:QName and xs:NOTATION</b></a>.</p>
|
|
<div class="note">
|
|
<p class="prefix"><b>Note:</b></p>
|
|
<p>This version of the specification allows casting between
|
|
<code>xs:QName</code> and <code>xs:NOTATION</code> in either
|
|
direction; this was not permitted in the previous Recommendation.
|
|
This version also removes the rule that only a string literal
|
|
(rather than a dynamic string) may be cast to an
|
|
<code>xs:QName</code></p>
|
|
</div>
|
|
<p>When casting to a numeric type:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If the value is too large or too small to be accurately
|
|
represented by the implementation, it is handled as an overflow or
|
|
underflow as defined in <a href="#op.numeric"><b>4.2 Arithmetic
|
|
operators on numeric values</b></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the target type is <code>xs:float</code> or
|
|
<code>xs:double</code>, the string <code>-0</code> (and equivalents
|
|
such as <code>-0.0</code> or <code>-000</code>)
|
|
<strong>should</strong> be converted to the value negative zero.
|
|
However, if the implementation is reliant on an implementation of
|
|
XML Schema 1.0 in which negative zero is not part of the value
|
|
space for these types, these lexical forms <strong>may</strong> be
|
|
converted to positive zero.</p>
|
|
</li>
|
|
</ul>
|
|
<p>In casting to <code>xs:decimal</code> or to a type derived from
|
|
<code>xs:decimal</code>, if the value is not too large or too small
|
|
but nevertheless cannot be represented accurately with the number
|
|
of decimal digits available to the implementation, the
|
|
implementation may round to the nearest representable value or may
|
|
raise a dynamic error [<a href="#ERRFOCA0006" title=
|
|
"err:FOCA0006">err:FOCA0006</a>]. The choice of rounding algorithm
|
|
and the choice between rounding and error behavior and is
|
|
implementation-defined.</p>
|
|
<p>In casting to <code>xs:date</code>, <code>xs:dateTime</code>,
|
|
<code>xs:gYear</code>, or <code>xs:gYearMonth</code> (or types
|
|
derived from these), if the value is too large or too small to be
|
|
represented by the implementation, error [<a href="#ERRFODT0001"
|
|
title="err:FODT0001">err:FODT0001</a>] is raised.</p>
|
|
<p>In casting to a duration value, if the value is too large or too
|
|
small to be represented by the implementation, error [<a href=
|
|
"#ERRFODT0002" title="err:FODT0002">err:FODT0002</a>] is
|
|
raised.</p>
|
|
<p>For <code>xs:anyURI</code>, the extent to which an
|
|
implementation validates the lexical form of <code>xs:anyURI</code>
|
|
is <a title="implementation dependent" class="termref" href=
|
|
"#implementation-dependent"><span class=
|
|
"arrow">·</span>implementation dependent<span class=
|
|
"arrow">·</span></a>.</p>
|
|
<p>If the cast fails for any other reason, error [<a href=
|
|
"#ERRFORG0001" title="err:FORG0001">err:FORG0001</a>] is
|
|
raised.</p>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="casting-non-primitive-types" id=
|
|
"casting-non-primitive-types"></a>18.3 Casting involving
|
|
non-primitive types</h3>
|
|
<p>Casting from <code>xs:string</code> and
|
|
<code>xs:untypedAtomic</code> to any other type (primitive or
|
|
non-primitive) has been described in <a href=
|
|
"#casting-from-strings"><b>18.2 Casting from xs:string and
|
|
xs:untypedAtomic</b></a>. This section defines how other casts to
|
|
non-primitive types operate, including casting to types derived by
|
|
restriction, to union types, and to list types.</p>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-derived-types" id=
|
|
"casting-to-derived-types"></a>18.3.1 Casting to derived types</h4>
|
|
<p>Casting a value to a derived type can be separated into four
|
|
cases. Note that <code>xs:untypedAtomic</code>,
|
|
<code>xs:integer</code> and the two derived types of
|
|
<code>xs:duration</code>:<code>xs:yearMonthDuration</code> and
|
|
<code>xs:dayTimeDuration</code> are treated as primitive types.</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>When <em>SV</em> is an instance of a type that is derived by
|
|
restriction from <em>TT</em>. This is described in section <a href=
|
|
"#casting-from-derived-to-parent"><b>18.3.2 Casting from derived
|
|
types to parent types</b></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>When <em>SV</em> is an instance of a type derived by restriction
|
|
from the same primitive type as <em>TT</em>. This is described in
|
|
<a href="#casting-within-branch"><b>18.3.3 Casting within a branch
|
|
of the type hierarchy</b></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>When the derived type is derived, directly or indirectly, from a
|
|
different primitive type than the primitive type of <em>ST</em>.
|
|
This is described in <a href="#casting-across-hierarchy"><b>18.3.4
|
|
Casting across the type hierarchy</b></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>When <em>SV</em> is an immediate instance of <em>TT</em>, the
|
|
cast always succeeds, returning <em>SV</em> unchanged.</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-from-derived-to-parent" id=
|
|
"casting-from-derived-to-parent"></a>18.3.2 Casting from derived
|
|
types to parent types</h4>
|
|
<p>It is always possible to cast an atomic value <var>A</var> to a
|
|
type <var>T</var> if the relation <code>A instance of T</code> is
|
|
true, provided that <var>T</var> is not an abstract type.</p>
|
|
<p>For example, it is possible to cast an
|
|
<code>xs:unsignedShort</code> to an <code>xs:unsignedInt</code>, to
|
|
an <code>xs:integer</code>, to an <code>xs:decimal</code>, or to a
|
|
union type whose member types are <code>xs:integer</code> and
|
|
<code>xs:double</code>.</p>
|
|
<p>Since the value space of the original type is a subset of the
|
|
value space of the target type, such a cast is always
|
|
successful.</p>
|
|
<p>For the expression <code>A instance of T</code> to be true,
|
|
<var>T</var> must be either an atomic type, or a union type that
|
|
has no constraining facets. It cannot be a list type, nor a union
|
|
type derived by restriction from another union type, nor a union
|
|
type that has a list type among its member types.</p>
|
|
<p>The result will have the same value as the original, but will
|
|
have a new type annotation:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <var>T</var> is an atomic type, then the type annotation of
|
|
the result is <code>T</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If <var>T</var> is a union type, then the type of the result is
|
|
an atomic type <code>M</code> such that <var>M</var> is one of the
|
|
atomic types in the transitive membership of the union type
|
|
<var>T</var> and <code>A instance of M</code> is true; if there is
|
|
more than one type <var>M</var> that satisfies these conditions
|
|
(which could happen, for example, if <var>T</var> is the union of
|
|
two overlapping types such as <code>xs:int</code> and
|
|
<code>xs:positiveInteger</code>) then the first one is used, taking
|
|
the member types in the order in which they appear within the
|
|
definition of the union type.</p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-within-branch" id=
|
|
"casting-within-branch"></a>18.3.3 Casting within a branch of the
|
|
type hierarchy</h4>
|
|
<p>It is possible to cast an <em>SV</em> to a <em>TT</em> if the
|
|
type of the <em>SV</em> and the <em>TT</em> type are both derived
|
|
by restriction (directly or indirectly) from the same primitive
|
|
type, provided that the supplied value conforms to the constraints
|
|
implied by the facets of the target type. This includes the case
|
|
where the target type is derived from the type of the supplied
|
|
value, as well as the case where the type of the supplied value is
|
|
derived from the target type. For example, an instance of
|
|
<code>xs:byte</code> can be cast as <code>xs:unsignedShort</code>,
|
|
provided the value is not negative.</p>
|
|
<p>If the value does not conform to the facets defined for the
|
|
target type, then an error is raised [<a href="#ERRFORG0001" title=
|
|
"err:FORG0001">err:FORG0001</a>]. See <a href="#xmlschema-2">[XML
|
|
Schema Part 2: Datatypes Second Edition]</a>. In the case of the
|
|
pattern facet (which applies to the lexical space rather than the
|
|
value space), the pattern is tested against the canonical lexical
|
|
representation of the value, as defined for the source type (or the
|
|
result of casting the value to an <code>xs:string</code>, in the
|
|
case of types that have no canonical lexical representation defined
|
|
for them).</p>
|
|
<p>Note that this will cause casts to fail if the pattern excludes
|
|
the canonical lexical representation of the source type. For
|
|
example, if the type <code>my:distance</code> is defined as a
|
|
restriction of <code>xs:decimal</code> with a pattern that requires
|
|
two digits after the decimal point, casting of an
|
|
<code>xs:integer</code> to <code>my:distance</code> will always
|
|
fail, because the canonical representation of an
|
|
<code>xs:integer</code> does not conform to this pattern.</p>
|
|
<p>In some cases, casting from a parent type to a derived type
|
|
requires special rules. See <a href=
|
|
"#casting-to-durations"><b>18.1.3 Casting to duration types</b></a>
|
|
for rules regarding casting to <code>xs:yearMonthDuration</code>
|
|
and <code>xs:dayTimeDuration</code>. See <a href=
|
|
"#casting-to-ENTITY"><b>18.1.9 Casting to xs:ENTITY</b></a>, below,
|
|
for casting to <code>xs:ENTITY</code> and types derived from
|
|
it.</p>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-across-hierarchy" id=
|
|
"casting-across-hierarchy"></a>18.3.4 Casting across the type
|
|
hierarchy</h4>
|
|
<p>When the <em>ST</em> and the <em>TT</em> are derived, directly
|
|
or indirectly, from different primitive types, this is called
|
|
casting across the type hierarchy. Casting across the type
|
|
hierarchy is logically equivalent to three separate steps performed
|
|
in order. Errors can occur in either of the latter two steps.</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>Cast the <em>SV</em>, up the hierarchy, to the primitive type of
|
|
the source, as described in <a href=
|
|
"#casting-from-derived-to-parent"><b>18.3.2 Casting from derived
|
|
types to parent types</b></a>.</p>
|
|
<ol class="enumla">
|
|
<li>
|
|
<p>If <em>SV</em> is an instance of <code>xs:string</code> or
|
|
<code>xs:untypedAtomic</code>, check its value against the pattern
|
|
facet of <em>TT</em>, and raise an error [<a href="#ERRFORG0001"
|
|
title="err:FORG0001">err:FORG0001</a>] if the check fails.</p>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>
|
|
<p>Cast the value to the primitive type of <em>TT</em>, as
|
|
described in <a href="#casting-from-primitive-to-primitive"><b>18.1
|
|
Casting from primitive types to primitive types</b></a>.</p>
|
|
<ul>
|
|
<li>
|
|
<p>If <em>TT</em> is derived from <code>xs:NOTATION</code>, assume
|
|
for the purposes of this rule that casting to
|
|
<code>xs:NOTATION</code> succeeds.</p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>Cast the value down to the <em>TT</em>, as described in <a href=
|
|
"#casting-within-branch"><b>18.3.3 Casting within a branch of the
|
|
type hierarchy</b></a></p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-union" id="casting-to-union"></a>18.3.5
|
|
Casting to union types</h4>
|
|
<p>If the target type of a cast expression (or a constructor
|
|
function) is a type with variety union, the supplied value must be
|
|
one of the following:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>A value of type <code>xs:string</code> or
|
|
<code>xs:untypedAtomic</code>. This case follows the general rules
|
|
for casting from strings, and has already been described in
|
|
<a href="#casting-from-strings"><b>18.2 Casting from xs:string and
|
|
xs:untypedAtomic</b></a>.</p>
|
|
<p>If the union type has a pattern facet, the pattern is tested
|
|
against the supplied value after whitespace normalization, using
|
|
the <code>whiteSpace</code> normalization rules of the member
|
|
datatype against which validation succeeds.</p>
|
|
</li>
|
|
<li>
|
|
<p>A value that is an instance of one of the atomic types in the
|
|
transitive membership of the union type, and of the union type
|
|
itself. This case has already been described in <a href=
|
|
"#casting-from-derived-to-parent"><b>18.3.2 Casting from derived
|
|
types to parent types</b></a></p>
|
|
<p>This situation only applies when the value is an instance of the
|
|
union type, which means it will never apply when the union is
|
|
derived by facet-based restriction from another union type.</p>
|
|
</li>
|
|
<li>
|
|
<p>A value that is castable to one or more of the atomic types in
|
|
the transitive membership of the union type (in the sense that the
|
|
<code>castable as</code> operator returns true).</p>
|
|
<p>In this case the supplied value is cast to each atomic type in
|
|
the transitive membership of the union type in turn (in the order
|
|
in which the member types appear in the declaration) until one of
|
|
these casts is successful; if none of them is successful, a dynamic
|
|
error occurs [<a href="#ERRFORG0001" title=
|
|
"err:FORG0001">err:FORG0001</a>]. If the union type has
|
|
constraining facets then the resulting value must satisfy these
|
|
facets, otherwise a dynamic error occurs [<a href="#ERRFORG0001"
|
|
title="err:FORG0001">err:FORG0001</a>].</p>
|
|
<p>If the union type has a pattern facet, the pattern is tested
|
|
against the canonical representation of the result value.</p>
|
|
<p>Only the atomic types in the transitive membership of the union
|
|
type are considered. The union type may have list types in its
|
|
transitive membership, but (unless the supplied value is of type
|
|
<code>xs:string</code> or <code>xs:untypedAtomic</code>, in which
|
|
case the rules in <a href="#casting-from-strings"><b>18.2 Casting
|
|
from xs:string and xs:untypedAtomic</b></a> apply), any list types
|
|
in the membership are effectively ignored.</p>
|
|
</li>
|
|
</ol>
|
|
<p>If more than one of these conditions applies, then the casting
|
|
is done according to the rules for the first condition that
|
|
applies.</p>
|
|
<p>Example: consider a type <var>U</var> whose member types are
|
|
<code>xs:integer</code> and <code>xs:date</code>.</p>
|
|
<ul>
|
|
<li>
|
|
<p>The expression <code>"123" cast as U</code> returns the
|
|
<code>xs:integer</code> value <code>123</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The expression <code>current-date() cast as U</code> returns the
|
|
current date as an instance of <code>xs:date</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The expression <code>23.1 cast as U</code> returns the
|
|
<code>xs:integer</code> value <code>23</code>.</p>
|
|
</li>
|
|
</ul>
|
|
<p>Example: consider a type <var>V</var> whose member types are
|
|
<code>xs:short</code> and <code>xs:negativeInteger</code>.</p>
|
|
<ul>
|
|
<li>
|
|
<p>The expression <code>"-123" cast as V</code> returns the
|
|
<code>xs:short</code> value <code>-123</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The expression <code>"-100000" cast as V</code> returns the
|
|
<code>xs:negativeInteger</code> value <code>-100000</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The expression <code>93.7 cast as V</code> returns the
|
|
<code>xs:short</code> value <code>93</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The expression <code>"93.7" cast as V</code> raises an error
|
|
[<a href="#ERRFORG0001" title="err:FORG0001">err:FORG0001</a>] on
|
|
the grounds that the string <code>"93.7"</code> is not in the
|
|
lexical space of the union type.</p>
|
|
</li>
|
|
</ul>
|
|
<p>Example: consider a type <var>W</var> that is derived from the
|
|
above type <var>V</var> by restriction, with a pattern facet of
|
|
<code>-?\d\d</code>.</p>
|
|
<ul>
|
|
<li>
|
|
<p>The expression <code>"12" cast as V</code> returns the
|
|
<code>xs:short</code> value <code>12</code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The expression <code>"123" cast as V</code> raises an error
|
|
[<a href="#ERRFORG0001" title="err:FORG0001">err:FORG0001</a>] on
|
|
the grounds that the string <code>"123"</code> does not match the
|
|
pattern facet.</p>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="casting-to-list" id="casting-to-list"></a>18.3.6
|
|
Casting to list types</h4>
|
|
<p>If the target type of a cast expression (or a constructor
|
|
function) is a type with variety <code>list</code>, the supplied
|
|
value must be of type <code>xs:string</code> or
|
|
<code>xs:untypedAtomic</code>. The rules follow the general
|
|
principle for all casts from <code>xs:string</code> outlined in
|
|
<a href="#casting-from-strings"><b>18.2 Casting from xs:string and
|
|
xs:untypedAtomic</b></a>.</p>
|
|
<p>The semantics of the operation are consistent with validation:
|
|
that is, the effect of casting a string <var>S</var> to a list type
|
|
<var>L</var> is the same as constructing an element or attribute
|
|
node whose string value is <var>S</var>, validating it using
|
|
<var>L</var> as the governing type, and atomizing the resulting
|
|
node. The result will always be either failure, or a sequence of
|
|
zero or more atomic values each of which is an instance of the item
|
|
type of <var>L</var> (or if the item type of <var>L</var> is a
|
|
union type, an instance of one of the atomic types in its
|
|
transitive membership).</p>
|
|
<p>If the item type of the list type is namespace-sensitive, then
|
|
the namespace bindings in the static context will be used to
|
|
resolve any namespace prefix, in the same way as when the target
|
|
type is <code>xs:QName</code>.</p>
|
|
<p>If the list type has a <code>pattern</code> facet, the pattern
|
|
must match the supplied value after collapsing whitespace (an
|
|
operation equivalent to the use of the <a href=
|
|
"#func-normalize-space"><code>fn:normalize-space</code></a>
|
|
function).</p>
|
|
<p>For example, the expression <code>cast "A B C D" as
|
|
xs:NMTOKENS</code> produces a sequence of four
|
|
<code>xs:NMTOKEN</code> values, <code>("A", "B", "C",
|
|
"D")</code>.</p>
|
|
<p>For example, given a user-defined type
|
|
<code>my:coordinates</code> defined as a list of
|
|
<code>xs:integer</code> with the facet <code><xs:length
|
|
value="3"/></code>, the expression <code>my:coordinates("2
|
|
-1")</code> will return a sequence of two xs:integer values
|
|
<code>(2, -1)</code>, while the expression <code>my:coordinates("1
|
|
2 3")</code> will result in a dynamic error because the length of
|
|
the list does not conform to the <code>length</code> facet. The
|
|
expression <code>my:coordinates("1.0 3.0")</code> will also fail
|
|
because the strings <code>1.0</code> and <code>3.0</code> are not
|
|
in the lexical space of <code>xs:integer</code>.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="back">
|
|
<div class="div1">
|
|
<h2><a name="biblio" id="biblio"></a>A References</h2>
|
|
<div class="div2">
|
|
<h3><a name="normative-biblio" id="normative-biblio"></a>A.1
|
|
Normative references</h3>
|
|
<dl>
|
|
<dt class="label"><span><a name="charmod" id=
|
|
"charmod"></a>Character Model for the World Wide Web 1.0:
|
|
Fundamentals</span></dt>
|
|
<dd>
|
|
<div>Character Model for the World Wide Web 1.0: Fundamentals.
|
|
Available at: <a href=
|
|
"http://www.w3.org/TR/2005/REC-charmod-20050215/">http://www.w3.org/TR/2005/REC-charmod-20050215/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="ieee754-2008" id=
|
|
"ieee754-2008"></a>IEEE 754-2008</span></dt>
|
|
<dd>
|
|
<div>IEEE. <em>IEEE Standard for Floating-Point
|
|
Arithmetic.</em></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="ISO3166" id="ISO3166"></a>ISO
|
|
3166-1</span></dt>
|
|
<dd>
|
|
<div>ISO (International Organization for Standardization) <em>Codes
|
|
for the representation of names of countries and their subdivisions
|
|
- Part 1: Country codes</em> ISO 3166-1:1997.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="ISO10967" id="ISO10967"></a>ISO
|
|
10967</span></dt>
|
|
<dd>
|
|
<div>ISO (International Organization for Standardization).
|
|
<em>ISO/IEC 10967-1:1994, Information technology—Language
|
|
Independent Arithmetic—Part 1: Integer and floating point
|
|
arithmetic</em> [Geneva]: International Organization for
|
|
Standardization, 1994. Available from: <a href=
|
|
"http://www.iso.org/">http://www.iso.org/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="LDML" id="LDML"></a>Locale Data
|
|
Markup Language</span></dt>
|
|
<dd>
|
|
<div>Unicode Technical Standard #35, Locale Data Markup Language.
|
|
Available at: <a href=
|
|
"http://www.unicode.org/reports/tr35/">http://www.unicode.org/reports/tr35/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="LEIRI" id="LEIRI"></a>Legacy
|
|
extended IRIs for XML resource identification</span></dt>
|
|
<dd>
|
|
<div><em>Legacy extended IRIs for XML resource identification</em>.
|
|
Henry S. Thomson, Richard Tobin, and Norman Walsh (eds), World Wide
|
|
Web Consortium. 3 November 2008. Available at <a href=
|
|
"http://www.w3.org/TR/leiri/">http://www.w3.org/TR/leiri/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="rfc2376" id="rfc2376"></a>RFC
|
|
2376</span></dt>
|
|
<dd>
|
|
<div>IETF. <em>RFC 2376: XML Media Types.</em> Available at:
|
|
<a href=
|
|
"http://www.ietf.org/rfc/rfc2376.txt">http://www.ietf.org/rfc/rfc2376.txt</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="rfc3023" id="rfc3023"></a>RFC
|
|
3023</span></dt>
|
|
<dd>
|
|
<div>IETF. <em>RFC 2376: XML Media Types.</em> Available at:
|
|
<a href=
|
|
"http://www.ietf.org/rfc/rfc3023.txt">http://www.ietf.org/rfc/rfc3023.txt</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="rfc3986" id="rfc3986"></a>RFC
|
|
3986</span></dt>
|
|
<dd>
|
|
<div>IETF. <em>RFC 3986: Uniform Resource Identifiers (URI):
|
|
Generic Syntax.</em> Available at: <a href=
|
|
"http://www.ietf.org/rfc/rfc3986.txt">http://www.ietf.org/rfc/rfc3986.txt</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="rfc3987" id="rfc3987"></a>RFC
|
|
3987</span></dt>
|
|
<dd>
|
|
<div>IETF. <em>RFC 3987: Internationalized Resource Identifiers
|
|
(IRIs).</em> Available at: <a href=
|
|
"http://www.ietf.org/rfc/rfc3987.txt">http://www.ietf.org/rfc/rfc3987.txt</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="olson" id="olson"></a>Olson
|
|
Timezone Database</span></dt>
|
|
<dd>
|
|
<div>The <em>tz</em> timezone database, available at <a href=
|
|
"http://www.twinsun.com/tz/tz-link.htm">http://www.twinsun.com/tz/tz-link.htm</a>.
|
|
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 the database is used.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="Unicode" id="Unicode"></a>The
|
|
Unicode Standard</span></dt>
|
|
<dd>
|
|
<div>The Unicode Consortium, Reading, MA, Addison-Wesley, 2003.
|
|
<em>The Unicode Standard</em> as updated from time to time by the
|
|
publication of new versions. See <a href=
|
|
"http://www.unicode.org/standard/versions/">http://www.unicode.org/standard/versions/</a>
|
|
for the latest version and additional information on versions of
|
|
the standard and of the Unicode Character Database. The version of
|
|
Unicode to be used is <a title="implementation-defined" class=
|
|
"termref" href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>, but implementations are recommended to use
|
|
the latest Unicode version; currently, Version 6.0.0.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="Unicode-Collations" id=
|
|
"Unicode-Collations"></a>Unicode Collation Algorithm</span></dt>
|
|
<dd>
|
|
<div>Unicode Technical Standard #10, Unicode Collation Algorithm.
|
|
Available at: <a href=
|
|
"http://www.unicode.org/reports/tr10/">http://www.unicode.org/reports/tr10/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="Unicode-Normalization" id=
|
|
"Unicode-Normalization"></a>Unicode Normaliation Forms</span></dt>
|
|
<dd>
|
|
<div>Unicode Standard Annex #15, Unicode Normalization Forms.
|
|
Available at: <a href=
|
|
"http://www.unicode.org/reports/tr15/">http://www.unicode.org/reports/tr15/</a>.
|
|
As with <a href="#Unicode">[The Unicode Standard]</a>, the version
|
|
to be used is <a title="implementation-defined" class="termref"
|
|
href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="Unicode-Regex" id=
|
|
"Unicode-Regex"></a>Unicode Regular Expressions</span></dt>
|
|
<dd>
|
|
<div>Unicode Technical Standard #18, Unicode Regular Expressions.
|
|
Available at: <a href=
|
|
"http://www.unicode.org/reports/tr18/">http://www.unicode.org/reports/tr18/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="REC-xml" id=
|
|
"REC-xml"></a>REC-xml</span></dt>
|
|
<dd>
|
|
<div>World Wide Web Consortium. <em>Extensible Markup Language
|
|
(XML) 1.0 Third Edition.</em> Available at: <a href=
|
|
"http://www.w3.org/TR/REC-xml/">http://www.w3.org/TR/REC-xml/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xml11" id="xml11"></a>Extensible
|
|
Markup Language (XML) 1.1 Recommendation</span></dt>
|
|
<dd>
|
|
<div>World Wide Web Consortium. <em>Extensible Markup Language
|
|
(XML) 1.1.</em> Available at: <a href=
|
|
"http://www.w3.org/TR/2004/REC-xml11-20040204/">http://www.w3.org/TR/2004/REC-xml11-20040204/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xpath" id="xpath"></a>XML Path
|
|
Language (XPath) Version 1.0</span></dt>
|
|
<dd>
|
|
<div><a href="http://www.w3.org/TR/xpath/"><cite>XML Path Language
|
|
(XPath) Version 1.0</cite></a>, Steven DeRose and James Clark,
|
|
Editors. World Wide Web Consortium, 16 Nov 1999. This
|
|
version is http://www.w3.org/TR/1999/REC-xpath-19991116/. The
|
|
<a href="http://www.w3.org/TR/xpath/">latest version</a> is
|
|
available at http://www.w3.org/TR/xpath/.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xpath20" id="xpath20"></a>XML Path
|
|
Language (XPath) 2.0</span></dt>
|
|
<dd>
|
|
<div><a href="http://www.w3.org/TR/xpath20/"><cite>XML Path
|
|
Language (XPath) 2.0 (Second Edition)</cite></a>, Don Chamberlin,
|
|
Anders Berglund, Scott Boag, <em>et. al.</em>, Editors. World Wide
|
|
Web Consortium, 14 December 2010. This version is
|
|
http://www.w3.org/TR/2010/REC-xpath20-20101214/. The <a href=
|
|
"http://www.w3.org/TR/xpath20/">latest version</a> is available at
|
|
http://www.w3.org/TR/xpath20/.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xpath-30" id="xpath-30"></a>XML
|
|
Path Language (XPath) 3.0</span></dt>
|
|
<dd>
|
|
<div><a href="http://www.w3.org/TR/xpath-30/"><cite>XML Path
|
|
Language (XPath) 3.0</cite></a>, Jonathan Robie, Don Chamberlin,
|
|
Michael Dyck, John Snelson, Editors. World Wide Web Consortium, 13
|
|
December 2011. This version is
|
|
http://www.w3.org/TR/2011/WD-xpath-30-20111213/. The <a href=
|
|
"http://www.w3.org/TR/xpath-30/">latest version</a> is available at
|
|
http://www.w3.org/TR/xpath-30/.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xslt20" id="xslt20"></a>XSL
|
|
Transformations (XSLT) Version 2.0</span></dt>
|
|
<dd>
|
|
<div><a href="http://www.w3.org/TR/xslt20/"><cite>XSL
|
|
Transformations (XSLT) Version 2.0 (Second Edition)</cite></a>,
|
|
Michael Kay, Editor. World Wide Web Consortium, 23 January 2007.
|
|
This version is http://www.w3.org/TR/2007/REC-xslt20-20070123/. The
|
|
<a href="http://www.w3.org/TR/xslt20/">latest version</a> is
|
|
available at http://www.w3.org/TR/xslt20/.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xslt-30" id="xslt-30"></a>XSL
|
|
Transformations (XSLT) Version 3.0</span></dt>
|
|
<dd>
|
|
<div><cite>XSL Transformations (XSLT) Version 3.0</cite>
|
|
(expected), Michael Kay, Editor. World Wide Web Consortium, (not
|
|
yet published but anticipated in 2012; see the <a href=
|
|
"http://www.w3.org/TR/#tr_XSLT">list of XSLT
|
|
specifications</a>)</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xpath-datamodel-30" id=
|
|
"xpath-datamodel-30"></a>XQuery and XPath Data Model (XDM)
|
|
3.0</span></dt>
|
|
<dd>
|
|
<div><a href=
|
|
"http://www.w3.org/TR/xpath-datamodel-30/"><cite>XQuery and XPath
|
|
Data Model (XDM) 3.0</cite></a>, Norman Walsh, John Snelson,
|
|
Editors. World Wide Web Consortium, 13 December 2011. This version
|
|
is http://www.w3.org/TR/2011/WD-xpath-datamodel-30-20111213/. The
|
|
<a href="http://www.w3.org/TR/xpath-datamodel-30/">latest
|
|
version</a> is available at
|
|
http://www.w3.org/TR/xpath-datamodel-30/.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xslt-xquery-serialization-30" id=
|
|
"xslt-xquery-serialization-30"></a>XSLT and XQuery Serialization
|
|
3.0</span></dt>
|
|
<dd>
|
|
<div><a href=
|
|
"http://www.w3.org/TR/xslt-xquery-serialization-30/"><cite>XSLT and
|
|
XQuery Serialization 3.0</cite></a>, Henry Zongaro, Editor. World
|
|
Wide Web Consortium, 13 December 2011. This version is
|
|
http://www.w3.org/TR/2011/WD-xslt-xquery-serialization-30-20111213/.
|
|
The <a href=
|
|
"http://www.w3.org/TR/xslt-xquery-serialization-30/">latest
|
|
version</a> is available at
|
|
http://www.w3.org/TR/xslt-xquery-serialization-30/.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xquery-semantics" id=
|
|
"xquery-semantics"></a>XQuery 1.0 and XPath 2.0 Formal
|
|
Semantics</span></dt>
|
|
<dd>
|
|
<div><a href="http://www.w3.org/TR/xquery-semantics/"><cite>XQuery
|
|
1.0 and XPath 2.0 Formal Semantics (Second Edition)</cite></a>,
|
|
Jérôme Siméon, Denise Draper, Peter Frankhauser, <em>et. al.</em>,
|
|
Editors. World Wide Web Consortium, 14 December 2010. This version
|
|
is http://www.w3.org/TR/2010/REC-xquery-semantics-20101214/. The
|
|
<a href="http://www.w3.org/TR/xquery-semantics/">latest version</a>
|
|
is available at http://www.w3.org/TR/xquery-semantics/.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xquery" id="xquery"></a>XQuery
|
|
1.0: An XML Query Language</span></dt>
|
|
<dd>
|
|
<div><a href="http://www.w3.org/TR/xquery/"><cite>XQuery 1.0: An
|
|
XML Query Language (Second Edition)</cite></a>, Don Chamberlin,
|
|
Anders Berglund, Scott Boag, <em>et. al.</em>, Editors. World Wide
|
|
Web Consortium, 14 December 2010. This version is
|
|
http://www.w3.org/TR/2010/REC-xquery-20101214/. The <a href=
|
|
"http://www.w3.org/TR/xquery/">latest version</a> is available at
|
|
http://www.w3.org/TR/xquery/.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xquery-30" id=
|
|
"xquery-30"></a>XQuery 3.0: An XML Query Language</span></dt>
|
|
<dd>
|
|
<div><a href="http://www.w3.org/TR/xquery-30/"><cite>XQuery 3.0: An
|
|
XML Query Language</cite></a>, Jonathan Robie, Don Chamberlin,
|
|
Michael Dyck, John Snelson, Editors. World Wide Web Consortium, 13
|
|
December 2011. This version is
|
|
http://www.w3.org/TR/2011/WD-xquery-30-20111213/. The <a href=
|
|
"http://www.w3.org/TR/xquery-30/">latest version</a> is available
|
|
at http://www.w3.org/TR/xquery-30/.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xinclude" id="xinclude"></a>XML
|
|
Inclusions (XInclude) Version 1.0 (Second Edition)</span></dt>
|
|
<dd>
|
|
<div><a href="http://www.w3.org/TR/xinclude/"><cite>XML Inclusions
|
|
(XInclude) Version 1.0 (Second Edition)</cite></a>, Daniel
|
|
Veillard, David Orchard, and Jonathan Marsh, Editors. World Wide
|
|
Web Consortium, 15 Nov 2006. This version is
|
|
http://www.w3.org/TR/2006/REC-xinclude-20061115/. The <a href=
|
|
"http://www.w3.org/TR/xinclude/">latest version</a> is available at
|
|
http://www.w3.org/TR/xinclude/.</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xmlschema-2" id=
|
|
"xmlschema-2"></a>XML Schema Part 2: Datatypes Second
|
|
Edition</span></dt>
|
|
<dd>
|
|
<div>XML Schema Part 2: Datatypes Second Edition, Oct. 28 2004.
|
|
Available at: <a href=
|
|
"http://www.w3.org/TR/xmlschema-2/">http://www.w3.org/TR/xmlschema-2/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="xmlschema11-2" id=
|
|
"xmlschema11-2"></a>XML Schema 1.1 Part 2: Datatypes</span></dt>
|
|
<dd>
|
|
<div>XML Schema 1.1 Part 2: Datatypes, 3 December 2009. Available
|
|
at: <a href=
|
|
"http://www.w3.org/TR/xmlschema11-2/">http://www.w3.org/TR/xmlschema11-2/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="REC-xml-names" id=
|
|
"REC-xml-names"></a>Namespaces in XML</span></dt>
|
|
<dd>
|
|
<div>Namespaces in XML. Available at: <a href=
|
|
"http://www.w3.org/TR/1999/REC-xml-names-19990114/">http://www.w3.org/TR/1999/REC-xml-names-19990114/</a></div>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="non-normative-biblio" id=
|
|
"non-normative-biblio"></a>A.2 Non-normative references</h3>
|
|
<dl>
|
|
<dt class="label"><span><a name="CALCALC" id=
|
|
"CALCALC"></a>Calendrical Calculations</span></dt>
|
|
<dd>
|
|
<div>Edward M. Reingold and Nachum Dershowitz. <em>Calendrical
|
|
Calculations Millennium edition (2nd Edition)</em>. Cambridge
|
|
University Press, ISBN 0 521 77752 6</div>
|
|
</dd>
|
|
<dt class="label"><span><a name="charmod-normalization" id=
|
|
"charmod-normalization"></a>Character Model for the World Wide Web
|
|
1.0: Normalization</span></dt>
|
|
<dd>
|
|
<div>Character Model for the World Wide Web 1.0: Normalization,
|
|
Last Call Working Draft. Available at: <a href=
|
|
"http://www.w3.org/TR/2004/WD-charmod-norm-20040225/">http://www.w3.org/TR/2004/WD-charmod-norm-20040225/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="HTML40" id="HTML40"></a>HTML
|
|
4.0</span></dt>
|
|
<dd>
|
|
<div>HTML 4.01 Recommendation, 24 December 1999. Available at:
|
|
<a href=
|
|
"http://www.w3.org/TR/REC-html40/">http://www.w3.org/TR/REC-html40/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="ISO8601" id="ISO8601"></a>ISO
|
|
8601</span></dt>
|
|
<dd>
|
|
<div>ISO (International Organization for Standardization).
|
|
<em>Representations of dates and times, 2000-08-03.</em> Available
|
|
from: <a href="http://www.iso.org/">http://www.iso.org/"</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="POSIX.1-2008" id=
|
|
"POSIX.1-2008"></a>POSIX.1-2008</span></dt>
|
|
<dd>
|
|
<div><em>The Open Group Base Specifications Isuse 7 (IEEE Std
|
|
1003.1-2008)</em>. Available at: <a href=
|
|
"http://pubs.opengroup.org/onlinepubs/9699919799/">http://pubs.opengroup.org/onlinepubs/9699919799/</a></div>
|
|
</dd>
|
|
<dt class="label"><span><a name="Working-With-Timezones" id=
|
|
"Working-With-Timezones"></a>Working With Timezones</span></dt>
|
|
<dd>
|
|
<div>World Wide Web Consortium Working Group Note. <em>Working With
|
|
Timezones, October 13, 2005.</em> Available at: <a href=
|
|
"http://www.w3.org/TR/2005/NOTE-timezone-20051013/">http://www.w3.org/TR/2005/NOTE-timezone-20051013/</a></div>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="error-summary" id="error-summary"></a>B Error
|
|
summary</h2>
|
|
<p>The error text provided with these errors is non-normative.</p>
|
|
<dl>
|
|
<dt><a name="ERRFOER0000" id="ERRFOER0000"></a>err:FOER0000,
|
|
Unidentified error.</dt>
|
|
<dd>
|
|
<p>Unidentified error.</p>
|
|
</dd>
|
|
<dt><a name="ERRFOAR0001" id="ERRFOAR0001"></a>err:FOAR0001,
|
|
Division by zero.</dt>
|
|
<dd>
|
|
<p>This error is raised whenever an attempt is made to divide by
|
|
zero.</p>
|
|
</dd>
|
|
<dt><a name="ERRFOAR0002" id="ERRFOAR0002"></a>err:FOAR0002,
|
|
Numeric operation overflow/underflow.</dt>
|
|
<dd>
|
|
<p>This error is raised whenever numeric operations result in an
|
|
overflow or underflow.</p>
|
|
</dd>
|
|
<dt><a name="ERRFOCA0001" id="ERRFOCA0001"></a>err:FOCA0001, Input
|
|
value too large for decimal.</dt>
|
|
<dt><a name="ERRFOCA0002" id="ERRFOCA0002"></a>err:FOCA0002,
|
|
Invalid lexical value.</dt>
|
|
<dt><a name="ERRFOCA0003" id="ERRFOCA0003"></a>err:FOCA0003, Input
|
|
value too large for integer.</dt>
|
|
<dt><a name="ERRFOCA0005" id="ERRFOCA0005"></a>err:FOCA0005, NaN
|
|
supplied as float/double value.</dt>
|
|
<dt><a name="ERRFOCA0006" id="ERRFOCA0006"></a>err:FOCA0006, String
|
|
to be cast to decimal has too many digits of precision.</dt>
|
|
<dt><a name="ERRFOCH0001" id="ERRFOCH0001"></a>err:FOCH0001,
|
|
Codepoint not valid.</dt>
|
|
<dt><a name="ERRFOCH0002" id="ERRFOCH0002"></a>err:FOCH0002,
|
|
Unsupported collation.</dt>
|
|
<dt><a name="ERRFOCH0003" id="ERRFOCH0003"></a>err:FOCH0003,
|
|
Unsupported normalization form.</dt>
|
|
<dt><a name="ERRFOCH0004" id="ERRFOCH0004"></a>err:FOCH0004,
|
|
Collation does not support collation units.</dt>
|
|
<dt><a name="ERRFODC0001" id="ERRFODC0001"></a>err:FODC0001, No
|
|
context document.</dt>
|
|
<dt><a name="ERRFODC0002" id="ERRFODC0002"></a>err:FODC0002, Error
|
|
retrieving resource.</dt>
|
|
<dt><a name="ERRFODC0003" id="ERRFODC0003"></a>err:FODC0003,
|
|
Function not defined as deterministic.</dt>
|
|
<dt><a name="ERRFODC0004" id="ERRFODC0004"></a>err:FODC0004,
|
|
Invalid argument to fn:collection.</dt>
|
|
<dt><a name="ERRFODC0005" id="ERRFODC0005"></a>err:FODC0005,
|
|
Invalid argument to fn:doc or fn:doc-available.</dt>
|
|
<dt><a name="ERRFODC0006" id="ERRFODC0006"></a>err:FODC0006, String
|
|
passed to fn:parse-xml is not a well-formed XML document.</dt>
|
|
<dt><a name="ERRFODC0007" id="ERRFODC0007"></a>err:FODC0007, Base
|
|
URI passed to fn:parse-xml is not a valid absolute URI.</dt>
|
|
<dt><a name="ERRFODF1280" id="ERRFODF1280"></a>err:FODF1280,
|
|
Invalid decimal format name.</dt>
|
|
<dd>
|
|
<p>This error is raised if the decimal format name supplied to
|
|
<a href="#func-format-number"><code>fn:format-number</code></a> is
|
|
not a valid QName, or if the prefix in the QName is undeclared, or
|
|
if there is no decimal format in the static context with a matching
|
|
name.</p>
|
|
</dd>
|
|
<dt><a name="ERRFODF1310" id="ERRFODF1310"></a>err:FODF1310,
|
|
Invalid decimal format picture string.</dt>
|
|
<dd>
|
|
<p>This error is raised if the picture string supplied to <a href=
|
|
"#func-format-number"><code>fn:format-number</code></a> has invalid
|
|
syntax.</p>
|
|
</dd>
|
|
<dt><a name="ERRFODT0001" id="ERRFODT0001"></a>err:FODT0001,
|
|
Overflow/underflow in date/time operation.</dt>
|
|
<dt><a name="ERRFODT0002" id="ERRFODT0002"></a>err:FODT0002,
|
|
Overflow/underflow in duration operation.</dt>
|
|
<dt><a name="ERRFODT0003" id="ERRFODT0003"></a>err:FODT0003,
|
|
Invalid timezone value.</dt>
|
|
<dt><a name="ERRFOFD1340" id="ERRFOFD1340"></a>err:FOFD1340,
|
|
Invalid date/time formatting picture string.</dt>
|
|
<dd>
|
|
<p>This error is raised if the picture string supplied to <a href=
|
|
"#func-format-date"><code>fn:format-date</code></a>, <a href=
|
|
"#func-format-time"><code>fn:format-time</code></a>, or <a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a> has
|
|
invalid syntax.</p>
|
|
</dd>
|
|
<dt><a name="ERRFOFD1350" id="ERRFOFD1350"></a>err:FOFD1350,
|
|
Invalid date/time formatting component.</dt>
|
|
<dd>
|
|
<p>This error is raised if the picture string supplied to <a href=
|
|
"#func-format-date"><code>fn:format-date</code></a> selects a
|
|
component that is not present in a date, or if the picture string
|
|
supplied to <a href=
|
|
"#func-format-time"><code>fn:format-time</code></a> selects a
|
|
component that is not present in a time.</p>
|
|
</dd>
|
|
<dt><a name="ERRFOFI0001" id="ERRFOFI0001"></a>err:FOFI0001,
|
|
Language argument is not castable to xs:language.</dt>
|
|
<dd>
|
|
<p>This error is raised if the language argument supplied to
|
|
<a href="#func-format-integer"><code>fn:format-integer</code></a>
|
|
is not castable to <code>xs:language</code>.</p>
|
|
</dd>
|
|
<dt><a name="ERRFOFL0001" id="ERRFOFL0001"></a>err:FOFL0001,
|
|
Dynamic call on context-dependent function item.</dt>
|
|
<dd>
|
|
<p>This error is raised if the <a href=
|
|
"#func-function-lookup"><code>fn:function-lookup</code></a> returns
|
|
a context-dependent function and the context-dependent function is
|
|
then called.</p>
|
|
</dd>
|
|
<dt><a name="ERRFOJS0001" id="ERRFOJS0001"></a>err:FOJS0001, Input
|
|
to parse-JSON does not conform to JSON syntax</dt>
|
|
<dt><a name="ERRFOJS0002" id="ERRFOJS0002"></a>err:FOJS0002,
|
|
Invalid escaped character in JSON input</dt>
|
|
<dt><a name="ERRFONS0004" id="ERRFONS0004"></a>err:FONS0004, No
|
|
namespace found for prefix.</dt>
|
|
<dt><a name="ERRFONS0005" id="ERRFONS0005"></a>err:FONS0005,
|
|
Base-uri not defined in the static context.</dt>
|
|
<dt><a name="ERRFORG0001" id="ERRFORG0001"></a>err:FORG0001,
|
|
Invalid value for cast/constructor.</dt>
|
|
<dt><a name="ERRFORG0002" id="ERRFORG0002"></a>err:FORG0002,
|
|
Invalid argument to fn:resolve-uri().</dt>
|
|
<dt><a name="ERRFORG0003" id="ERRFORG0003"></a>err:FORG0003,
|
|
fn:zero-or-one called with a sequence containing more than one
|
|
item.</dt>
|
|
<dt><a name="ERRFORG0004" id="ERRFORG0004"></a>err:FORG0004,
|
|
fn:one-or-more called with a sequence containing no items.</dt>
|
|
<dt><a name="ERRFORG0005" id="ERRFORG0005"></a>err:FORG0005,
|
|
fn:exactly-one called with a sequence containing zero or more than
|
|
one item.</dt>
|
|
<dt><a name="ERRFORG0006" id="ERRFORG0006"></a>err:FORG0006,
|
|
Invalid argument type.</dt>
|
|
<dt><a name="ERRFORG0008" id="ERRFORG0008"></a>err:FORG0008, The
|
|
two arguments to fn:dateTime have inconsistent timezones.</dt>
|
|
<dt><a name="ERRFORG0009" id="ERRFORG0009"></a>err:FORG0009, Error
|
|
in resolving a relative URI against a base URI in
|
|
fn:resolve-uri.</dt>
|
|
<dt><a name="ERRFORX0001" id="ERRFORX0001"></a>err:FORX0001,
|
|
Invalid regular expression flags.</dt>
|
|
<dt><a name="ERRFORX0002" id="ERRFORX0002"></a>err:FORX0002,
|
|
Invalid regular expression.</dt>
|
|
<dt><a name="ERRFORX0003" id="ERRFORX0003"></a>err:FORX0003,
|
|
Regular expression matches zero-length string.</dt>
|
|
<dt><a name="ERRFORX0004" id="ERRFORX0004"></a>err:FORX0004,
|
|
Invalid replacement string.</dt>
|
|
<dt><a name="ERRFOTY0012" id="ERRFOTY0012"></a>err:FOTY0012,
|
|
Argument to fn:data() contains a node that does not have a typed
|
|
value.</dt>
|
|
<dt><a name="ERRFOTY0013" id="ERRFOTY0013"></a>err:FOTY0013, The
|
|
argument to fn:data() contains a function item.</dt>
|
|
<dt><a name="ERRFOTY0014" id="ERRFOTY0014"></a>err:FOTY0014, The
|
|
argument to fn:string() is a function item.</dt>
|
|
<dt><a name="ERRFOTY0015" id="ERRFOTY0015"></a>err:FOTY0015, An
|
|
argument to fn:deep-equal() contains a function item.</dt>
|
|
<dt><a name="ERRFOUT1170" id="ERRFOUT1170"></a>err:FOUT1170,
|
|
Invalid $href argument to fn:unparsed-text() (etc.)</dt>
|
|
<dd>
|
|
<p>An error is raised if the <code>$href</code> argument contains a
|
|
fragment identifier, or if it cannot be used to retrieve a resource
|
|
containing text.</p>
|
|
</dd>
|
|
<dt><a name="ERRFOUT1190" id="ERRFOUT1190"></a>err:FOUT1190, Cannot
|
|
decode resource retrieved by fn:unparsed-text() (etc.)</dt>
|
|
<dd>
|
|
<p>An error is raised if the retrieved resource contains octets
|
|
that cannot be decoded into Unicode <a title="character" class=
|
|
"termref" href="#character"><span class=
|
|
"arrow">·</span>characters<span class="arrow">·</span></a> using
|
|
the specified encoding, or if the resulting characters are not
|
|
permitted XML characters. This includes the case where the
|
|
processor does not support the requested encoding.</p>
|
|
</dd>
|
|
<dt><a name="ERRFOUT1200" id="ERRFOUT1200"></a>err:FOUT1200, Cannot
|
|
infer encoding of resource retrieved by fn:unparsed-text()
|
|
(etc.)</dt>
|
|
<dd>
|
|
<p>An error is raised if <code>$encoding</code> is absent and the
|
|
processor cannot infer the encoding using external information and
|
|
the encoding is not UTF-8.</p>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="xpath1-compatibility" id="xpath1-compatibility"></a>C
|
|
Compatibility with XPath 1.0 (Non-Normative)</h2>
|
|
<p>This appendix summarizes the relationship between certain
|
|
functions defined in <a href="#xpath">[XML Path Language (XPath)
|
|
Version 1.0]</a> and the corresponding functions defined in this
|
|
document. The first column of the table provides the signature of
|
|
functions defined in this document. The second column provides the
|
|
signature of the corresponding function in <a href="#xpath">[XML
|
|
Path Language (XPath) Version 1.0]</a>. The third column describes
|
|
the differences in the semantics of the corresponding functions.
|
|
The functions appear in the order they appear in <a href=
|
|
"#xpath">[XML Path Language (XPath) Version 1.0]</a>.</p>
|
|
<p>The evaluation of the arguments to the functions defined in this
|
|
document depends on whether the XPath 1.0 compatibility mode is on
|
|
or off. See <a href="#xpath20">[XML Path Language (XPath) 2.0]</a>.
|
|
If the mode is on, the following conversions are applied, in order,
|
|
before the argument value is passed to the function:</p>
|
|
<ul>
|
|
<li>
|
|
<p>If the expected type is a single item or an optional single
|
|
item, (examples: <code>xs:string, xs:string?, xs:untypedAtomic,
|
|
xs:untypedAtomic?, node(), node()?, item(), item()?</code>), then
|
|
the given value <code>V</code> is effectively replaced by <a href=
|
|
"#func-subsequence"><code>fn:subsequence(V, 1, 1)</code></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the expected type is <code>xs:string</code> or
|
|
<code>xs:string?</code>, then the given value <code>V</code> is
|
|
effectively replaced by <a href=
|
|
"#func-string"><code>fn:string(V)</code></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the expected type is numeric or optional numeric, then the
|
|
given value <code>V</code> is effectively replaced by <a href=
|
|
"#func-number"><code>fn:number(V)</code></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Otherwise, the given value is unchanged.</p>
|
|
</li>
|
|
</ul>
|
|
<table summary="Issues list" border="1" width="100%">
|
|
<col width="33%" span="1" />
|
|
<col width="33%" span="1" />
|
|
<col width="33%" span="1" />
|
|
<tbody>
|
|
<tr>
|
|
<th colspan="1">XQuery 1.0 and XPath 2.0</th>
|
|
<th colspan="1">XPath 1.0</th>
|
|
<th colspan="1">Notes</th>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:last</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer</code></div>
|
|
</td>
|
|
<td><code>last() => number</code></td>
|
|
<td>Precision of numeric results may be different.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:position</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer</code></div>
|
|
</td>
|
|
<td><code>position() => number</code></td>
|
|
<td>Precision of numeric results may be different.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:count</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:integer</code></div>
|
|
</td>
|
|
<td><code>count(node-set) => number</code></td>
|
|
<td>Precision of numeric results may be different.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class="function">fn:id</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">element()*</code></div>
|
|
</td>
|
|
<td><code>id(object) => node-set</code></td>
|
|
<td>XPath 2.0 behavior is different for boolean and numeric
|
|
arguments. The recognition of a node as an id value is sensitive to
|
|
the manner in which the datamodel is constructed. In XPath 1.0 the
|
|
whole string is treated as a unit. In XPath 2.0 each string is
|
|
treated as a list.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:local-name</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string</code></div>
|
|
</td>
|
|
<td rowspan="2"><code>local-name(node-set?) =>
|
|
string</code></td>
|
|
<td rowspan="2">If compatibility mode is off, an error will occur
|
|
if argument has more than one node.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:local-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:string</code></div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:namespace-uri</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string</code></div>
|
|
</td>
|
|
<td rowspan="2"><code>namespace-uri(node-set?) =>
|
|
string</code></td>
|
|
<td rowspan="2">If compatibility mode is off, an error will occur
|
|
if argument has more than one node.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:namespace-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:string</code></div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn: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:string</code></div>
|
|
</td>
|
|
<td><code>name(node-set?) => string</code></td>
|
|
<td>If compatibility mode is off, an error will occur if argument
|
|
has more than one node. The rules for determining the prefix are
|
|
more precisely defined in <a href="#xpath20">[XML Path Language
|
|
(XPath) 2.0]</a>. Function is not "well-defined" for parentless
|
|
attribute nodes.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:string</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string</code></div>
|
|
</td>
|
|
<td rowspan="2"><code>string(object) => string</code></td>
|
|
<td rowspan="2">If compatibility mode is off, an error will occur
|
|
if argument has more than one node. Representations of numeric
|
|
values are XPath 1.0 compatible except for the special values
|
|
positive and negative infinity, and for values outside the range
|
|
1.0e-6 to 1.0e+6.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<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>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="3"><code class=
|
|
"function">fn:concat</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><span class="varargs">...</span></td>
|
|
<td valign="baseline">)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</td>
|
|
<td><code>concat(string, string, string*) => string</code></td>
|
|
<td>If compatibility mode is off, an error will occur if an
|
|
argument has more than one node. If compatibility mode on, the
|
|
first node in the sequence is used.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:starts-with</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></div>
|
|
</td>
|
|
<td rowspan="2"><code>starts-with(string, string) =>
|
|
boolean</code></td>
|
|
<td rowspan="2">If compatibility mode is off, an error will occur
|
|
if either argument has more than one node or is a number or a
|
|
boolean. If compatibility mode is on, implicit conversion is
|
|
performed.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="3"><code class=
|
|
"function">fn:starts-with</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</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">$arg2</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">$collation</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:boolean</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:contains</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$arg2</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></div>
|
|
</td>
|
|
<td rowspan="2"><code>contains(string, string) =>
|
|
boolean</code></td>
|
|
<td rowspan="2">If compatibility mode is off, an error will occur
|
|
if either argument has more than one node or is a number or a
|
|
boolean. If compatibility mode is on, implicit conversion is
|
|
performed.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="3"><code class=
|
|
"function">fn:contains</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</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">$arg2</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">$collation</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:boolean</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:substring-before</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$arg2</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>
|
|
</td>
|
|
<td rowspan="2"><code>substring-before(string, string) =>
|
|
string</code></td>
|
|
<td rowspan="2">If compatibility mode is off, an error will occur
|
|
if either argument has more than one node or is a number or a
|
|
boolean. If compatibility mode is on, implicit conversion is
|
|
performed.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="3"><code class=
|
|
"function">fn:substring-before</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</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">$arg2</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">$collation</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>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:substring-after</code>(<code class=
|
|
"arg">$arg1</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$arg2</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>
|
|
</td>
|
|
<td rowspan="2"><code>substring-after(string, string) =>
|
|
string</code></td>
|
|
<td rowspan="2">If compatibility mode is off, an error will occur
|
|
if either argument has more than one node or is a number or a
|
|
boolean. If compatibility mode is on, implicit conversion is
|
|
performed.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="3"><code class=
|
|
"function">fn:substring-after</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</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">$arg2</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">$collation</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>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:substring</code>(</td>
|
|
<td valign="baseline"><code class="arg">$sourceString</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">$startingLoc</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:double</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</td>
|
|
<td rowspan="2"><code>substring(string, number, number?) =>
|
|
string</code></td>
|
|
<td rowspan="2">If compatibility mode is off, an error will occur
|
|
if <code>$sourceString</code> has more than one node or is a number
|
|
or a boolean. If compatibility mode is on, implicit conversion is
|
|
performed.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="3"><code class=
|
|
"function">fn:substring</code>(</td>
|
|
<td valign="baseline"><code class="arg">$sourceString</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">$startingLoc</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">xs:double</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$length</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:double</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:string-length</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:string?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</code></div>
|
|
</td>
|
|
<td rowspan="2"><code>string-length(string?) =>
|
|
number</code></td>
|
|
<td rowspan="2">If compatibility mode is off, numbers and booleans
|
|
will give errors for first arg. Also, multiple nodes will give
|
|
error.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:string-length</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer?</code></div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:normalize-space</code>(<code class=
|
|
"arg">$arg</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>
|
|
</td>
|
|
<td rowspan="2"><code>normalize-space(string?) =>
|
|
string</code></td>
|
|
<td rowspan="2">If compatibility mode is off, an error will occur
|
|
if <code>$arg</code> has more than one node or is a number or a
|
|
boolean. If compatibility mode is on, implicit conversion is
|
|
performed.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:normalize-space</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string</code></div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="3"><code class=
|
|
"function">fn:translate</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg</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">$mapString</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">$transString</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>
|
|
</td>
|
|
<td><code>translate(string, string, string)=> string</code></td>
|
|
<td>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:boolean</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:boolean</code></div>
|
|
</td>
|
|
<td><code>boolean(object) => boolean</code></td>
|
|
<td></td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:not</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:boolean</code></div>
|
|
</td>
|
|
<td><code>not(boolean) => boolean</code></td>
|
|
<td></td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:true</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></div>
|
|
</td>
|
|
<td><code>true() => boolean</code></td>
|
|
<td></td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:false</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></div>
|
|
</td>
|
|
<td><code>false() => boolean</code></td>
|
|
<td></td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:lang</code>(<code class=
|
|
"arg">$testlang</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:string</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:boolean</code></div>
|
|
</td>
|
|
<td><code>lang(string) => boolean</code></td>
|
|
<td>If compatibility mode is off, numbers and booleans will give
|
|
errors. Also, multiple nodes will give error. If compatibility mode
|
|
is on, implicit conversion is performed.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:number</code>()<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:double</code></div>
|
|
</td>
|
|
<td rowspan="2"><code>number(object?) => number</code></td>
|
|
<td rowspan="2">Error if argument has more than one node when not
|
|
in compatibility node.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:number</code>(<code class=
|
|
"arg">$arg</code><code class="as"> as </code><code class=
|
|
"type">xs:anyAtomicType?</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:double</code></div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<div class="proto"><code class=
|
|
"function">fn:sum</code>(<code class="arg">$arg</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-varies">xs:anyAtomicType</code></div>
|
|
</td>
|
|
<td><code>sum(node-set) => number</code></td>
|
|
<td>2.0 raises an error if sequence contains values that cannot be
|
|
added together such as NMTOKENS and other subtypes of string. 1.0
|
|
returns <code>NaN</code>.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<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-varies">numeric?</code></div>
|
|
</td>
|
|
<td><code>floor(number)=> number</code></td>
|
|
<td>In 2.0, if argument is <code>()</code>, the result is
|
|
<code>()</code>. In 1.0, the result is <code>NaN</code>. If
|
|
compatibility mode is off, an error will occur with more than one
|
|
node. If compatibility mode is on, implicit conversion is
|
|
performed.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<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-varies">numeric?</code></div>
|
|
</td>
|
|
<td><code>ceiling(number)=> number</code></td>
|
|
<td>In 2.0, if argument is <code>()</code>, the result is
|
|
<code>()</code>. In 1.0, the result is <code>NaN</code>. If
|
|
compatibility mode is off, an error will occur with more than one
|
|
node. If compatibility mode is on, implicit conversion is
|
|
performed.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<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-varies">numeric?</code></div>
|
|
</td>
|
|
<td><code>round(number)=> number</code></td>
|
|
<td>In 2.0, if argument is <code>()</code>, the result is
|
|
<code>()</code>. In 1.0, the result is <code>NaN</code>. If
|
|
compatibility mode is off, an error will occur with more than one
|
|
node. If compatibility mode is on, implicit conversion is
|
|
performed.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="examples" id="examples"></a>D Illustrative
|
|
user-written functions (Non-Normative)</h2>
|
|
<p>Certain functions that were proposed for inclusion in this
|
|
function library have been excluded on the basis that it is
|
|
straightforward for users to implement these functions themselves
|
|
using XSLT 2.0 or XQuery 1.0.</p>
|
|
<p>This Appendix provides sample implementations of some of these
|
|
functions.</p>
|
|
<p>To emphasize that these functions are examples of functions that
|
|
vendors may write, their names carry the prefix 'eg'. Vendors are
|
|
free to define such functions in any namespace. A group of vendors
|
|
may also choose to create a collection of such useful functions and
|
|
put them in a common namespace.</p>
|
|
<div class="div2">
|
|
<h3><a name="if-empty-if-absent" id="if-empty-if-absent"></a>D.1
|
|
eg:if-empty and eg:if-absent</h3>
|
|
<p>In some situations, users may want to provide default values for
|
|
missing information that may be signaled by elements that are
|
|
omitted, have no value or have the empty sequence as their value.
|
|
For example, a missing middle initial may be indicated by omitting
|
|
the element or a non-existent bonus signaled with an empty
|
|
sequence. This section includes examples of functions that provide
|
|
such defaults. These functions return
|
|
<code>xs:anyAtomicType*</code>. Users may want to write functions
|
|
that return more specific types.</p>
|
|
<div class="div3">
|
|
<h4><a name="if-empty" id="if-empty"></a>D.1.1 eg:if-empty</h4>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:eg:if-empty</code>(</td>
|
|
<td valign="baseline"><code class="arg">$node</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">node()?</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$value</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType*</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<p>If the first argument is the empty sequence or an element
|
|
without simple or complex content, <code>eg:if-empty()</code>
|
|
returns the second argument; otherwise, it returns the content of
|
|
the first argument.</p>
|
|
<p>XSLT implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="eg:if-empty" as="xs:anyAtomicType*">
|
|
<xsl:param name="node" as="node()?"/>
|
|
<xsl:param name="value" as="xs:anyAtomicType"/>
|
|
<xsl:sequence select="($node[child::node()], $value)[1]"/>
|
|
</xsl:function>
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:if-empty (
|
|
$node as node()?,
|
|
$value as xs:anyAtomicType) as xs:anyAtomicType*
|
|
{
|
|
($node[child::node()], $value)[1]
|
|
}
|
|
|
|
</pre></div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="if-absent" id="if-absent"></a>D.1.2 eg:if-absent</h4>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:eg:if-absent</code>(</td>
|
|
<td valign="baseline"><code class="arg">$node</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class="type">node()?</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$value</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType*</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<p>If the first argument is the empty sequence,
|
|
<code>eg:if-absent()</code> returns the second argument; otherwise,
|
|
it returns the content of the first argument.</p>
|
|
<p>XSLT implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="eg:if-absent" as="xs:anyAtomicType*">
|
|
<xsl:param name="node" as="node()?"/>
|
|
<xsl:param name="value" as="xs:anyAtomicType"/>
|
|
<xsl:sequence select="($node, $value)[1]"/>
|
|
</xsl:function>
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:if-absent (
|
|
$node as node()?,
|
|
$value as xs:anyAtomicType) as xs:anyAtomicType*
|
|
{
|
|
($node, $value)[1]
|
|
}
|
|
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="union-intersect-except-on-values" id=
|
|
"union-intersect-except-on-values"></a>D.2 Union, intersection and
|
|
difference on sequences of values</h3>
|
|
<div class="div3">
|
|
<h4><a name="value-union" id="value-union"></a>D.2.1
|
|
eg:value-union</h4>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:eg:value-union</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType*</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<p>This function returns a sequence containing all the distinct
|
|
items in $arg1 and $arg2, in an arbitrary order.</p>
|
|
<p>XSLT implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
xsl:function name="eg:value-union" as="xs:anyAtomicType*">
|
|
<xsl:param name="arg1" as="xs:anyAtomicType*"/>
|
|
<xsl:param name="arg2" as="xs:anyAtomicType*"/>
|
|
<xsl:sequence
|
|
select="fn:distinct-values(($arg1, $arg2))"/>
|
|
</xsl:function>
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:value-union (
|
|
$arg1 as xs:anyAtomicType*,
|
|
$arg2 as xs:anyAtomicType*) as xs:anyAtomicType*
|
|
{
|
|
fn:distinct-values(($arg1, $arg2))
|
|
}
|
|
|
|
</pre></div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="value-intersect" id="value-intersect"></a>D.2.2
|
|
eg:value-intersect</h4>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:eg:value-intersect</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType*</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<p>This function returns a sequence containing all the distinct
|
|
items that appear in both $arg1 and $arg2, in an arbitrary
|
|
order.</p>
|
|
<p>XSLT implementation></p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="eg:value-intersect" as="xs:anyAtomicType*">
|
|
<xsl:param name="arg1" as="xs:anyAtomicType*"/>
|
|
<xsl:param name="arg2" as="xs:anyAtomicType*"/>
|
|
<xsl:sequence
|
|
select="fn:distinct-values($arg1[.=$arg2])"/>
|
|
</xsl:function>
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:value-intersect (
|
|
$arg1 as xs:anyAtomicType*,
|
|
$arg2 as xs:anyAtomicType* ) as xs:anyAtomicType*
|
|
{
|
|
fn:distinct-values($arg1[.=$arg2])
|
|
}
|
|
|
|
</pre></div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="value-except" id="value-except"></a>D.2.3
|
|
eg:value-except</h4>
|
|
<div class="exampleInner">
|
|
<div class="proto">
|
|
<table border="0" cellpadding="0" cellspacing="0" summary=
|
|
"Function/operator prototype">
|
|
<tr>
|
|
<td valign="baseline" rowspan="2"><code class=
|
|
"function">fn:eg:value-except</code>(</td>
|
|
<td valign="baseline"><code class="arg">$arg1</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>,</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="baseline"><code class="arg">$arg2</code></td>
|
|
<td valign="baseline"><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:anyAtomicType*</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:anyAtomicType*</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<p>This function returns a sequence containing all the distinct
|
|
items that appear in $arg1 but not in $arg2, in an arbitrary
|
|
order.</p>
|
|
<p>XSLT implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="eg:value-except" as="xs:anyAtomicType*">
|
|
<xsl:param name="arg1" as="xs:anyAtomicType*"/>
|
|
<xsl:param name="arg2" as="xs:anyAtomicType*"/>
|
|
<xsl:sequence
|
|
select="fn:distinct-values($arg1[not(.=$arg2)])"/>
|
|
</xsl:function>
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:value-except (
|
|
$arg1 as xs:anyAtomicType*,
|
|
$arg2 as xs:anyAtomicType*) as xs:anyAtomicType*
|
|
{
|
|
fn:distinct-values($arg1[not(.=$arg2)])
|
|
}
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="index-of-node" id="index-of-node"></a>D.3
|
|
eg:index-of-node</h3>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:eg:index-of-node</code>(<code class=
|
|
"arg">$seq</code><code class="as"> as </code><code class=
|
|
"type">node()*</code>, <code class="arg">$search</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">node()</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:integer*</code></div>
|
|
</div>
|
|
<p>This function returns a sequence of positive integers giving the
|
|
positions within the sequence <code>$seq</code> of nodes that are
|
|
identical to <code>$search</code>.</p>
|
|
<p>The nodes in the sequence <code>$seq</code> are compared with
|
|
<code>$search</code> under the rules for the <code>is</code>
|
|
operator. If a node compares identical, then the position of that
|
|
node in the sequence <code>$seq</code> is included in the
|
|
result.</p>
|
|
<p>If the value of <code>$seq</code> is the empty sequence, or if
|
|
no node in <code>$seq</code> matches <code>$search</code>, then the
|
|
empty sequence is returned.</p>
|
|
<p>The index is 1-based, not 0-based.</p>
|
|
<p>The result sequence is in ascending numeric order.</p>
|
|
<p>XSLT implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="eg:index-of-node" as="xs:integer*">
|
|
<xsl:param name="seq" as="node()*"/>
|
|
<xsl:param name="search" as="node()"/>
|
|
<xsl:sequence select="filter(
|
|
function($i as xs:integer) as xs:boolean {$seq[$i] is $search},
|
|
1 to count($seq)
|
|
)
|
|
"/>
|
|
</xsl:function>
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:index-of-node($seq as node()*, $search as node()) as xs:integer*
|
|
{
|
|
fn:filter(
|
|
function($i as xs:integer) as xs:boolean {$seq[$i] is $search},
|
|
1 to fn:count($seq)
|
|
)
|
|
|
|
}
|
|
</pre></div>
|
|
<p>An alternative implementation, which might be faster in systems
|
|
where indexing into a sequence is slow, is:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:index-of-node($seq as node()*, $search as node()) as xs:integer*
|
|
{
|
|
fn:map-pairs(function($node, $index) {
|
|
if($node is $search) then $index else ()
|
|
}, $seq, 1 to fn:count($seq))
|
|
}
|
|
</pre></div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="string-pad" id="string-pad"></a>D.4 eg:string-pad</h3>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:eg:string-pad</code>(<code class=
|
|
"arg">$padString</code><code class=
|
|
"as"> as </code><code class="type">xs:string?</code>,
|
|
<code class="arg">$padCount</code><code class=
|
|
"as"> as </code><code class=
|
|
"type">xs:integer</code>)<code class=
|
|
"as"> as </code><code class=
|
|
"return-type">xs:string</code></div>
|
|
</div>
|
|
<p>Returns a <code>xs:string</code> consisting of a given number of
|
|
copies of an <code>xs:string</code> argument concatenated
|
|
together.</p>
|
|
<p>XSLT implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="eg:string-pad" as="xs:string">
|
|
<xsl:param name="padString" as="xs:string?"/>
|
|
<xsl:param name="padCount" as="xs:integer"/>
|
|
<xsl:sequence select="
|
|
fn:string-join(for $i in 1 to $padCount return $padString)"/>
|
|
</xsl:function>
|
|
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:string-pad (
|
|
$padString as xs:string?,
|
|
$padCount as xs:integer) as xs:string
|
|
{
|
|
fn:string-join(for $i in 1 to $padCount return $padString)
|
|
}
|
|
|
|
</pre></div>
|
|
<p>This returns the zero-length string if <code>$padString</code>
|
|
is the empty sequence, which is consistent with the general
|
|
principle that if an <code>xs:string</code> argument is the empty
|
|
sequence it is treated as if it were the zero-length string.</p>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="func-distinct-nodes-stable" id=
|
|
"func-distinct-nodes-stable"></a>D.5 eg:distinct-nodes-stable</h3>
|
|
<div class="exampleInner">
|
|
<div class="proto"><code class=
|
|
"function">fn:eg:distinct-nodes-stable</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">node()*</code></div>
|
|
</div>
|
|
<p>This function illustrates one possible implementation of a
|
|
distinct-nodes function. It removes duplicate nodes by identity,
|
|
preserving the first occurrence of each node.</p>
|
|
<p>XPath</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
$arg[empty(subsequence($arg, 1, position()-1) intersect .)]
|
|
|
|
</pre></div>
|
|
<p>XSLT implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="eg:distinct-nodes-stable" as="node()*">
|
|
<xsl:param name="arg" as="node()*"/>
|
|
<xsl:sequence select=""
|
|
fn:fold-left(
|
|
function($foundSoFar as node()*, $this as node()) as node()* {
|
|
if ($foundSoFar intersect $this)
|
|
then $foundSoFar
|
|
else ($foundSoFar, $this)
|
|
}, (), $seq)
|
|
"/>
|
|
</xsl:function>
|
|
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function distinct-nodes-stable ($arg as node()*) as node()* {
|
|
fn:fold-left(
|
|
function($foundSoFar as node()*, $this as node()) as node()* {
|
|
if ($foundSoFar intersect $this)
|
|
then $foundSoFar
|
|
else ($foundSoFar, $this)
|
|
}, (), $seq)
|
|
|
|
};
|
|
</pre></div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="highest-lowest" id="highest-lowest"></a>D.6 Finding
|
|
minima and maxima</h3>
|
|
<p>The <a href="#func-min"><code>fn:min</code></a> and <a href=
|
|
"#func-max"><code>fn:max</code></a> functions allow one to
|
|
determine the smallest and largest values in a set of values, but
|
|
they do not directly allow one to determine the elements having the
|
|
smallest or largest value for some property, for example the
|
|
employees earning the highest or lowest salary. The functions in
|
|
this section show how this can be achieved.</p>
|
|
<p>The functions take as input an arbitrary sequence of items
|
|
(typically but not necessarily a sequence of elements) and a
|
|
function that computes a property value for each of these items.
|
|
This must be a value of an atomic type for which order comparisons
|
|
are defined. The functions return those items from the input
|
|
sequence that have a higher (or lower) value for the given property
|
|
than any others in the sequence. If there are several that are
|
|
joint highest (or lowest) then they are all returned.</p>
|
|
<div class="div3">
|
|
<h4><a name="highest" id="highest"></a>D.6.1 eg:highest</h4>
|
|
<p>The function <code>eg:highest</code> returns the items having
|
|
the highest value for the supplied function.</p>
|
|
<p>XSLT implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="eg:highest" as="item()*">
|
|
<xsl:param name="f" as="function(item()) as xs:anyAtomicType"/>
|
|
<xsl:param name="seq" as="item()*"/>
|
|
<xsl:sequence select="
|
|
fold-left(
|
|
function($highestSoFar as item()*, $this as item()*) as item()* {
|
|
let $thisValue := $f($this)
|
|
let $highestValue := $f($highestSoFar[1])
|
|
return
|
|
if ($thisValue gt $highestValue)
|
|
then $this
|
|
else if ($thisValue eq $highestValue)
|
|
then ($highestSoFar, $this)
|
|
else $highestSoFar
|
|
}, head($seq), tail($seq))"/>
|
|
</xsl:function>
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:highest(
|
|
$f as function(item()) as xs:anyAtomicType,
|
|
$seq as item()*)
|
|
as item()* {
|
|
fn:fold-left(
|
|
function($highestSoFar as item()*, $this as item()*) as item()* {
|
|
let $thisValue := $f($this)
|
|
let $highestValue := $f($highestSoFar[1])
|
|
return
|
|
if ($thisValue gt $highestValue)
|
|
then $this
|
|
else if ($thisValue eq $highestValue)
|
|
then ($highestSoFar, $this)
|
|
else $highestSoFar
|
|
}, fn:head($seq), fn:tail($seq))
|
|
};
|
|
</pre></div>
|
|
<p>To find the employees with the highest salary, the function
|
|
might be called as:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
eg:highest(function($emp){$emp/salary}, //employee)
|
|
</pre></div>
|
|
</div>
|
|
<div class="div3">
|
|
<h4><a name="lowest" id="lowest"></a>D.6.2 eg:lowest</h4>
|
|
<p>The function <code>eg:lowest</code> returns the items having the
|
|
lowest value for the supplied function.</p>
|
|
<p>XSLT implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="eg:lowest" as="item()*">
|
|
<xsl:param name="f" as="function(item()) as xs:anyAtomicType"/>
|
|
<xsl:param name="seq" as="item()*"/>
|
|
<xsl:sequence select="
|
|
fold-left(
|
|
function($lowestSoFar as item()*, $this as item()*) as item()* {
|
|
let $thisValue := $f($this)
|
|
let $lowestValue := $f($lowestSoFar[1])
|
|
return
|
|
if ($thisValue lt $lowestValue)
|
|
then $this
|
|
else if ($thisValue eq $lowestValue)
|
|
then ($lowestSoFar, $this)
|
|
else $lowestSoFar
|
|
}, head($seq), tail($seq))"/>
|
|
</xsl:function>
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:highest(
|
|
$f as function(item()) as xs:anyAtomicType,
|
|
$seq as item()*)
|
|
as item()* {
|
|
fn:fold-left(
|
|
function($lowestSoFar as item()*, $this as item()*) as item()* {
|
|
let $thisValue := $f($this)
|
|
let $lowestValue := $f($lowestSoFar[1])
|
|
return
|
|
if ($thisValue gt $lowestValue)
|
|
then $this
|
|
else if ($thisValue eq $lowestValue)
|
|
then ($lowestSoFar, $this)
|
|
else $lowestSoFar
|
|
}, fn:head($seq), fn:tail($seq))
|
|
};
|
|
</pre></div>
|
|
<p>To find the employees with the lowest total number of hours
|
|
worked, the function might be called as:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
eg:lowest(function($emp){sum($emp/timesheet/period/hours}, //employee)
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="sorting" id="sorting"></a>D.7 Sorting</h3>
|
|
<p>Both XSLT and XQuery include constructs for sorting sequences.
|
|
However, it can often be convenient to invoke sorting via a simple
|
|
function call. The example function in this section takes two
|
|
arguments, a sequence to be sorted, and a function to compute a
|
|
sort key, and it returns the items from the input sequence in
|
|
sorted order of this sort key.</p>
|
|
<p>XSLT implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
<xsl:function name="eg:sort" as="item()*">
|
|
<xsl:param name="f" as="function(item()) as xs:anyAtomicType"/>
|
|
<xsl:param name="seq" as="item()*"/>
|
|
<xsl:perform-sort select="$seq">
|
|
<xsl:sort select="$f(.)"/>
|
|
</xsl:perform-sort>
|
|
</xsl:function>
|
|
</pre></div>
|
|
<p>XQuery implementation</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
declare function eg:sort(
|
|
$f as function(item()) as xs:anyAtomicType,
|
|
$seq as item()*)
|
|
as item()* {
|
|
for $item in $seq order by $f($item) return $item
|
|
};
|
|
</pre></div>
|
|
<p>To obtain a list of employees sorted by salary, the function
|
|
might be called as:</p>
|
|
<div class="exampleInner">
|
|
<pre>
|
|
eg:sort(function($emp){$emp/salary}, //employee)
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="impl-def" id="impl-def"></a>E Checklist of
|
|
implementation-defined features (Non-Normative)</h2>
|
|
<p>This appendix provides a summary of features defined in this
|
|
specification whose effect is explicitly <a title=
|
|
"implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>. The conformance rules require vendors to
|
|
provide documentation that explains how these choices have been
|
|
exercised.</p>
|
|
<ol class="enumar">
|
|
<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>It is <a title="implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> whether the guarantee of node identity in
|
|
relation to URI identity also holds for document nodes obtained by
|
|
means other than the <a href="#func-doc"><code>fn:doc</code></a>
|
|
function, for example a document node passed as the initial context
|
|
node of a query or transformation.</p>
|
|
</li>
|
|
<li>
|
|
<p>The destination of the output of <a href=
|
|
"#func-trace"><code>fn:trace</code></a> 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>For integer operations that overflow, implementations <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.</p>
|
|
</li>
|
|
<li>
|
|
<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>
|
|
</li>
|
|
<li>
|
|
<p>IEEE-defined floating point exceptions <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.</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> which numbering sequences, additional to those
|
|
listed in the specification, are supported (in <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>).</p>
|
|
</li>
|
|
<li>
|
|
<p>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 some numbering sequences (in <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>).</p>
|
|
</li>
|
|
<li>
|
|
<p>The set of languages for which numbering is supported (in
|
|
<a href="#func-format-integer"><code>fn:format-integer</code></a>)
|
|
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>The default choice between alphabetical and traditional
|
|
numbering (in <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>) 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>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 (in <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>).</p>
|
|
</li>
|
|
<li>
|
|
<p>There is always a default decimal format available (for use by
|
|
<a href="#func-format-integer"><code>fn:format-integer</code></a>)
|
|
but its contents are <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 the preferred quantum (for trigonometric
|
|
functions) 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>The set of collations that are supported 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>Implementations <strong>may</strong> support additional
|
|
normalization forms with <a title="implementation-defined" class=
|
|
"termref" href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> semantics.</p>
|
|
</li>
|
|
<li>
|
|
<p>The ability to decompose strings into collation units is an
|
|
<a title="implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> property of a collation.</p>
|
|
</li>
|
|
<li>
|
|
<p>The <a href="#func-resolve-uri"><code>fn:resolve-uri</code></a>
|
|
function must accept input conforming to the rules of RFC3987,
|
|
extended with an <a title="implementation-defined" class="termref"
|
|
href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> subset of the extensions permitted in
|
|
LEIRI.</p>
|
|
</li>
|
|
<li>
|
|
<p>Processors <a title="may" class="termref" href=
|
|
"#may"><span class="arrow">·</span>may<span class=
|
|
"arrow">·</span></a> set larger <a title="implementation-defined"
|
|
class="termref" href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> limits on the maximum number of digits they
|
|
support, beyond the minimum of 4 digits for a year and 3 digits for
|
|
fractional seconds.</p>
|
|
</li>
|
|
<li>
|
|
<p>The results of operations on dates that cross the year 0000 are
|
|
<a title="implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>If the processor cannot output these components (months, days of
|
|
the week, timezones, and eras) by name for the chosen calendar and
|
|
language then it must use an <a title="implementation-defined"
|
|
class="termref" href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> fallback representation.</p>
|
|
</li>
|
|
<li>
|
|
<p>When formatting fractional seconds, <code>[f1]</code> will
|
|
produce an <a title="implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> number of digits</p>
|
|
</li>
|
|
<li>
|
|
<p>The set of languages, calendars, and <span>places</span> that
|
|
are supported in the <a title="date formatting function" class=
|
|
"termref" href="#dt-date-formatting-function"><span class=
|
|
"arrow">·</span>date formatting functions<span class=
|
|
"arrow">·</span></a> is <a title="implementation-defined" class=
|
|
"termref" href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>. When any of these arguments is omitted or is
|
|
an empty sequence, an <a title="implementation-defined" class=
|
|
"termref" href="#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> default value is used.</p>
|
|
</li>
|
|
<li>
|
|
<p>The choice of the names and abbreviations used in any given
|
|
language (for example, the names of days and months) 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>implementations may provide a user option to evaluate functions
|
|
such as <a href="#func-doc"><code>fn:doc</code></a> and <a href=
|
|
"#func-collection"><code>fn:collection</code></a> without a
|
|
guarantee of determinism. The manner in which any such option is
|
|
provided is implementation-defined.</p>
|
|
</li>
|
|
<li>
|
|
<p>Various aspects of the processing performed by the <a href=
|
|
"#func-doc"><code>fn:doc</code></a> function are <a title=
|
|
"implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The processor <strong>may</strong> use <a title=
|
|
"implementation-defined" class="termref" href=
|
|
"#implementation-defined"><span class=
|
|
"arrow">·</span>implementation-defined<span class=
|
|
"arrow">·</span></a> heuristics to determine the likely encoding of
|
|
a file read using the <a href=
|
|
"#func-unparsed-text"><code>fn:unparsed-text</code></a>
|
|
function</p>
|
|
</li>
|
|
<li>
|
|
<p>The collation used for matching names of environment variables
|
|
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>The precise process used by <a href=
|
|
"#func-parse-xml"><code>fn:parse-xml</code></a>to construct the XDM
|
|
instance 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>If there is no matching function in the static context, then the
|
|
results pf the <a href=
|
|
"#func-function-lookup"><code>fn:function-lookup</code></a>
|
|
function depend on what is present in the dynamic context, which 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>When casting to <code>xs:decimal</code>, the choice of rounding
|
|
algorithm and the choice between rounding and error behavior and is
|
|
implementation-defined.</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> which version of the Olson timezone database
|
|
is used.</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> either raise an error [<a href="#ERRFOAR0002"
|
|
title="err:FOAR0002">err:FOAR0002</a>] or 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="#op.numeric"><b>4.2
|
|
Arithmetic operators on numeric values</b></a>.</p>
|
|
</li>
|
|
<li>
|
|
<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>. See <a href="#op.numeric"><b>4.2 Arithmetic
|
|
operators on numeric values</b></a>. See also <a href=
|
|
"#casting-to-decimal"><b>18.1.2.3 Casting to xs:decimal</b></a> and
|
|
<a href="#casting-to-integer"><b>18.1.2.4 Casting to
|
|
xs:integer</b></a></p>
|
|
</li>
|
|
<li>
|
|
<p>If the number of digits in the result of a numeric operation
|
|
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. See <a href="#op.numeric"><b>4.2
|
|
Arithmetic operators on numeric values</b></a>. See also <a href=
|
|
"#casting-to-decimal"><b>18.1.2.3 Casting to xs:decimal</b></a> and
|
|
<a href="#casting-to-integer"><b>18.1.2.4 Casting to
|
|
xs:integer</b></a></p>
|
|
</li>
|
|
<li>
|
|
<p>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>. See <a href="#func-trace"><b>3.2.1
|
|
fn:trace</b></a>.</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="changelog" id="changelog"></a>F Changes since previous
|
|
Recommendation (Non-Normative)</h2>
|
|
<div class="div2">
|
|
<h3><a name="substantive-changes-2009-12-15" id=
|
|
"substantive-changes-2009-12-15"></a>F.1 Substantive changes (15
|
|
December 2009)</h3>
|
|
<p>In the Working Draft of 15 December 2009, the following changes
|
|
were made relative to the first edition of the Functions and
|
|
Operators specification for XPath 2.0 and XQuery 1.0 published on
|
|
23 January 2007:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>Errata E1 through E47 were applied.</p>
|
|
</li>
|
|
<li>
|
|
<p>A two-argument version of the <a href=
|
|
"#func-round"><code>fn:round</code></a> function was introduced.
|
|
(Bugzilla 6240)</p>
|
|
</li>
|
|
<li>
|
|
<p>A single-argument version of the <a href=
|
|
"#func-string-join"><code>fn:string-join</code></a> function was
|
|
introduced.</p>
|
|
</li>
|
|
<li>
|
|
<p>Specifications for the functions <a href=
|
|
"#func-format-date"><code>fn:format-date</code></a>, <a href=
|
|
"#func-format-time"><code>fn:format-time</code></a>, and <a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a> were
|
|
transferred from the XSLT 2.0 specification.</p>
|
|
</li>
|
|
<li>
|
|
<p>The specification of <a href=
|
|
"#func-format-number"><code>fn:format-number</code></a> was
|
|
transferred from the XSLT specification.</p>
|
|
</li>
|
|
<li>
|
|
<p>A function <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a> was
|
|
introduced.</p>
|
|
</li>
|
|
<li>
|
|
<p>The function <a href=
|
|
"#func-generate-id"><code>fn:generate-id</code></a> was introduced,
|
|
transferred from the XSLT specification.</p>
|
|
</li>
|
|
<li>
|
|
<p>A range of trigonometric functions was defined (in a new
|
|
namespace).</p>
|
|
</li>
|
|
<li>
|
|
<p>New functions <a href=
|
|
"#func-parse-xml"><code>fn:parse-xml</code></a> and <a href=
|
|
"#func-serialize"><code>fn:serialize</code></a> were defined. (The
|
|
<code>fn:parse</code> function was subsequently renamed <a href=
|
|
"#func-parse-xml"><code>fn:parse-xml</code></a></p>
|
|
</li>
|
|
<li>
|
|
<p>A new function <a href=
|
|
"#func-analyze-string"><code>fn:analyze-string</code></a> was
|
|
defined.</p>
|
|
</li>
|
|
<li>
|
|
<p>The syntax of regular expressions was extended to allow
|
|
non-capturing groups.</p>
|
|
</li>
|
|
<li>
|
|
<p>A new flag was introduced for the <code>$flags</code> argument
|
|
of functions that use regular expressions: the <code>q</code> flag
|
|
causes all characters in a regular expression to be treated as
|
|
ordinary characters rather than metacharacters.</p>
|
|
</li>
|
|
<li>
|
|
<p>Supporting the new language feature of higher-order functions, a
|
|
number of functions were defined that operate on function items as
|
|
their arguments. (The function <code>fn:partial-apply</code>,
|
|
however, which was introduced in the previous version of this
|
|
Working Draft, has now been dropped in favor of custom syntax for
|
|
partial application using "?" as a place-holder for missing
|
|
arguments.)</p>
|
|
</li>
|
|
<li>
|
|
<p>The description of the <a href=
|
|
"#func-error"><code>fn:error</code></a> function was rewritten to
|
|
allow for the introduction of try/catch facilities into XQuery and
|
|
XSLT.</p>
|
|
</li>
|
|
<li>
|
|
<p>The section describing what it means for functions to be
|
|
contextual and/or deterministic was rewritten. The term
|
|
<b>deterministic</b> has replaced <b>stable</b>.</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="substantive-changes-current-draft" id=
|
|
"substantive-changes-current-draft"></a>F.2 Substantive changes
|
|
(current draft)</h3>
|
|
<p>In this Working Draft, the following substantive changes are
|
|
made relative to the draft of 15 December 2009:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>The version number of the specification is changed from 1.1 to
|
|
3.0.</p>
|
|
</li>
|
|
<li>
|
|
<p>New functions <a href="#func-filter"><code>fn:filter</code></a>,
|
|
<a href="#func-map"><code>fn:map</code></a>, <a href=
|
|
"#func-map-pairs"><code>fn:map-pairs</code></a>, <a href=
|
|
"#func-fold-left"><code>fn:fold-left</code></a>, and <a href=
|
|
"#func-fold-right"><code>fn:fold-right</code></a> are
|
|
introduced.</p>
|
|
</li>
|
|
<li>
|
|
<p>New functions <a href=
|
|
"#func-math-exp"><code>math:exp</code></a>, <a href=
|
|
"#func-math-exp10"><code>math:exp10</code></a>, <a href=
|
|
"#func-math-log"><code>math:log</code></a>, <a href=
|
|
"#func-math-log10"><code>math:log10</code></a>, <a href=
|
|
"#func-math-atan2"><code>math:atan2</code></a>, and <a href=
|
|
"#func-math-pow"><code>math:pow</code></a> are defined. The
|
|
trigonometric and exponential functions are now specified by
|
|
reference to <a href="#ieee754-2008">[IEEE 754-2008]</a>.</p>
|
|
</li>
|
|
<li>
|
|
<p>In the rules for <a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a> and
|
|
related functions, the rules for formatting of timezones have been
|
|
expanded and clarified; the <code>$country</code> argument is
|
|
renamed <code>$place</code>, and its value may now be an Olson
|
|
timezone name.</p>
|
|
</li>
|
|
<li>
|
|
<p>The rules for the <a href=
|
|
"#func-normalize-unicode"><code>fn:normalize-unicode</code></a>
|
|
function are now defined directly by reference to the Unicode
|
|
specifications rather than the W3C Working Draft on the Character
|
|
Model for the World Wide Web (which never progressed beyond Working
|
|
Draft status). The rules for the normalization form
|
|
<code>FULLY_NORMALIZED</code> are now defined normatively in this
|
|
specification.</p>
|
|
</li>
|
|
<li>
|
|
<p>The syntax for the picture string used by <a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a> has been
|
|
extended to allow grouping positions to be associated with optional
|
|
digit positions.</p>
|
|
</li>
|
|
<li>
|
|
<p>Two convenience functions <a href=
|
|
"#func-head"><code>fn:head</code></a> and <a href=
|
|
"#func-tail"><code>fn:tail</code></a> are added, reflecting the
|
|
increased role played by head-tail recursive functions when writing
|
|
code to take advantage of higher-order functions.</p>
|
|
</li>
|
|
<li>
|
|
<p>The function <code>fn:partial-apply</code> has been removed, as
|
|
this functionality is now provided by custom syntax (partial
|
|
function application, using "?" as a placeholder for missing
|
|
arguments)</p>
|
|
</li>
|
|
<li>
|
|
<p>Casting from a dynamic string to an <code>xs:QName</code> or a
|
|
type derived from <code>xs:NOTATION</code> is now permitted (the
|
|
restriction that the argument must be a string literal has been
|
|
removed). (Bug 9183)</p>
|
|
</li>
|
|
<li>
|
|
<p>Zero-argument forms have been introduced for the functions
|
|
<a href="#func-data"><code>fn:data</code></a>, <a href=
|
|
"#func-document-uri"><code>fn:document-uri</code></a>, and <a href=
|
|
"#func-node-name"><code>fn:node-name</code></a>, with the argument
|
|
defaulting to the context item in each case. (Bug 9571)</p>
|
|
</li>
|
|
<li>
|
|
<p>The new function <code>fn:parse</code> is renamed <a href=
|
|
"#func-parse-xml"><code>fn:parse-xml</code></a>. (Bug 9751)</p>
|
|
</li>
|
|
<li>
|
|
<p>The rules for handling of negative zero have been clarified.
|
|
Where operations return negative zero, then in general
|
|
implementations must respect this; the only exception is for
|
|
casting from string to float or double, where the lexical form
|
|
<code>-0</code> <strong>may</strong> result in positive zero for
|
|
compatibility with existing XML Schema 1.0 processors. (Bug
|
|
9907)</p>
|
|
</li>
|
|
<li>
|
|
<p>The functions <a href=
|
|
"#func-unparsed-text"><code>fn:unparsed-text</code></a> and
|
|
<a href="#func-unparsed-text-available"><code>fn:unparsed-text-available</code></a>
|
|
have been transferred unchanged from XSLT 2.0. (Bug 9067), and
|
|
<a href=
|
|
"#func-unparsed-text-lines"><code>fn:unparsed-text-lines</code></a>
|
|
has been transferred from the XSLT 2.1 draft.</p>
|
|
</li>
|
|
<li>
|
|
<p>The function <a href=
|
|
"#func-uri-collection"><code>fn:uri-collection</code></a> has been
|
|
added. This was originally defined as an output of the work on
|
|
streaming in XSLT 3.0; its purpose is to give applications greater
|
|
control of the processing of individual documents within a large
|
|
collection.</p>
|
|
</li>
|
|
<li>
|
|
<p>The rules for the <a href=
|
|
"#func-resolve-uri"><code>fn:resolve-uri</code></a> function have
|
|
been rewritten to refer to more up-to-date specifications,
|
|
specifically the IRI and LEIRI specifications. Implementations are
|
|
required to support the IRI syntax as a minimum, and are permitted
|
|
to support the legacy extensions defined in LEIRI.</p>
|
|
</li>
|
|
<li>
|
|
<p>Two new functions <a href=
|
|
"#func-environment-variable"><code>fn:environment-variable</code></a>
|
|
and <a href=
|
|
"#func-available-environment-variables"><code>fn:available-environment-variables</code></a>
|
|
have been defined.</p>
|
|
</li>
|
|
<li>
|
|
<p>A new function <a href=
|
|
"#func-uri-collection"><code>fn:uri-collection</code></a> is
|
|
added.</p>
|
|
</li>
|
|
<li>
|
|
<p>Zero-argument versions of the <a href=
|
|
"#func-base-uri"><code>fn:base-uri</code></a>, <a href=
|
|
"#func-data"><code>fn:data</code></a>, and <a href=
|
|
"#func-document-uri"><code>fn:document-uri</code></a> functions are
|
|
added.</p>
|
|
</li>
|
|
<li>
|
|
<p>Casting from a string or <code>xs:untypedAtomic</code> value to
|
|
a union type is now allowed.</p>
|
|
</li>
|
|
<li>
|
|
<p>References to the Formal Semantics have been removed.</p>
|
|
</li>
|
|
<li>
|
|
<p>Rules for the precision of the results of trigonometric and
|
|
exponential functions have been removed, and replaced with a
|
|
normative reference to the rules in the IEEE specifications.</p>
|
|
</li>
|
|
<li>
|
|
<p>The functions <a href=
|
|
"#func-unparsed-text-lines"><code>fn:unparsed-text-lines</code></a>,
|
|
<a href="#func-has-children"><code>fn:has-children</code></a>,
|
|
<a href="#func-innermost"><code>fn:innermost</code></a> and
|
|
<a href="#func-outermost"><code>fn:outermost</code></a> have been
|
|
transferred from the XSLT 3.0 working draft.</p>
|
|
</li>
|
|
<li>
|
|
<p>The function <a href="#func-path"><code>fn:path</code></a> has
|
|
been added.</p>
|
|
</li>
|
|
<li>
|
|
<p>References to IEEE 754-1985 (to define the semantics of
|
|
operations on 32-bit and 64-bit floating point) have been updated
|
|
to refer to IEEE 754-2008.</p>
|
|
</li>
|
|
<li>
|
|
<p>The error codes produced by <a href=
|
|
"#func-collection"><code>fn:collection</code></a> have been
|
|
clarified, possibly involving incompatible changes.</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="incompatibilities" id="incompatibilities"></a>F.3
|
|
Incompatibilities</h3>
|
|
<p>The following is a list of known incompatibilities between this
|
|
draft and the first edition of the Functions and Operators
|
|
specification for XPath 2.0 and XQuery 1.0 published on 23 January
|
|
2007 (that is, differences in observable behaviour that may mean
|
|
existing applications using these functions need to be changed to
|
|
continue functioning correctly)</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>The handling of timezones by <a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a> is more
|
|
prescriptive than in the previous specification (in this case, the
|
|
XSLT 2.0 specification). The output of the function may be
|
|
different, depending on the interpretation adopted by
|
|
implementations of the previous specification.</p>
|
|
</li>
|
|
<li>
|
|
<p>For functions such as <a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a> and
|
|
<a href="#func-unparsed-text"><code>fn:unparsed-text</code></a>
|
|
transferred from the XSLT 2.0 specification, error codes have been
|
|
changed to start with "FO" rather than "XT".</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="editorial-changes" id="editorial-changes"></a>F.4
|
|
Editorial changes</h3>
|
|
<p>The following editorial changes have been made since the first
|
|
edition of the Functions and Operators specification for XPath 2.0
|
|
and XQuery 1.0 published on 23 January 2007. These are not
|
|
explicitly marked in the change-highlighted version of the
|
|
specification:</p>
|
|
<ol class="enumar">
|
|
<li>
|
|
<p>References to the Formal Semantics (which in nearly all cases
|
|
were references to detailed rules for static type inferencing) have
|
|
been removed, as the Formal Semantics is not being maintained. (Bug
|
|
9056)</p>
|
|
</li>
|
|
<li>
|
|
<p>A quick reference section containing links to the functions has
|
|
been added before the full table of contents.</p>
|
|
</li>
|
|
<li>
|
|
<p>The section on constructor functions has been moved so that it
|
|
is now adjacent to the closely-related section on casting.</p>
|
|
</li>
|
|
<li>
|
|
<p>The function <a href=
|
|
"#func-dateTime"><code>fn:dateTime</code></a> has been moved out of
|
|
the section describing constructor functions, and is no longer
|
|
described as "a special constructor function". It is now an
|
|
ordinary function described in the appropriate section along with
|
|
other functions on dates and times. This allows the term
|
|
"constructor function" to be associated exclusively with
|
|
single-argument functions whose name is the same as the type name
|
|
of the value that they return, and avoids any suggestion that this
|
|
function has special behavior. Similarly, the functions <a href=
|
|
"#func-true"><code>fn:true</code></a> and <a href=
|
|
"#func-false"><code>fn:false</code></a> are no longer described as
|
|
constructor functions.</p>
|
|
</li>
|
|
<li>
|
|
<p>Where a function is referred to by name, the reference is now
|
|
always in the form (for example) <a href=
|
|
"#func-base-uri"><code>fn:base-uri</code></a> rather than <a href=
|
|
"#func-base-uri"><code>fn:base-uri()</code></a>. The latter form is
|
|
used only to indicate a call on the function in which no arguments
|
|
are supplied.</p>
|
|
</li>
|
|
<li>
|
|
<p>The specification of each function now consists of a set of
|
|
standard subsections: Summary, Operator Mapping, Signature,
|
|
Properties, Rules, Error Conditions, Notes, and Examples.</p>
|
|
</li>
|
|
<li>
|
|
<p>The "Summary" of the effect of each function is now just that:
|
|
it never contains any information that cannot be found in the more
|
|
detailed rules, and it does not attempt to list unusual or error
|
|
conditions. Such rules have been moved into separate paragraphs.
|
|
Sometimes the language used in the summary is relatively informal.
|
|
Although the summary remains normative, it must be regarded as
|
|
being subservient to the rules that follow.</p>
|
|
</li>
|
|
<li>
|
|
<p>Functions are always <em>called</em>, never
|
|
<em>invoked</em>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The specification no longer <em>discusses</em> functions, it now
|
|
<em>specifies</em> or <em>defines</em> them.</p>
|
|
</li>
|
|
<li>
|
|
<p>A seperate section for each function now lists the properties of
|
|
the function: whether or not it is deterministic,
|
|
context-dependent, or focus-dependent. These properties are linked
|
|
to their definitions, which also explain the implications: for
|
|
example, a focus-dependent function cannot be used as the basis of
|
|
a function literal for use with higher-order functions.</p>
|
|
</li>
|
|
<li>
|
|
<p>Rules have been rewritten in a more consistent style: "If
|
|
<code>$arg</code> is X, the function returns Y" (avoiding
|
|
alternatives such as "Returns Y if <code>$arg</code> is X", and
|
|
avoiding the passive "is returned"). In nearly all cases the
|
|
language used for error conditions has been standardized to the
|
|
form "An error is raised [code] if ...".</p>
|
|
</li>
|
|
<li>
|
|
<p>The section heading for a section that defines a function is now
|
|
always the name of the function. Some function definitions have
|
|
been moved into subsections to achieve this.</p>
|
|
</li>
|
|
<li>
|
|
<p>Statements within the rules of a function that follow inevitably
|
|
from other rules have in many cases been downgraded to notes. An
|
|
example is the statement that <a href=
|
|
"#func-remove"><code>fn:remove($seq, N)</code></a> returns an empty
|
|
sequence if <code>$seq</code> is an empty sequence.</p>
|
|
</li>
|
|
<li>
|
|
<p>The functions for durations and those for dates/times have been
|
|
split into separate sections.</p>
|
|
</li>
|
|
<li>
|
|
<p>The <a href="#func-boolean"><code>fn:boolean</code></a> function
|
|
has been moved from "General Functions and Operators on Sequences"
|
|
to "Functions on Boolean Values".</p>
|
|
</li>
|
|
<li>
|
|
<p>In the interests of automating the testing of examples, the
|
|
convention has been adopted that the result of an example
|
|
expression is wherever possible given in the form of a simple XPath
|
|
expression. Specifically a numeric or string literal is used for
|
|
numbers and strings; the expressions <code>true()</code> and
|
|
<code>false()</code> for booleans; constructors such as
|
|
<code>xs:duration('PT0S')</code> for other atomic types;
|
|
expressions such as <code>(1, 2, 3, 4)</code> for sequences. The
|
|
expression will always return a value of the correct type; so the
|
|
<code>xs:double</code> value zero is shown as <code>0.0e0</code>,
|
|
not as <code>0</code>, which is the way the value would be
|
|
serialized on output. The value <code>NaN</code> is given as
|
|
<code>xs:double('NaN')</code>. Previously results were sometimes
|
|
given in this form, sometimes in the form of a serialization of the
|
|
result value, and sometimes (particularly for dates, times, and
|
|
durations) in the form of an informal description.</p>
|
|
</li>
|
|
<li>
|
|
<p>In some cases where one function can be readily specified in
|
|
terms of another, the opportunity has been taken to simplify the
|
|
specification. For example, all the operator support functions of
|
|
the form <code>op:xx-greater-than</code> are now specified by
|
|
reference to the corresponding <code>op:xx-less-than</code>
|
|
function with the arguments reversed. This reduces the risk of
|
|
introducing errors and inconsistencies.</p>
|
|
</li>
|
|
<li>
|
|
<p>In some cases, the rules for a function have been reordered. For
|
|
example, the rule describing how an empty sequence is handled now
|
|
generally comes before any rule that works only if the argument is
|
|
not an empty sequence.</p>
|
|
</li>
|
|
<li>
|
|
<p>Some non-normative examples and notes have been added.</p>
|
|
</li>
|
|
<li>
|
|
<p>The non-normative example functions in Appendix D have been
|
|
revised, and new functions are supplied to illustrate use cases for
|
|
higher-order functions.</p>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
<div class="div1">
|
|
<h2><a name="quickref" id="quickref"></a>G Function and Operator
|
|
Quick Reference (Non-Normative)</h2>
|
|
<div class="div2">
|
|
<h3><a name="quickref-section" id="quickref-section"></a>G.1
|
|
Functions and Operators by Section</h3>
|
|
<dl>
|
|
<dt class="label">2 Accessors</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">2.1 fn:node-name</dt>
|
|
<dt class="label">2.2 fn:nilled</dt>
|
|
<dt class="label">2.3 fn:string</dt>
|
|
<dt class="label">2.4 fn:data</dt>
|
|
<dt class="label">2.5 fn:base-uri</dt>
|
|
<dt class="label">2.6 fn:document-uri</dt>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">3 Errors and diagnostics</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">3.1 Raising errors</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-error"><code>fn:error</code></a>()<code> as </code><code>none</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-error"><code>fn:error</code></a>(<code>$code</code><code> as </code><code>xs:QName</code>)<code> as </code><code>none</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-error"><code>fn:error</code></a>(<code>$code</code><code> as </code><code>xs:QName?</code>,
|
|
<code>$description</code><code> as </code><code>xs:string</code>)<code> as </code><code>none</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-error"><code>fn:error</code></a>(<code>$code</code><code> as </code><code>xs:QName?</code>,
|
|
<code>$description</code><code> as </code><code>xs:string</code>,
|
|
<code>$error-object</code><code> as </code><code>item()*</code>)<code> as </code><code>none</code></div>
|
|
</dd>
|
|
<dt class="label">3.2 Diagnostic tracing</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-trace"><code>fn:trace</code></a>(<code>$value</code><code> as </code><code>item()*</code>,
|
|
<code>$label</code><code> as </code><code>xs:string</code>)<code> as </code><code>item()*</code></div>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">4 Functions and operators on numerics</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">4.2 Arithmetic operators on numeric values</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-add"><code>op:numeric-add</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-subtract"><code>op:numeric-subtract</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-multiply"><code>op:numeric-multiply</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-divide"><code>op:numeric-divide</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-integer-divide"><code>op:numeric-integer-divide</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>xs:integer</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-mod"><code>op:numeric-mod</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-unary-plus"><code>op:numeric-unary-plus</code></a>(<code>$arg</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-unary-minus"><code>op:numeric-unary-minus</code></a>(<code>$arg</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code></div>
|
|
</dd>
|
|
<dt class="label">4.3 Comparison operators on numeric values</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-equal"><code>op:numeric-equal</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-less-than"><code>op:numeric-less-than</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-greater-than"><code>op:numeric-greater-than</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>xs:boolean</code></div>
|
|
</dd>
|
|
<dt class="label">4.4 Functions on numeric values</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-abs"><code>fn:abs</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>)<code> as </code><code>numeric?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-ceiling"><code>fn:ceiling</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>)<code> as </code><code>numeric?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-floor"><code>fn:floor</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>)<code> as </code><code>numeric?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-round"><code>fn:round</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>)<code> as </code><code>numeric?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-round"><code>fn:round</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>,
|
|
<code>$precision</code><code> as </code><code>xs:integer</code>)<code> as </code><code>numeric?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-round-half-to-even"><code>fn:round-half-to-even</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>)<code> as </code><code>numeric?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-round-half-to-even"><code>fn:round-half-to-even</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>,
|
|
<code>$precision</code><code> as </code><code>xs:integer</code>)<code> as </code><code>numeric?</code></div>
|
|
</dd>
|
|
<dt class="label">4.5 Parsing numbers</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-number"><code>fn:number</code></a>()<code> as </code><code>xs:double</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-number"><code>fn:number</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType?</code>)<code> as </code><code>xs:double</code></div>
|
|
</dd>
|
|
<dt class="label">4.6 Formatting integers</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>(<code>$value</code><code> as </code><code>xs:integer?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>(<code>$value</code><code> as </code><code>xs:integer?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>,
|
|
<code>$language</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code></div>
|
|
</dd>
|
|
<dt class="label">4.7 Formatting numbers</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-format-number"><code>fn:format-number</code></a>(<code>$value</code><code> as </code><code>numeric?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-number"><code>fn:format-number</code></a>(<code>$value</code><code> as </code><code>numeric?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>,
|
|
<code>$decimal-format-name</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code></div>
|
|
</dd>
|
|
<dt class="label">4.8 Trigonometric and exponential functions</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-math-pi"><code>math:pi</code></a>()<code> as </code><code>xs:double</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-exp"><code>math:exp</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-exp10"><code>math:exp10</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-log"><code>math:log</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-log10"><code>math:log10</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-pow"><code>math:pow</code></a>(<code>$x</code><code> as </code><code>xs:double?</code>,
|
|
<code>$y</code><code> as </code><code>numeric</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-sqrt"><code>math:sqrt</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-sin"><code>math:sin</code></a>(<code>$</code><span style="font-family:Times; font-style:italic">θ</span><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-cos"><code>math:cos</code></a>(<code>$</code><span style="font-family:Times; font-style:italic">θ</span><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-tan"><code>math:tan</code></a>(<code>$</code><span style="font-family:Times; font-style:italic">θ</span><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-asin"><code>math:asin</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-acos"><code>math:acos</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-atan"><code>math:atan</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-atan2"><code>math:atan2</code></a>(<code>$y</code><code> as </code><code>xs:double</code>,
|
|
<code>$x</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:double</code></div>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">5 Functions on strings</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">5.2 Functions to assemble and disassemble
|
|
strings</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-codepoints-to-string"><code>fn:codepoints-to-string</code></a>(<code>$arg</code><code> as </code><code>xs:integer*</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-string-to-codepoints"><code>fn:string-to-codepoints</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:integer*</code></div>
|
|
</dd>
|
|
<dt class="label">5.3 Comparison of strings</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-compare"><code>fn:compare</code></a>(<code>$comparand1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$comparand2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-compare"><code>fn:compare</code></a>(<code>$comparand1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$comparand2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-codepoint-equal"><code>fn:codepoint-equal</code></a>(<code>$comparand1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$comparand2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean?</code></div>
|
|
</dd>
|
|
<dt class="label">5.4 Functions on string values</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-concat"><code>op:concat</code></a>(<code>$arg1</code><code> as </code><code>xs:anyAtomicType?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:anyAtomicType?</code>,
|
|
<span class=
|
|
"varargs">...</span>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-string-join"><code>fn:string-join</code></a>(<code>$arg1</code><code> as </code><code>xs:string*</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-string-join"><code>fn:string-join</code></a>(<code>$arg1</code><code> as </code><code>xs:string*</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring"><code>fn:substring</code></a>(<code>$sourceString</code><code> as </code><code>xs:string?</code>,
|
|
<code>$start</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring"><code>fn:substring</code></a>(<code>$sourceString</code><code> as </code><code>xs:string?</code>,
|
|
<code>$start</code><code> as </code><code>xs:double</code>,
|
|
<code>$length</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-string-length"><code>fn:string-length</code></a>()<code> as </code><code>xs:integer</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-string-length"><code>fn:string-length</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:integer</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-normalize-space"><code>fn:normalize-space</code></a>()<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-normalize-space"><code>fn:normalize-space</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-normalize-unicode"><code>fn:normalize-unicode</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-normalize-unicode"><code>fn:normalize-unicode</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>,
|
|
<code>$normalizationForm</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-upper-case"><code>fn:upper-case</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-lower-case"><code>fn:lower-case</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-translate"><code>fn:translate</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>,
|
|
<code>$mapString</code><code> as </code><code>xs:string</code>,
|
|
<code>$transString</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code></div>
|
|
</dd>
|
|
<dt class="label">5.5 Functions based on substring matching</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-contains"><code>fn:contains</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-contains"><code>fn:contains</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-starts-with"><code>fn:starts-with</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-starts-with"><code>fn:starts-with</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-ends-with"><code>fn:ends-with</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-ends-with"><code>fn:ends-with</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring-before"><code>fn:substring-before</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring-before"><code>fn:substring-before</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring-after"><code>fn:substring-after</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring-after"><code>fn:substring-after</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code></div>
|
|
</dd>
|
|
<dt class="label">5.6 String functions that use regular
|
|
expressions</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-matches"><code>fn:matches</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-matches"><code>fn:matches</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>,
|
|
<code>$flags</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-replace"><code>fn:replace</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>,
|
|
<code>$replacement</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-replace"><code>fn:replace</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>,
|
|
<code>$replacement</code><code> as </code><code>xs:string</code>,
|
|
<code>$flags</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-tokenize"><code>fn:tokenize</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-tokenize"><code>fn:tokenize</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>,
|
|
<code>$flags</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-analyze-string"><code>fn:analyze-string</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>)<code> as </code><code>element(fn:analyze-string-result)</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-analyze-string"><code>fn:analyze-string</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>,
|
|
<code>$flags</code><code> as </code><code>xs:string</code>)<code> as </code><code>element(fn:analyze-string-result)</code></div>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">6 Functions that manipulate URIs</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">6.1 fn:resolve-uri</dt>
|
|
<dt class="label">6.2 fn:encode-for-uri</dt>
|
|
<dt class="label">6.3 fn:iri-to-uri</dt>
|
|
<dt class="label">6.4 fn:escape-html-uri</dt>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">7 Functions and operators on Boolean values</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">7.1 Boolean constant functions</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-true"><code>fn:true</code></a>()<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-false"><code>fn:false</code></a>()<code> as </code><code>xs:boolean</code></div>
|
|
</dd>
|
|
<dt class="label">7.2 Operators on Boolean values</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-boolean-equal"><code>op:boolean-equal</code></a>(<code>$value1</code><code> as </code><code>xs:boolean</code>,
|
|
<code>$value2</code><code> as </code><code>xs:boolean</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-boolean-less-than"><code>op:boolean-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:boolean</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:boolean</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-boolean-greater-than"><code>op:boolean-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:boolean</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:boolean</code>)<code> as </code><code>xs:boolean</code></div>
|
|
</dd>
|
|
<dt class="label">7.3 Functions on Boolean values</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-boolean"><code>fn:boolean</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-not"><code>fn:not</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:boolean</code></div>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">8 Functions and operators on durations</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">8.2 Comparison operators on durations</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-yearMonthDuration-less-than"><code>op:yearMonthDuration-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-yearMonthDuration-greater-than"><code>op:yearMonthDuration-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-dayTimeDuration-less-than"><code>op:dayTimeDuration-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-dayTimeDuration-greater-than"><code>op:dayTimeDuration-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-duration-equal"><code>op:duration-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:duration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:duration</code>)<code> as </code><code>xs:boolean</code></div>
|
|
</dd>
|
|
<dt class="label">8.3 Component extraction functions on
|
|
durations</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-years-from-duration"><code>fn:years-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-months-from-duration"><code>fn:months-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-days-from-duration"><code>fn:days-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-hours-from-duration"><code>fn:hours-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-minutes-from-duration"><code>fn:minutes-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-seconds-from-duration"><code>fn:seconds-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:decimal?</code></div>
|
|
</dd>
|
|
<dt class="label">8.4 Arithmetic operators on durations</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-add-yearMonthDurations"><code>op:add-yearMonthDurations</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:yearMonthDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-yearMonthDurations"><code>op:subtract-yearMonthDurations</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:yearMonthDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-multiply-yearMonthDuration"><code>op:multiply-yearMonthDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:yearMonthDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-divide-yearMonthDuration"><code>op:divide-yearMonthDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:yearMonthDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-divide-yearMonthDuration-by-yearMonthDuration"><code>op:divide-yearMonthDuration-by-yearMonthDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:decimal</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-dayTimeDurations"><code>op:add-dayTimeDurations</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:dayTimeDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dayTimeDurations"><code>op:subtract-dayTimeDurations</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:dayTimeDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-multiply-dayTimeDuration"><code>op:multiply-dayTimeDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:dayTimeDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-divide-dayTimeDuration"><code>op:divide-dayTimeDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:dayTimeDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-divide-dayTimeDuration-by-dayTimeDuration"><code>op:divide-dayTimeDuration-by-dayTimeDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:decimal</code></div>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">9 Functions and operators on dates and times</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">9.3 Constructing a dateTime</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-dateTime"><code>fn:dateTime</code></a>(<code>$arg1</code><code> as </code><code>xs:date?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:dateTime?</code></div>
|
|
</dd>
|
|
<dt class="label">9.4 Comparison operators on duration, date and
|
|
time values</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-dateTime-equal"><code>op:dateTime-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dateTime</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-dateTime-less-than"><code>op:dateTime-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dateTime</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-dateTime-greater-than"><code>op:dateTime-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dateTime</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-date-equal"><code>op:date-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:date</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-date-less-than"><code>op:date-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:date</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-date-greater-than"><code>op:date-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:date</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-time-equal"><code>op:time-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:time</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-time-less-than"><code>op:time-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:time</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-time-greater-than"><code>op:time-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:time</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-gYearMonth-equal"><code>op:gYearMonth-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:gYearMonth</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:gYearMonth</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-gYear-equal"><code>op:gYear-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:gYear</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:gYear</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-gMonthDay-equal"><code>op:gMonthDay-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:gMonthDay</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:gMonthDay</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-gMonth-equal"><code>op:gMonth-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:gMonth</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:gMonth</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-gDay-equal"><code>op:gDay-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:gDay</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:gDay</code>)<code> as </code><code>xs:boolean</code></div>
|
|
</dd>
|
|
<dt class="label">9.5 Component extraction functions on dates and
|
|
times</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-year-from-dateTime"><code>fn:year-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-month-from-dateTime"><code>fn:month-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-day-from-dateTime"><code>fn:day-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-hours-from-dateTime"><code>fn:hours-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-minutes-from-dateTime"><code>fn:minutes-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-seconds-from-dateTime"><code>fn:seconds-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:decimal?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-timezone-from-dateTime"><code>fn:timezone-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:dayTimeDuration?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-year-from-date"><code>fn:year-from-date</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-month-from-date"><code>fn:month-from-date</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-day-from-date"><code>fn:day-from-date</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-timezone-from-date"><code>fn:timezone-from-date</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>)<code> as </code><code>xs:dayTimeDuration?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-hours-from-time"><code>fn:hours-from-time</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-minutes-from-time"><code>fn:minutes-from-time</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:integer?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-seconds-from-time"><code>fn:seconds-from-time</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:decimal?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-timezone-from-time"><code>fn:timezone-from-time</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:dayTimeDuration?</code></div>
|
|
</dd>
|
|
<dt class="label">9.6 Timezone adjustment functions on dates and
|
|
time values</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:dateTime</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>,
|
|
<code>$timezone</code><code> as </code><code>xs:dayTimeDuration?</code>)<code> as </code><code>xs:dateTime</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-date-to-timezone"><code>fn:adjust-date-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>)<code> as </code><code>xs:date?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-date-to-timezone"><code>fn:adjust-date-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>,
|
|
<code>$timezone</code><code> as </code><code>xs:dayTimeDuration?</code>)<code> as </code><code>xs:date?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-time-to-timezone"><code>fn:adjust-time-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:time?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-time-to-timezone"><code>fn:adjust-time-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>,
|
|
<code>$timezone</code><code> as </code><code>xs:dayTimeDuration?</code>)<code> as </code><code>xs:time?</code></div>
|
|
</dd>
|
|
<dt class="label">9.7 Arithmetic operators on durations, dates and
|
|
times</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dateTimes"><code>op:subtract-dateTimes</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dateTime</code>)<code> as </code><code>xs:dayTimeDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dates"><code>op:subtract-dates</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:date</code>)<code> as </code><code>xs:dayTimeDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-times"><code>op:subtract-times</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:time</code>)<code> as </code><code>xs:dayTimeDuration</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-yearMonthDuration-to-dateTime"><code>op:add-yearMonthDuration-to-dateTime</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:dateTime</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-dayTimeDuration-to-dateTime"><code>op:add-dayTimeDuration-to-dateTime</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:dateTime</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-yearMonthDuration-from-dateTime"><code>op:subtract-yearMonthDuration-from-dateTime</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:dateTime</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dayTimeDuration-from-dateTime"><code>op:subtract-dayTimeDuration-from-dateTime</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:dateTime</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-yearMonthDuration-to-date"><code>op:add-yearMonthDuration-to-date</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:date</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-dayTimeDuration-to-date"><code>op:add-dayTimeDuration-to-date</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:date</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-yearMonthDuration-from-date"><code>op:subtract-yearMonthDuration-from-date</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:date</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dayTimeDuration-from-date"><code>op:subtract-dayTimeDuration-from-date</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:date</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-dayTimeDuration-to-time"><code>op:add-dayTimeDuration-to-time</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:time</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dayTimeDuration-from-time"><code>op:subtract-dayTimeDuration-from-time</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:time</code></div>
|
|
</dd>
|
|
<dt class="label">9.8 Formatting dates and times</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a>(<code>$value</code><code> as </code><code>xs:dateTime?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a>(<code>$value</code><code> as </code><code>xs:dateTime?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>,
|
|
<code>$language</code><code> as </code><code>xs:string?</code>,
|
|
<code>$calendar</code><code> as </code><code>xs:string?</code>,
|
|
<code>$place</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-date"><code>fn:format-date</code></a>(<code>$value</code><code> as </code><code>xs:date?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-date"><code>fn:format-date</code></a>(<code>$value</code><code> as </code><code>xs:date?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>,
|
|
<code>$language</code><code> as </code><code>xs:string?</code>,
|
|
<code>$calendar</code><code> as </code><code>xs:string?</code>,
|
|
<code>$place</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-time"><code>fn:format-time</code></a>(<code>$value</code><code> as </code><code>xs:time?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-time"><code>fn:format-time</code></a>(<code>$value</code><code> as </code><code>xs:time?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>,
|
|
<code>$language</code><code> as </code><code>xs:string?</code>,
|
|
<code>$calendar</code><code> as </code><code>xs:string?</code>,
|
|
<code>$place</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string?</code></div>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">10 Functions related to QNames</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">10.1 Functions to create a QName</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-resolve-QName"><code>fn:resolve-QName</code></a>(<code>$qname</code><code> as </code><code>xs:string?</code>,
|
|
<code>$element</code><code> as </code><code>element()</code>)<code> as </code><code>xs:QName?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-QName"><code>fn:QName</code></a>(<code>$paramURI</code><code> as </code><code>xs:string?</code>,
|
|
<code>$paramQName</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:QName</code></div>
|
|
</dd>
|
|
<dt class="label">10.2 Functions and operators related to
|
|
QNames</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-QName-equal"><code>op:QName-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:QName</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:QName</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-prefix-from-QName"><code>fn:prefix-from-QName</code></a>(<code>$arg</code><code> as </code><code>xs:QName?</code>)<code> as </code><code>xs:NCName?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-local-name-from-QName"><code>fn:local-name-from-QName</code></a>(<code>$arg</code><code> as </code><code>xs:QName?</code>)<code> as </code><code>xs:NCName?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-namespace-uri-from-QName"><code>fn:namespace-uri-from-QName</code></a>(<code>$arg</code><code> as </code><code>xs:QName?</code>)<code> as </code><code>xs:anyURI?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-namespace-uri-for-prefix"><code>fn:namespace-uri-for-prefix</code></a>(<code>$prefix</code><code> as </code><code>xs:string?</code>,
|
|
<code>$element</code><code> as </code><code>element()</code>)<code> as </code><code>xs:anyURI?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-in-scope-prefixes"><code>fn:in-scope-prefixes</code></a>(<code>$element</code><code> as </code><code>element()</code>)<code> as </code><code>xs:string*</code></div>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">11 Operators on base64Binary and hexBinary</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">11.1 Comparisons of base64Binary and hexBinary
|
|
values</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-hexBinary-equal"><code>op:hexBinary-equal</code></a>(<code>$value1</code><code> as </code><code>xs:hexBinary</code>,
|
|
<code>$value2</code><code> as </code><code>xs:hexBinary</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-base64Binary-equal"><code>op:base64Binary-equal</code></a>(<code>$value1</code><code> as </code><code>xs:base64Binary</code>,
|
|
<code>$value2</code><code> as </code><code>xs:base64Binary</code>)<code> as </code><code>xs:boolean</code></div>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">12 Operators on NOTATION</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">12.1 op:NOTATION-equal</dt>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">13 Functions and operators on nodes</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">13.1 fn:name</dt>
|
|
<dt class="label">13.2 fn:local-name</dt>
|
|
<dt class="label">13.3 fn:namespace-uri</dt>
|
|
<dt class="label">13.4 fn:lang</dt>
|
|
<dt class="label">13.5 op:is-same-node</dt>
|
|
<dt class="label">13.6 op:node-before</dt>
|
|
<dt class="label">13.7 op:node-after</dt>
|
|
<dt class="label">13.8 fn:root</dt>
|
|
<dt class="label">13.9 fn:path</dt>
|
|
<dt class="label">13.10 fn:has-children</dt>
|
|
<dt class="label">13.11 fn:innermost</dt>
|
|
<dt class="label">13.12 fn:outermost</dt>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">14 Functions and operators on sequences</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">14.1 General functions and operators on
|
|
sequences</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-concatenate"><code>op:concatenate</code></a>(<code>$seq1</code><code> as </code><code>item()*</code>,
|
|
<code>$seq2</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-empty"><code>fn:empty</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-exists"><code>fn:exists</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-head"><code>fn:head</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-tail"><code>fn:tail</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-insert-before"><code>fn:insert-before</code></a>(<code>$target</code><code> as </code><code>item()*</code>,
|
|
<code>$position</code><code> as </code><code>xs:integer</code>,
|
|
<code>$inserts</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-remove"><code>fn:remove</code></a>(<code>$target</code><code> as </code><code>item()*</code>,
|
|
<code>$position</code><code> as </code><code>xs:integer</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-reverse"><code>fn:reverse</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subsequence"><code>fn:subsequence</code></a>(<code>$sourceSeq</code><code> as </code><code>item()*</code>,
|
|
<code>$startingLoc</code><code> as </code><code>xs:double</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-subsequence"><code>fn:subsequence</code></a>(<code>$sourceSeq</code><code> as </code><code>item()*</code>,
|
|
<code>$startingLoc</code><code> as </code><code>xs:double</code>,
|
|
<code>$length</code><code> as </code><code>xs:double</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-unordered"><code>fn:unordered</code></a>(<code>$sourceSeq</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code></div>
|
|
</dd>
|
|
<dt class="label">14.2 Functions that compare values in
|
|
sequences</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-distinct-values"><code>fn:distinct-values</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>)<code> as </code><code>xs:anyAtomicType*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-distinct-values"><code>fn:distinct-values</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:anyAtomicType*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-index-of"><code>fn:index-of</code></a>(<code>$seq</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$search</code><code> as </code><code>xs:anyAtomicType</code>)<code> as </code><code>xs:integer*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-index-of"><code>fn:index-of</code></a>(<code>$seq</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$search</code><code> as </code><code>xs:anyAtomicType</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:integer*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-deep-equal"><code>fn:deep-equal</code></a>(<code>$parameter1</code><code> as </code><code>item()*</code>,
|
|
<code>$parameter2</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-deep-equal"><code>fn:deep-equal</code></a>(<code>$parameter1</code><code> as </code><code>item()*</code>,
|
|
<code>$parameter2</code><code> as </code><code>item()*</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code></div>
|
|
</dd>
|
|
<dt class="label">14.3 Functions that test the cardinality of
|
|
sequences</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-zero-or-one"><code>fn:zero-or-one</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-one-or-more"><code>fn:one-or-more</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()+</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-exactly-one"><code>fn:exactly-one</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()</code></div>
|
|
</dd>
|
|
<dt class="label">14.4 Union, intersection and difference</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-union"><code>op:union</code></a>(<code>$arg1</code><code> as </code><code>node()*</code>,
|
|
<code>$arg2</code><code> as </code><code>node()*</code>)<code> as </code><code>node()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-intersect"><code>op:intersect</code></a>(<code>$arg1</code><code> as </code><code>node()*</code>,
|
|
<code>$arg2</code><code> as </code><code>node()*</code>)<code> as </code><code>node()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-except"><code>op:except</code></a>(<code>$arg1</code><code> as </code><code>node()*</code>,
|
|
<code>$arg2</code><code> as </code><code>node()*</code>)<code> as </code><code>node()*</code></div>
|
|
</dd>
|
|
<dt class="label">14.5 Aggregate functions</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-count"><code>fn:count</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:integer</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-avg"><code>fn:avg</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>)<code> as </code><code>xs:anyAtomicType?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-max"><code>fn:max</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>)<code> as </code><code>xs:anyAtomicType?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-max"><code>fn:max</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:anyAtomicType?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-min"><code>fn:min</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>)<code> as </code><code>xs:anyAtomicType?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-min"><code>fn:min</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:anyAtomicType?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-sum"><code>fn:sum</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>)<code> as </code><code>xs:anyAtomicType</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-sum"><code>fn:sum</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$zero</code><code> as </code><code>xs:anyAtomicType?</code>)<code> as </code><code>xs:anyAtomicType?</code></div>
|
|
</dd>
|
|
<dt class="label">14.6 Functions and operators that generate
|
|
sequences</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-to"><code>op:to</code></a>(<code>$firstval</code><code> as </code><code>xs:integer</code>,
|
|
<code>$lastval</code><code> as </code><code>xs:integer</code>)<code> as </code><code>xs:integer*</code></div>
|
|
</dd>
|
|
<dt class="label">14.7 Functions on node identifiers</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-id"><code>fn:id</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>)<code> as </code><code>element()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-id"><code>fn:id</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>,
|
|
<code>$node</code><code> as </code><code>node()</code>)<code> as </code><code>element()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-element-with-id"><code>fn:element-with-id</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>)<code> as </code><code>element()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-element-with-id"><code>fn:element-with-id</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>,
|
|
<code>$node</code><code> as </code><code>node()</code>)<code> as </code><code>element()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-idref"><code>fn:idref</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>)<code> as </code><code>node()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-idref"><code>fn:idref</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>,
|
|
<code>$node</code><code> as </code><code>node()</code>)<code> as </code><code>node()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-generate-id"><code>fn:generate-id</code></a>()<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-generate-id"><code>fn:generate-id</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:string</code></div>
|
|
</dd>
|
|
<dt class="label">14.8 Functions giving access to external
|
|
information</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-doc"><code>fn:doc</code></a>(<code>$uri</code><code> as </code><code>xs:string?</code>)<code> as </code><code>document-node()?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-doc-available"><code>fn:doc-available</code></a>(<code>$uri</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-collection"><code>fn:collection</code></a>()<code> as </code><code>node()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-collection"><code>fn:collection</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>node()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-uri-collection"><code>fn:uri-collection</code></a>()<code> as </code><code>xs:anyURI*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-uri-collection"><code>fn:uri-collection</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:anyURI*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text"><code>fn:unparsed-text</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text"><code>fn:unparsed-text</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>,
|
|
<code>$encoding</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text-lines"><code>fn:unparsed-text-lines</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text-lines"><code>fn:unparsed-text-lines</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>,
|
|
<code>$encoding</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text-available"><code>fn:unparsed-text-available</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text-available"><code>fn:unparsed-text-available</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>,
|
|
<code>$encoding</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-environment-variable"><code>fn:environment-variable</code></a>(<code>$name</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-available-environment-variables"><code>fn:available-environment-variables</code></a>()<code> as </code><code>xs:string*</code></div>
|
|
</dd>
|
|
<dt class="label">14.9 Parsing and serializing</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-parse-xml"><code>fn:parse-xml</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>document-node(element(*))</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-parse-xml-fragment"><code>fn:parse-xml-fragment</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>document-node()?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-serialize"><code>fn:serialize</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:string</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-serialize"><code>fn:serialize</code></a>(<code>$arg</code><code> as </code><code>item()*</code>,
|
|
<code>$params</code><code> as </code><code>element(output:serialization-parameters)?</code>)<code> as </code><code>xs:string</code></div>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">15 Context functions</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">15.1 fn:position</dt>
|
|
<dt class="label">15.2 fn:last</dt>
|
|
<dt class="label">15.3 fn:current-dateTime</dt>
|
|
<dt class="label">15.4 fn:current-date</dt>
|
|
<dt class="label">15.5 fn:current-time</dt>
|
|
<dt class="label">15.6 fn:implicit-timezone</dt>
|
|
<dt class="label">15.7 fn:default-collation</dt>
|
|
<dt class="label">15.8 fn:static-base-uri</dt>
|
|
</dl>
|
|
</dd>
|
|
<dt class="label">16 Higher-order functions</dt>
|
|
<dd>
|
|
<dl>
|
|
<dt class="label">16.1 Functions on functions</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-function-lookup"><code>fn:function-lookup</code></a>(<code>$name</code><code> as </code><code>xs:QName</code>,
|
|
<code>$arity</code><code> as </code><code>xs:integer</code>)<code> as </code><code>function()?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-function-name"><code>fn:function-name</code></a>(<code>$func</code><code> as </code><code>function(*)</code>)<code> as </code><code>xs:QName?</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-function-arity"><code>fn:function-arity</code></a>(<code>$func</code><code> as </code><code>function(*)</code>)<code> as </code><code>xs:integer</code></div>
|
|
</dd>
|
|
<dt class="label">16.2 Basic higher-order functions</dt>
|
|
<dd>
|
|
<div class="protoref"><a href=
|
|
"#func-map"><code>fn:map</code></a>(<code>$f</code><code> as </code><code>function(item())
|
|
as item()*</code>,
|
|
<code>$seq</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-filter"><code>fn:filter</code></a>(<code>$f</code><code> as </code><code>function(item())
|
|
as xs:boolean</code>,
|
|
<code>$seq</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-fold-left"><code>fn:fold-left</code></a>(<code>$f</code><code> as </code><code>function(item()*,
|
|
item()) as item()*</code>,
|
|
<code>$zero</code><code> as </code><code>item()*</code>,
|
|
<code>$seq</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-fold-right"><code>fn:fold-right</code></a>(<code>$f</code><code> as </code><code>function(item(),
|
|
item()*) as item()*</code>,
|
|
<code>$zero</code><code> as </code><code>item()*</code>,
|
|
<code>$seq</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code></div>
|
|
<div class="protoref"><a href=
|
|
"#func-map-pairs"><code>fn:map-pairs</code></a>(<code>$f</code><code> as </code><code>function(item(),
|
|
item()) as item()*</code>,
|
|
<code>$seq1</code><code> as </code><code>item()*</code>,
|
|
<code>$seq2</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code></div>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
<div class="div2">
|
|
<h3><a name="quickref-alpha" id="quickref-alpha"></a>G.2 Functions
|
|
and Operators Alphabetically</h3>
|
|
<div class="protoref"><a href=
|
|
"#func-abs"><code>fn:abs</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>)<code> as </code><code>numeric?</code>
|
|
(§<a href="#func-abs">4.4.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-acos"><code>math:acos</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-acos">4.8.12</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-dayTimeDurations"><code>op:add-dayTimeDurations</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:dayTimeDuration</code>
|
|
(§<a href="#func-add-dayTimeDurations">8.4.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-dayTimeDuration-to-date"><code>op:add-dayTimeDuration-to-date</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:date</code>
|
|
(§<a href="#func-add-dayTimeDuration-to-date">9.7.10</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-dayTimeDuration-to-dateTime"><code>op:add-dayTimeDuration-to-dateTime</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:dateTime</code>
|
|
(§<a href="#func-add-dayTimeDuration-to-dateTime">9.7.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-dayTimeDuration-to-time"><code>op:add-dayTimeDuration-to-time</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:time</code>
|
|
(§<a href="#func-add-dayTimeDuration-to-time">9.7.13</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-yearMonthDurations"><code>op:add-yearMonthDurations</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:yearMonthDuration</code>
|
|
(§<a href="#func-add-yearMonthDurations">8.4.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-yearMonthDuration-to-date"><code>op:add-yearMonthDuration-to-date</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:date</code>
|
|
(§<a href="#func-add-yearMonthDuration-to-date">9.7.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-add-yearMonthDuration-to-dateTime"><code>op:add-yearMonthDuration-to-dateTime</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:dateTime</code>
|
|
(§<a href=
|
|
"#func-add-yearMonthDuration-to-dateTime">9.7.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:dateTime</code>
|
|
(§<a href="#func-adjust-dateTime-to-timezone">9.6.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-dateTime-to-timezone"><code>fn:adjust-dateTime-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>,
|
|
<code>$timezone</code><code> as </code><code>xs:dayTimeDuration?</code>)<code> as </code><code>xs:dateTime</code>
|
|
(§<a href="#func-adjust-dateTime-to-timezone">9.6.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-date-to-timezone"><code>fn:adjust-date-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>)<code> as </code><code>xs:date?</code>
|
|
(§<a href="#func-adjust-date-to-timezone">9.6.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-date-to-timezone"><code>fn:adjust-date-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>,
|
|
<code>$timezone</code><code> as </code><code>xs:dayTimeDuration?</code>)<code> as </code><code>xs:date?</code>
|
|
(§<a href="#func-adjust-date-to-timezone">9.6.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-time-to-timezone"><code>fn:adjust-time-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:time?</code>
|
|
(§<a href="#func-adjust-time-to-timezone">9.6.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-adjust-time-to-timezone"><code>fn:adjust-time-to-timezone</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>,
|
|
<code>$timezone</code><code> as </code><code>xs:dayTimeDuration?</code>)<code> as </code><code>xs:time?</code>
|
|
(§<a href="#func-adjust-time-to-timezone">9.6.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-analyze-string"><code>fn:analyze-string</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>)<code> as </code><code>element(fn:analyze-string-result)</code>
|
|
(§<a href="#func-analyze-string">5.6.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-analyze-string"><code>fn:analyze-string</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>,
|
|
<code>$flags</code><code> as </code><code>xs:string</code>)<code> as </code><code>element(fn:analyze-string-result)</code>
|
|
(§<a href="#func-analyze-string">5.6.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-asin"><code>math:asin</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-asin">4.8.11</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-atan"><code>math:atan</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-atan">4.8.13</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-atan2"><code>math:atan2</code></a>(<code>$y</code><code> as </code><code>xs:double</code>,
|
|
<code>$x</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:double</code>
|
|
(§<a href="#func-math-atan2">4.8.14</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-available-environment-variables"><code>fn:available-environment-variables</code></a>()<code> as </code><code>xs:string*</code>
|
|
(§<a href="#func-available-environment-variables">14.8.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-avg"><code>fn:avg</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>)<code> as </code><code>xs:anyAtomicType?</code>
|
|
(§<a href="#func-avg">14.5.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-base64Binary-equal"><code>op:base64Binary-equal</code></a>(<code>$value1</code><code> as </code><code>xs:base64Binary</code>,
|
|
<code>$value2</code><code> as </code><code>xs:base64Binary</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-base64Binary-equal">11.1.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-base-uri"><code>fn:base-uri</code></a>()<code> as </code><code>xs:anyURI?</code>
|
|
(§<a href="#func-base-uri">2.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-base-uri"><code>fn:base-uri</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:anyURI?</code>
|
|
(§<a href="#func-base-uri">2.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-boolean"><code>fn:boolean</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-boolean">7.3.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-boolean-equal"><code>op:boolean-equal</code></a>(<code>$value1</code><code> as </code><code>xs:boolean</code>,
|
|
<code>$value2</code><code> as </code><code>xs:boolean</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-boolean-equal">7.2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-boolean-greater-than"><code>op:boolean-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:boolean</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:boolean</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-boolean-greater-than">7.2.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-boolean-less-than"><code>op:boolean-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:boolean</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:boolean</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-boolean-less-than">7.2.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-ceiling"><code>fn:ceiling</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>)<code> as </code><code>numeric?</code>
|
|
(§<a href="#func-ceiling">4.4.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-codepoint-equal"><code>fn:codepoint-equal</code></a>(<code>$comparand1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$comparand2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean?</code>
|
|
(§<a href="#func-codepoint-equal">5.3.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-codepoints-to-string"><code>fn:codepoints-to-string</code></a>(<code>$arg</code><code> as </code><code>xs:integer*</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-codepoints-to-string">5.2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-collection"><code>fn:collection</code></a>()<code> as </code><code>node()*</code>
|
|
(§<a href="#func-collection">14.8.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-collection"><code>fn:collection</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>node()*</code>
|
|
(§<a href="#func-collection">14.8.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-compare"><code>fn:compare</code></a>(<code>$comparand1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$comparand2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-compare">5.3.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-compare"><code>fn:compare</code></a>(<code>$comparand1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$comparand2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-compare">5.3.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-concat"><code>op:concat</code></a>(<code>$arg1</code><code> as </code><code>xs:anyAtomicType?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:anyAtomicType?</code>,
|
|
<span class=
|
|
"varargs">...</span>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-concat">5.4.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-concatenate"><code>op:concatenate</code></a>(<code>$seq1</code><code> as </code><code>item()*</code>,
|
|
<code>$seq2</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-concatenate">14.1.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-contains"><code>fn:contains</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-contains">5.5.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-contains"><code>fn:contains</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-contains">5.5.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-cos"><code>math:cos</code></a>(<code>$</code><span style="font-family:Times; font-style:italic">θ</span><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-cos">4.8.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-count"><code>fn:count</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:integer</code>
|
|
(§<a href="#func-count">14.5.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-current-date"><code>fn:current-date</code></a>()<code> as </code><code>xs:date</code>
|
|
(§<a href="#func-current-date">15.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-current-dateTime"><code>fn:current-dateTime</code></a>()<code> as </code><code>xs:dateTimeStamp</code>
|
|
(§<a href="#func-current-dateTime">15.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-current-time"><code>fn:current-time</code></a>()<code> as </code><code>xs:time</code>
|
|
(§<a href="#func-current-time">15.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-data"><code>fn:data</code></a>()<code> as </code><code>xs:anyAtomicType*</code>
|
|
(§<a href="#func-data">2.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-data"><code>fn:data</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:anyAtomicType*</code>
|
|
(§<a href="#func-data">2.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-date-equal"><code>op:date-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:date</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-date-equal">9.4.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-date-greater-than"><code>op:date-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:date</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-date-greater-than">9.4.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-date-less-than"><code>op:date-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:date</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-date-less-than">9.4.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-dateTime"><code>fn:dateTime</code></a>(<code>$arg1</code><code> as </code><code>xs:date?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:dateTime?</code>
|
|
(§<a href="#func-dateTime">9.3.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-dateTime-equal"><code>op:dateTime-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dateTime</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-dateTime-equal">9.4.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-dateTime-greater-than"><code>op:dateTime-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dateTime</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-dateTime-greater-than">9.4.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-dateTime-less-than"><code>op:dateTime-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dateTime</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-dateTime-less-than">9.4.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-day-from-date"><code>fn:day-from-date</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-day-from-date">9.5.10</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-day-from-dateTime"><code>fn:day-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-day-from-dateTime">9.5.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-days-from-duration"><code>fn:days-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-days-from-duration">8.3.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-dayTimeDuration-greater-than"><code>op:dayTimeDuration-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-dayTimeDuration-greater-than">8.2.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-dayTimeDuration-less-than"><code>op:dayTimeDuration-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-dayTimeDuration-less-than">8.2.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-deep-equal"><code>fn:deep-equal</code></a>(<code>$parameter1</code><code> as </code><code>item()*</code>,
|
|
<code>$parameter2</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-deep-equal">14.2.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-deep-equal"><code>fn:deep-equal</code></a>(<code>$parameter1</code><code> as </code><code>item()*</code>,
|
|
<code>$parameter2</code><code> as </code><code>item()*</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-deep-equal">14.2.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-default-collation"><code>fn:default-collation</code></a>()<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-default-collation">15.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-distinct-values"><code>fn:distinct-values</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>)<code> as </code><code>xs:anyAtomicType*</code>
|
|
(§<a href="#func-distinct-values">14.2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-distinct-values"><code>fn:distinct-values</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:anyAtomicType*</code>
|
|
(§<a href="#func-distinct-values">14.2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-divide-dayTimeDuration"><code>op:divide-dayTimeDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:dayTimeDuration</code>
|
|
(§<a href="#func-divide-dayTimeDuration">8.4.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-divide-dayTimeDuration-by-dayTimeDuration"><code>op:divide-dayTimeDuration-by-dayTimeDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:decimal</code>
|
|
(§<a href=
|
|
"#func-divide-dayTimeDuration-by-dayTimeDuration">8.4.10</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-divide-yearMonthDuration"><code>op:divide-yearMonthDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:yearMonthDuration</code>
|
|
(§<a href="#func-divide-yearMonthDuration">8.4.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-divide-yearMonthDuration-by-yearMonthDuration"><code>op:divide-yearMonthDuration-by-yearMonthDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:decimal</code>
|
|
(§<a href=
|
|
"#func-divide-yearMonthDuration-by-yearMonthDuration">8.4.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-doc"><code>fn:doc</code></a>(<code>$uri</code><code> as </code><code>xs:string?</code>)<code> as </code><code>document-node()?</code>
|
|
(§<a href="#func-doc">14.8.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-doc-available"><code>fn:doc-available</code></a>(<code>$uri</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-doc-available">14.8.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-document-uri"><code>fn:document-uri</code></a>()<code> as </code><code>xs:anyURI?</code>
|
|
(§<a href="#func-document-uri">2.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-document-uri"><code>fn:document-uri</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:anyURI?</code>
|
|
(§<a href="#func-document-uri">2.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-duration-equal"><code>op:duration-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:duration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:duration</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-duration-equal">8.2.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-element-with-id"><code>fn:element-with-id</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>)<code> as </code><code>element()*</code>
|
|
(§<a href="#func-element-with-id">14.7.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-element-with-id"><code>fn:element-with-id</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>,
|
|
<code>$node</code><code> as </code><code>node()</code>)<code> as </code><code>element()*</code>
|
|
(§<a href="#func-element-with-id">14.7.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-empty"><code>fn:empty</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-empty">14.1.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-encode-for-uri"><code>fn:encode-for-uri</code></a>(<code>$uri-part</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-encode-for-uri">6.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-ends-with"><code>fn:ends-with</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-ends-with">5.5.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-ends-with"><code>fn:ends-with</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-ends-with">5.5.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-environment-variable"><code>fn:environment-variable</code></a>(<code>$name</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-environment-variable">14.8.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-error"><code>fn:error</code></a>()<code> as </code><code>none</code>
|
|
(§<a href="#func-error">3.1.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-error"><code>fn:error</code></a>(<code>$code</code><code> as </code><code>xs:QName</code>)<code> as </code><code>none</code>
|
|
(§<a href="#func-error">3.1.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-error"><code>fn:error</code></a>(<code>$code</code><code> as </code><code>xs:QName?</code>,
|
|
<code>$description</code><code> as </code><code>xs:string</code>)<code> as </code><code>none</code>
|
|
(§<a href="#func-error">3.1.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-error"><code>fn:error</code></a>(<code>$code</code><code> as </code><code>xs:QName?</code>,
|
|
<code>$description</code><code> as </code><code>xs:string</code>,
|
|
<code>$error-object</code><code> as </code><code>item()*</code>)<code> as </code><code>none</code>
|
|
(§<a href="#func-error">3.1.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-escape-html-uri"><code>fn:escape-html-uri</code></a>(<code>$uri</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-escape-html-uri">6.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-exactly-one"><code>fn:exactly-one</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()</code>
|
|
(§<a href="#func-exactly-one">14.3.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-except"><code>op:except</code></a>(<code>$arg1</code><code> as </code><code>node()*</code>,
|
|
<code>$arg2</code><code> as </code><code>node()*</code>)<code> as </code><code>node()*</code>
|
|
(§<a href="#func-except">14.4.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-exists"><code>fn:exists</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-exists">14.1.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-exp"><code>math:exp</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-exp">4.8.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-exp10"><code>math:exp10</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-exp10">4.8.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-false"><code>fn:false</code></a>()<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-false">7.1.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-filter"><code>fn:filter</code></a>(<code>$f</code><code> as </code><code>function(item())
|
|
as xs:boolean</code>,
|
|
<code>$seq</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-filter">16.2.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-floor"><code>fn:floor</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>)<code> as </code><code>numeric?</code>
|
|
(§<a href="#func-floor">4.4.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-fold-left"><code>fn:fold-left</code></a>(<code>$f</code><code> as </code><code>function(item()*,
|
|
item()) as item()*</code>,
|
|
<code>$zero</code><code> as </code><code>item()*</code>,
|
|
<code>$seq</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-fold-left">16.2.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-fold-right"><code>fn:fold-right</code></a>(<code>$f</code><code> as </code><code>function(item(),
|
|
item()*) as item()*</code>,
|
|
<code>$zero</code><code> as </code><code>item()*</code>,
|
|
<code>$seq</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-fold-right">16.2.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-date"><code>fn:format-date</code></a>(<code>$value</code><code> as </code><code>xs:date?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-format-date">9.8.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-date"><code>fn:format-date</code></a>(<code>$value</code><code> as </code><code>xs:date?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>,
|
|
<code>$language</code><code> as </code><code>xs:string?</code>,
|
|
<code>$calendar</code><code> as </code><code>xs:string?</code>,
|
|
<code>$place</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-format-date">9.8.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a>(<code>$value</code><code> as </code><code>xs:dateTime?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-format-dateTime">9.8.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-dateTime"><code>fn:format-dateTime</code></a>(<code>$value</code><code> as </code><code>xs:dateTime?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>,
|
|
<code>$language</code><code> as </code><code>xs:string?</code>,
|
|
<code>$calendar</code><code> as </code><code>xs:string?</code>,
|
|
<code>$place</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-format-dateTime">9.8.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>(<code>$value</code><code> as </code><code>xs:integer?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-format-integer">4.6.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-integer"><code>fn:format-integer</code></a>(<code>$value</code><code> as </code><code>xs:integer?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>,
|
|
<code>$language</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-format-integer">4.6.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-number"><code>fn:format-number</code></a>(<code>$value</code><code> as </code><code>numeric?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-format-number">4.7.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-number"><code>fn:format-number</code></a>(<code>$value</code><code> as </code><code>numeric?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>,
|
|
<code>$decimal-format-name</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-format-number">4.7.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-time"><code>fn:format-time</code></a>(<code>$value</code><code> as </code><code>xs:time?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-format-time">9.8.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-format-time"><code>fn:format-time</code></a>(<code>$value</code><code> as </code><code>xs:time?</code>,
|
|
<code>$picture</code><code> as </code><code>xs:string</code>,
|
|
<code>$language</code><code> as </code><code>xs:string?</code>,
|
|
<code>$calendar</code><code> as </code><code>xs:string?</code>,
|
|
<code>$place</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-format-time">9.8.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-function-arity"><code>fn:function-arity</code></a>(<code>$func</code><code> as </code><code>function(*)</code>)<code> as </code><code>xs:integer</code>
|
|
(§<a href="#func-function-arity">16.1.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-function-lookup"><code>fn:function-lookup</code></a>(<code>$name</code><code> as </code><code>xs:QName</code>,
|
|
<code>$arity</code><code> as </code><code>xs:integer</code>)<code> as </code><code>function()?</code>
|
|
(§<a href="#func-function-lookup">16.1.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-function-name"><code>fn:function-name</code></a>(<code>$func</code><code> as </code><code>function(*)</code>)<code> as </code><code>xs:QName?</code>
|
|
(§<a href="#func-function-name">16.1.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-gDay-equal"><code>op:gDay-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:gDay</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:gDay</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-gDay-equal">9.4.14</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-generate-id"><code>fn:generate-id</code></a>()<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-generate-id">14.7.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-generate-id"><code>fn:generate-id</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-generate-id">14.7.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-gMonthDay-equal"><code>op:gMonthDay-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:gMonthDay</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:gMonthDay</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-gMonthDay-equal">9.4.12</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-gMonth-equal"><code>op:gMonth-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:gMonth</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:gMonth</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-gMonth-equal">9.4.13</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-gYear-equal"><code>op:gYear-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:gYear</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:gYear</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-gYear-equal">9.4.11</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-gYearMonth-equal"><code>op:gYearMonth-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:gYearMonth</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:gYearMonth</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-gYearMonth-equal">9.4.10</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-has-children"><code>fn:has-children</code></a>()<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-has-children">13.10</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-has-children"><code>fn:has-children</code></a>(<code>$node</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-has-children">13.10</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-head"><code>fn:head</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()?</code>
|
|
(§<a href="#func-head">14.1.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-hexBinary-equal"><code>op:hexBinary-equal</code></a>(<code>$value1</code><code> as </code><code>xs:hexBinary</code>,
|
|
<code>$value2</code><code> as </code><code>xs:hexBinary</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-hexBinary-equal">11.1.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-hours-from-dateTime"><code>fn:hours-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-hours-from-dateTime">9.5.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-hours-from-duration"><code>fn:hours-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-hours-from-duration">8.3.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-hours-from-time"><code>fn:hours-from-time</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-hours-from-time">9.5.12</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-id"><code>fn:id</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>)<code> as </code><code>element()*</code>
|
|
(§<a href="#func-id">14.7.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-id"><code>fn:id</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>,
|
|
<code>$node</code><code> as </code><code>node()</code>)<code> as </code><code>element()*</code>
|
|
(§<a href="#func-id">14.7.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-idref"><code>fn:idref</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>)<code> as </code><code>node()*</code>
|
|
(§<a href="#func-idref">14.7.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-idref"><code>fn:idref</code></a>(<code>$arg</code><code> as </code><code>xs:string*</code>,
|
|
<code>$node</code><code> as </code><code>node()</code>)<code> as </code><code>node()*</code>
|
|
(§<a href="#func-idref">14.7.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-implicit-timezone"><code>fn:implicit-timezone</code></a>()<code> as </code><code>xs:dayTimeDuration</code>
|
|
(§<a href="#func-implicit-timezone">15.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-index-of"><code>fn:index-of</code></a>(<code>$seq</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$search</code><code> as </code><code>xs:anyAtomicType</code>)<code> as </code><code>xs:integer*</code>
|
|
(§<a href="#func-index-of">14.2.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-index-of"><code>fn:index-of</code></a>(<code>$seq</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$search</code><code> as </code><code>xs:anyAtomicType</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:integer*</code>
|
|
(§<a href="#func-index-of">14.2.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-innermost"><code>fn:innermost</code></a>(<code>$nodes</code><code> as </code><code>node()*</code>)<code> as </code><code>node()*</code>
|
|
(§<a href="#func-innermost">13.11</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-in-scope-prefixes"><code>fn:in-scope-prefixes</code></a>(<code>$element</code><code> as </code><code>element()</code>)<code> as </code><code>xs:string*</code>
|
|
(§<a href="#func-in-scope-prefixes">10.2.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-insert-before"><code>fn:insert-before</code></a>(<code>$target</code><code> as </code><code>item()*</code>,
|
|
<code>$position</code><code> as </code><code>xs:integer</code>,
|
|
<code>$inserts</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-insert-before">14.1.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-intersect"><code>op:intersect</code></a>(<code>$arg1</code><code> as </code><code>node()*</code>,
|
|
<code>$arg2</code><code> as </code><code>node()*</code>)<code> as </code><code>node()*</code>
|
|
(§<a href="#func-intersect">14.4.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-iri-to-uri"><code>fn:iri-to-uri</code></a>(<code>$iri</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-iri-to-uri">6.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-is-same-node"><code>op:is-same-node</code></a>(<code>$arg1</code><code> as </code><code>node()</code>,
|
|
<code>$arg2</code><code> as </code><code>node()</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-is-same-node">13.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-lang"><code>fn:lang</code></a>(<code>$testlang</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-lang">13.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-lang"><code>fn:lang</code></a>(<code>$testlang</code><code> as </code><code>xs:string?</code>,
|
|
<code>$node</code><code> as </code><code>node()</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-lang">13.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-last"><code>fn:last</code></a>()<code> as </code><code>xs:integer</code>
|
|
(§<a href="#func-last">15.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-local-name"><code>fn:local-name</code></a>()<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-local-name">13.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-local-name"><code>fn:local-name</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-local-name">13.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-local-name-from-QName"><code>fn:local-name-from-QName</code></a>(<code>$arg</code><code> as </code><code>xs:QName?</code>)<code> as </code><code>xs:NCName?</code>
|
|
(§<a href="#func-local-name-from-QName">10.2.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-log"><code>math:log</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-log">4.8.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-log10"><code>math:log10</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-log10">4.8.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-lower-case"><code>fn:lower-case</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-lower-case">5.4.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-map"><code>fn:map</code></a>(<code>$f</code><code> as </code><code>function(item())
|
|
as item()*</code>,
|
|
<code>$seq</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-map">16.2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-map-pairs"><code>fn:map-pairs</code></a>(<code>$f</code><code> as </code><code>function(item(),
|
|
item()) as item()*</code>,
|
|
<code>$seq1</code><code> as </code><code>item()*</code>,
|
|
<code>$seq2</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-map-pairs">16.2.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-matches"><code>fn:matches</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-matches">5.6.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-matches"><code>fn:matches</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>,
|
|
<code>$flags</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-matches">5.6.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-max"><code>fn:max</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>)<code> as </code><code>xs:anyAtomicType?</code>
|
|
(§<a href="#func-max">14.5.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-max"><code>fn:max</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:anyAtomicType?</code>
|
|
(§<a href="#func-max">14.5.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-min"><code>fn:min</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>)<code> as </code><code>xs:anyAtomicType?</code>
|
|
(§<a href="#func-min">14.5.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-min"><code>fn:min</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:anyAtomicType?</code>
|
|
(§<a href="#func-min">14.5.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-minutes-from-dateTime"><code>fn:minutes-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-minutes-from-dateTime">9.5.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-minutes-from-duration"><code>fn:minutes-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-minutes-from-duration">8.3.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-minutes-from-time"><code>fn:minutes-from-time</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-minutes-from-time">9.5.13</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-month-from-date"><code>fn:month-from-date</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-month-from-date">9.5.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-month-from-dateTime"><code>fn:month-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-month-from-dateTime">9.5.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-months-from-duration"><code>fn:months-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-months-from-duration">8.3.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-multiply-dayTimeDuration"><code>op:multiply-dayTimeDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:dayTimeDuration</code>
|
|
(§<a href="#func-multiply-dayTimeDuration">8.4.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-multiply-yearMonthDuration"><code>op:multiply-yearMonthDuration</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:yearMonthDuration</code>
|
|
(§<a href="#func-multiply-yearMonthDuration">8.4.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-name"><code>fn:name</code></a>()<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-name">13.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-name"><code>fn:name</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-name">13.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-namespace-uri"><code>fn:namespace-uri</code></a>()<code> as </code><code>xs:anyURI</code>
|
|
(§<a href="#func-namespace-uri">13.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-namespace-uri"><code>fn:namespace-uri</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:anyURI</code>
|
|
(§<a href="#func-namespace-uri">13.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-namespace-uri-for-prefix"><code>fn:namespace-uri-for-prefix</code></a>(<code>$prefix</code><code> as </code><code>xs:string?</code>,
|
|
<code>$element</code><code> as </code><code>element()</code>)<code> as </code><code>xs:anyURI?</code>
|
|
(§<a href="#func-namespace-uri-for-prefix">10.2.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-namespace-uri-from-QName"><code>fn:namespace-uri-from-QName</code></a>(<code>$arg</code><code> as </code><code>xs:QName?</code>)<code> as </code><code>xs:anyURI?</code>
|
|
(§<a href="#func-namespace-uri-from-QName">10.2.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-nilled"><code>fn:nilled</code></a>()<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-nilled">2.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-nilled"><code>fn:nilled</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:boolean?</code>
|
|
(§<a href="#func-nilled">2.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-node-after"><code>op:node-after</code></a>(<code>$arg1</code><code> as </code><code>node()</code>,
|
|
<code>$arg2</code><code> as </code><code>node()</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-node-after">13.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-node-before"><code>op:node-before</code></a>(<code>$arg1</code><code> as </code><code>node()</code>,
|
|
<code>$arg2</code><code> as </code><code>node()</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-node-before">13.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-node-name"><code>fn:node-name</code></a>()<code> as </code><code>xs:QName?</code>
|
|
(§<a href="#func-node-name">2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-node-name"><code>fn:node-name</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:QName?</code>
|
|
(§<a href="#func-node-name">2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-normalize-space"><code>fn:normalize-space</code></a>()<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-normalize-space">5.4.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-normalize-space"><code>fn:normalize-space</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-normalize-space">5.4.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-normalize-unicode"><code>fn:normalize-unicode</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-normalize-unicode">5.4.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-normalize-unicode"><code>fn:normalize-unicode</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>,
|
|
<code>$normalizationForm</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-normalize-unicode">5.4.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-not"><code>fn:not</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-not">7.3.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-NOTATION-equal"><code>op:NOTATION-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:NOTATION</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:NOTATION</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-NOTATION-equal">12.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-number"><code>fn:number</code></a>()<code> as </code><code>xs:double</code>
|
|
(§<a href="#func-number">4.5.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-number"><code>fn:number</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType?</code>)<code> as </code><code>xs:double</code>
|
|
(§<a href="#func-number">4.5.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-add"><code>op:numeric-add</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code>
|
|
(§<a href="#func-numeric-add">4.2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-divide"><code>op:numeric-divide</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code>
|
|
(§<a href="#func-numeric-divide">4.2.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-equal"><code>op:numeric-equal</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-numeric-equal">4.3.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-greater-than"><code>op:numeric-greater-than</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-numeric-greater-than">4.3.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-integer-divide"><code>op:numeric-integer-divide</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>xs:integer</code>
|
|
(§<a href="#func-numeric-integer-divide">4.2.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-less-than"><code>op:numeric-less-than</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-numeric-less-than">4.3.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-mod"><code>op:numeric-mod</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code>
|
|
(§<a href="#func-numeric-mod">4.2.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-multiply"><code>op:numeric-multiply</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code>
|
|
(§<a href="#func-numeric-multiply">4.2.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-subtract"><code>op:numeric-subtract</code></a>(<code>$arg1</code><code> as </code><code>numeric</code>,
|
|
<code>$arg2</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code>
|
|
(§<a href="#func-numeric-subtract">4.2.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-unary-minus"><code>op:numeric-unary-minus</code></a>(<code>$arg</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code>
|
|
(§<a href="#func-numeric-unary-minus">4.2.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-numeric-unary-plus"><code>op:numeric-unary-plus</code></a>(<code>$arg</code><code> as </code><code>numeric</code>)<code> as </code><code>numeric</code>
|
|
(§<a href="#func-numeric-unary-plus">4.2.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-one-or-more"><code>fn:one-or-more</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()+</code>
|
|
(§<a href="#func-one-or-more">14.3.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-outermost"><code>fn:outermost</code></a>(<code>$nodes</code><code> as </code><code>node()*</code>)<code> as </code><code>node()*</code>
|
|
(§<a href="#func-outermost">13.12</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-parse-xml"><code>fn:parse-xml</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>document-node(element(*))</code>
|
|
(§<a href="#func-parse-xml">14.9.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-parse-xml-fragment"><code>fn:parse-xml-fragment</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>document-node()?</code>
|
|
(§<a href="#func-parse-xml-fragment">14.9.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-path"><code>fn:path</code></a>()<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-path">13.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-path"><code>fn:path</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-path">13.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-pi"><code>math:pi</code></a>()<code> as </code><code>xs:double</code>
|
|
(§<a href="#func-math-pi">4.8.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-position"><code>fn:position</code></a>()<code> as </code><code>xs:integer</code>
|
|
(§<a href="#func-position">15.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-pow"><code>math:pow</code></a>(<code>$x</code><code> as </code><code>xs:double?</code>,
|
|
<code>$y</code><code> as </code><code>numeric</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-pow">4.8.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-prefix-from-QName"><code>fn:prefix-from-QName</code></a>(<code>$arg</code><code> as </code><code>xs:QName?</code>)<code> as </code><code>xs:NCName?</code>
|
|
(§<a href="#func-prefix-from-QName">10.2.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-QName"><code>fn:QName</code></a>(<code>$paramURI</code><code> as </code><code>xs:string?</code>,
|
|
<code>$paramQName</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:QName</code>
|
|
(§<a href="#func-QName">10.1.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-QName-equal"><code>op:QName-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:QName</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:QName</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-QName-equal">10.2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-remove"><code>fn:remove</code></a>(<code>$target</code><code> as </code><code>item()*</code>,
|
|
<code>$position</code><code> as </code><code>xs:integer</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-remove">14.1.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-replace"><code>fn:replace</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>,
|
|
<code>$replacement</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-replace">5.6.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-replace"><code>fn:replace</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>,
|
|
<code>$replacement</code><code> as </code><code>xs:string</code>,
|
|
<code>$flags</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-replace">5.6.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-resolve-QName"><code>fn:resolve-QName</code></a>(<code>$qname</code><code> as </code><code>xs:string?</code>,
|
|
<code>$element</code><code> as </code><code>element()</code>)<code> as </code><code>xs:QName?</code>
|
|
(§<a href="#func-resolve-QName">10.1.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-resolve-uri"><code>fn:resolve-uri</code></a>(<code>$relative</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:anyURI?</code>
|
|
(§<a href="#func-resolve-uri">6.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-resolve-uri"><code>fn:resolve-uri</code></a>(<code>$relative</code><code> as </code><code>xs:string?</code>,
|
|
<code>$base</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:anyURI?</code>
|
|
(§<a href="#func-resolve-uri">6.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-reverse"><code>fn:reverse</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-reverse">14.1.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-root"><code>fn:root</code></a>()<code> as </code><code>node()</code>
|
|
(§<a href="#func-root">13.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-root"><code>fn:root</code></a>(<code>$arg</code><code> as </code><code>node()?</code>)<code> as </code><code>node()?</code>
|
|
(§<a href="#func-root">13.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-round"><code>fn:round</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>)<code> as </code><code>numeric?</code>
|
|
(§<a href="#func-round">4.4.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-round"><code>fn:round</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>,
|
|
<code>$precision</code><code> as </code><code>xs:integer</code>)<code> as </code><code>numeric?</code>
|
|
(§<a href="#func-round">4.4.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-round-half-to-even"><code>fn:round-half-to-even</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>)<code> as </code><code>numeric?</code>
|
|
(§<a href="#func-round-half-to-even">4.4.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-round-half-to-even"><code>fn:round-half-to-even</code></a>(<code>$arg</code><code> as </code><code>numeric?</code>,
|
|
<code>$precision</code><code> as </code><code>xs:integer</code>)<code> as </code><code>numeric?</code>
|
|
(§<a href="#func-round-half-to-even">4.4.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-seconds-from-dateTime"><code>fn:seconds-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:decimal?</code>
|
|
(§<a href="#func-seconds-from-dateTime">9.5.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-seconds-from-duration"><code>fn:seconds-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:decimal?</code>
|
|
(§<a href="#func-seconds-from-duration">8.3.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-seconds-from-time"><code>fn:seconds-from-time</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:decimal?</code>
|
|
(§<a href="#func-seconds-from-time">9.5.14</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-serialize"><code>fn:serialize</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-serialize">14.9.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-serialize"><code>fn:serialize</code></a>(<code>$arg</code><code> as </code><code>item()*</code>,
|
|
<code>$params</code><code> as </code><code>element(output:serialization-parameters)?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-serialize">14.9.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-sin"><code>math:sin</code></a>(<code>$</code><span style="font-family:Times; font-style:italic">θ</span><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-sin">4.8.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-sqrt"><code>math:sqrt</code></a>(<code>$arg</code><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-sqrt">4.8.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-starts-with"><code>fn:starts-with</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-starts-with">5.5.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-starts-with"><code>fn:starts-with</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-starts-with">5.5.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-static-base-uri"><code>fn:static-base-uri</code></a>()<code> as </code><code>xs:anyURI?</code>
|
|
(§<a href="#func-static-base-uri">15.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-string"><code>fn:string</code></a>()<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-string">2.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-string"><code>fn:string</code></a>(<code>$arg</code><code> as </code><code>item()?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-string">2.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-string-join"><code>fn:string-join</code></a>(<code>$arg1</code><code> as </code><code>xs:string*</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-string-join">5.4.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-string-join"><code>fn:string-join</code></a>(<code>$arg1</code><code> as </code><code>xs:string*</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-string-join">5.4.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-string-length"><code>fn:string-length</code></a>()<code> as </code><code>xs:integer</code>
|
|
(§<a href="#func-string-length">5.4.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-string-length"><code>fn:string-length</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:integer</code>
|
|
(§<a href="#func-string-length">5.4.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-string-to-codepoints"><code>fn:string-to-codepoints</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:integer*</code>
|
|
(§<a href="#func-string-to-codepoints">5.2.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subsequence"><code>fn:subsequence</code></a>(<code>$sourceSeq</code><code> as </code><code>item()*</code>,
|
|
<code>$startingLoc</code><code> as </code><code>xs:double</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-subsequence">14.1.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subsequence"><code>fn:subsequence</code></a>(<code>$sourceSeq</code><code> as </code><code>item()*</code>,
|
|
<code>$startingLoc</code><code> as </code><code>xs:double</code>,
|
|
<code>$length</code><code> as </code><code>xs:double</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-subsequence">14.1.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring"><code>fn:substring</code></a>(<code>$sourceString</code><code> as </code><code>xs:string?</code>,
|
|
<code>$start</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-substring">5.4.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring"><code>fn:substring</code></a>(<code>$sourceString</code><code> as </code><code>xs:string?</code>,
|
|
<code>$start</code><code> as </code><code>xs:double</code>,
|
|
<code>$length</code><code> as </code><code>xs:double</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-substring">5.4.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring-after"><code>fn:substring-after</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-substring-after">5.5.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring-after"><code>fn:substring-after</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-substring-after">5.5.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring-before"><code>fn:substring-before</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-substring-before">5.5.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-substring-before"><code>fn:substring-before</code></a>(<code>$arg1</code><code> as </code><code>xs:string?</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:string?</code>,
|
|
<code>$collation</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-substring-before">5.5.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dates"><code>op:subtract-dates</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:date</code>)<code> as </code><code>xs:dayTimeDuration</code>
|
|
(§<a href="#func-subtract-dates">9.7.3</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dateTimes"><code>op:subtract-dateTimes</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dateTime</code>)<code> as </code><code>xs:dayTimeDuration</code>
|
|
(§<a href="#func-subtract-dateTimes">9.7.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dayTimeDuration-from-date"><code>op:subtract-dayTimeDuration-from-date</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:date</code>
|
|
(§<a href=
|
|
"#func-subtract-dayTimeDuration-from-date">9.7.12</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dayTimeDuration-from-dateTime"><code>op:subtract-dayTimeDuration-from-dateTime</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:dateTime</code>
|
|
(§<a href=
|
|
"#func-subtract-dayTimeDuration-from-dateTime">9.7.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dayTimeDuration-from-time"><code>op:subtract-dayTimeDuration-from-time</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:time</code>
|
|
(§<a href=
|
|
"#func-subtract-dayTimeDuration-from-time">9.7.14</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-dayTimeDurations"><code>op:subtract-dayTimeDurations</code></a>(<code>$arg1</code><code> as </code><code>xs:dayTimeDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:dayTimeDuration</code>)<code> as </code><code>xs:dayTimeDuration</code>
|
|
(§<a href="#func-subtract-dayTimeDurations">8.4.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-times"><code>op:subtract-times</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:time</code>)<code> as </code><code>xs:dayTimeDuration</code>
|
|
(§<a href="#func-subtract-times">9.7.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-yearMonthDuration-from-date"><code>op:subtract-yearMonthDuration-from-date</code></a>(<code>$arg1</code><code> as </code><code>xs:date</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:date</code>
|
|
(§<a href=
|
|
"#func-subtract-yearMonthDuration-from-date">9.7.11</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-yearMonthDuration-from-dateTime"><code>op:subtract-yearMonthDuration-from-dateTime</code></a>(<code>$arg1</code><code> as </code><code>xs:dateTime</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:dateTime</code>
|
|
(§<a href=
|
|
"#func-subtract-yearMonthDuration-from-dateTime">9.7.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-subtract-yearMonthDurations"><code>op:subtract-yearMonthDurations</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:yearMonthDuration</code>
|
|
(§<a href="#func-subtract-yearMonthDurations">8.4.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-sum"><code>fn:sum</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>)<code> as </code><code>xs:anyAtomicType</code>
|
|
(§<a href="#func-sum">14.5.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-sum"><code>fn:sum</code></a>(<code>$arg</code><code> as </code><code>xs:anyAtomicType*</code>,
|
|
<code>$zero</code><code> as </code><code>xs:anyAtomicType?</code>)<code> as </code><code>xs:anyAtomicType?</code>
|
|
(§<a href="#func-sum">14.5.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-tail"><code>fn:tail</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-tail">14.1.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-math-tan"><code>math:tan</code></a>(<code>$</code><span style="font-family:Times; font-style:italic">θ</span><code> as </code><code>xs:double?</code>)<code> as </code><code>xs:double?</code>
|
|
(§<a href="#func-math-tan">4.8.10</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-time-equal"><code>op:time-equal</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:time</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-time-equal">9.4.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-time-greater-than"><code>op:time-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:time</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-time-greater-than">9.4.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-time-less-than"><code>op:time-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:time</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:time</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-time-less-than">9.4.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-timezone-from-date"><code>fn:timezone-from-date</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>)<code> as </code><code>xs:dayTimeDuration?</code>
|
|
(§<a href="#func-timezone-from-date">9.5.11</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-timezone-from-dateTime"><code>fn:timezone-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:dayTimeDuration?</code>
|
|
(§<a href="#func-timezone-from-dateTime">9.5.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-timezone-from-time"><code>fn:timezone-from-time</code></a>(<code>$arg</code><code> as </code><code>xs:time?</code>)<code> as </code><code>xs:dayTimeDuration?</code>
|
|
(§<a href="#func-timezone-from-time">9.5.15</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-to"><code>op:to</code></a>(<code>$firstval</code><code> as </code><code>xs:integer</code>,
|
|
<code>$lastval</code><code> as </code><code>xs:integer</code>)<code> as </code><code>xs:integer*</code>
|
|
(§<a href="#func-to">14.6.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-tokenize"><code>fn:tokenize</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string*</code>
|
|
(§<a href="#func-tokenize">5.6.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-tokenize"><code>fn:tokenize</code></a>(<code>$input</code><code> as </code><code>xs:string?</code>,
|
|
<code>$pattern</code><code> as </code><code>xs:string</code>,
|
|
<code>$flags</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string*</code>
|
|
(§<a href="#func-tokenize">5.6.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-trace"><code>fn:trace</code></a>(<code>$value</code><code> as </code><code>item()*</code>,
|
|
<code>$label</code><code> as </code><code>xs:string</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-trace">3.2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-translate"><code>fn:translate</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>,
|
|
<code>$mapString</code><code> as </code><code>xs:string</code>,
|
|
<code>$transString</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-translate">5.4.9</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-true"><code>fn:true</code></a>()<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-true">7.1.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-union"><code>op:union</code></a>(<code>$arg1</code><code> as </code><code>node()*</code>,
|
|
<code>$arg2</code><code> as </code><code>node()*</code>)<code> as </code><code>node()*</code>
|
|
(§<a href="#func-union">14.4.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-unordered"><code>fn:unordered</code></a>(<code>$sourceSeq</code><code> as </code><code>item()*</code>)<code> as </code><code>item()*</code>
|
|
(§<a href="#func-unordered">14.1.10</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text"><code>fn:unparsed-text</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-unparsed-text">14.8.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text"><code>fn:unparsed-text</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>,
|
|
<code>$encoding</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string?</code>
|
|
(§<a href="#func-unparsed-text">14.8.5</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text-available"><code>fn:unparsed-text-available</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-unparsed-text-available">14.8.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text-available"><code>fn:unparsed-text-available</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>,
|
|
<code>$encoding</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-unparsed-text-available">14.8.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text-lines"><code>fn:unparsed-text-lines</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string*</code>
|
|
(§<a href="#func-unparsed-text-lines">14.8.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-unparsed-text-lines"><code>fn:unparsed-text-lines</code></a>(<code>$href</code><code> as </code><code>xs:string?</code>,
|
|
<code>$encoding</code><code> as </code><code>xs:string</code>)<code> as </code><code>xs:string*</code>
|
|
(§<a href="#func-unparsed-text-lines">14.8.6</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-upper-case"><code>fn:upper-case</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:string</code>
|
|
(§<a href="#func-upper-case">5.4.7</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-uri-collection"><code>fn:uri-collection</code></a>()<code> as </code><code>xs:anyURI*</code>
|
|
(§<a href="#func-uri-collection">14.8.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-uri-collection"><code>fn:uri-collection</code></a>(<code>$arg</code><code> as </code><code>xs:string?</code>)<code> as </code><code>xs:anyURI*</code>
|
|
(§<a href="#func-uri-collection">14.8.4</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-year-from-date"><code>fn:year-from-date</code></a>(<code>$arg</code><code> as </code><code>xs:date?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-year-from-date">9.5.8</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-year-from-dateTime"><code>fn:year-from-dateTime</code></a>(<code>$arg</code><code> as </code><code>xs:dateTime?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-year-from-dateTime">9.5.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-yearMonthDuration-greater-than"><code>op:yearMonthDuration-greater-than</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-yearMonthDuration-greater-than">8.2.2</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-yearMonthDuration-less-than"><code>op:yearMonthDuration-less-than</code></a>(<code>$arg1</code><code> as </code><code>xs:yearMonthDuration</code>,
|
|
<code>$arg2</code><code> as </code><code>xs:yearMonthDuration</code>)<code> as </code><code>xs:boolean</code>
|
|
(§<a href="#func-yearMonthDuration-less-than">8.2.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-years-from-duration"><code>fn:years-from-duration</code></a>(<code>$arg</code><code> as </code><code>xs:duration?</code>)<code> as </code><code>xs:integer?</code>
|
|
(§<a href="#func-years-from-duration">8.3.1</a>)</div>
|
|
<div class="protoref"><a href=
|
|
"#func-zero-or-one"><code>fn:zero-or-one</code></a>(<code>$arg</code><code> as </code><code>item()*</code>)<code> as </code><code>item()?</code>
|
|
(§<a href="#func-zero-or-one">14.3.1</a>)</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|