Added numeric functions and some string

This commit is contained in:
2023-04-06 14:03:39 +02:00
parent a773022f0d
commit 3d41447581

View File

@@ -286,104 +286,402 @@
<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()</code></a>
<span>
<button class="section-button collapseTrigger" style="border: none">Boolean</button>
</span>
<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: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>
<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/#function-not" class="hyperlink" target="_blank">Boolean-Functions</code></a>
<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>
<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 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">