XPath functions
The following is an annotated list of core XPath functions and XSLT-specific additions to XPath, including a description, syntax, a list of arguments, result-type, source in the appropriate W3C Recommendation. For further information on using XPath/XSLT functions, please see the For Further Reading page.
- boolean
The
booleanfunction evaluates an expression and returns true or false.- ceiling
The
ceilingfunction evaluates a decimal number and returns the smallest integer greater than or equal to the decimal number.- choose
The
choosefunction returns one of the specified objects based on a boolean parameter.- concat
The
concatfunction concatenates two or more strings and returns the resulting string.- contains
The
containsfunction determines whether the first argument string contains the second argument string and returns boolean true or false.- count
The
countfunction counts the number of nodes in a node-set and returns an integer.- current
The
currentfunction can be used to get the context node in an XSLT instruction.- document
The
documentfinds a node-set in an external document, or multiple external documents, and returns the resulting node-set.- element-available
The
element-availablefunction determines if an element is available and returns true or false.- false
The
falsefunction returns boolean false.- floor
The
floorfunction evaluates a decimal number and returns the largest integer less than or equal to the decimal number.- format-number
The
format-numberfunction evaluates a number and returns a string representing the number in a given format.- function-available
The
function-availablefunction determines if a given function is available and returns boolean true or false.- generate-id
The
generate-idfunction generates a unique id for the first node in a given node-set and returns a string containing that id.- id
The
idfunction finds nodes matching the given ids and returns a node-set containing the identified nodes.- key
The
keyfunction returns a node-set of nodes that have the given value for the given key.- lang
The
langfunction determines whether the context node matches the given language and returns boolean true or false.- last
The
lastfunction returns a number equal to the context size from the expression evaluation context.- local-name
The
local-namefunction returns a string representing the local name of the first node in a given node-set.- name
The
namefunction returns a string representing the QName of the first node in a given node-set.- namespace-uri
The
namespace-urifunction returns a string representing the namespace URI of the first node in a given node-set.- normalize-space
The
normalize-spacefunction strips leading and trailing white-space from a string, replaces sequences of whitespace characters by a single space, and returns the resulting string.- not
The
notfunction evaluates a boolean expression and returns the opposite value.- number
The
numberfunction converts an object to a number and returns the number.- position
The
positionfunction returns a number equal to the context position from the expression evaluation context.- round
The
roundfunction returns a number that is the nearest integer to the given number.- starts-with
The
starts-withchecks whether the first string starts with the second string and returns true or false.- string
The
stringfunction converts the given argument to a string.- string-length
The
string-lengthfunction returns a number equal to the number of characters in a given string.- substring
The
substringfunction returns a part of a given string.- substring-after
The
substring-afterfunction returns a string that is the rest of a given string after a given substring.- substring-before
The
substring-beforefunction returns a string that is the part of a given string before a given substring.- sum
The
sumfunction returns a number that is the sum of the numeric values of each node in a given node-set.- system-property
The
system-propertyfunction returns an object representing the given system-property.- translate
The
translatefunction evaluates a string and a set of characters to translate and returns the translated string.- true
The
truefunction returns a boolean value of true.- unparsed-entity-url
The
unparsed-entity-url()function returns the URI of the unparsed entity with the given name. This is non-XML data referenced in the DTD of the source document.