Files
release11-tools/Frontend/tools/xpath.html

5408 lines
329 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<!-- <link rel="stylesheet" href="../common.css"> -->
<!-- <link rel="stylesheet" href="styles.css"> -->
<link rel="stylesheet" href="../assets/css/tools/r11form.css">
<script src="../assets/scripts/tools/scripts.js"> </script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
</head>
<body onload="init();">
<div class="container">
<div id="tool" class="tool rwd-expandable">
<div class="tool-context">
<div class="headline">
<h1>Online XPath tester</h1>
</div>
<div class="display-space-between">
<div>
<label for="processors">Select XPath processor:</label>
<select name="processors" id="processors">
<option value="saxon">Saxon</option>
<option value="xalan">Xalan</option>
<option value="libxml">libXML</option>
</select><br>
<label for="versions">XPath version:</label>
<select name="versions" id="versions">
<option class="hideable libxml xalan"value="1.0">1.0</option>
<option class="hideable saxon" value="2.0">2.0</option>
<option class="hideable saxon" value="3.0">3.0</option>
<option class="hideable saxon" value="3.1">3.1</option>
</select>
</div>
<div>
<button class="action-button active" id="clearXMLButton" style="padding: 3px 10px;"
onclick="clearDataField()">Clear</button>
<button class="action-button active" id="prettyXMLButton" style="padding: 3px 10px;"
onclick="performFormatRequest('prettify', true, 'xmlArea', 'xmlArea')">Format XML</button>
<button class="action-button active" id="defaultXMLButton" style="padding: 3px 10px;"
onclick="fillDefaultXML(this)">Insert default XML</button>
</div>
</div>
<br>
<label for="xmlArea"><b>Insert your XML:</b></label>
<textarea id="xmlArea" name="xmlArea" rows="15"
class="textarea-300 bordered-field vertically-resizeable max-width"
onblur="setDefaultContent(this, 'Insert XML here');"
onfocus="clearDefaultContent(this, 'Insert XML here');"></textarea>
<br><br>
<label for="transformArea"><b>Insert your XPath:</b></label>
<textarea id="transformArea" name="transformArea"
class="bordered-field vertically-resizeable max-width" rows="4"
onblur="setDefaultContent(this, 'Insert XPath expression here');"
onfocus="clearDefaultContent(this, 'Insert XPath expression here');"></textarea>
<br>
<button id="requestButton" class="max-width block-label action-button active"
onclick="performRequest('xpath', false, true)">Execute XPath
expression</button>
<br><br>
<label for="resultArea"><b>Transform result:<span id="procinfo"></span></b></label>
<textarea disabled id="resultArea" name="resultArea"
class="textarea-300 bordered-field vertically-resizeable max-width" style="margin-bottom: 50px;" rows="10" cols="100"></textarea>
</div>
</div>
<div class="tooltip tooltip-window rwd-hideable">
<h2>What is XPath?</h2>
<p>XPath is a query language used for selecting nodes from XML and processing them.<br>
It may perform operations on strings, numbers and boolean values.<br></p>
<span id="collapsible-lists">
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">XPath 1.0 vs 2.0 vs 3.0 vs
3.1</button>
</span>
<div class="content">
<p><b>XPath 2.0 introduced many new features XQuery-cośtam:</b><br>
- Added support for all XML simple types<br>
- Many new functions (tripled instruction count)<br>
- All expressions evaluate to sequence<br>
- Introduces conditional expressions and for-loops<br>
</p>
<p><b>XPath 3.0</b><br>
- Dynamic function calls (function may be called without being referenced by name (find
function in collection and call)<br>
- Inline functions<br>
- Namespace literals - Namespace may be embedded into function name<br>
- Support for union types - collections containing elements of different types<br>
- Mapping operator - '!' performs evaluation for each element in sequence and
concatenates results<br>
- Introduced maps <br>
</p>
<p><b>XPath 3.1</b><br>
- New operator for function chaining '=>' <br>
- Introduced maps that store data in pair 'key:value' - 'map{ key : value, key : value
}'<br>
- Introduced arrays - they differ from sequences in that they can be nested 'array{1, 5, 7,
(10 to 20)}'<br>
</p>
</div>
</div>
<h2><span id="tooltipFunctionInfo">XPath 1.0 & 2.0 functions</span></h2>
<!-- Cut here -->
<span name="collapse10">
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Node-Set</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:position()</code></a>
<div class="content">
Returns the position of the current context node <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Node-Set-Functions" class="hyperlink" target="_blank">Node-Set-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:count()</code></a>
<div class="content">
Returns the number of nodes in the node-set <br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node-set</td>
<td>Node-set to count nodes in</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>count(//b:book)</td>
<td>5</td>
</tr>
<tr>
<td>count(//person[@id>5])</td>
<td>17</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Node-Set-Functions" class="hyperlink" target="_blank">Node-Set-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:id()</code></a>
<div class="content">
Returns the element specified by it's unique id, requires DTD <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Node-Set-Functions" class="hyperlink" target="_blank">Node-Set-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:local-name()</code></a>
<div class="content">
Returns the local-name for the first node in the node-set <br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node-set</td>
<td>Extract first node and return its local name</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>local-name(//b:books)</td>
<td>b:book</td>
</tr>
<tr>
<td>local-name(//b:book)</td>
<td>b:title</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Node-Set-Functions" class="hyperlink" target="_blank">Node-Set-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:local-name()</code></a>
<div class="content">
Returns the local-name for the context node <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Node-Set-Functions" class="hyperlink" target="_blank">Node-Set-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:namespace-uri()</code></a>
<div class="content">
Returns the namespace-uri for the first node in the node-set <br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node-set</td>
<td>Extract first node and return the namespace URI</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>namespace-uri(//b:book)</td>
<td>http://www.book.com</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Node-Set-Functions" class="hyperlink" target="_blank">Node-Set-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:namespace-uri()</code></a>
<div class="content">
Returns the namespace-uri for the context node <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Node-Set-Functions" class="hyperlink" target="_blank">Node-Set-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:name()</code></a>
<div class="content">
Returns the name for the first node in the node-set <br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node-set (Optional)</td>
<td>Extract first node and return QName</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>name(//b:books/*)</td>
<td>b:book</td>
</tr>
<tr>
<td>name(//b:book/*)</td>
<td>b:title</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Node-Set-Functions" class="hyperlink" target="_blank">Node-Set-Functions</code></a>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Boolean</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:boolean()</code></a>
<div class="content">
The boolean function converts its argument to a boolean as follows:
<ul>
<li>a number is true if and only if it is neither positive or negative zero nor NaN</li>
<li>a node-set is true if and only if it is non-empty</li>
<li>a string is true if and only if its length is non-zero</li>
<li>an object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type</li>
</ul>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>object</td>
<td>The object to convert to a boolean</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>boolean("Release11")</td>
<td>true</td>
</tr>
<tr>
<td>boolean("")</td>
<td>false</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Boolean-Functions" class="hyperlink" target="_blank">Boolean-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:not()</code></a>
<div class="content">
The not function returns true if its argument is false, and false otherwise. <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#function-not" class="hyperlink" target="_blank">Boolean-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:true()</code></a>
<div class="content">
The true function returns true. <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Boolean-Functions" class="hyperlink" target="_blank">Boolean-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:false()</code></a>
<div class="content">
The true function returns false. <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Boolean-Functions" class="hyperlink" target="_blank">Boolean-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:lang()</code></a>
<div class="content">
The lang function returns true or false depending on whether the language of the context node as specified by xml:lang attributes is the same as or is a sublanguage of the language specified by the argument string. The language of the context node is determined by the value of the xml:lang attribute on the context node, or, if the context node has no xml:lang attribute, by the value of the xml:lang attribute on the nearest ancestor of the context node that has an xml:lang attribute. If there is no such attribute, then lang returns false. If there is such an attribute, then lang returns true if the attribute value is equal to the argument ignoring case, or if there is some suffix starting with - such that the attribute value is equal to the argument ignoring that suffix of the attribute value and ignoring case. <br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string</td>
<td>Language that will be looked for in context node</td>
</tr>
</table><b>Examples: </b> Look W3C documentation<br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Boolean-Functions" class="hyperlink" target="_blank">Boolean-Functions</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">String</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:string()</code></a>
<div class="content">
The string function converts an object to a string as follows: A node-set is converted to a string by returning the string-value of the node in the node-set that is first in document order. If the node-set is empty, an empty string is returned.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>object</td>
<td>The object to convert to a string</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>string(10)</td>
<td>true</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-String-Functions" class="hyperlink" target="_blank">String-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:concat()</code></a>
<div class="content">
The concat function returns the concatenation of its arguments.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string*</td>
<td>Strings to concatenate</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>concat("Release", 11)</td>
<td>Release11</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-String-Functions" class="hyperlink" target="_blank">String-Functions</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:starts-with()</code></a>
<div class="content">
The concat function returns the concatenation of its arguments.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string</td>
<td></td>
</tr>
<tr>
<td>string</td>
<td>The object to convert to a string</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>concat("Release", 11)</td>
<td>Release11</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-String-Functions" class="hyperlink" target="_blank">String-Functions</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Numeric</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:number()</code></a>
<div class="content">
The number function converts its argument to a number as follows:
<ul>
<li>a string that consists of optional whitespace followed by an optional minus sign followed by a Number followed by whitespace is converted to the IEEE 754 number that is nearest (according to the IEEE 754 round-to-nearest rule) to the mathematical value represented by the string; any other string is converted to NaN</li>
<li>boolean true is converted to 1; boolean false is converted to 0</li>
<li>a node-set is first converted to a string as if by a call to the string function and then converted in the same way as a string argument</li>
<li>an object of a type other than the four basic types is converted to a number in a way that is dependent on that type</li>
</ul>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>object</td>
<td>The object to convert to a number</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>number(10)</td>
<td>10</td>
</tr>
<tr>
<td>number("")</td>
<td>NaN</td>
</tr>
</table><br>
<code><a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Number-Functions" class="hyperlink" target="_blank">W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:sum()</code></a>
<div class="content">
The sum function returns the sum, for each node in the argument node-set, of the result of converting the string-values of the node to a number.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node-set</td>
<td>Node set to sum</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>sum(/l:library/l:readerList/p:person/p:readerID)</td>
<td>12444</td>
</tr>
</table><br>
<code><a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Number-Functions" class="hyperlink" target="_blank">W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:floor()</code></a>
<div class="content">
The floor function returns the largest (closest to positive infinity) number that is not greater than the argument and that is an integer.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node-set</td>
<td>Node set to sum</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>floor(3.1)</td>
<td>4</td>
</tr>
<tr>
<td>floor(3.9)</td>
<td>4</td>
</tr>
<tr>
<td>floor(3.5)</td>
<td>4</td>
</tr>
</table><br>
<code><a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Number-Functions" class="hyperlink" target="_blank">W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:ceiling()</code></a>
<div class="content">
The ceiling function returns the smallest (closest to negative infinity) number that is not less than the argument and that is an integer.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node-set</td>
<td>Node set to sum</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>floor(3.1)</td>
<td>3</td>
</tr>
<tr>
<td>floor(3.9)</td>
<td>3</td>
</tr>
<tr>
<td>floor(3.5)</td>
<td>3</td>
</tr>
</table><br>
<code><a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Number-Functions" class="hyperlink" target="_blank">W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:round()</code></a>
<div class="content">
The round function returns the number that is closest to the argument and that is an integer. If there are two such numbers, then the one that is closest to positive infinity is returned. If the argument is NaN, then NaN is returned. If the argument is positive infinity, then positive infinity is returned. If the argument is negative infinity, then negative infinity is returned. 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, but greater than or equal to -0.5, then negative zero is returned.
<h4>NOTE</h4>
For these last two cases, the result of calling the round function is not the same as the result of adding 0.5 and then calling the floor function.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node-set</td>
<td>Node set to sum</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>floor(3.1)</td>
<td>3</td>
</tr>
<tr>
<td>floor(3.9)</td>
<td>4</td>
</tr>
<tr>
<td>floor(3.5)</td>
<td>3</td>
</tr>
</table><br>
<code><a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Number-Functions" class="hyperlink" target="_blank">W3C Documentation reference</code></a>
</div>
</div>
</div>
</span>
<span name="collapse20">
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Node-Set</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:name()</code></a>
<div class="content">
Returns the name of a node, as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName.<br>
If the argument is omitted, it defaults to the context item (.). 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.<br>
The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.<br>
If the argument is supplied and is the empty sequence, the function returns the zero-length string.<br>
If the target node has no name (that is, if it is a document node, a comment, a text node, or a namespace binding having no name), the function returns the zero-length string.<br>
Otherwise, the value returned is fn:string(fn:node-name($arg)).<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node?</td>
<td>Node to display name.</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>name(/l:library)</td>
<td>l:library</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-name" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:local-name()</code></a>
<div class="content">
Returns the local part of the name of $arg as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName.<br>
If the argument is omitted, it defaults to the context item (.). 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.<br>
The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.<br>
If the argument is supplied and is the empty sequence, the function returns the zero-length string.<br>
If the target node has no name (that is, if it is a document node, a comment, or a text node), the function returns the zero-length string.<br>
Otherwise, the value returned will be the local part of the expanded-QName of the target node (as determined by the dm:node-name accessor in Section 5.11 node-name Accessor). This will be an xs:string whose lexical form is an xs:NCName.<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node?</td>
<td>Node to display local-name.</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>name(/l:library)</td>
<td>library</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-local-name" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:nilled()</code></a>
<div class="content">
Returns an xs:boolean indicating whether the argument node is "nilled". If the argument is not an element node, returns the empty sequence. If the argument is the empty sequence, returns the empty sequence.<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node?</td>
<td>Node to test.</td>
</tr>
</table>
<b>Return type:</b> xs:boolean?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>nilled(/l:library)</td>
<td>false</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-nilled" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:base-uri()</code></a>
<div class="content">
Returns the value of the base-uri URI property for $arg as defined by the accessor function dm:base-uri() for that kind of node in Section 5.2 base-uri AccessorDM. If $arg is not specified, the behavior is identical to calling the function with the context item (.) as argument. The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.<br>
If $arg is the empty sequence, the empty sequence is returned.<br>
Document, element and processing-instruction nodes have a base-uri property which may be empty. The base-uri property of all other node types is the empty sequence. The value of the base-uri property is returned if it exists and is not empty. Otherwise, if the node has a parent, the value of dm:base-uri() applied to its parent is returned, recursively. If the node does not have a parent, or if the recursive ascent up the ancestor chain encounters a node whose base-uri property is empty and it does not have a parent, the empty sequence is returned.<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node?</td>
<td>Node to find base URI of.</td>
</tr>
</table>
<b>Return type:</b> xs:anyURI?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>base-uri(/l:library/l:libraryName)</td>
<td>&lt;empty sequence&gt;</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-base-uri" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:document-uri()</code></a>
<div class="content">
Returns the value of the document-uri property for $arg as defined by the dm:document-uri accessor function defined in Section 6.1.2 AccessorsDM.<br>
If $arg is the empty sequence, the empty sequence is returned.<br>
Returns the empty sequence if the node is not a document node. Otherwise, returns the value of the dm:document-uri accessor of the document node.<br>
In the case of a document node $D returned by the fn:doc function, or a document node at the root of a tree containing a node returned by the fn:collection function, it will always be true that either fn:document-uri($D) returns the empty sequence, or that the following expression is true: fn:doc(fn:document-uri($D)) is $D. It is implementation-defined whether this guarantee also holds for document nodes obtained by other means, for example a document node passed as the initial context node of a query or transformation.<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node?</td>
<td>Node which document-uri value needs to be returned.</td>
</tr>
</table>
<b>Return type:</b> xs:anyURI?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>document-uri(/l:library/l:libraryName)</td>
<td>&lt;empty sequence&gt;</td>
</tr>
<tr>
<td>document-uri(/library/fiction:book[1])</td>
<td>http://example.com/library.xml (assuming the document URI of the first fiction:book element is "http://example.com/library.xml")</td>
</tr>
<tr>
<td>document-uri(/library)</td>
<td>http://example.com/library.xml (assuming the document URI of the library element is "http://example.com/library.xml")</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-document-uri" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:lang()</code></a>
<div class="content">
This function tests whether the language of $node, or the context item if the second argument is omitted, as specified by xml:lang attributes is the same as, or is a sublanguage of, the language specified by $testlang. The behavior of the function if the second argument is omitted is exactly the same as if the context item (.) had been passed as the second argument. The language of the argument node, or the context item if the second argument is omitted, is determined by the value of the xml:lang attribute on the node, or, if the node has no such attribute, by the value of the xml:lang attribute on the nearest ancestor of the node that has an xml:lang attribute. If there is no such ancestor, then the function returns false<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$testlang</td>
</tr>
<tr>
<td>node()</td>
<td>$node (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:boolean?<br><br>
<b>Examples:</b> Look W3C documentation below.
<br>
<a href="https://www.w3.org/TR/xquery-operators/#func-lang" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:root()</code></a>
<div class="content">
Returns the root of the tree to which $arg belongs. This will usually, but not necessarily, be a document node.<br>
If $arg is the empty sequence, the empty sequence is returned.<br>
If $arg is a document node, $arg is returned.<br>
If the function is called without an argument, the context item (.) 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.<br>
The following errors may be raised: if the context item is undefined [err:XPDY0002]; if the context item is not a node [err:XPTY0004].<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>node()</td>
<td>$arg (Optional)</td>
</tr>
</table>
<b>Return type:</b> node()?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>root()</td>
<td>&lt;l:library&gt;[...]&lt;/l:library&gt;</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-root" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:count()</code></a>
<div class="content">
Returns the number of items in the value of $arg. Returns 0 if $arg is the empty sequence.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>count(/l:library/l:readerList/p:person)</td>
<td>2</td>
</tr>
<tr>
<td>count(/l:library/l:writers)</td>
<td>0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-count" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:avg()</code></a>
<div class="content">
Returns the number of items in the value of $arg. Returns 0 if $arg is the empty sequence.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:anyAtomicType*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:anyAtomicType<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>avg(/l:library/l:readerList/p:person/p:readerID)</td>
<td>6222</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-avg" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:max()</code></a>
<div class="content">
Selects an item from the input sequence $arg whose value is greater than or equal to the value of every other item in the input sequence. If there are two or more such items, then the specific item whose value is returned is ·implementation dependent·.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:anyAtomicType*</td>
<td>$arg</td>
</tr>
<tr>
<td>xs:string</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:anyAtomicType?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>max((3,4,5))</td>
<td>5</td>
</tr>
<tr>
<td>max((5, 5.0e0))</td>
<td>5.0e0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-max" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:min()</code></a>
<div class="content">
Selects an item from the input sequence $arg whose value is less than or equal to the value of every other item in the input sequence. If there are two or more such items, then the specific item whose value is returned is ·implementation dependent·.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:anyAtomicType*</td>
<td>$arg</td>
</tr>
<tr>
<td>xs:string</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:anyAtomicType?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>min((3,4,5))</td>
<td>3</td>
</tr>
<tr>
<td>min((5, 5.0e0))</td>
<td>5.0e0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-min" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:sum()</code></a>
<div class="content">
Returns a value obtained by adding together the values in $arg. If $zero is not specified, then the value returned for an empty sequence is the xs:integer value 0. If $zero is specified, then the value returned for an empty sequence is $zero.<br>
Any values of type xs:untypedAtomic in $arg are cast to xs:double. The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:anyAtomicType*</td>
<td>$arg</td>
</tr>
<tr>
<td>xs:anyAtomicType?</td>
<td>$zero (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:anyAtomicType?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>sum(/l:library/l:readerList/p:person/p:readerID)</td>
<td>12444</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-sum" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Boolean</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:boolean()</code></a>
<div class="content">
Computes the effective boolean value of the sequence $arg. See Section 2.4.3 Effective Boolean ValueXP<br>
If $arg is the empty sequence, fn:boolean returns false.<br>
If $arg is a sequence whose first item is a node, fn:boolean returns true.<br>
If $arg is a singleton value of type xs:boolean or a derived from xs:boolean, fn:boolean returns $arg.<br>
If $arg is a singleton value of type xs:string or a type derived from xs:string, xs:anyURI or a type derived from xs:anyURI or xs:untypedAtomic, fn:boolean returns false if the operand value has zero length; otherwise it returns true.<br>
If $arg is a singleton value of any numeric type or a type derived from a numeric type, fn:boolean returns false if the operand value is NaN or is numerically equal to zero; otherwise it returns true.
In all other cases, fn:boolean raises a type error [err:FORG0006].<br>
The static semantics of this function are described in Section 7.2.4 The fn:boolean and fn:not functionsFS.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:boolean?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>boolean("/l:library")</td>
<td>true</td>
</tr>
<tr>
<td>boolean(0)</td>
<td>false</td>
</tr>
<tr>
<td>boolean(())</td>
<td>false</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-boolean" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:true()</code></a>
<div class="content">
Returns the xs:boolean value true. Equivalent to xs:boolean("1").<br><br>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>true()</td>
<td>true</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-true" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:false()</code></a>
<div class="content">
Returns the xs:boolean value false. Equivalent to xs:boolean("0").<br><br>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>false()</td>
<td>false</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-false" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:not()</code></a>
<div class="content">
$arg is first reduced to an effective boolean value by applying the fn:boolean() function. Returns true if the effective boolean value is false, and false if the effective boolean value is true.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>not(false())</td>
<td>true</td>
</tr>
<tr>
<td>not(true())</td>
<td>false</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-not" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">String</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:string(object)</code></a>
<div class="content">
Returns the value of $arg represented as a xs:string. If no argument is supplied, the context item (.) 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.<br>
If the context item is undefined, error [err:XPDY0002]XP is raised.<br>
If $arg is the empty sequence, the zero-length string is returned.<br>
If $arg is a node, the function returns the string-value of the node, as obtained using the dm:string-value accessor defined in the Section 5.13 string-value AccessorDM.<br>
If $arg is an atomic value, then the function returns the same string as is returned by the expression " $arg cast as xs:string " (see 17 Casting).<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string</td>
<td>The object to convert to a string</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>string((1&lt;0))</td>
<td>false</td>
</tr>
<tr>
<td>string(.11)</td>
<td>0.11</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-string" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:codepoints-to-string()</code></a>
<div class="content">
Creates an xs:string from a sequence of The Unicode Standard code points. Returns the zero-length string if $arg is the empty sequence. If any of the code points in $arg is not a legal XML character, an error is raised [err:FOCH0001].<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:integer*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>codepoints-to-string((2309, 2358, 2378, 2325))</td>
<td>अशॊक</td>
</tr>
<tr>
<td>codepoints-to-string((40, 32, 865, 176, 32, 860, 662, 32, 865, 176, 41))</td>
<td>( ͡° ͜ʖ ͡°)</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-codepoints-to-string" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:string-to-codepoints()</code></a>
<div class="content">
Returns the sequence of The Unicode Standard code points that constitute an xs:string. If $arg is a zero-length string or the empty sequence, the empty sequence is returned.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer*<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>string-to-codepoints("Thérèse")</td>
<td>(84, 104, 233, 114, 232, 115, 101)</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-string-to-codepoints" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:compare()</code></a>
<div class="content">
Returns -1, 0, or 1, depending on whether the value of the $comparand1 is respectively less than, equal to, or greater than the value of $comparand2, according to the rules of the collation that is used.<br>
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations.<br>
If either argument is the empty sequence, the result is the empty sequence.<br>
This function, invoked with the first signature, backs up the "eq", "ne", "gt", "lt", "le" and "ge" operators on string values.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$comparand1</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$comparand2</td>
</tr>
<tr>
<td>xs:string</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:integer*<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>compare('abc', 'abc')</td>
<td>0</td>
</tr>
<tr>
<td>compare('abc', 'acc')</td>
<td>-1</td>
</tr>
<tr>
<td>compare('abc', 'acc')</td>
<td>1</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-compare" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:codepoint-equal()</code></a>
<div class="content">
Returns true or false depending on whether the value of $comparand1 is equal to the value of $comparand2, according to the <a href="http://www.w3.org/2005/xpath-functions/collation/codepoint)">Unicode code point collation</a>.<br>
If either argument is the empty sequence, the result is the empty sequence.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$comparand1</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$comparand2</td>
</tr>
</table>
<b>Return type:</b> xs:boolean?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>codepoint-equal("asdf", "asdf")</td>
<td>true</td>
</tr>
<tr>
<td>codepoint-equal("asdf", "asdf ")</td>
<td>false</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-codepoint-equal" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:concat()</code></a>
<div class="content">
Accepts two or more xs:anyAtomicType arguments and casts them to xs:string. Returns the xs:string that is the concatenation of the values of its arguments after conversion. If any of the arguments is the empty sequence, the argument is treated as the zero-length string.<br>
The fn:concat 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 [XML Path Language (XPath) Version 1.0].<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:anyAtomicType?</td>
<td>$arg1</td>
</tr>
<tr>
<td>xs:anyAtomicType?</td>
<td>$arg2</td>
</tr>
<tr>
<td>xs:anyAtomicType?</td>
<td>$arg... (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>concat('un', 'grateful')</td>
<td>ungrateful</td>
</tr>
<tr>
<td>concat('Thy ', (), 'old ', "groans", "", ' ring', ' yet', ' in', ' my', ' ancient',' ears.')</td>
<td>Thy old groans ring yet in my ancient ears.</td>
</tr>
<tr>
<td>fn:concat('Ciao!',())</td>
<td>Ciao!</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-concat" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:string-join()</code></a>
<div class="content">
Returns a xs:string created by concatenating the members of the $arg1 sequence using $arg2 as a separator. If the value of $arg2 is the zero-length string, then the members of $arg1 are concatenated without a separator.<br>
If the value of $arg1 is the empty sequence, the zero-length string is returned.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string*</td>
<td>$arg1</td>
</tr>
<tr>
<td>xs:string</td>
<td>$arg2</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>string-join(('Now', 'is', 'the', 'time', '...'), ' ')</td>
<td>Now is the time ...</td>
</tr>
<tr>
<td>string-join(('Blow, ', 'blow, ', 'thou ', 'winter ', 'wind!'), '')</td>
<td>Blow, blow, thou winter wind!</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-string-join" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:substring()</code></a>
<div class="content">
Returns the portion of the value of $sourceString beginning at the position indicated by the value of $startingLoc and continuing for the number of characters indicated by the value of $length. The characters returned do not extend beyond $sourceString. If $startingLoc is zero or negative, only those characters in positions greater than zero are returned.<br>
More specifically, the three argument version of the function returns the characters in $sourceString whose position $p obeys:<br>
<code>fn:round($startingLoc) &lt;= $p &lt; fn:round($startingLoc) + fn:round($length)</code><br>
The two argument version of the function assumes that $length is infinite and returns the characters in $sourceString whose position $p obeys:<br>
<code>fn:round($startingLoc) &lt;= $p &lt; fn:round(INF)</code><br>
In the above computations, the rules for op:numeric-less-than() and op:numeric-greater-than() apply.<br>
If the value of $sourceString is the empty sequence, the zero-length string is returned.<br>
<strong>Note:</strong><br>
The first character of a string is located at position 1, not position 0.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$sourceString</td>
</tr>
<tr>
<td>xs:double</td>
<td>$startingLoc</td>
</tr>
<tr>
<td>xs:double</td>
<td>$length (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>substring("motor car", 6)</td>
<td>" car"</td>
</tr>
<tr>
<td>substring("metadata", 4, 3)</td>
<td>ada</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-substring" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:string-length()</code></a>
<div class="content">
Returns an xs:integer equal to the length in characters of the value of $arg.<br>
If the value of $arg is the empty sequence, the xs:integer 0 is returned.<br>
If no argument is supplied, $arg defaults to the string value (calculated using fn:string()) of the context item (.). If no argument is supplied and the context item is undefined an error is raised: [err:XPDY0002].<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:integer<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>string-length("Harp not on that string, madam; that is past.")</td>
<td>45</td>
</tr>
<tr>
<td>string-length(())</td>
<td>0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-string-length" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:normalize-space()</code></a>
<div class="content">
Returns the value of $arg with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of one or more than one whitespace character with a single space, #x20.<br>
If the value of $arg is the empty sequence, returns the zero-length string.<br>
If no argument is supplied, then $arg defaults to the string value (calculated using fn:string()) of the context item (.). If no argument is supplied and the context item is undefined an error is raised: [err:XPDY0002].<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>normalize-space(" The wealthy curled darlings of our nation. ")</td>
<td>The wealthy curled darlings of our nation.</td>
</tr>
<tr>
<td>normalize-space(())</td>
<td>""</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-normalize-space" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:normalize-unicode()</code></a>
<div class="content">
Returns the value of $arg normalized according to the normalization criteria for a normalization form identified by the value of $normalizationForm. The effective value of the $normalizationForm is computed by removing leading and trailing blanks, if present, and converting to upper case.<br>
If the value of $arg is the empty sequence, returns the zero-length string.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg</td>
</tr>
<tr>
<td>xs:string</td>
<td>$normalizationForm (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>normalize-unicode("test ")</td>
<td>test</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-normalize-unicode" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:upper-case()</code></a>
<div class="content">
Returns the value of $arg after translating every character to its upper-case correspondent as defined in the appropriate case mappings section in the Unicode standard [The Unicode Standard]. 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.<br>
If the value of $arg is the empty sequence, the zero-length string is returned.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>upper-case("abCd0")</td>
<td>ABCD0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-upper-case" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:lower-case()</code></a>
<div class="content">
Returns the value of $arg after translating every character to its lower-case correspondent as defined in the appropriate case mappings section in the Unicode standard [The Unicode Standard]. 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.<br>
If the value of $arg is the empty sequence, the zero-length string is returned.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>lower-case("abCd0")</td>
<td>abcd0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-lower-case" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:translate()</code></a>
<div class="content">
Returns the value of $arg modified so that every character in the value of $arg that occurs at some position N in the value of $mapString has been replaced by the character that occurs at position N in the value of $transString.<br>
If the value of $arg is the empty sequence, the zero-length string is returned.<br>
Every character in the value of $arg that does not appear in the value of $mapString is unchanged.<br>
Every character in the value of $arg that appears at some position M in the value of $mapString, where the value of $transString is less than M characters in length, is omitted from the returned value. If $mapString is the zero-length string $arg is returned.<br>
If a character occurs more than once in $mapString, then the first occurrence determines the replacement character. If $transString is longer than $mapString, the excess characters are ignored.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg</td>
</tr>
<tr>
<td>xs:string</td>
<td>$mapString</td>
</tr>
<tr>
<td>xs:string</td>
<td>$mapString</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>translate("bar","abc","ABC")</td>
<td>BAr</td>
</tr>
<tr>
<td>translate("--aaa--","abc-","ABC")</td>
<td>AAA</td>
</tr>
<tr>
<td>translate("abcdabc", "abc", "AB")</td>
<td>ABdAB</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-translate" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:encode-for-uri()</code></a>
<div class="content">
This function encodes reserved characters in an xs:string that is intended to be used in the path segment of a URI. It is invertible but not idempotent. This function applies the URI escaping rules defined in section 2 of [RFC 3986] to the xs:string supplied as $uri-part. 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 [RFC 3986].<br>
If $uri-part is the empty sequence, returns the zero-length string.<br>
All characters are escaped except those identified as "unreserved" by [RFC 3986], that is the upper- and lower-case letters A-Z, the digits 0-9, HYPHEN-MINUS ("-"), LOW LINE ("_"), FULL STOP ".", and TILDE "~".<br>
Note that this function escapes URI delimiters and therefore cannot be used indiscriminately to encode "invalid" characters in a path segment.<br>
Since [RFC 3986] 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.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$uri-part</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>encode-for-uri("https://www.google.com")</td>
<td>"https%3A%2F%2Fwww.<br>google.com"</td>
</tr>
<tr>
<td>concat("http://www.example.com/", encode-for-uri("~bébé"))</td>
<td>http://www.example.com/<br>~b%C3%A9b%C3%A9</td>
</tr>
<tr>
<td>concat("http://www.example.com/", encode-for-uri("100% organic"))</td>
<td>http://www.example.com/<br>100%25%20organic</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-encode-for-uri" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:iri-to-uri()</code></a>
<div class="content">
This function converts an xs:string containing an IRI into a URI according to the rules spelled out in Section 3.1 of [RFC 3987]. It is idempotent but not invertible.<br>
If $iri 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 [RFC 3986] before the conversion is performed.<br>
If $iri is the empty sequence, returns the zero-length string.<br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$iri</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>iri-to-uri ("http://www.example.com/00/Weather/CA/Los%20Angeles#ocean")</td>
<td>"http://www.example.com/00/<br>Weather/CA/Los%20Angeles#ocean"</td>
</tr>
<tr>
<td>iri-to-uri ("http://www.example.com/~bébé")</td>
<td>http://www.example.com/<br>~b%C3%A9b%C3%A9</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-iri-to-uri" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:escape-html-uri()</code></a>
<div class="content">
This function escapes all characters except printable characters of the US-ASCII coded character set, specifically the octets ranging from 32 to 126 (decimal). The effect of the function is to escape a URI in the manner html user agents handle attribute values that expect URIs. Each character in $uri 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.<br>
If $uri is the empty sequence, returns the zero-length string.
<h4>Note:</h4>
The behavior of this function corresponds to the recommended handling of non-ASCII characters in URI attribute values as described in [HTML 4.0] Appendix B.2.1.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$uri</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>escape-html-uri("http://www.example.com/00/Weather/CA/Los Angeles#ocean")</td>
<td>http://www.example.com/00/Weather/CA/Los Angeles#ocean</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-escape-html-uri" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:contains()</code></a>
<div class="content">
Returns an xs:boolean indicating whether or not the value of $arg1 contains (at the beginning, at the end, or anywhere within) at least one sequence of collation units that provides a minimal match to the collation units in the value of $arg2, according to the collation that is used.
If the value of $arg1 or $arg2 is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string.<br>
If the value of $arg2 is the zero-length string, then the function returns true.<br>
If the value of $arg1 is the zero-length string, the function returns false.<br>
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. If the specified collation does not support collation units an error ·may· be raised [err:FOCH0004].<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg1</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg2</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>contains( "tattoo", "tat")</td>
<td>true</td>
</tr>
<tr>
<td>contains( "tattoo", "ttt")</td>
<td>false</td>
</tr>
<tr>
<td>contains ( "", ())</td>
<td>true</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-contains" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:starts-with()</code></a>
<div class="content">
Returns an xs:boolean indicating whether or not the value of $arg1 starts with a sequence of collation units that provides a match to the collation units of $arg2 according to the collation that is used.
If the value of $arg1 or $arg2 is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string.<br>
If the value of $arg2 is the zero-length string, then the function returns true. If the value of $arg1 is the zero-length string and the value of $arg2 is not the zero-length string, then the function returns false.<br>
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. If the specified collation does not support collation units an error ·may· be raised [err:FOCH0004].<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg1</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg2</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>starts-with( "tattoo", "tat")</td>
<td>true</td>
</tr>
<tr>
<td>starts-with( "tattoo", "ttt")</td>
<td>false</td>
</tr>
<tr>
<td>starts-with ( "", ())</td>
<td>true</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-starts-with" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:ends-with()</code></a>
<div class="content">
Returns an xs:boolean indicating whether or not the value of $arg1 starts with a sequence of collation units that provides a match to the collation units of $arg2 according to the collation that is used.<br>
If the value of $arg1 or $arg2 is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string.<br>
If the value of $arg2 is the zero-length string, then the function returns true. If the value of $arg1 is the zero-length string and the value of $arg2 is not the zero-length string, then the function returns false.<br>
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. If the specified collation does not support collation units an error ·may· be raised [err:FOCH0004].<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg1</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg2</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>ends-with( "tattoo", "too")</td>
<td>true</td>
</tr>
<tr>
<td>ends-with( "tattoo", "tatoo")</td>
<td>false</td>
</tr>
<tr>
<td>ends-with ((), ())</td>
<td>true</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-ends-with" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:substring-before()</code></a>
<div class="content">
Returns the substring of the value of $arg1 that precedes in the value of $arg1 the first occurrence of a sequence of collation units that provides a minimal match to the collation units of $arg2 according to the collation that is used.<br>
If the value of $arg1 or $arg2 is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string.<br>
If the value of $arg2 is the zero-length string, then the function returns the zero-length string.<br>
If the value of $arg1 does not contain a string that is equal to the value of $arg2, then the function returns the zero-length string.<br>
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations If the specified collation does not support collation units an error ·may· be raised [err:FOCH0004].<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg1</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg2</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>substring-before( "tattoo", "too")</td>
<td>tat</td>
</tr>
<tr>
<td>substring-before( "tattoo", "tat")</td>
<td>&lt;empty string&gt;</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-substring-before" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:substring-after()</code></a>
<div class="content">
Returns the substring of the value of $arg1 that follows in the value of $arg1 the first occurrence of a sequence of collation units that provides a minimal match to the collation units of $arg2 according to the collation that is used.<br>
If the value of $arg1 or $arg2 is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string.<br>
If the value of $arg2 is the zero-length string, then the function returns the value of $arg1.<br>
If the value of $arg1 does not contain a string that is equal to the value of $arg2, then the function returns the zero-length string.<br>
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations If the specified collation does not support collation units an error ·may· be raised [err:FOCH0004].<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg1</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg2</td>
</tr>
<tr>
<td>xs:string?</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>substring-after( "tattoo", "too")</td>
<td>&lt;empty string&gt;</td>
</tr>
<tr>
<td>substring-after( "tattoo", "tat")</td>
<td>too</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-substring-after" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:matches()</code></a>
<div class="content">
The function returns true if $input matches the regular expression supplied as $pattern as influenced by the value of $flags, if present; otherwise, it returns false.<br>
The effect of calling the first version of this function (omitting the argument $flags) is the same as the effect of calling the second version with the $flags argument set to a zero-length string. Flags are defined in 7.6.1.1 Flags.<br>
If $input is the empty sequence, it is interpreted as the zero-length string.<br>
Unless the metacharacters ^ and $ 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).<br>
An error is raised [err:FORX0002] if the value of $pattern is invalid according to the rules described in section 7.6.1 Regular Expression Syntax.<br>
An error is raised [err:FORX0001] if the value of $flags is invalid according to the rules described in section 7.6.1 Regular Expression Syntax.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$input</td>
</tr>
<tr>
<td>xs:string</td>
<td>$pattern</td>
</tr>
<tr>
<td>xs:string</td>
<td>$flags (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>matches("abracadabra", "bra")</td>
<td>true</td>
</tr>
<tr>
<td>matches("abracadabra", "^a.*a$")</td>
<td>false</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-matches" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:replace()</code></a>
<div class="content">
The function returns the xs:string that is obtained by replacing each non-overlapping substring of $input that matches the given $pattern with an occurrence of the $replacement string.<br>
The effect of calling the first version of this function (omitting the argument $flags) is the same as the effect of calling the second version with the $flags argument set to a zero-length string. Flags are defined in 7.6.1.1 Flags.<br>
The $flags argument is interpreted in the same manner as for the fn:matches() function.<br>
If $input is the empty sequence, it is interpreted as the zero-length string.<br>
If two overlapping substrings of $input both match the $pattern, then only the<br> first one (that is, the one whose first character comes first in the $input string) is replaced.
Within the $replacement string, a variable $N 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 characters in $input that matched the pattern. $0 refers to the substring captured by the regular expression as a whole.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$input</td>
</tr>
<tr>
<td>xs:string</td>
<td>$pattern</td>
</tr>
<tr>
<td>xs:string</td>
<td>$replacement</td>
</tr>
<tr>
<td>xs:string</td>
<td>$flags (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>replace("abracadabra", "bra", "*")</td>
<td>a*cada*</td>
</tr>
<tr>
<td>replace("abracadabra", "a.*a", "*")</td>
<td>*</td>
</tr>
<tr>
<td>replace("AAAA", "A+", "b")</td>
<td>b</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-replace" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:tokenize()</code></a>
<div class="content">
This function breaks the $input string into a sequence of strings, treating any substring that matches $pattern as a separator. The separators themselves are not returned.<br>
The effect of calling the first version of this function (omitting the argument $flags) is the same as the effect of calling the second version with the $flags argument set to a zero-length string. Flags are defined in 7.6.1.1 Flags.<br>
The $flags argument is interpreted in the same way as for the fn:matches() function.<br>
If $input is the empty sequence, or if $input is the zero-length string, the result is the empty sequence.<br>
If the supplied $pattern matches a zero-length string, that is, if fn:matches("", $pattern, $flags) returns true, then an error is raised: [err:FORX0003].<br>
If a separator occurs at the start of the $input 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 $input string, or if two adjacent substrings match the supplied $pattern.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$input</td>
</tr>
<tr>
<td>xs:string</td>
<td>$pattern</td>
</tr>
<tr>
<td>xs:string</td>
<td>$flags (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:string*<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>tokenize("The cat sat on the mat", "\s+")</td>
<td>("The", "cat", "sat", "on", "the", "mat")</td>
</tr>
<tr>
<td>tokenize("1, 15, 24, 50", ",\s*")</td>
<td>("1", "15", "24", "50")</td>
</tr>
<tr>
<td>tokenize("1,15,,24,50,", ",")</td>
<td>("1", "15", "", "24", "50", "")</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-tokenize" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Numeric</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:number()</code></a>
<div class="content">
Returns the value indicated by $arg or, if $arg is not specified, the context item after atomization, converted to an xs:double<br>
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 (.). That is, fn:number() is equivalent to fn:number(.).<br>
If $arg is the empty sequence or if $arg or the context item cannot be converted to an xs:double, the xs:double value NaN is returned. If the context item is undefined an error is raised: [err:XPDY0002]XP.<br>
If $arg is the empty sequence, NaN is returned. Otherwise, $arg, or the context item after atomization, is converted to an xs:double following the rules of 17.1.3.2 Casting to xs:double. If the conversion to xs:double fails, the xs:double value NaN is returned.<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:anyAtomicType?</td>
<td>Value to convert to number</td>
</tr>
</table>
<b>Return type:</b> xs:double<br><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-number" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:abs()</code></a>
<div class="content">
Returns the absolute value of $arg. If $arg is negative returns -$arg otherwise returns $arg. If type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the type of $arg. If the type of $arg is a type derived from one of the numeric types, the result is an instance of the base numeric type.<br>
For xs:float and xs:double 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.<br>
For detailed type semantics, see Section 7.2.3 The fn:abs, fn:ceiling, fn:floor, fn:round, and fn:round-half-to-even functions.<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>numeric?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> numeric?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>abs(-2)</td>
<td>2</td>
</tr>
<tr>
<td>abs(2137)</td>
<td>2137</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-abs" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:ceiling()</code></a>
<div class="content">
Returns the smallest (closest to negative infinity) number with no fractional part that is not less than the value of $arg. If type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the type of $arg. If the type of $arg is a type derived from one of the numeric types, the result is an instance of the base numeric type.<br>
For xs:float and xs:double 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.<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>numeric?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> numeric?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>ceiling(10.5)</td>
<td>11</td>
</tr>
<tr>
<td>ceiling(-10.5)</td>
<td>-10</td>
</tr>
<tr>
<td>ceiling(10.1)</td>
<td>11</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-ceiling" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:floor()</code></a>
<div class="content">
Returns the largest (closest to positive infinity) number with no fractional part that is not greater than the value of $arg. If type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the type of $arg. If the type of $arg is a type derived from one of the numeric types, the result is an instance of the base numeric type.<br>
For float and double arguments, if the argument is positive zero, then positive zero is returned. If the argument is negative zero, then negative zero is returned.<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>numeric?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> numeric?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>floor(10.5)</td>
<td>10</td>
</tr>
<tr>
<td>floor(-10.5)</td>
<td>-11</td>
</tr>
<tr>
<td>floor(10.8)</td>
<td>10</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-floor" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:round()</code></a>
<div class="content">
Returns the number with no fractional part that is closest to the argument. If there are two such numbers, then the one that is closest to positive infinity is returned. If type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the type of $arg. If the type of $arg is a type derived from one of the numeric types, the result is an instance of the base numeric type.<br>
For xs:float and xs:double arguments, if the argument is positive infinity, then positive infinity is returned. If the argument is negative infinity, then negative infinity is returned. 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, but greater than or equal to -0.5, then negative zero is returned. In the cases where positive zero or negative zero is returned, negative zero or positive zero may be returned as [XML Schema Part 2: Datatypes Second Edition] does not distinguish between the values positive zero and negative zero.<br>
For the last two cases, note that the result is not the same as fn:floor(x+0.5).<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>numeric?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> numeric?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>round(10.5)</td>
<td>11</td>
</tr>
<tr>
<td>round(10.4999)</td>
<td>10</td>
</tr>
<tr>
<td>round(-10.5)</td>
<td>-10</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-round" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:round-half-to-even()</code></a>
<div class="content">
The value returned is the nearest (that is, numerically closest) value to $arg that is a multiple of ten to the power of minus $precision. If two such values are equally near (e.g. if the fractional part in $arg is exactly .500...), the function returns the one whose least significant digit is even.<br>
If the type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the type of $arg. If the type of $arg is a type derived from one of the numeric types, the result is an instance of the base numeric type.<br>
The first signature of this function produces the same result as the second signature with $precision=0.<br>
For arguments of type xs:float and xs:double, if the argument is NaN, positive or negative zero, or positive or negative infinity, then the result is the same as the argument. In all other cases, the argument is cast to xs:decimal, the function is applied to this xs:decimal value, and the resulting xs:decimal is cast back to xs:float or xs:double as appropriate to form the function result. If the resulting xs:decimal value is zero, then positive or negative zero is returned according to the sign of the original argument.<br>
Note that the process of casting to xs:decimal may result in an error [err:FOCA0001].<br>
If $arg is of type xs:float or xs:double, rounding occurs on the value of the mantissa computed with exponent = 0.<br>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>numeric?</td>
<td>$arg</td>
</tr>
<tr>
<td>numeric?</td>
<td>$precision (Optional)</td>
</tr>
</table>
<b>Return type:</b> numeric?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>round-half-to-even(0.5)</td>
<td>0</td>
</tr>
<tr>
<td>round-half-to-even(1.5)</td>
<td>2</td>
</tr>
<tr>
<td>round-half-to-even(2.5)</td>
<td>2</td>
</tr>
<tr>
<td>round-half-to-even(2.6)</td>
<td>3</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-round-half-to-even" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span name="collapse20">
<button class="section-button collapseTrigger" style="border: none">Collections</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:data()</code></a>
<div class="content">
fn:data takes a sequence of items and returns a sequence of atomic values.<br>
The result of fn:data is the sequence of atomic values produced by applying the following rules to each item in $arg:<br>
<ul>
<li>If the item is an atomic value, it is returned.</li>
<li>
If the item is a node:
<ul>
<li>If the node does not have a typed value an error is raised [err:FOTY0012].</li>
<li>Otherwise, fn:data() returns the typed value of the node as defined by the accessor function dm:typed-value in Section 5.15 typed-value AccessorDM.</li>
</ul>
</li>
</ul>
<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item*</td>
<td>Items to convert.</td>
</tr>
</table>
<b>Return type:</b> xs:anyAtomicType*<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>data(/l:library/l:readerList/p:person[1])</td>
<td>7321<br>Adam<br>Choke</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-data" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:index-of()</code></a>
<div class="content">
Returns the root of the tree to which $arg belongs. This will usually, but not necessarily, be a document node.<br>
If $arg is the empty sequence, the empty sequence is returned.<br>
If $arg is a document node, $arg is returned.<br>
If the function is called without an argument, the context item (.) 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.<br>
The following errors may be raised: if the context item is undefined [err:XPDY0002]; if the context item is not a node [err:XPTY0004].<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:anyAtomicType</td>
<td>$seqParam</td>
</tr>
<tr>
<td>xs:anyAtomicType</td>
<td>$srchParam</td>
</tr>
<tr>
<td>xs:string</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:integer*<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>index-of((10, 20, 30, 40), 35)</td>
<td>()</td>
</tr>
<tr>
<td>index-of((10, 20, 30, 30, 20, 10), 20)</td>
<td>(2, 5)</td>
</tr>
<tr>
<td>index-of(("a", "sport", "and", "a", "pastime"), "a")</td>
<td>(1, 4)</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-index-of" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:empty()</code></a>
<div class="content">
If the value of $arg is the empty sequence, the function returns true; otherwise, the function returns false.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>empty(fn:remove(("hello", "world"), 1))</td>
<td>false</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-empty" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:exists()</code></a>
<div class="content">
If the value of $arg is not the empty sequence, the function returns true; otherwise, the function returns false.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>exists(fn:remove(("hello"), 1))</td>
<td>true</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-exists" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:distinct-values()</code></a>
<div class="content">
Returns the sequence that results from removing from $arg all but one of a set of values that are eq to one other. Values of type xs:untypedAtomic are compared as if they were of type xs:string. Values that cannot be compared, i.e. the eq operator is not defined for their types, are considered to be distinct. The order in which the sequence of values is returned is ·implementation dependent·.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:anyAtomicType*</td>
<td>$arg</td>
</tr>
<tr>
<td>xs:string</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:anyAtomicType*<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>distinct-values((1, 2.0, 3, 2))</td>
<td>(1, 3, 2.0)</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-distinct-values" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:insert-before()</code></a>
<div class="content">
Returns a new sequence constructed from the value of $target with the value of $inserts inserted at the position specified by the value of $position. (The value of $target is not affected by the sequence construction.)<br>
If $target is the empty sequence, $inserts is returned. If $inserts is the empty sequence, $target is returned.<br>
The value returned by the function consists of all items of $target whose index is less than $position, followed by all items of $inserts, followed by the remaining elements of $target, in that sequence.<br>
If $position is less than one (1), the first position, the effective value of $position is one (1). If $position is greater than the number of items in $target, then the effective value of $position is equal to the number of items in $target plus 1.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$target</td>
</tr>
<tr>
<td>xs:integer</td>
<td>$position</td>
</tr>
<tr>
<td>item()*</td>
<td>$inserts</td>
</tr>
</table>
<b>Return type:</b> item()*<br><br>
<b>Examples:</b><br>
<code>let $x := ("a", "b", "c")</code>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>insert-before($x, 0, "z")</td>
<td>("z", "a", "b", "c")</td>
</tr>
<tr>
<td>insert-before($x, 1, "z")</td>
<td>("z", "a", "b", "c")</td>
</tr>
<tr>
<td>insert-before($x, 2, "z")</td>
<td>("a", "z", "b", "c")</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-insert-before" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:remove()</code></a>
<div class="content">
Returns a new sequence constructed from the value of $target with the item at the position specified by the value of $position removed.<br>
If $position is less than 1 or greater than the number of items in $target, $target is returned. Otherwise, the value returned by the function consists of all items of $target whose index is less than $position, followed by all items of $target whose index is greater than $position. If $target is the empty sequence, the empty sequence is returned.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$target</td>
</tr>
<tr>
<td>xs:integer</td>
<td>$position</td>
</tr>
</table>
<b>Return type:</b> item()*<br><br>
<b>Examples:</b><br>
<code>let $x := ("a", "b", "c")</code>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>remove($x, 0)</td>
<td> ("a", "b", "c")</td>
</tr>
<tr>
<td>remove($x, 1)</td>
<td>("b", "c")</td>
</tr>
<tr>
<td>remove($x, 6)</td>
<td>("a", "b", "c")</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-remove" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:reverse()</code></a>
<div class="content">
Reverses the order of items in a sequence. If $arg is the empty sequence, the empty sequence is returned.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> item()*<br><br>
<b>Examples:</b><br>
<code>let $x := ("a", "b", "c")</code>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>reverse($x)</td>
<td>("c", "b", "a")</td>
</tr>
<tr>
<td>reverse(("hello"))</td>
<td> ("hello")</td>
</tr>
<tr>
<td>reverse(())</td>
<td>()</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-reverse" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:subsequence()</code></a>
<div class="content">
Returns the contiguous sequence of items in the value of $sourceSeq beginning at the position indicated by the value of $startingLoc and continuing for the number of items indicated by the value of $length.
If $sourceSeq is the empty sequence, the empty sequence is returned.<br>
If $startingLoc is zero or negative, the subsequence includes items from the beginning of the $sourceSeq.<br>
If $length is not specified, the subsequence includes items to the end of $sourceSeq.<br>
If $length is greater than the number of items in the value of $sourceSeq following $startingLoc, the subsequence includes items to the end of $sourceSeq.<br>
The first item of a sequence is located at position 1, not position 0.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$sourceSeq</td>
</tr>
<tr>
<td>xs:double</td>
<td>$startingLoc (Optional)</td>
</tr>
<tr>
<td>xs:double</td>
<td>$length (Optional)</td>
</tr>
</table>
<b>Return type:</b> item()*<br><br>
<b>Examples:</b><br>
<code>let $seq = ($item1, $item2, $item3, $item4, ...)</code>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>subsequence($seq, 4)</td>
<td>($item4, ...)</td>
</tr>
<tr>
<td>subsequence($seq, 3, 2)</td>
<td>($item3, $item4)</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-subsequence" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:unordered()</code></a>
<div class="content">
Returns the items of $sourceSeq in an implementation dependent order.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$sourceSeq</td>
</tr>
</table>
<b>Return type:</b> item()*<br><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-unordered" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:zero-or-one()</code></a>
<div class="content">
Returns $arg if it contains zero or one items. Otherwise, raises an error [err:FORG0003].<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> item()?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>zero-or-one(("a"))</td>
<td>a</td>
</tr>
<tr>
<td>zero-or-one(("a", "b"))</td>
<td>A sequence of more than one item is not allowed as the first argument of fn:zero-or-one() ("a", "b") </td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-zero-or-one" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:one-or-more()</code></a>
<div class="content">
Returns $arg if it contains one or more items. Otherwise, raises an error [err:FORG0004].<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> item()?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>one-or-more(("a"))</td>
<td>a</td>
</tr>
<tr>
<td>one-or-more(("a", "b"))</td>
<td>a<br>b</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-one-or-more" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:exactly-one()</code></a>
<div class="content">
Returns $arg if it contains exactly one item. Otherwise, raises an error [err:FORG0005].<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> item()?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>exactly-one(("a"))</td>
<td>a</td>
</tr>
<tr>
<td>exactly-one(("a", "b"))</td>
<td>A sequence of more than one item is not allowed as the first argument of fn:exactly-one() ("a", "b") </td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-exactly-one" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:deep-equal()</code></a>
<div class="content">
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. This is defined in more detail below. The $collation 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 7.3.1 Collations.<br>
If the two sequences are both empty, the function returns true.<br>
If the two sequences are of different lengths, the function returns false.<br>
If the two sequences are of the same length, the function returns true if and only if every item in the sequence $parameter1 is deep-equal to the item at the same position in the sequence $parameter2. The rules for deciding whether two items are deep-equal follow.
For more in-depth description look into W3C Documentation<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item()*</td>
<td>$parameter1</td>
</tr>
<tr>
<td>item()*</td>
<td>$parameter2</td>
</tr>
<tr>
<td>xs:string</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>deep-equal(/l:library/p:person[0], /l:library/p:person[1])</td>
<td>true</td>
</tr>
<tr>
<td>deep-equal(/l:library/p:person[0], /l:library)</td>
<td>false</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-deep-equal" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:id()</code></a>
<div class="content">
Returns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $arg.
<h4>Note:</h4>
This function does not have the desired effect when searching a document in which elements of type xs:ID are used as identifiers. To preserve backwards compatibility, a new function fn:element-with-id is therefore being introduced; it behaves the same way as fn:id in the case of ID-valued attributes.
<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string*</td>
<td>$arg</td>
</tr>
<tr>
<td>node()*</td>
<td>$node</td>
</tr>
<tr>
<td>xs:string</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> element()*<br><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-id" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:idref()</code></a>
<div class="content">
Returns the sequence of element or attribute nodes with an IDREF value matching the value of one or more of the ID values supplied in $arg.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string*</td>
<td>$arg</td>
</tr>
<tr>
<td>node()*</td>
<td>$node</td>
</tr>
<tr>
<td>xs:string</td>
<td>$collation (Optional)</td>
</tr>
</table>
<b>Return type:</b> node()*<br><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-idref" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:doc()</code></a>
<div class="content">
Returns the sequence of element or attribute nodes with an IDREF value matching the value of one or more of the ID values supplied in $arg.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string</td>
<td>$uri</td>
</tr>
</table>
<b>Return type:</b> document-node()?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>doc("test.xml")</td>
<td>Contents of test.xml file returned as node</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-doc" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:doc-available()</code></a>
<div class="content">
Retrieves a document using a URI supplied as an xs:string, and returns the corresponding document node.<br>
If $uri is the empty sequence, the result is an empty sequence.<br>
If $uri is not a valid URI, an error may be raised [err:FODC0005].<br>
If $uri is a relative URI reference, it is resolved relative to the value of the base URI property from the static context. The resulting absolute URI is promoted to an xs:string.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string</td>
<td>$uri</td>
</tr>
</table>
<b>Return type:</b> xs:boolean<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>doc("test.xml")</td>
<td>true (If document is available)</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-doc-available" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:collection()</code></a>
<div class="content">
This function takes an xs:string as argument and returns a sequence of nodes obtained by interpreting $arg as an xs:anyURI and resolving it according to the mapping specified in Available collections described in Section C.2 Dynamic Context ComponentsXP. If Available collections provides a mapping from this string to a sequence of nodes, the function returns that sequence. If Available collections maps the string to an empty sequence, then the function returns an empty sequence. If Available collections provides no mapping for the string, an error is raised [err:FODC0004]. <br>
If $arg is not specified, the function returns the sequence of the nodes in the default collection in the dynamic context. See Section C.2 Dynamic Context ComponentsXP. If the value of the default collection is undefined an error is raised [err:FODC0002].<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg (Optional)</td>
</tr>
</table>
<b>Return type:</b> node()*<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>collection("")</td>
<td>&lt;empty sequence&gt;</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-collection" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:element-with-id()</code></a>
<div class="content">
Returns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $arg.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$arg (Optional)</td>
</tr>
</table>
<b>Return type:</b> node()*<br><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-element-with-id" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:position()</code></a>
<div class="content">
Returns the context position from the dynamic context. (See Section C.2 Dynamic Context ComponentsXP.) If the context item is undefined, an error is raised: [err:XPDY0002]XP.<br><br>
<b>Return type:</b> xs:integer<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>/l:library/l:readerList/position()</td>
<td>1</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-position" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:last()</code></a>
<div class="content">
Returns the context size from the dynamic context. (See Section C.2 Dynamic Context ComponentsXP.) If the context item is undefined, an error is raised: [err:XPDY0002]XP.<br><br>
<b>Return type:</b> xs:integer<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>/l:library/l:readerList/p:person/last()</td>
<td>2<br>2</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-last" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span name="collapse20">
<button class="section-button collapseTrigger" style="border: none">Date / Time</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:years-from-duration()</code></a>
<div class="content">
Returns an xs:integer representing the years component in the value of $arg. The result is obtained by casting $arg to an xs:yearMonthDuration (see 17.1.4 Casting to duration types) and then computing the years component as described in 10.3.1.3 Canonical representation.<br>
The result may be negative.<br>
If $arg is an xs:dayTimeDuration returns 0.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:duration?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>years-from-duration(xs:yearMonthDuration("P20Y15M"))</td>
<td>21</td>
</tr>
<tr>
<td>years-from-duration(xs:yearMonthDuration("-P15M"))</td>
<td>-1</td>
</tr>
<tr>
<td>years-from-duration(xs:dayTimeDuration("-P2DT15H"))</td>
<td>0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-years-from-duration" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:months-from-duration()</code></a>
<div class="content">
Returns an xs:integer representing the months component in the value of $arg. The result is obtained by casting $arg to an xs:yearMonthDuration (see 17.1.4 Casting to duration types) and then computing the months component as described in 10.3.1.3 Canonical representation.<br>
The result may be negative.<br>
If $arg is an xs:dayTimeDuration returns 0.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:duration?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>months-from-duration(xs:yearMonthDuration("P20Y15M"))</td>
<td>3</td>
</tr>
<tr>
<td>months-from-duration(xs:yearMonthDuration("-P20Y18M"))</td>
<td>-6</td>
</tr>
<tr>
<td>months-from-duration(xs:dayTimeDuration("-P2DT15H0M0S"))</td>
<td>0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-months-from-duration" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:days-from-duration()</code></a>
<div class="content">
Returns an xs:integer representing the days component in the value of $arg. The result is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to duration types) and then computing the days component as described in 10.3.2.3 Canonical representation.<br>
The result may be negative.<br>
If $arg is an xs:yearMonthDuration returns 0.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:duration?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>days-from-duration(xs:dayTimeDuration("P3DT10H"))</td>
<td>3</td>
</tr>
<tr>
<td>days-from-duration(xs:dayTimeDuration("P3DT55H"))</td>
<td>5</td>
</tr>
<tr>
<td>days-from-duration(xs:yearMonthDuration("P3Y5M"))</td>
<td>0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-days-from-duration" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:hours-from-duration()</code></a>
<div class="content">
Returns an xs:integer representing the hours component in the value of $arg. The result is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to duration types) and then computing the hours component as described in 10.3.2.3 Canonical representation.<br>
The result may be negative.<br>
If $arg is an xs:yearMonthDuration returns 0.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:duration?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>hours-from-duration(xs:dayTimeDuration("P3DT10H"))</td>
<td>10</td>
</tr>
<tr>
<td>hours-from-duration(xs:dayTimeDuration("P3DT12H32M12S"))</td>
<td>12</td>
</tr>
<tr>
<td>hours-from-duration(xs:dayTimeDuration("PT123H"))</td>
<td>0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-hours-from-duration" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:minutes-from-duration()</code></a>
<div class="content">
Returns an xs:integer representing the minutes component in the value of $arg. The result is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to duration types) and then computing the minutes component as described in 10.3.2.3 Canonical representation.
The result may be negative.
If $arg is an xs:yearMonthDuration returns 0.
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:duration?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>minutes-from-duration(xs:dayTimeDuration("P3DT10H"))</td>
<td>0</td>
</tr>
<tr>
<td>minutes-from-duration(xs:dayTimeDuration("-P5DT12H30M"))</td>
<td>-30</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-minutes-from-duration" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:seconds-from-duration()</code></a>
<div class="content">
Returns an xs:decimal representing the seconds component in the value of $arg. The result is obtained by casting $arg to an xs:dayTimeDuration (see 17.1.4 Casting to duration types) and then computing the seconds component as described in 10.3.2.3 Canonical representation.<br>
The result may be negative.<br>
If $arg is an xs:yearMonthDuration returns 0.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:duration?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:decimal?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>seconds-from-duration(xs:dayTimeDuration("P3DT10H12.5S"))</td>
<td>12.5</td>
</tr>
<tr>
<td>seconds-from-duration(xs:dayTimeDuration("-PT256S"))</td>
<td>-16.0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-seconds-from-duration" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:year-from-dateTime()</code></a>
<div class="content">
Returns an xs:integer representing the year component in the localized value of $arg. The result may be negative.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:dateTime?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>year-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</td>
<td>1999</td>
</tr>
<tr>
<td>year-from-dateTime(xs:dateTime("1999-12-31T19:20:00"))</td>
<td>1999</td>
</tr>
<tr>
<td>year-from-dateTime(xs:dateTime("1999-12-31T24:00:00"))</td>
<td>2000</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-year-from-dateTime" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:month-from-dateTime()</code></a>
<div class="content">
Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:dateTime?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>month-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</td>
<td>5</td>
</tr>
<tr>
<td>month-from-dateTime(xs:dateTime("1999-12-31T19:20:00"))</td>
<td>12</td>
</tr>
<tr>
<td>month-from-dateTime(xs:dateTime("1999-12-31T24:00:00"))</td>
<td>1</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-month-from-dateTime" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:day-from-dateTime()</code></a>
<div class="content">
Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:dateTime?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>day-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</td>
<td>31</td>
</tr>
<tr>
<td>day-from-dateTime(xs:dateTime("1999-12-31T19:20:00"))</td>
<td>31</td>
</tr>
<tr>
<td>day-from-dateTime(xs:dateTime("1999-12-31T24:00:00"))</td>
<td>1</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-day-from-dateTime" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:hours-from-dateTime()</code></a>
<div class="content">
Returns an xs:integer between 0 and 23, both inclusive, representing the hours component in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:dateTime?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>hours-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</td>
<td>13</td>
</tr>
<tr>
<td>hours-from-dateTime(xs:dateTime("1999-12-31T19:20:00"))</td>
<td>19</td>
</tr>
<tr>
<td>hours-from-dateTime(xs:dateTime("1999-12-31T24:00:00"))</td>
<td>0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-hours-from-dateTime" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:minutes-from-dateTime()</code></a>
<div class="content">
Returns an xs:integer value between 0 and 59, both inclusive, representing the minute component in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:dateTime?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>minutes-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</td>
<td>20</td>
</tr>
<tr>
<td>minutes-from-dateTime(xs:dateTime("1999-05-31T13:30:00+05:30"))</td>
<td>30</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-minutes-from-dateTime" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:seconds-from-dateTime()</code></a>
<div class="content">
Returns an xs:decimal value greater than or equal to zero and less than 60, representing the seconds and fractional seconds in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:dateTime?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:decimal?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>seconds-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</td>
<td>0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-seconds-from-dateTime" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:timezone-from-dateTime()</code></a>
<div class="content">
Returns an xs:decimal value greater than or equal to zero and less than 60, representing the seconds and fractional seconds in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:dateTime?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:dayTimeDuration?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>timezone-from-dateTime(xs:dateTime("1999-05-31T13:20:00-05:00"))</td>
<td>-PT5H</td>
</tr>
<tr>
<td>timezone-from-dateTime(xs:dateTime("2000-06-12T13:20:00Z")) </td>
<td>PT0S</td>
</tr>
<tr>
<td>timezone-from-dateTime(xs:dateTime("2004-08-27T00:00:00"))</td>
<td>()</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-timezone-from-dateTime" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:year-from-date()</code></a>
<div class="content">
Returns an xs:integer representing the year in the localized value of $arg. The value may be negative.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:date?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>year-from-date(xs:date("1999-05-31"))</td>
<td>1999</td>
</tr>
<tr>
<td>year-from-date(xs:date("2000-01-01+05:00"))</td>
<td>2000</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-year-from-date" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:month-from-date()</code></a>
<div class="content">
Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:date?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>month-from-date(xs:date("1999-05-31-05:00"))</td>
<td>5</td>
</tr>
<tr>
<td>month-from-date(xs:date("2000-01-01+05:00"))</td>
<td>1</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-month-from-date" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:day-from-date()</code></a>
<div class="content">
Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:date?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>day-from-date(xs:date("1999-05-31-05:00"))</td>
<td>31</td>
</tr>
<tr>
<td>day-from-date(xs:date("2000-01-01+05:00"))</td>
<td>1</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-day-from-date" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:timezone-from-date()</code></a>
<div class="content">
Returns the timezone component of $arg if any. If $arg has a timezone component, then the result is an xs:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. Otherwise, the result is the empty sequence.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:date?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:dayTimeDuration?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>timezone-from-date(xs:date("1999-05-31-05:00"))</td>
<td>-PT5H</td>
</tr>
<tr>
<td>timezone-from-date(xs:date("2000-06-12Z"))</td>
<td>PT0S</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-timezone-from-date" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:hours-from-time()</code></a>
<div class="content">
Returns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:time?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>hours-from-time(xs:time("11:23:00"))</td>
<td>11</td>
</tr>
<tr>
<td>hours-from-time(xs:time("24:00:00"))</td>
<td>0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-hours-from-time" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:minutes-from-time()</code></a>
<div class="content">
Returns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:time?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:integer?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>hours-from-time(xs:time("11:23:00"))</td>
<td>11</td>
</tr>
<tr>
<td>hours-from-time(xs:time("24:00:00"))</td>
<td>0</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-minutes-from-time" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:seconds-from-time()</code></a>
<div class="content">
Returns an xs:decimal value greater than or equal to zero and less than 60, representing the seconds and fractional seconds in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:time?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:decimal?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>seconds-from-time(xs:time("13:20:10.5"))</td>
<td>10.5</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-seconds-from-time" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:timezone-from-time()</code></a>
<div class="content">
Returns an xs:decimal value greater than or equal to zero and less than 60, representing the seconds and fractional seconds in the localized value of $arg.<br>
If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:time?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:dayTimeDuration?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>timezone-from-time(xs:time("13:20:00-05:00"))</td>
<td>-PT5H</td>
</tr>
<tr>
<td>timezone-from-time(xs:time("13:20:00"))</td>
<td>()</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-timezone-from-time" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:adjust-date-to-timezone()</code></a>
<div class="content">
Adjusts an xs:date value to a specific timezone, or to no timezone at all. If $timezone is the empty sequence, returns an xs:date without a timezone. Otherwise, returns an xs:date with a timezone. For purposes of timezone adjustment, an xs:date is treated as an xs:dateTime with time 00:00:00.<br>
If $timezone is not specified, then $timezone is the value of the implicit timezone in the dynamic context.<br>
If $arg is the empty sequence, then the result is the empty sequence.<br>
A dynamic error is raised [err:FODT0003] if $timezone is less than -PT14H or greater than PT14H or if does not contain an integral number of minutes.<br>
If $arg does not have a timezone component and $timezone is the empty sequence, then the result is the value of $arg.<br>
If $arg does not have a timezone component and $timezone is not the empty sequence, then the result is $arg with $timezone as the timezone component.<br>
If $arg has a timezone component and $timezone is the empty sequence, then the result is the localized value of $arg without its timezone component.<br>
If $arg has a timezone component and $timezone is not the empty sequence, then:
<ul>
<li>Let $srcdt be an xs:dateTime value, with 00:00:00 for the time component and date and timezone components that are the same as the date and timezone components of $arg.</li>
<li>Let $r be the result of evaluating fn:adjust-dateTime-to-timezone($srcdt, $timezone)</li>
<li>The result of this function will be a date value that has date and timezone components that are the same as the date and timezone components of $r.</li>
</ul>
<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:date?</td>
<td>$arg</td>
</tr>
<tr>
<td>xs:dayTimeDuration?</td>
<td>$timezone</td>
</tr>
</table>
<b>Return type:</b> xs:date?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>adjust-date-to-timezone(xs:date("2002-03-07"))</td>
<td>2002-03-07-05:00</td>
</tr>
<tr>
<td>adjust-date-to-timezone(xs:date("2002-03-07"), xs:dayTimeDuration("-PT10H"))</td>
<td>2002-03-07-10:00</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-adjust-date-to-timezone" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:adjust-time-to-timezone()</code></a>
<div class="content">
Adjusts an xs:time value to a specific timezone, or to no timezone at all. If $timezone is the empty sequence, returns an xs:time without a timezone. Otherwise, returns an xs:time with a timezone.<br>
If $timezone is not specified, then $timezone is the value of the implicit timezone in the dynamic context.<br>
If $arg is the empty sequence, then the result is the empty sequence.<br>
A dynamic error is raised [err:FODT0003] if $timezone is less than -PT14H or greater than PT14H or if does not contain an integral number of minutes.<br>
If $arg does not have a timezone component and $timezone is the empty sequence, then the result is $arg.<br>
If $arg does not have a timezone component and $timezone is not the empty sequence, then the result is $arg with $timezone as the timezone component.<br>
If $arg has a timezone component and $timezone is the empty sequence, then the result is the localized value of $arg without its timezone component.<br>
If $arg has a timezone component and $timezone is not the empty sequence, then:
<ul>
<li>Let $srcdt be an xs:dateTime value, with an arbitrary date for the date component and time and timezone components that are the same as the time and timezone components of $arg.</li>
<li>Let $r be the result of evaluating fn:adjust-dateTime-to-timezone($srcdt, $timezone)</li>
<li>The result of this function will be a time value that has time and timezone components that are the same as the time and timezone components of $r.</li>
</ul>
<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:time?</td>
<td>$arg</td>
</tr>
<tr>
<td>xs:dayTimeDuration?</td>
<td>$timezone</td>
</tr>
</table>
<b>Return type:</b> xs:time?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>adjust-time-to-timezone(xs:time("10:00:00"))</td>
<td>10:00:00-05:00</td>
</tr>
<tr>
<td>adjust-time-to-timezone(xs:time("10:00:00"), xs:dayTimeDuration("-PT10H"))</td>
<td>10:00:00-10:00</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-adjust-time-to-timezone" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:current-dateTime()</code></a>
<div class="content">
Returns the current dateTime (with timezone) from the dynamic context. (See Section C.2 Dynamic Context ComponentsXP.) This is an xs:dateTime that is current at some time during the evaluation of a query or transformation in which fn:current-dateTime() is executed. This function is ·stable·. The precise instant during the query or transformation represented by the value of fn:current-dateTime() is ·implementation dependent·.<br><br>
<b>Return type:</b> xs:dateTime<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>current-dateTime()</td>
<td>xs:dateTime corresponding to the current date and time</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-current-dateTime" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:current-date()</code></a>
<div class="content">
Returns xs:date(fn:current-dateTime()). This is an xs:date (with timezone) that is current at some time during the evaluation of a query or transformation in which fn:current-date() is executed. This function is ·stable·. The precise instant during the query or transformation represented by the value of fn:current-date() is ·implementation dependent·.<br><br>
<b>Return type:</b> xs:date<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>current-date()</td>
<td>xs:date corresponding to the current date</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-current-date" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:current-time()</code></a>
<div class="content">
Returns xs:date(fn:current-dateTime()). This is an xs:date (with timezone) that is current at some time during the evaluation of a query or transformation in which fn:current-date() is executed. This function is ·stable·. The precise instant during the query or transformation represented by the value of fn:current-date() is ·implementation dependent·.<br><br>
<b>Return type:</b> xs:time<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>current-time()</td>
<td>xs:date corresponding to the current time</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-current-time" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:implicit-timezone()</code></a>
<div class="content">
Returns the value of the implicit timezone property from the dynamic context. Components of the dynamic context are discussed in Section C.2 Dynamic Context ComponentsXP.<br><br>
<b>Return type:</b> xs:string<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>implicit-timezone()</td>
<td>PT0S</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-implicit-timezone" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span name="collapse20">
<button class="section-button collapseTrigger" style="border: none">Error</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:error()</code></a>
<div class="content">
The fn:error function is a general function that may be invoked as above but may also be invoked from [XQuery 1.0: An XML Query Language] or [XML Path Language (XPath) 2.0] applications with, for example, an xs:QName argument.
<br>
<a href="https://www.w3.org/TR/xquery-operators/#func-error" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:trace()</code></a>
<div class="content">
Provides an execution trace intended to be used in debugging queries.<br>
The input $value is returned, unchanged, as the result of the function. In addition, the inputs $value, converted to an xs:string, and $label may be directed to a trace data set. The destination of the trace output is ·implementation-defined·. The format of the trace output is ·implementation dependent·. The ordering of output from invocations of the fn:trace() function is ·implementation dependent·.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>item*</td>
<td>$value</td>
</tr>
<tr>
<td>xs:string</td>
<td>$label</td>
</tr>
</table>
<b>Return type:</b> item<br><br>
<br>
<a href="https://www.w3.org/TR/xquery-operators/#func-trace" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span name="collapse20">
<button class="section-button collapseTrigger" style="border: none">Misc</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:resolve-uri()</code></a>
<div class="content">
This function enables a relative URI reference to be resolved against an absolute URI.
The first form of this function resolves $relative against the value of the base-uri property from the static context. If the base-uri property is not initialized in the static context an error is raised [err:FONS0005].<br>
If $relative is a relative URI reference, it is resolved against $base, or against the base-uri property from the static context, using an algorithm such as those described in [RFC 2396] or [RFC 3986], and the resulting absolute URI reference is returned.<br>
If $relative is an absolute URI reference, it is returned unchanged.<br>
If $relative is the empty sequence, the empty sequence is returned.<br>
If $relative is not a valid URI according to the rules of the xs:anyURI data type, or if it is not a suitable relative reference to use as input to the chosen resolution algorithm, then an error is raised [err:FORG0002].<br>
If $base is not a valid URI according to the rules of the xs:anyURI data type, if it is not a suitable URI to use as input to the chosen resolution algorithm (for example, if it is a relative URI reference, if it is a non-hierarchic URI, or if it contains a fragment identifier), then an error is raised [err:FORG0002].<br>
If the chosen resolution algorithm fails for any other reason then an error is raised [err:FORG0009].<br>
<h4>Note:</h4>
Resolving a URI does not dereference it. This is merely a syntactic operation on two character strings.
<br><br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$relative</td>
</tr>
<tr>
<td>xs:string</td>
<td>$base</td>
</tr>
</table>
<b>Return type:</b> xs:anyURI?<br><br>
<br>
<a href="https://www.w3.org/TR/xquery-operators/#func-resolve-uri" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:resolve-QName()</code></a>
<div class="content">
Returns an xs:QName value (that is, an expanded-QName) by taking an xs:string that has the lexical form of an xs:QName (a string in the form "prefix:local-name" or "local-name") and resolving it using the in-scope namespaces for a given element.<br>
If $qname does not have the correct lexical form for xs:QName an error is raised [err:FOCA0002].<br>
If $qname is the empty sequence, returns the empty sequence.<br>
More specifically, the function searches the namespace bindings of $element for a binding whose name matches the prefix of $qname, or the zero-length string if it has no prefix, and constructs an expanded-QName whose local name is taken from the supplied $qname, and whose namespace URI is taken from the string value of the namespace binding.<br>
If the $qname has a prefix and if there is no namespace binding for $element that matches this prefix, then an error is raised [err:FONS0004].<br>
If the $qname has no prefix, and there is no namespace binding for $element corresponding to the default (unnamed) namespace, then the resulting expanded-QName has no namespace part.<br>
The prefix (or absence of a prefix) in the supplied $qname argument is retained in the returned expanded-QName, as discussed in Section 2.1 TerminologyDM.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$qname</td>
</tr>
<tr>
<td>element</td>
<td>$element</td>
</tr>
</table>
<b>Return type:</b> xs:QName?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>resolve-QName("hello", /l:library/l:libraryName)</td>
<td>hello</td>
</tr>
<tr>
<td>resolve-QName("l:libraryID", /l:library/l:libraryName)</td>
<td>l:libraryID</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-resolve-QName" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:QName()</code></a>
<div class="content">
Returns an xs:QName with the namespace URI given in $paramURI. If $paramURI is the zero-length string or the empty sequence, it represents "no namespace"; in this case, if the value of $paramQName contains a colon (:), an error is raised [err:FOCA0002]. The prefix (or absence of a prefix) in $paramQName is retained in the returned xs:QName value. The local name in the result is taken from the local part of $paramQName.<br>
If $paramQName does not have the correct lexical form for xs:QName an error is raised [err:FOCA0002].<br>
Note that unlike xs:QName this function does not require a xs:string literal as the argument.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$paramURI</td>
</tr>
<tr>
<td>xs:string</td>
<td>$paramQName</td>
</tr>
</table>
<b>Return type:</b> xs:QName<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>QName("http://www.release11.com/library", "l:libraryName")</td>
<td>l:libraryName</td>
</tr>
</table>
For more extensive examples see W3C documentation below.<br>
<a href="https://www.w3.org/TR/xquery-operators/#func-QName" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:prefix-from-QName()</code></a>
<div class="content">
Returns an xs:NCName representing the prefix of $arg. The empty sequence is returned if $arg is the empty sequence or if the value of $arg contains no prefix.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:QName?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:NCName?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>prefix-from-QName(resolve-QName("l:library", /l:library))</td>
<td>l</td>
</tr>
</table>
<a href="https://www.w3.org/TR/xquery-operators/#func-prefix-from-QName" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:local-name-from-QName()</code></a>
<div class="content">
Returns an xs:NCName representing the local part of $arg. If $arg is the empty sequence, returns the empty sequence.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:QName?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:NCName?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>prefix-from-QName(resolve-QName("l:library", /l:library))</td>
<td>library</td>
</tr>
</table>
<a href="https://www.w3.org/TR/xquery-operators/#func-local-name-from-QName" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:prefix-from-QName()</code></a>
<div class="content">
Returns an xs:NCName representing the prefix of $arg. The empty sequence is returned if $arg is the empty sequence or if the value of $arg contains no prefix.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:QName?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:NCName?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>prefix-from-QName(resolve-QName("l:library", /l:library))</td>
<td>l</td>
</tr>
</table>
<a href="https://www.w3.org/TR/xquery-operators/#func-prefix-from-QName" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:namespace-uri-from-QName()</code></a>
<div class="content">
Returns the namespace URI for $arg as an xs:anyURI. If $arg is the empty sequence, the empty sequence is returned. If $arg is in no namespace, the zero-length xs:anyURI is returned.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:QName?</td>
<td>$arg</td>
</tr>
</table>
<b>Return type:</b> xs:anyURI?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>prefix-from-QName(resolve-QName("l:library", /l:library))</td>
<td>http://www.release11.com/library</td>
</tr>
</table>
<a href="https://www.w3.org/TR/xquery-operators/#func-namespace-uri-from-QName" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:namespace-uri-for-prefix()</code></a>
<div class="content">
Returns the namespace URI of one of the in-scope namespaces for $element, identified by its namespace prefix.<br>
If $element has an in-scope namespace whose namespace prefix is equal to $prefix, it returns the namespace URI of that namespace. If $prefix is the zero-length string or the empty sequence, it returns the namespace URI of the default (unnamed) namespace. Otherwise, it returns the empty sequence.<br>
Prefixes are equal only if their Unicode code points match exactly.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>xs:string?</td>
<td>$prefix</td>
</tr>
<tr>
<td>element()</td>
<td>$element</td>
</tr>
</table>
<b>Return type:</b> xs:anyURI?<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>namespace-uri-for-prefix("l", /l:library)</td>
<td>http://www.release11.com/library</td>
</tr>
</table>
<a href="https://www.w3.org/TR/xquery-operators/#func-namespace-uri-for-prefix" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:in-scope-prefixes()</code></a>
<div class="content">
Returns the prefixes of the in-scope namespaces for $element. For namespaces that have a prefix, it returns the prefix as an xs:NCName. For the default namespace, which has no prefix, it returns the zero-length string.<br><br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>element()</td>
<td>$element</td>
</tr>
</table>
<b>Return type:</b> xs:string*<br><br>
<b>Examples:</b>
<table class="table-doc">
<tr>
<th>Query</th>
<th>Result</th>
</tr>
<tr>
<td>in-scope-prefixes(/l:library)</td>
<td>b<br>l<br>p<br>xsi<br>xml</td>
</tr>
</table>
<a href="https://www.w3.org/TR/xquery-operators/#func-in-scope-prefixes" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:static-base-uri()</code></a>
<div class="content">
Returns the value of the Base URI property from the static context. If the Base URI property is undefined, the empty sequence is returned. Components of the static context are discussed in Section C.1 Static Context ComponentsXP.<br><br>
<b>Return type:</b> xs:anyURI?<br><br>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>static-base-uri()()</td>
<td>&lt;empty sequence&gt;</td>
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-static-base-uri" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
</div>
</div>
</div>
</span>
<span name="collapse30">
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Node-Set</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:last()</code></a>
<div class="content">
Returns the position of the last node in the context list <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Node-Set-Functions" class="hyperlink" target="_blank">Node-Set-Functions</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Boolean</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:boolean(object)</code></a>
<div class="content">
The boolean function converts its argument to a boolean as follows:
<ul>
<li>a number is true if and only if it is neither positive or negative zero nor NaN</li>
<li>a node-set is true if and only if it is non-empty</li>
<li>a string is true if and only if its length is non-zero</li>
<li>an object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type</li>
</ul>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>object</td>
<td>The object to convert to a boolean</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>boolean("Release11")</td>
<td>true</td>
</tr>
<tr>
<td>boolean("")</td>
<td>false</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Boolean-Functions" class="hyperlink" target="_blank">Boolean-Functions</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">String</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:string(object)</code></a>
<div class="content">
Returns the string representation of the object argument <br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string</td>
<td>The object to convert to a string</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>string((1&lt;0))</td>
<td>false</td>
</tr>
<tr>
<td>string(.11)</td>
<td>0.11</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-String-Functions" class="hyperlink" target="_blank">String-Functions</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Numeric</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:number(object)</code></a>
<div class="content">
The number function converts its argument to a number as follows:
<ul>
<li>a string that consists of optional whitespace followed by an optional minus sign followed by a Number followed by whitespace is converted to the IEEE 754 number that is nearest (according to the IEEE 754 round-to-nearest rule) to the mathematical value represented by the string; any other string is converted to NaN</li>
<li>boolean true is converted to 1; boolean false is converted to 0</li>
<li>a node-set is first converted to a string as if by a call to the string function and then converted in the same way as a string argument</li>
<li>an object of a type other than the four basic types is converted to a number in a way that is dependent on that type</li>
</ul>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>object</td>
<td>The object to convert to a number</td>
</tr>
</table>
<b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>boolean("Release11")</td>
<td>true</td>
</tr>
<tr>
<td>boolean("")</td>
<td>false</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/1999/REC-xpath-19991116/#section-Number-Functions" class="hyperlink" target="_blank">Numeric-Functions</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Date / Time</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:adjust-date-to-timezone(date,timezone)</code></a>
<div class="content">
If the timezone argument is empty, it returns a date without a timezone. Otherwise,
it returns a date with a timezone <br>
<b>Arguments and return type:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>date</td>
<td>date to be adjusted</td>
</tr>
<tr>
<td>timezone</td>
<td>timezone to be imposed into date</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>adjust-date-to-timezone(xs:date('2011-11-15'),
xs:dayTimeDuration("PT10H"))</td>
<td>2011-11-15+10:00</td>
</tr>
</table><br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/xpath-functions/#func-adjust-date-to-timezone" class="hyperlink" target="_blank">#func-adjust-date-to-timezone</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Error</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:error()</code></a>
<div class="content">
https://www.w3.org/TR/xpath-functions/#func-error <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/xpath-functions/#func-error" class="hyperlink" target="_blank">#func-error</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Misc</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:nilled(node)</code></a>
<div class="content">
Returns a Boolean value indicating whether the argument node is nilled <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/xpath-functions/#func-nilled" class="hyperlink" target="_blank">#func-nilled</code></a>
</div>
</div>
</div>
<div class="collapsible">
<span>
<button class="section-button collapseTrigger" style="border: none">Loop /
Conditional</button>
</span>
<div class="content">
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:for-each(sequence*, function)</code></a>
<div class="content">
Applies function item to every element in sequence <br>
<br>
<code>W3C Documentation reference: <a href="https://www.w3.org/TR/xpath-functions-30/#func-for-each" class="hyperlink" target="_blank">#func-for-each</code></a>
</div>
</div>
</div>
</span>
</div>
<!-- Cut here -->
</span>
</div>
</div>
<script>
function processVersionSelector() {
var processor = getProcessor();
var hideableOptions = document.getElementsByClassName("hideable");
for (let i = 0; i < hideableOptions.length; i++) {
hideableOptions[i].style = "display: none;";
}
if (processor == "xalan" || processor == "libxml") {
var xalanOptions = document.getElementsByClassName("xalan");
for (let i = 0; i < xalanOptions.length; i++) {
xalanOptions[i].style = "";
}
document.getElementById("versions").selectedIndex = 0;
}
else {
var saxonOptions = document.getElementsByClassName("saxon");
for (let i = 0; i < saxonOptions.length; i++) {
saxonOptions[i].style = "";
}
document.getElementById("versions").selectedIndex = 3;
}
processTooltip();
}
function processTooltip() {
var filter = "collapse" + getVersion();
var collList;
if (filter == "collapse3.0") {
document.getElementById("tooltipFunctionInfo").innerText = "XPath 3.0 functions";
hideList(document.getElementsByName("collapse10"));
hideList(document.getElementsByName("collapse20"));
showList(document.getElementsByName("collapse30"));
hideList(document.getElementsByName("collapse31"));
} else if (filter == "collapse3.1") {
document.getElementById("tooltipFunctionInfo").innerText = "XPath 3.1 functions";
hideList(document.getElementsByName("collapse10"));
hideList(document.getElementsByName("collapse20"));
hideList(document.getElementsByName("collapse30"));
showList(document.getElementsByName("collapse31"));
} else if (filter == "collapse2.0"){
document.getElementById("tooltipFunctionInfo").innerText = "XPath 2.0 functions";
hideList(document.getElementsByName("collapse10"));
showList(document.getElementsByName("collapse20"));
hideList(document.getElementsByName("collapse30"));
hideList(document.getElementsByName("collapse31"));
} else {
document.getElementById("tooltipFunctionInfo").innerText = "XPath 1.0 functions";
showList(document.getElementsByName("collapse10"));
hideList(document.getElementsByName("collapse20"));
hideList(document.getElementsByName("collapse30"));
hideList(document.getElementsByName("collapse31"));
}
}
var triggerList = document.getElementsByClassName("collapseTrigger");
for (i = 0; i < triggerList.length; i++) {
triggerList[i].addEventListener("click", function () {
var collapsible = this.parentElement;
if (this.tagName == "A") {
var collapsibleData = this.nextElementSibling;
} else {
var collapsibleData = this.parentElement.nextElementSibling;
}
if (collapsibleData.style.maxHeight > "0px") {
collapsibleData.style.maxHeight = "0px";
this.classList.toggle("active", false);
if (!this.classList.contains("collapsibleMini")) {
collapsible.classList.toggle("active", false);
}
var subLists1 = collapsibleData.getElementsByClassName("content");
var subLists2 = collapsibleData.getElementsByClassName("active");
for (j = 0; j < subLists1.length; j++) {
subLists1[j].style.maxHeight = "0px";
}
for (j = 0; j < subLists2.length; j++) {
subLists2[j].classList.toggle("active", false);
}
} else {
collapsibleData.style.maxHeight = (collapsibleData.scrollHeight) + "px";
this.classList.toggle("active", true);
if (!this.classList.contains("collapsibleMini")) {
collapsible.classList.toggle("active", true);
} else {
var parentContent = this.closest(".content");
parentContent.style.maxHeight = (parentContent.scrollHeight + collapsibleData.scrollHeight) + "px";
}
}
});
}
function init() {
//Handle clicks in whole form and set info in tooltip
setDefaultContent(document.getElementById("xmlArea"), 'Insert XML here');
setDefaultContent(document.getElementById("transformArea"), 'Insert XPath expression here');
processVersionSelector();
processTooltip();
tool.addEventListener('change', event => {
//Check if script was called from textarea or selector
var targetID = event.target.getAttribute('id');
if (targetID == "processors") {
processVersionSelector();
processTooltip();
}
else if (targetID == "versions") {
processTooltip();
}
})
tool.addEventListener('click', event => {
//Check if script was called from textarea or selector
var targetID = event.target.getAttribute('id');
if (targetID !== "xmlArea" && targetID !== "transformArea") {
return;
}
processTooltip();
})
tool.addEventListener('change', event => {
//Check if script was called from textarea or selector
var targetID = event.target.getAttribute('id');
if (targetID !== "xmlArea" && targetID !== "transformArea") {
return;
}
processTooltip();
})
}
</script>
</body>
</html>