Zdrojový soubor
<expressions>
<expression id="1"> 123 </expression>
<expression id="2"> 123+456 </expression>
<expression id="3"> 1e2 </expression>
<expression id="4">
<expression id="4a">123</expression>
<expression id="4b">-456.789</expression>
<expression id="4c">0</expression>
<expression id="4d" />
</expression>
</expressions>Aplikace jednotlivých číselných funkcí (XPath 2.0)
Nezávislých na kontextu
Funkce jsou aplikovány na konstanty, proto výsledek nezávisí na kontextu.Funkce | Výsledek |
---|
floor(123.5) | 123 |
---|
ceiling(123.5) | 124 |
---|
round(123.5) | 124 |
---|
floor(-123.5) | -124 |
---|
ceiling(-123.5) | -123 |
---|
round(-123.5) | -123 |
---|
Závislých na kontextu
Funkce jsou aplikovány na obsahy elementů, proto výsledek závisí na kontextu.Název elementu | number(.) | number(text()) | position() | last() | count(*) | sum(*) | avg(*) | max(*) | min(*) |
---|
expressions/ | NaN | NaN | 1 | 1 | 4 | NaN | NaN | 123 | 100 |
---|
expression/1 | 123 | 123 | 2 | 9 | 0 | 0 | NaN | -Infinity | Infinity |
---|
expression/2 | NaN | NaN | 4 | 9 | 0 | 0 | NaN | -Infinity | Infinity |
---|
expression/3 | 100 | 100 | 6 | 9 | 0 | 0 | NaN | -Infinity | Infinity |
---|
expression/4 | NaN | NaN | 8 | 9 | 4 | NaN | NaN | 123 | -456.789 |
---|
expression/4a | 123 | 123 | 2 | 9 | 0 | 0 | NaN | -Infinity | Infinity |
---|
expression/4b | -456.789 | -456.789 | 4 | 9 | 0 | 0 | NaN | -Infinity | Infinity |
---|
expression/4c | 0 | 0 | 6 | 9 | 0 | 0 | NaN | -Infinity | Infinity |
---|
expression/4d | NaN | NaN | 8 | 9 | 0 | 0 | NaN | -Infinity | Infinity |
---|