XPath - String, Boolean and Number Functions

admin's picture
  

String functions
Boolean functions
Number functions
string string(object?)
 
converts an object to a string
boolean not(boolean)
 
returns true if its argument is false, and false otherwise
number number(object?)
 
converts its argument to a number
string concat(string, string, string*)
 
returns the concatenation of its arguments
boolean true()
 
returns true
number sum(node-set)
 
returns the sum, for each node in the argument node-set
boolean starts-with(string, string)
 
returns true if the first argument string starts with the second argument string, and otherwise returns false
boolean false()
 
returns false
number floor(number)
 
returns the largest (closest to positive infinity) number that is not greater than the argument and that is an integer
boolean contains(string, string)
 
returns true if the first argument string contains the second argument string, and otherwise returns false
boolean lang(string)
 
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
number ceiling(number)
 
returns the smallest (closest to negative infinity) number that is not less than the argument and that is an integer
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
 
number round(number)
 
returns the number that is closest to the argument and that is an integer
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 by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space
 
 
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