Online XPath tester






What is XPath?

XPath is a query language used for selecting nodes from XML and processing them.
It may perform operations on strings, numbers and boolean values.

XPath 2.0 introduced many new features XQuery-cośtam:
- Added support for all XML simple types
- Many new functions (tripled instruction count)
- All expressions evaluate to sequence
- Introduces conditional expressions and for-loops

XPath 3.0
- Dynamic function calls (function may be called without being referenced by name (find function in collection and call)
- Inline functions
- Namespace literals - Namespace may be embedded into function name
- Support for union types - collections containing elements of different types
- Mapping operator - '!' performs evaluation for each element in sequence and concatenates results
- Introduced maps

XPath 3.1
- New operator for function chaining '=>'
- Introduced maps that store data in pair 'key:value' - 'map{ key : value, key : value }'
- Introduced arrays - they differ from sequences in that they can be nested 'array{1, 5, 7, (10 to 20)}'

XPath 1.0 & 2.0 functions

[1.0] fn:last()
Returns the position of the last node in the context list

W3C Documentation reference: Node-Set-Functions
[1.0] fn:position()
Returns the position of the current context node

W3C Documentation reference: Node-Set-Functions
[1.0] fn:count(node-set)
Returns the number of nodes in the node-set
Arguments and return type:
Type Description
node-set Node-set to count nodes in
Examples:
Expression Result
count(//b:book) 5
count(//person[@id>5]) 17

W3C Documentation reference: Node-Set-Functions
[1.0] fn:id(object)
Returns the element specified by it's unique id, requires DTD

W3C Documentation reference: Node-Set-Functions
[1.0] fn:local-name(node-set)
Returns the local-name for the first node in the node-set
Arguments and return type:
Type Description
node-set Extract first node and return its local name
Examples:
Expression Result
local-name(//b:books) b:book
local-name(//b:book) b:title

W3C Documentation reference: Node-Set-Functions
[1.0] fn:local-name()
Returns the local-name for the context node

W3C Documentation reference: Node-Set-Functions
[1.0] fn:namespace-uri(node-set)
Returns the namespace-uri for the first node in the node-set
Arguments and return type:
Type Description
node-set Extract first node and return the namespace URI
Examples:
Expression Result
namespace-uri(//b:book) http://www.book.com

W3C Documentation reference: Node-Set-Functions
[1.0] fn:namespace-uri()
Returns the namespace-uri for the context node

W3C Documentation reference: Node-Set-Functions
[1.0] fn:name(node-set)
Returns the name for the first node in the node-set
Arguments and return type:
Type Description
node-set Extract first node and return QName
Examples:
Expression Result
name(//b:books/*) b:book
name(//b:book/*) b:title

W3C Documentation reference: Node-Set-Functions
[1.0] fn:name()
Returns the name for the context node
Examples:
Expression Result
current context node Extract first node and return QName

W3C Documentation reference: Node-Set-Functions
[1.0] fn:boolean(object)
The boolean function converts its argument to a boolean as follows:
  • a number is true if and only if it is neither positive or negative zero nor NaN
  • a node-set is true if and only if it is non-empty
  • a string is true if and only if its length is non-zero
  • 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
Arguments and return type:
Type Description
object The object to convert to a boolean
Examples:
Expression Result
boolean("Release11") true
boolean("") false

W3C Documentation reference: Boolean-Functions
[1.0] fn:not()
The not function returns true if its argument is false, and false otherwise.

W3C Documentation reference: Boolean-Functions
[1.0] fn:true()
The true function returns true.

W3C Documentation reference: Boolean-Functions
[1.0] fn:false()
The true function returns false.

W3C Documentation reference: Boolean-Functions
[1.0] fn:lang(string)
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.
Arguments and return type:
Type Description
string Language that will be looked for in context node
Examples: Look W3C documentation

W3C Documentation reference: Boolean-Functions
[1.0] fn:string(object)
Returns the string representation of the object argument
Arguments and return type:
Type Description
string The object to convert to a string
Examples:
Expression Result
string((1<0)) false
string(.11) 0.11

W3C Documentation reference: String-Functions
[1.0] fn:string()
Returns a string value representation of the context node

W3C Documentation reference: String-Functions
[1.0] fn:concat(string, string, string*)
Returns the concatenation of its arguments
Arguments and return type:
Type Description
string String to be merged
string String to be merged
string* any number of strings
Examples:
Expression Result
concat("aa","bb") aabb
concat("aa", 123) aa123

W3C Documentation reference: String-Functions
[1.0] fn:starts-with(string, string)
Returns true if the first string starts with the second string
Arguments and return type:
Type Description
string String to be searched
string String to be found
Examples:
Expression Result
starts-with("aabb", "aa") true
starts-with("aabb", "cc") false

W3C Documentation reference: String-Functions
[1.0] fn:contains(string, string)
Returns true if the first string contains the second string
Arguments and return type:
Type Description
string String to be searched
string String to be found
Examples:
Expression Result
contains("abc", "c") true
contains("abc", "1") false

W3C Documentation reference: String-Functions
[1.0] fn:substring-before(string, string)
Returns the substring found before the first occurrence of the second argument
Arguments and return type:
Type Description
string String to be searched
string String to be used to split
Examples:
Expression Result
substring-before("aabbcc","bb") aa
substring-before("aabbcc","c") aabb

W3C Documentation reference: String-Functions
[1.0] fn:substring-after(string, string)
Returns the substring found after the first occurrence of the second argument
Arguments and return type:
Type Description
string String to be searched
string String to be used to split
Examples:
Expression Result
substring-after("aabbcc","bb") cc
substring-after("aabbcc","a") abbcc

W3C Documentation reference: String-Functions
[1.0] fn:substring(string, number, number)
Returns the substring starting at second argument with lenght of third argument
Arguments and return type:
Type Description
string String to be cut
integer Starting position
integer Length of the substring
Examples:
Expression Result
substring("aabbcc", 1, 2) aa

W3C Documentation reference: String-Functions
[1.0] fn:substring(string, number)
Returns the substring of the first argument from the position specified by the second argument
Arguments and return type:
Type Description
string String to be cut
integer Starting position
Examples:
Expression Result
substring("aabbcc", 3) bbcc

W3C Documentation reference: String-Functions
[1.0] fn:string-length(string)
Returns the length of the string specified by the argument
Arguments and return type:
Type Description
string String of which length should be returned
Examples:
Expression Result
string-length("aabbcc") 6
string-length("aa bb cc") 8

W3C Documentation reference: String-Functions
[1.0] fn:string-length()
Returns the length of the string specified by the context node

W3C Documentation reference: String-Functions
[1.0] fn:normalize-space(string)
Returns a white-space normalized string
Arguments and return type:
Type Description
string String to be normalized
Examples:
Expression Result
normalize-space("aa bb cc") aa bb cc
normalize-space("aa bb cc") aa bb cc

W3C Documentation reference: String-Functions
[1.0] fn:normalize-space()
Returns a white-space normalized string specified by the context-node

W3C Documentation reference: String-Functions
[1.0] fn:translate(string, string, string)
Replaces characters specified by the second argument using those from the third argument
Arguments and return type:
Type Description
string String to be edited
string sequence of characters to be replaced
string sequence of character to be used in replacement
Examples:
Expression Result
translate("aabbcc", "ab","xz") xxzzcc
translate("Test sequence", "e","z") Tzst szquzncz

W3C Documentation reference: String-Functions
[2.0] fn:string-join((string,string,...),sep)
Returns a string created by concatenating the string arguments and using the sep argument as the separator
Arguments and return type:
Type Description
string* string sequence to be joined
string separator to be used
Examples:
Expression Result
string-join(('fox', 'jumps', 'over', 'dog'), ' ') ' fox jumps over dog '
string-join(('fox', 'jumps', 'over', 'dog')) 'joxjumpsoverdog'

W3C Documentation reference: #func-string-join
[3.0] fn:string-to-codepoints(string)
Returns sequence of unicode codepoint representing the provided string
Arguments and return type:
Type Description
string string to be coverted to list of unicode values
Examples:
Expression Result
string-to-codepoints("test") (116, 101, 115, 116)

W3C Documentation reference: #func-string-to-codepoints
[2.0] fn:compare(comp1,comp2)
Returns -1 if comp1 is less than comp2, 0 if comp1 is equal to comp2, or 1 if comp1 is greater than comp2 (according to the rules of the collation that is used)
Arguments and return type:
Type Description
string first parameter to be compared
string second parameter to be compared
Examples:
Expression Result
compare('abc', 'abc') 0
compare('abc', 'abd') -1
compare('abc1', 'abd') -1
compare("abc1","abc") 1

W3C Documentation reference: #func-compare
[2.0] fn:compare(comp1,comp2,collation)
Returns -1 if comp1 is less than comp2, 0 if comp1 is equal to comp2, or 1 if comp1 is greater than comp2 (according to the rules of the collation that is used)
Arguments and return type:
Type Description
string first parameter to be compared
string second parameter to be compared
string collation to be used in comparison(letter weight may differ between languages)
Examples:
Expression Result
compare('ghi', 'ghi') 0

W3C Documentation reference: #func-compare
[2.0] fn:codepoints-to-string((int,int,...))
Creates a string from a sequence of the Unicode Standard code points
Arguments and return type:
Type Description
int* int sequence to be converted to string
Examples:
Expression Result
codepoints-to-string((116, 101, 115, 116)) 'test'

W3C Documentation reference: #func-codepoints-to-string
[2.0] fn:codepoint-equal(comp1,comp2)
Returns true if the value of comp1 is equal to the value of comp2, according to the Unicode code point collation (http://www.w3.org/2005/02/xpath-functions/collation/codepoint), otherwise it returns false
Arguments and return type:
Type Description
int unicode codepoint
int unicode codepoint
Examples:
Expression Result
codepoint-equal(111, 111) true
codepoint-equal(111, 112) false
codepoint-equal("111F", "111F") true

W3C Documentation reference: #func-codepoint-equal
[2.0] fn:normalize-unicode()
NONE

W3C Documentation reference: #func-normalize-unicode
[2.0] fn:upper-case(string)
Converts the string argument to upper-case
Arguments and return type:
Type Description
string string to be converted to upper case
Examples:
Expression Result
upper-case('aabbCC') 'AABBCC'

W3C Documentation reference: #func-upper-case
[2.0] fn:lower-case(string)
Converts the string argument to lower-case
Arguments and return type:
Type Description
string string to be converted to upper case
Examples:
Expression Result
lower-case('aabbCC') 'aabbcc'

W3C Documentation reference: #func-lower-case
[2.0] fn:escape-uri(stringURI,esc-res)
https://www.w3.org/TR/xpath-functions/#func-escape-uri

W3C Documentation reference: #func-escape-uri
[2.0] fn:tokenize(string,pattern)
https://www.w3.org/TR/xpath-functions/#func-tokenize
Arguments and return type:
Type Description
string string to be tokenized
string string to be used to split the first argument
Examples:
Expression Result
tokenize("fox jumps over dog", "s+") ("fox", "jumps", "over", "dog")

W3C Documentation reference: #func-tokenize
[2.0] fn:matches(string,pattern)
Returns true if the string argument matches the pattern, otherwise, it returns false
Arguments and return type:
Type Description
string string to search in
string pattern to be found
Examples:
Expression Result
matches("Xpath", "pat") true
matches("Xpath", "abc") false

W3C Documentation reference: #func-matches
[2.0] fn:replace(string,pattern,replace)
Returns a string that is created by replacing the given pattern with the replace argument

W3C Documentation reference: #func-replace
[2.0] fn:ends-with(string1,string2)
Returns true if string1 ends with string2, otherwise it returns false

W3C Documentation reference: #func-ends-with
[1.0] fn:number(object)
The number function converts its argument to a number as follows:
  • 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
  • boolean true is converted to 1; boolean false is converted to 0
  • 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
  • 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
Arguments and return type:
Type Description
object The object to convert to a number
Examples:
Expression Result
boolean("Release11") true
boolean("") false

W3C Documentation reference: Numeric-Functions
[1.0] fn:sum(node-set)
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.

Arguments and return type:
Type Description
node-set Set of nodes whose values will be summed.
Examples:
Expression Result
sum(/l:library/l:readerList/p:person/p:readerID) 12444

W3C Documentation reference: Numeric-Functions
[1.0] fn:floor(number)
The floor function returns the largest (closest to positive infinity) number that is not greater than the argument and that is an integer.

Arguments and return type:
Type Description
number Number to convert
Examples:
Expression Result
floor(2.55) 2
W3C Documentation reference: Numeric-Functions
[1.0] fn:ceiling(number)
The ceiling function returns the smallest (closest to negative infinity) number that is not less than the argument and that is an integer.

Arguments and return type:
Type Description
number Number to convert
Examples:
Expression Result
ceiling(2.55) 3
W3C Documentation reference: Numeric-Functions
[1.0] fn:round(number)
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.
NOTE: 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.
Arguments and return type:
Type Description
number Number to convert
Examples:
Expression Result
round(2.55) 3
round(2.35) 2

W3C Documentation reference: Numeric-Functions
[2.0] fn:avg((arg,arg,...))
Returns the average of the argument values
Arguments and return type:
Type Description
sequence* returns average value of provided elements
Examples:
Expression Result
avg((1,2,3)) 2

W3C Documentation reference: #func-avg
[2.0] fn:exactly-one(item,item,...)
Returns the argument if it contains exactly one item, otherwise it raises an error
Arguments and return type:
Type Description
sequence sequence to check
Examples:
Expression Result
exactly-one((1)) 1
exactly-one((1,1)) fn:exactly-one called with a sequence containing zero or more than one item.

W3C Documentation reference: #func-exactly-one
[2.0] fn:zero-or-one(item,item,...)
Returns the argument if it contains zero or one items, otherwise it raises an error

W3C Documentation reference: #func-zero-or-one
[2.0] fn:index-of((item,item,...),searchitem)
Returns the positions within the sequence of items that are equal to the searchitem argument

W3C Documentation reference: #func-index-of
[2.0] fn:reverse((item,item,...))
Returns the reversed order of the items specified
Arguments and return type:
Type Description
sequence* sequence of elements to have its order reversed
Examples:
Expression Result
reverse(("ab", "cd", "ef")) ("ef", "cd", "ab")
reverse(("ab")) ("ab")

W3C Documentation reference: #func-reverse
[2.0] fn:one-or-more(item,item,...)
Returns the argument if it contains one or more items, otherwise it raises an error
Arguments and return type:
Type Description
sequence sequence to check
Examples:
Expression Result
one-or-more((1, 2, 3)) 1 2 3
one-or-more() An empty sequence is not allowed as the first argument of fn:one-or-more()

W3C Documentation reference: #func-one-or-more
[2.0] fn:distinct-values((item,item,...),collation)
Returns only distinct (different) values
Arguments and return type:
Type Description
sequence sequence to extract distinct values from
Examples:
Expression Result
distinct-values((1, 2, 3, 1, 2)) (1, 2, 3)

W3C Documentation reference: #func-distinct-values
[2.0] fn:exists(item,item,...)
Returns true if the value of the arguments IS NOT an empty sequence, otherwise it returns false

W3C Documentation reference: #func-exists
[2.0] fn:subsequence((item,item,...),start,len)
Returns a sequence of items from the position specified by the start argument and continuing for the number of items specified by the len argument. The first item is located at position 1

W3C Documentation reference: #func-subsequence
[2.0] fn:empty(item,item,...)
Returns true if the value of the arguments IS an empty sequence, otherwise it returns false

W3C Documentation reference: #func-empty
[2.0] fn:insert-before((item,item,...),pos,inserts)
Returns a new sequence constructed from the value of the item arguments

W3C Documentation reference: #func-insert-before
[2.0] fn:remove((item,item,...),position)
Returns a new sequence constructed from the value of the item arguments
Arguments and return type:
Type Description
sequence* sequence to be modified
integer position to insert element from
Examples:
Expression Result
remove(("a","b","c"), 1) b c
remove(("a","b","c"), 0) a b c

W3C Documentation reference: #func-remove
[2.0] fn:unordered((item,item,...))
Returns the items in an implementation dependent order

W3C Documentation reference: #func-unordered
[2.0] fn:data(item.item,...)
Takes a sequence of items and returns a sequence of atomic values
Arguments and return type:
Type Description
sequence* sequence to be split to atomic values
Examples:
Expression Result
data((1,2,23, "test")) 1 2 23 test

W3C Documentation reference: #func-data
[2.0] fn:collection()
NONE

W3C Documentation reference: #func-collection
[2.0] fn:collection(string)
NONE

W3C Documentation reference: #func-collection
[2.0] fn:min((arg,arg,...))
Returns the argument that is less than the others
Arguments and return type:
Type Description
sequence* sequence to select minimum from
Examples:
Expression Result
min((1,2,3)) 1
min(('a', 'k')) 'a'

W3C Documentation reference: #func-min
[2.0] fn:max((arg,arg,...))
Returns the argument that is greater than the others
Arguments and return type:
Type Description
sequence* sequence to select maximum from
Examples:
Expression Result
max((1,2,3)) 3
max(('a', 'k')) 'k'

W3C Documentation reference: #func-max
[2.0] fn:deep-equal(param1,param2,collation)
Returns true if param1 and param2 are deep-equal to each other, otherwise it returns false

W3C Documentation reference: #func-deep-equal
[2.0] fn:adjust-date-to-timezone(date,timezone)
If the timezone argument is empty, it returns a date without a timezone. Otherwise, it returns a date with a timezone
Arguments and return type:
Type Description
date date to be adjusted
timezone timezone to be imposed into date
Examples:
Expression Result
adjust-date-to-timezone(xs:date('2011-11-15'), xs:dayTimeDuration("PT10H")) 2011-11-15+10:00

W3C Documentation reference: #func-adjust-date-to-timezone
[2.0] fn:adjust-time-to-timezone(time,timezone)
If the timezone argument is empty, it returns a time without a timezone. Otherwise, it returns a time with a timezone

W3C Documentation reference: #func-adjust-time-to-timezone
[2.0] fn:implicit-timezone()
Returns the value of the implicit timezone
Examples:
Expression Result
implicit-timezone() PT1H

W3C Documentation reference: #func-implicit-timezone
[2.0] fn:dateTime(date,time)
Converts the arguments to a date and a time
Arguments and return type:
Type Description
date date to be merged into dateTime
time time to be merged into dateTime
Examples:
Expression Result
dateTime(xs:date("2011-11-15"), xs:time("10:22:00")) 2011-11-15T10:22:00

W3C Documentation reference: #func-dateTime
[2.0] fn:current-time()
Returns the current time (with timezone)
Examples:
Expression Result
current-time() 11:48:04.393361+01:00

W3C Documentation reference: #func-current-time
[2.0] fn:timezone-from-time(time)
Returns the time zone component of the argument if any
Arguments and return type:
Type Description
time time to extract timezone infromation from
Examples:
Expression Result
timezone-from-time(xs:time("10:22:00+10:00")) PT10H

W3C Documentation reference: #func-timezone-from-time
[2.0] fn:hours-from-time(time)
Returns an integer that represents the hours component in the localized value of the argument
Arguments and return type:
Type Description
time time to extact hours component from
Examples:
Expression Result
hours-from-time(xs:time("10:22:00")) 10

W3C Documentation reference: #func-hours-from-time
[2.0] fn:minutes-from-time(time)
Returns an integer that represents the minutes component in the localized value of the argument
Arguments and return type:
Type Description
time time to extract minutes component from
Examples:
Expression Result
minutes-from-time(xs:time("10:22:00")) 22

W3C Documentation reference: #func-minutes-from-time
[2.0] fn:seconds-from-time(time)
Returns an integer that represents the seconds component in the localized value of the argument
Arguments and return type:
Type Description
time Time to convert to seconds
Examples:
Expression Result
seconds-from-time(xs:time("10:22:00")) 0

W3C Documentation reference: #func-seconds-from-time
[2.0] fn:years-from-duration(datetimedur)
Returns an integer that represents the years component in the canonical lexical representation of the value of the argument
Arguments and return type:
Type Description
datetimedur datetimedur to extract years component from
Examples:
Expression Result
years-from-duration(xs:duration("P5Y2DT10H59M")) 5

W3C Documentation reference: #func-years-from-duration
[2.0] fn:months-from-duration(datetimedur)
Returns an integer that represents the months component in the canonical lexical representation of the value of the argument
Arguments and return type:
Type Description
datetimedur datetimedur to extract months component from
Examples:
Expression Result
months-from-duration(xs:duration("P5Y10M2DT10H59M")) 10

W3C Documentation reference: #func-years-from-duration
[2.0] fn:days-from-duration(datetimedur)
Returns an integer that represents the days component in the canonical lexical representation of the value of the argument
Arguments and return type:
Type Description
datetimedur datetimedur to extract days component from
Examples:
Expression Result
days-from-duration(xs:duration("P5Y2DT10H59M")) 2

W3C Documentation reference: #func-days-from-duration
[2.0] fn:hours-from-duration(datetimedur)
Returns an integer that represents the hours component in the canonical lexical representation of the value of the argument
Arguments and return type:
Type Description
datetimedur datetimedur to extract hours component from
Examples:
Expression Result
hours-from-duration(xs:duration("P5Y2DT10H59M")) 10

W3C Documentation reference: #func-hours-from-duration
[2.0] fn:minutes-from-duration(datetimedur)
Returns an integer that represents the minutes component in the canonical lexical representation of the value of the argument
Arguments and return type:
Type Description
datetimedur datetimedur to extract minute component from
Examples:
Expression Result
years-from-duration(xs:duration("P5Y2DT10H59M")) 59

W3C Documentation reference: #func-minutes-from-duration
[2.0] fn:seconds-from-duration(datetimedur)
Returns a decimal that represents the seconds component in the canonical lexical representation of the value of the argument
Arguments and return type:
Type Description
datetimedur datetimedur to extract seconds component from
Examples:
Expression Result
days-from-duration(xs:duration("P5Y2DT10H59M40S")) 40

W3C Documentation reference: #func-seconds-from-duration
[2.0] fn:current-date()
Returns the current date (with timezone)

W3C Documentation reference: #func-current-date
[2.0] fn:timezone-from-date(date)
Returns the time zone component of the argument if any
Arguments and return type:
Type Description
date date to extract timezone information from
Examples:
Expression Result
timezone-from-date(xs:date("2011-11-15+11:00")) PT1H
timezone-from-date(xs:date("2011-11-15+11:00")) PT11H

W3C Documentation reference: #func-timezone-from-date
[2.0] fn:year-from-date(date)
Returns an integer that represents the year in the localized value of the argument
Arguments and return type:
Type Description
date date to extract years component from
Examples:
Expression Result
year-from-date(xs:date("2011-11-15")) 2011

W3C Documentation reference: #func-year-from-date
[2.0] fn:month-from-date(date)
Returns an integer that represents the month in the localized value of the argument
Arguments and return type:
Type Description
date Date to extrat the month from
Examples:
Expression Result
month-from-date(xs:date("2011-11-15")) 11

W3C Documentation reference: #func-month-from-date
[2.0] fn:day-from-date(date)
Returns an integer that represents the day in the localized value of the argument
Arguments and return type:
Type Description
date date to extact day component from
Examples:
Expression Result
day-from-date(xs:date("2011-04-23")) 23

W3C Documentation reference: #func-day-from-date
[2.0] fn:current-dateTime()
Returns the current dateTime (with timezone)
Examples:
Expression Result
current-dateTime() 2021-03-24T18:15:09.808+01:00

W3C Documentation reference: #func-current-dateTime
[2.0] fn:timezone-from-dateTime(datetime)
Returns the time zone component of the argument if any
Arguments and return type:
Type Description
datetime DateTime to extract fimezone information from
Examples:
Expression Result
timezone-from-dateTime(xs:dateTime("2021-01-15T12:10:00-03:00")) -PT3H

W3C Documentation reference: #func-timezone-from-dateTime
[2.0] fn:year-from-dateTime(datetime)
Returns an integer that represents the year component in the localized value of the argument
Arguments and return type:
Type Description
datetime datetime to extract years component from
Examples:
Expression Result
year-from-dateTime(xs:dateTime("2011-11-15T12:30-04:10")) 2011

W3C Documentation reference: #func-year-from-dateTime
[2.0] fn:month-from-dateTime(datetime)
Returns an integer that represents the month component in the localized value of the argument
Arguments and return type:
Type Description
datetime datetime to extract month component from
Examples:
Expression Result
month-from-dateTime(xs:dateTime("2011-11-15T12:30-04:10")) 11

W3C Documentation reference: #func-month-from-dateTime
[2.0] fn:day-from-dateTime(datetime)
Returns an integer that represents the day component in the localized value of the argument
Arguments and return type:
Type Description
datetime datetime to extract day component from
Examples:
Expression Result
day-from-dateTime(xs:dateTime("2011-11-15T12:30-04:10")) 15

W3C Documentation reference: #func-day-from-dateTime
[2.0] fn:hours-from-dateTime(datetime)
Returns an integer that represents the hours component in the localized value of the argument
Arguments and return type:
Type Description
datetime datetime to extract hours component from
Examples:
Expression Result
hours-from-dateTime(xs:dateTime("2011-11-15T12:30-04:10")) 12

W3C Documentation reference: #func-hours-from-dateTime
[2.0] fn:minutes-from-dateTime(datetime)
Returns an integer that represents the minutes component in the localized value of the argument
Arguments and return type:
Type Description
datetime datetime to extract minutes component from
Examples:
Expression Result
minutes-from-dateTime(xs:dateTime("2011-11-15T12:30-04:10")) 30

W3C Documentation reference: #func-minutes-from-dateTime
[2.0] fn:seconds-from-dateTime(datetime)
Returns a decimal that represents the seconds component in the localized value of the argument
Arguments and return type:
Type Description
datetime datetime to extract seconds component from
Examples:
Expression Result
seconds-from-dateTime(xs:dateTime("2011-11-15T12:30:00-04:10")) 0

W3C Documentation reference: #func-seconds-from-dateTime
[2.0] fn:adjust-dateTime-to-timezone(datetime,timezone)
If the timezone argument is empty, it returns a dateTime without a timezone. Otherwise, it returns a dateTime with a timezone
Arguments and return type:
Type Description
datetime datetime to be adjusted
timezone timezone to be used in provided date
Examples:
Expression Result
adjust-dateTime-to-timezone(xs:dateTime('2011-11-15T12:30:00-04:10'), xs:dayTimeDuration("PT10H")) 2011-11-16T02:40:00+10:00

W3C Documentation reference: #func-adjust-dateTime-to-timezone
[2.0] fn:error()
https://www.w3.org/TR/xpath-functions/#func-error

W3C Documentation reference: #func-error
[2.0] fn:error(error)
https://www.w3.org/TR/xpath-functions/#func-error

W3C Documentation reference: #func-error
[2.0] fn:error(error,description)
https://www.w3.org/TR/xpath-functions/#func-error

W3C Documentation reference: #func-error
[2.0] fn:error(error,description,error-object)
https://www.w3.org/TR/xpath-functions/#func-error

W3C Documentation reference: #func-error
[2.0] fn:trace(value,label)
Used to debug queries

W3C Documentation reference: #func-trace
[2.0] fn:nilled(node)
Returns a Boolean value indicating whether the argument node is nilled

W3C Documentation reference: #func-nilled
[2.0] fn:namespace-uri-from-QName()
NONE

W3C Documentation reference: #func-namespace-uri-from-QName
[2.0] fn:base-uri()
Returns the value of the base-uri property of the current or specified node

W3C Documentation reference: #func-base-uri
[2.0] fn:base-uri(node)
Returns the value of the base-uri property of the current or specified node

W3C Documentation reference: #func-base-uri
[2.0] fn:static-base-uri()
Returns the value of the base-uri
Examples:
Expression Result
default-collation() http://www.w3.org/2005/xpath-functions/collation/codepoint

W3C Documentation reference: #func-static-base-uri
[2.0] fn:doc-available(URI)
Returns true if the doc() function returns a document node, otherwise it returns false

W3C Documentation reference: #func-doc-available
[2.0] fn:resolve-QName()
NONE

W3C Documentation reference: #func-resolve-QName
[2.0] fn:node-name(node)
Returns the node-name of the argument node

W3C Documentation reference: #func-node-name
[2.0] fn:default-collation()
Returns the value of the default collation

W3C Documentation reference: #func-default-collation
[2.0] fn:idref((string,string,...),node)
Returns a sequence of element or attribute nodes that have an IDREF value equal to the value of one or more of the values specified in the string argument

W3C Documentation reference: #func-idref
[2.0] fn:document-uri(node)
Returns the value of the document-uri property for the specified node

W3C Documentation reference: #func-document-uri
[2.0] fn:local-name-from-QName()
NONE

W3C Documentation reference: #func-local-name-from-QName
[2.0] fn:in-scope-prefixes()
NONE

W3C Documentation reference: #func-in-scope-prefixes
[2.0] fn:namespace-uri-for-prefix()
NONE

W3C Documentation reference: #func-namespace-uri-for-prefix
[2.0] fn:QName()
NONE

W3C Documentation reference: #func-QName
[2.0] fn:root() fn:root(node)
Returns the root of the tree to which the current node or the specified belongs. This will usually be a document node

W3C Documentation reference: #func-root
[2.0] fn:doc(URI)
NONE

W3C Documentation reference: #func-doc
[2.0] fn:resolve-uri(relative,base)
NONE

W3C Documentation reference: #func-resolve-uri
[3.0] fn:available-environment-variables()
Returns a list of environment variable names

W3C Documentation reference: #func-available-environment-variables
[3.0] fn:doc-available(uri)
The function returns true the function call fn:doc(uri) would return a document node

W3C Documentation reference: #func-doc-available
[3.0] fn:element-with-id()
https://www.w3.org/TR/xpath-functions-31/#func-element-with-id

W3C Documentation reference: #func-element-with-id
[3.0] fn:encode-for-uri(uri-part)
Encodes reserved characters in a string that is intended to be used in the path segment of a URI.

W3C Documentation reference: #func-encode-for-uri
[3.0] fn:environment-variable(name)
Returns the value of a system environment variable, if it exists

W3C Documentation reference: #func-environment-variable
[3.0] fn:escape-html-uri(uri)
Escapes a URI in the same way that HTML user agents handle attribute values expected to contain URIs

W3C Documentation reference: #func-escape-html-uri
[3.0] fn:iri-to-uri(iri)
Converts a string containing an IRI into a URI

W3C Documentation reference: #func-iri-to-uri
[3.0] fn:for-each(sequence*, function)
Applies function item to every element in sequence

W3C Documentation reference: #func-for-each
[3.0] fn:for-each-pair(sequence*, sequence*, function)
Applies the function to consecutive pairs of elements taken from sequences

W3C Documentation reference: #func-for-each-pair
[3.0] fn:fold-left(sequence*, baseValue, function)
Applies function item to every element in sequence, accumulating value

W3C Documentation reference: #func-fold-left
[3.0] fn:fold-right()
Applies function item to every element in sequence, accumulating value

W3C Documentation reference: #func-fold-right
[3.0] fn:filter(sequence*, function)
Returns those items from the sequence for which the supplied function returns true

W3C Documentation reference: #func-filter