Added sequence and aggregating functions

This commit is contained in:
2023-03-31 14:22:47 +02:00
parent 15d0da2c8f
commit 6e06e2cece

View File

@@ -681,9 +681,197 @@
</tr>
</table><br>
<a href="https://www.w3.org/TR/xquery-operators/#func-lang" class="hyperlink" target="_blank"><code>W3C Documentation reference</code></a>
<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>
@@ -695,42 +883,57 @@
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:boolean(object)</code></a>
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 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>
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>
@@ -1017,7 +1220,7 @@
</div>
<a href="#" onClick="return false;"
class="hyperlink collapsible collapsibleMini collapseTrigger"><code>fn:codepoint-equal()</code></a>
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>
@@ -2269,6 +2472,564 @@
<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>
The static type of the result is a sequence of prime types as defined in Section 7.2.7 The fn:distinct-values functionFS.<br>
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. The collation is used when string comparison is required.<br>
If $arg is the empty sequence, the empty sequence is returned.<br>
For xs:float and xs:double values, positive zero is equal to negative zero and, although NaN does not equal itself, if $arg contains multiple NaN values a single NaN is returned.<br>
If xs:dateTime, xs:date or xs:time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for the purpose of comparison. Note that xs:dateTime, xs:date or xs:time values can compare equal even if their timezones are different.<br>
Which value of a set of values that compare equal is returned is ·implementation dependent·.<br>
If the input sequence contains values of different numeric types that differ from each other by small amounts, then the eq operator is not transitive, because of rounding effects occurring during type promotion. In the situation where the input contains three values A, B, and C such that A eq B, B eq C, but A ne C, then the number of items in the result of the function (as well as the choice of which items are returned) is ·implementation-dependent·, subject only to the constraints that (a) no two items in the result sequence compare equal to each other, and (b) every input item that does not appear in the result sequence compares equal to some item that does appear in the result sequence.<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>
</div>
</div>