header

XPath Quick Reference

These functions are part of the XPath and XSLT languages, which are used to manipulate and query XML documents. They can be used in the context of an XPath expression or an XSLT stylesheet, depending on the context in which they are used.

  • fn:abs() returns the absolute value of a number.
  • fn:adjust-date-to-timezone() adjusts a date value to a specific timezone.
  • fn:adjust-dateTime-to-timezone() adjusts a date and time value to a specific timezone.
  • fn:adjust-time-to-timezone() adjusts a time value to a specific timezone.
  • fn:avg() returns the average of a sequence of numbers.
  • fn:base-uri() returns the base URI of a node or an empty sequence if the node has no base URI.
  • fn:boolean() converts its argument to a boolean value.
  • fn:ceiling() returns the smallest integer that is greater than or equal to a number.
  • fn:codepoint-equal() compares two strings based on their Unicode code points and returns true if they are equal, or false if they are not.
  • fn:codepoints-to-string() converts a sequence of integers representing Unicode code points to a string.
  • fn:collection() returns a sequence of nodes selected from a URI or an in-memory document.
  • fn:compare() compares two strings and returns an integer indicating their relative order.
  • fn:concat() concatenates two or more strings.
  • fn:contains() returns true if a string contains a specified substring, or false if it does not.
  • fn:count() returns the number of items in a sequence.
  • fn:current-date() returns the current date as a date value.
  • fn:current-dateTime() returns the current date and time as a dateTime value.
  • fn:current-time() returns the current time as a time value.
  • fn:data() returns the typed value of a node or an atomic value.
  • fn:dateTime() constructs a dateTime value from a given year, month, and day, and optionally hour, minute, second, and timezone.
  • fn:day-from-date() returns the day component of a date value.
  • fn:day-from-dateTime() returns the day component of a dateTime value.
  • fn:days-from-duration() returns the number of days in a duration.
  • fn:deep-equal() compares two sequences for deep equality, meaning that all items in the sequences are compared recursively.
  • fn:default-collation() returns the default collation of the implementation.
  • fn:distinct-values() returns a sequence with no duplicates, based on a comparison using the default collation.
  • fn:doc() retrieves an XML document from a URI and returns the document node.
  • fn:doc-available() returns true if an XML document is available at a given URI, or false if it is not.
  • fn:document-uri() returns the URI of the document containing a node, or an empty sequence if the node is not in a document.
  • fn:empty() returns true if a sequence is empty, or false if it is not.
  • fn:encode-for-uri() encodes a string for use in a URI.
  • fn:ends-with() returns true if a string ends with a specified substring, or false if it does not.
  • fn:error() raises an error and terminates the evaluation of an XPath expression.
  • fn:escape-html-uri() escapes certain characters in a string so that it can be used as an HTML attribute value.
  • fn:exactly-one() returns the only item in a sequence, or raises an error if the sequence contains more than one item or is empty.
  • fn:exists() returns true if a sequence contains at least one item, or false if it is empty.
  • fn:false() returns the boolean value false.
  • fn:floor() returns the largest integer that is less than or equal to a number.
  • fn:hours-from-dateTime() returns the hours component of a dateTime value.
  • fn:hours-from-duration() returns the number of hours in a duration.
  • fn:hours-from-time() returns the hours component of a time value.
  • fn:id() selects elements by their unique ID values.
  • fn:idref() selects elements by their IDREF values.
  • fn:implicit-timezone() returns the implicit timezone of the implementation.
  • fn:in-scope-prefixes() returns a sequence of namespace prefixes that are in scope for a given element.
  • fn:index-of() returns a sequence of integers representing the positions of a specified item in a sequence.
  • fn:insert-before() inserts an item or sequence of items into another sequence at a specified position.
  • fn:iri-to-uri() converts an IRI (Internationalized Resource Identifier) to a URI (Uniform Resource Identifier).
  • fn:lang() returns true if the language of a node as specified in its xml:lang attribute matches a given language, or false if it does not.
  • fn:last() returns the last item in a sequence.
  • fn:local-name() returns the local name of a node.
  • fn:local-name-from-QName() returns the local name of a QName (Qualified Name).
  • fn:lower-case() converts a string to lower case.
  • fn:matches() returns true if a string matches a regular expression, or false if it does not.
  • fn:max() returns the maximum value in a sequence of numbers.
  • fn:min() returns the minimum value in a sequence of numbers.
  • fn:minutes-from-dateTime() returns the minutes component of a dateTime value.
  • fn:minutes-from-duration() returns the number of minutes in a duration.
  • fn:minutes-from-time() returns the minutes component of a time value.
  • fn:month-from-date() returns the month component of a date value.
  • fn:month-from-dateTime() returns the month component of a dateTime value.
  • fn:months-from-duration() returns the number of months in a duration.
  • fn:name() returns the name of a node as a string.
  • fn:namespace-uri() returns the namespace URI of a node.
  • fn:namespace-uri-for-prefix() returns the namespace URI associated with a given prefix.
  • fn:namespace-uri-from-QName() returns the namespace URI of a QName (Qualified Name).
  • fn:nilled() returns true if an element has the xsi:nil attribute set to true, or false if it does not.
  • fn:node-name() returns the name of a node as a QName (Qualified Name).
  • fn:normalize-space() removes leading and trailing whitespace from a string, and replaces sequences of whitespace characters with a single space.
  • fn:normalize-unicode() normalizes a string to Unicode Normalization Form C.
  • fn:not() returns the boolean negation of its argument.
  • fn:number() converts its argument to a number.
  • fn:one-or-more() returns the argument if it contains one or more items, or raises an error if it is empty.
  • fn:position() returns the position of an item in the context of a sequence.
  • fn:prefix-from-QName() returns the namespace prefix of a QName (Qualified Name).
  • fn:QName() constructs a QName (Qualified Name) from a namespace URI and a local name.
  • fn:remove() removes an item or sequence of items from a sequence.
  • fn:replace() replaces substrings in a string that match a regular expression with a specified replacement string.
  • fn:resolve-QName() constructs a QName (Qualified Name) from a lexical QName and a namespace URI.
  • fn:resolve-uri() resolves a relative URI against a base URI.
  • fn:reverse() returns a sequence with the items in reverse order.
  • fn:root() returns the root node of the tree containing a given node.
  • fn:round() rounds a number to the nearest integer.
  • fn:round-half-to-even() rounds a number to the nearest integer, using "half to even" rounding.
  • fn:seconds-from-dateTime() returns the seconds component of a dateTime value.
  • fn:seconds-from-duration() returns the number of seconds in a duration.
  • fn:seconds-from-time() returns the seconds component of a time value.
  • fn:starts-with() returns true if a string starts with a specified substring, or false if it does not.
  • fn:static-base-uri() returns the base URI of the static context.
  • fn:string() converts its argument to a string.
  • fn:string-join() concatenates a sequence of strings into a single string, with a specified separator.
  • fn:string-length() returns the number of characters in a string.
  • fn:string-to-codepoints() converts a string to a sequence of integers representing its Unicode code points.
  • fn:subsequence() returns a subsequence of a sequence.
  • fn:substring() returns a substring of a string.
  • fn:substring-after() returns the substring of a string after the first occurrence of a specified substring.
  • fn:substring-before() returns the substring of a string before the first occurrence of a specified substring.
  • fn:sum() returns the sum of a sequence of numbers.
  • fn:timezone-from-date() returns the timezone component of a date value.
  • fn:timezone-from-dateTime() returns the timezone component of a dateTime value.
  • fn:timezone-from-time() returns the timezone component of a time value.
  • fn:tokenize() tokenizes a string into a sequence of strings, using a specified regular expression as the delimiter.
  • fn:trace() writes a message to the trace output, for debugging purposes.
  • fn:translate() replaces characters in a string with specified characters.
  • fn:true() returns the boolean value true.
  • fn:unordered() returns a sequence in an implementation-defined order that is not necessarily the same as the order of the original sequence.
  • fn:upper-case() converts a string to upper case.
  • fn:year-from-date() returns the year component of a date value.
  • fn:year-from-dateTime() returns the year component of a dateTime value.
  • fn:years-from-duration() returns the number of years in a duration.
  • fn:zero-or-one() returns the argument if it contains zero or one items, or raises an error if it contains more than one item.
  • op:add-dayTimeDuration-to-date() adds a dayTimeDuration to a date value.
  • op:add-dayTimeDuration-to-dateTime() adds a dayTimeDuration to a dateTime value.
  • op:add-dayTimeDuration-to-time() adds a dayTimeDuration to a time value.
  • op:add-dayTimeDurations() adds two dayTimeDuration values.
  • op:add-yearMonthDuration-to-date() adds a yearMonthDuration to a date value.
  • op:add-yearMonthDuration-to-dateTime() adds a yearMonthDuration to a dateTime value.
  • op:add-yearMonthDurations() adds two yearMonthDuration values.
  • op:base64Binary-equal() compares two base64Binary values for equality.
  • op:boolean-equal() compares two boolean values for equality.
  • op:boolean-greater-than() compares two boolean values to determine which is greater.
  • op:boolean-less-than() compares two boolean values to determine which is less.
  • op:concatenate() concatenates two strings.
  • op:date-equal() compares two date values for equality.
  • op:date-greater-than() compares two date values to determine which is greater.
  • op:date-less-than() compares two date values to determine which is less.
  • op:dateTime-equal() compares two dateTime values for equality.
  • op:dateTime-greater-than() compares two dateTime values to determine which is greater.
  • op:dateTime-less-than() compares two dateTime values to determine which is less.
  • op:dayTimeDuration-greater-than() compares two dayTimeDuration values to determine which is greater.
  • op:dayTimeDuration-less-than() compares two dayTimeDuration values to determine which is less.
  • op:divide-dayTimeDuration() divides a dayTimeDuration by a number.
  • op:divide-dayTimeDuration-by-dayTimeDuration() divides a dayTimeDuration by another dayTimeDuration.
  • op:divide-yearMonthDuration() divides a yearMonthDuration by a number.
  • op:divide-yearMonthDuration-by-yearMonthDuration() divides a yearMonthDuration by another yearMonthDuration.
  • op:duration-equal() compares two duration values for equality.
  • op:except() returns a sequence containing the items that are in one sequence but not in another.
  • op:gDay-equal() compares two gDay values for equality.
  • op:gMonth-equal() compares two gMonth values for equality.
  • op:gMonthDay-equal() compares two gMonthDay values for equality.
  • op:gYear-equal() compares two gYear values for equality.
  • op:gYearMonth-equal() compares two gYearMonth values for equality.
  • op:hexBinary-equal() compares two hexBinary values for equality.
  • op:intersect() returns a sequence containing the items that are in both of two sequences.
  • op:is-same-node() returns true if two nodes are the same node, or false if they are not.
  • op:multiply-dayTimeDuration() multiplies a dayTimeDuration by a number.
  • op:multiply-yearMonthDuration() multiplies a yearMonthDuration by a number.
  • op:node-after() returns true if one node is after another in document order, or false if it is not.
  • op:node-before() returns true if one node is before another in document order, or false if it is not.
  • op:NOTATION-equal() compares two NOTATION values for equality.
  • op:numeric-add() adds two numeric values.
  • op:numeric-divide() divides a numeric value by another numeric value.
  • op:numeric-equal() compares two numeric values for equality.
  • op:numeric-greater-than() compares two numeric values to determine which is greater.
  • op:numeric-integer-divide() divides a numeric value by another numeric value, and returns the integer part of the result.
  • op:numeric-less-than() compares two numeric values to determine which is less.
  • op:numeric-mod() returns the remainder of dividing a numeric value by another numeric value.
  • op:numeric-multiply() multiplies two numeric values.
  • op:numeric-subtract() subtracts one numeric value from another.
  • op:numeric-unary-minus() negates a numeric value.
  • op:numeric-unary-plus() returns the positive version of a numeric value.
  • op:QName-equal() compares two QName values for equality.
  • op:subtract-dateTimes() subtracts one dateTime value from another, returning the result as a dayTimeDuration.
  • op:subtract-dates() subtracts one date value from another, returning the result as a dayTimeDuration.
  • op:subtract-dayTimeDuration-from-date() subtracts a dayTimeDuration from a date value.
  • op:subtract-dayTimeDuration-from-dateTime() subtracts a dayTimeDuration from a dateTime value.
  • op:subtract-dayTimeDuration-from-time() subtracts a dayTimeDuration from a time value.
  • op:subtract-dayTimeDurations() subtracts one dayTimeDuration value from another.
  • op:subtract-times() subtracts one time value from another, returning the result as a dayTimeDuration.
  • op:subtract-yearMonthDuration-from-date() subtracts a yearMonthDuration from a date value.
  • op:subtract-yearMonthDuration-from-dateTime() subtracts a yearMonthDuration from a dateTime value.
  • op:subtract-yearMonthDurations() subtracts one yearMonthDuration value from another.
  • op:time-equal() compares two time values for equality.
  • op:time-greater-than() compares two time values to determine which is greater.
  • op:time-less-than() compares two time values to determine which is less.
  • op:to() returns a sequence of integers starting at one number and ending at another number, incrementing by a specified step value.
  • op:union() returns a sequence containing the items that are in either of two sequences.
  • op:yearMonthDuration-greater-than() compares two yearMonthDuration values to determine which is greater.
  • op:yearMonthDuration-less-than() compares two yearMonthDuration values to determine which is less.

XSLT Reference