Added missing functions #143

Merged
bema merged 1 commits from bema/fix/missing-functions into master 2023-04-18 10:55:47 +02:00

View File

@@ -135,7 +135,15 @@
<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>
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:last()</code></a>
<div class="content">
The last function returns a number equal to the context size from the expression evaluation context.<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>
@@ -218,17 +226,6 @@
</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">
@@ -258,17 +255,6 @@
</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">
@@ -315,12 +301,10 @@
<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 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>
<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>
@@ -380,16 +364,7 @@
<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>
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>
@@ -417,9 +392,7 @@
<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>
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">
@@ -478,7 +451,7 @@
<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>
Returns true if the first argument string starts with the second argument string, and otherwise returns false.<br>
<b>Arguments:</b>
<table class="table-doc">
@@ -488,11 +461,11 @@
</tr>
<tr>
<td>string</td>
<td></td>
<td>String to test</td>
</tr>
<tr>
<td>string</td>
<td>The object to convert to a string</td>
<td>String that first string has to start from</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
@@ -501,8 +474,254 @@
<th>Result</th>
</tr>
<tr>
<td>concat("Release", 11)</td>
<td>Release11</td>
<td>starts-with("Release11", "Rel")</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:contains()</code></a>
<div class="content">
The contains function returns true if the first argument string contains the second argument string, and otherwise returns false.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string</td>
<td>String to test</td>
</tr>
<tr>
<td>string</td>
<td>String that first string has to contain</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>contains("Release11", "eas")</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:substring-before()</code></a>
<div class="content">
The substring-before function returns the substring of the first argument string that precedes the first occurrence of the second argument string in the first argument string, or the empty string if the first argument string does not contain the second argument string.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string</td>
<td>String to test</td>
</tr>
<tr>
<td>string</td>
<td>String that first string has to contain</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>substring-before("1999/04/01","/")</td>
<td>1999</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:substring-after()</code></a>
<div class="content">
The substring-after function returns the substring of the first argument string that follows the first occurrence of the second argument string in the first argument string, or the empty string if the first argument string does not contain the second argument string.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string</td>
<td>String to test</td>
</tr>
<tr>
<td>string</td>
<td>String that first string has to contain</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>substring-after("1999/04/01","/")</td>
<td>04/01</td>
</tr>
<tr>
<td>substring-after("1999/04/01","19")</td>
<td>99/04/01</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:substring()</code></a>
<div class="content">
The substring function returns the substring of the first argument starting at the position specified in the second argument with length specified in the third argument.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string</td>
<td>String to test</td>
</tr>
<tr>
<td>number</td>
<td>Starting index</td>
</tr>
<tr>
<td>number?</td>
<td>Length of target substring</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>substring("12345",2)</td>
<td>2345</td>
</tr>
<tr>
<td>substring("12345",2,3)</td>
<td>234</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:string-length()</code></a>
<div class="content">
The string-length returns the number of characters in the string. If the argument is omitted, it defaults to the context node converted to a string, in other words the string-value of the context node.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string?</td>
<td>String to test</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>string-length("abcdef")</td>
<td>6</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:normalize-space()</code></a>
<div class="content">
The normalize-space function returns the argument string with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space. Whitespace characters are the same as those allowed by the S production in XML. If the argument is omitted, it defaults to the context node converted to a string, in other words the string-value of the context node.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string?</td>
<td>String to test</td>
</tr>
</table><b>Examples: </b><br>
<table class="table-doc">
<tr>
<th>Expression</th>
<th>Result</th>
</tr>
<tr>
<td>normalize-space(" abc def ")</td>
<td>abc def</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:translate()</code></a>
<div class="content">
The translate function returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string. If there is a character in the second argument string with no character at a corresponding position in the third argument string (because the second argument string is longer than the third argument string), then occurrences of that character in the first argument string are removed.<br>
<b>Arguments:</b>
<table class="table-doc">
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>string</td>
<td>String to translate</td>
</tr>
<tr>
<td>string</td>
<td>Characters to remove</td>
</tr>
<tr>
<td>string</td>
<td>String to insert characters from second argument</td>
</tr>
</table><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>
</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>
@@ -523,16 +742,10 @@
<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>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>
<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>
@@ -566,8 +779,7 @@
<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>
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">
@@ -596,8 +808,7 @@
<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>
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">
@@ -634,8 +845,7 @@
<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>
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">
@@ -673,18 +883,10 @@
<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.
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>
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">