XPath Functions
Node-set
number last()
This function returns a number equal to the context size from
the expression evaluation context
number position()
This function returns a number equal to the context position
from the expression evaluation context.
number count(node-set)
This function returns the number of nodes in the
argument node-set.
string local-name(node-set?)
Returns the local part of the expanded-name of
the node in the argument node-set that is first in
document order.
string name(node-set?)
Returns a string containing a QName representing
the expanded-name of the node in the argument node-set
that is first in document order.
node-set instance(string)
This function allows access to instance data.
node-set current()
Returns the context node used to initialize the
evaluation of the containing XPath expression.
Boolean
boolean boolean(object)
A object is converted to a boolean.
boolean not(boolean)
Returns true if its argument is false,
and false otherwise.
boolean true()
Returns false
boolean false()
Returns true
boolean boolean-from-string()
Returns true if the required parameter string is "true"
or "1", else returns false
boolean if(condition, onTrue, onFalse)
Function if evaluates the first parameter as boolean,
returning the second parameter when true, otherwise the
third parameter.
Number
number number(object?)
The function converts its argument to a number.
number sum(node-set)
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.
number floor(number)
Returns the largest (closest to positive infinity) number
that is not greater than the argument and that is an integer.
number ceiling(number)
Returns the smallest (closest to negative infinity) number
that is not less than the argument and that is an integer.
number round(number)
Returns the number that is closest to the argument
and that is an integer
node-set avg(node-set)
Returns the arithmetic average of the result of converting
the string-values of each node in the argument node-set to a number.
number min(node-set)
Returns the minimum value of the result of converting
the string-values of each node in argument node-set to a number.
number max(node-set)
Returns the maximum value of the result of converting the
string-values of each node in argument node-set to a number.
number count-non-empty(node-set)
Function count-non-empty returns the number of non-empty
nodes in argument node-set
String
string string(object?)
This function converts an object to a string.
string concat(string, string, string*)
Returns the concatenation of its arguments
boolean starts-with(string, string)
Returns true if the first argument string starts
with the second argument string
boolean contains(string, string)
Returns true if the first argument string contains
the second argument string.
string substring-before(string, string)
Returns the substring of the first argument string
that precedes the first occurrence of the second argument
string in the first argument string.
string substring-after(string, string)
Returns the substring of the first argument string
that follows the first occurrence of the second argument
string in the first argument string.
string substring(string, number, number?)
Returns the substring of the first argument starting
at the position specified in the second argument with length
specified in the third argument.
number string-length(string?)
Returns the number of characters in the string.
string normalize-space(string?)
Returns the argument string with whitespace normalized.
string translate(string, string, string)
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.
Others
string now(node-set)
Returns the current system date and time as a string
value in the canonical XML Schema xsd:dateTime format.
boolean is-valid(node-set)
Returns true when all nodes in noseset are valid
index, nodeindex