XSLT & XPath Function Reference
Complete reference for XSLT elements and XPath functions, organized by version. Each entry includes syntax, parameters, and runnable examples.
XSLT Elements
- xsl:accept XSLT 3.0 Inside xsl:use-package, accepts specific components from the used package and …
- xsl:decimal-format XSLT 1.0 Defines a named decimal format controlling how format-number() formats numbers …
- xsl:expose XSLT 3.0 Controls the visibility of components in an xsl:package, determining which are …
- xsl:key XSLT 1.0 Defines a named index for efficiently selecting nodes using the key() function …
- xsl:message XSLT 1.0 Emits a diagnostic message to the processor's error output; optionally …
- xsl:namespace-alias XSLT 1.0 Maps a namespace prefix used in the stylesheet to a different prefix in the …
- xsl:number XSLT 1.0 Formats a number or automatically generates a sequence number based on the …
- xsl:override XSLT 3.0 Inside xsl:use-package, provides local implementations that replace specific …
- xsl:package XSLT 3.0 The root element of an XSLT 3.0 package, a named and versioned reusable unit of …
- xsl:use-accumulators XSLT 3.0 Declares which accumulators are active for a streaming template or mode, …
- xsl:use-package XSLT 3.0 Declares that the current stylesheet or package uses components from a named …
- xsl:accumulator XSLT 3.0 Declares a streaming accumulator that maintains a typed value updated by rules …
- xsl:accumulator-rule XSLT 3.0 Defines when and how an xsl:accumulator's value is updated, matching nodes by …
- xsl:analyze-string XSLT 2.0 Processes a string against a regular expression, separating matching and …
- xsl:apply-templates XSLT 1.0 Selects a set of nodes and applies the best-matching template rule to each one, …
- xsl:array XSLT 3.0 Creates an XDM array from xsl:array-member children, providing ordered …
- xsl:array-member XSLT 3.0 Defines a single member inside an xsl:array; the member value is any XDM …
- xsl:attribute XSLT 1.0 Creates an attribute on the nearest ancestor result element, with a name and …
- xsl:attribute-set XSLT 1.0 Defines a named, reusable collection of attributes that can be applied to …
- xsl:break XSLT 3.0 Exits an xsl:iterate loop early and returns an optional final value, enabling …
- xsl:call-template XSLT 1.0 Invokes a named template by name, optionally passing parameters, without …
- xsl:catch XSLT 3.0 Handles dynamic errors thrown inside an xsl:try block, with access to error …
- xsl:character-map XSLT 2.0 Declares a named mapping of individual characters to output strings, applied …
- xsl:choose XSLT 1.0 Multi-branch conditional that evaluates xsl:when conditions in order and …
- xsl:comment XSLT 1.0 Generates an XML comment node in the result tree with content computed from the …
- xsl:copy XSLT 1.0 Creates a shallow copy of the current node — the node itself but not its …
- xsl:copy-of XSLT 1.0 Performs a deep copy of a node-set or value into the result tree, preserving all …
- xsl:element XSLT 1.0 Creates an element node in the result tree with a name computed at runtime from …
- xsl:fallback XSLT 2.0 Provides fallback content to execute when an enclosing extension element or …
- xsl:for-each XSLT 1.0 Iterates over a node-set or sequence, applying the contained template body to …
- xsl:for-each-group XSLT 2.0 Groups a sequence of items by a key expression or adjacent values, then iterates …
- xsl:fork XSLT 3.0 Processes a streamed sequence in multiple independent branches simultaneously, …
- xsl:function XSLT 2.0 Defines a named, callable stylesheet function available in XPath expressions …
- xsl:if XSLT 1.0 Conditionally outputs content when a boolean XPath expression evaluates to true; …
- xsl:import XSLT 1.0 Imports another stylesheet at a lower import precedence, allowing the importing …
- xsl:import-schema XSLT 2.0 Imports an XML Schema to enable schema-aware processing, typed variable …
- xsl:include XSLT 1.0 Merges another stylesheet's top-level declarations into the current stylesheet …
- xsl:iterate XSLT 3.0 Processes a sequence item-by-item with carry-forward parameters, enabling …
- xsl:map XSLT 3.0 Creates an XDM map from one or more xsl:map-entry children, enabling key-value …
- xsl:map-entry XSLT 3.0 Adds a single key-value pair to an xsl:map, where the key is any atomic value …
- xsl:matching-substring XSLT 2.0 Defines the template body applied to each substring that matches the regex …
- xsl:merge XSLT 3.0 Merges multiple pre-sorted sequences into a single sorted sequence, processing …
- xsl:merge-action XSLT 3.0 Defines the body executed for each group of items sharing the same merge key …
- xsl:merge-key XSLT 3.0 Defines the sort key for items in an xsl:merge-source, determining how items …
- xsl:merge-source XSLT 3.0 Defines one sorted input sequence for xsl:merge, specifying the source data and …
- xsl:mode XSLT 3.0 Declares a named mode and its default behaviour when no template matches, …
- xsl:namespace XSLT 2.0 Creates a namespace node on the current element, binding a prefix to a namespace …
- xsl:next-iteration XSLT 3.0 Advances an xsl:iterate loop to the next item in the sequence, optionally …
- xsl:next-match XSLT 2.0 Applies the next-priority matching template rule for the current node, passing …
- xsl:non-matching-substring XSLT 2.0 Defines the template body applied to each substring that does not match the …
- xsl:on-empty XSLT 3.0 Generates fallback content when the sibling sequence constructor produces no …
- xsl:on-non-empty XSLT 3.0 Generates content only when the sibling sequence constructor produces at least …
- xsl:otherwise XSLT 1.0 Default fallback branch inside xsl:choose, instantiated when no xsl:when …
- xsl:output XSLT 1.0 Controls how the result tree is serialised — output method, encoding, …
- xsl:output-character XSLT 2.0 Specifies a single character-to-string substitution within an xsl:character-map, …
- xsl:param XSLT 1.0 Declares a parameter with an optional default value, accepting values passed via …
- xsl:perform-sort XSLT 2.0 Sorts a sequence of items and returns the sorted sequence without iterating over …
- xsl:preserve-space XSLT 1.0 Explicitly preserves whitespace-only text nodes in the named source elements, …
- xsl:processing-instruction XSLT 1.0 Generates an XML processing instruction in the result tree with a computed name …
- xsl:result-document XSLT 2.0 Writes transformation output to a secondary result document at a specified URI, …
- xsl:sequence XSLT 2.0 Returns a sequence of items; the XSLT 2.0 equivalent of xsl:value-of for typed …
- xsl:sort XSLT 1.0 Specifies a sort key for xsl:apply-templates or xsl:for-each, controlling the …
- xsl:stream XSLT 3.0 Processes a source document in streaming mode without loading it fully into …
- xsl:strip-space XSLT 1.0 Removes whitespace-only text nodes from the specified source elements before the …
- xsl:stylesheet XSLT 1.0 Root element of every XSLT stylesheet, declaring the version, namespace, and …
- xsl:template XSLT 1.0 Defines a template rule that fires when a node matches a pattern, or a named …
- xsl:text XSLT 1.0 Outputs literal text exactly as written, preserving all whitespace and …
- xsl:transform XSLT 1.0 Synonym for xsl:stylesheet — the root element of an XSLT stylesheet, …
- xsl:try XSLT 3.0 Evaluates an XPath expression or sequence constructor and catches any dynamic …
- xsl:value-of XSLT 1.0 Outputs the string value of an XPath expression as a text node in the result …
- xsl:variable XSLT 1.0 Binds a name to a value or node-set for the duration of the enclosing scope; …
- xsl:when XSLT 1.0 Condition branch inside xsl:choose; its content is output when test evaluates to …
- xsl:where-populated XSLT 3.0 Suppresses the entire wrapper element, including its start and end tags, when …
- xsl:with-param XSLT 1.0 Supplies a parameter value to a called or applied template, overriding that …
XPath Functions
- accumulator-after() XSLT 3.0 Returns the value of a named accumulator computed after processing the current …
- accumulator-before() XSLT 3.0 Returns the value of a named accumulator computed before processing the current …
- array:filter() XSLT 3.0 Returns a new array containing only the members for which a predicate function …
- array:flatten() XSLT 3.0 Recursively flattens nested arrays into a single flat sequence of atomic items …
- array:fold-left() XSLT 3.0 Accumulates a result by applying a function to each array member from left to …
- array:fold-right() XSLT 3.0 Accumulates a result by applying a function to each array member from right to …
- array:for-each-pair() XSLT 3.0 Returns a new array by applying the function to corresponding members of two …
- array:for-each() XSLT 3.0 Returns a new array where each member is the result of applying the function to …
- array:insert-before() XSLT 3.0 Returns a new array with the given members inserted before the specified 1-based …
- array:remove() XSLT 3.0 Returns a new array with the members at the specified 1-based positions removed.
- array:sort() XSLT 3.0 Returns a new array with members sorted using an optional collation and key …
- available-environment-variables() XSLT 3.0 Returns a sequence of strings naming the environment variables that are …
- copy-of() XSLT 2.0 Returns a deep copy of all nodes in the sequence, detached from the original …
- current-merge-group() XSLT 3.0 Returns the sequence of items in the current merge group inside an …
- current-merge-key() XSLT 3.0 Returns the current merge key value inside an xsl:merge-action block.
- deep-equal() XSLT 2.0 Returns true if two sequences are deeply equal: same items in the same order …
- environment-variable() XSLT 3.0 Returns the value of the named environment variable as a string, or the empty …
- error() XSLT 2.0 Raises a dynamic error with an optional error code, description message, and …
- exactly-one() XSLT 2.0 Asserts that the sequence contains exactly one item; raises a dynamic error if …
- has-children() XSLT 3.0 Returns true if the node has one or more child nodes; defaults to the context …
- innermost() XSLT 3.0 Returns the nodes from the input that are not ancestors of any other node in the …
- json-doc() XSLT 3.0 Retrieves a JSON document from a URI and parses it into XDM value using the same …
- json-to-xml() XSLT 3.0 Converts a JSON string to its W3C standard XML representation, producing an …
- local-name-from-QName() XSLT 2.0 Returns the local part of an xs:QName value as an xs:NCName.
- namespace-uri-from-QName() XSLT 2.0 Returns the namespace URI part of an xs:QName value.
- one-or-more() XSLT 2.0 Asserts that the sequence contains one or more items; raises a dynamic error if …
- outermost() XSLT 3.0 Returns the nodes from the input that are not descendants of any other node in …
- parse-json() XSLT 3.0 Parses a JSON string and returns the result as an XDM map, array, string, …
- path() XSLT 3.0 Returns a string that is a valid XPath expression identifying the path from the …
- prefix-from-QName() XSLT 2.0 Returns the namespace prefix of an xs:QName value, or the empty sequence if the …
- resolve-QName() XSLT 2.0 Resolves a lexical QName string against the in-scope namespace bindings of a …
- reverse() XSLT 2.0 Returns the items of a sequence in reverse order.
- serialize() XSLT 3.0 Serializes a node or sequence to a string using the W3C serialization …
- snapshot() XSLT 3.0 Returns a snapshot copy of the sequence, making streamed nodes available for …
- subsequence() XSLT 2.0 Returns a contiguous subsequence of items starting at a 1-based position.
- trace() XSLT 2.0 Emits a trace message to the processor's trace output and returns the value …
- type-available() XSLT 2.0 Returns true if the schema type named by the argument is available in the static …
- unordered() XSLT 2.0 Returns the items in the sequence in an implementation-defined order; a hint to …
- xml-to-json() XSLT 3.0 Converts the W3C XML representation of JSON back to a JSON string, reversing …
- zero-or-one() XSLT 2.0 Asserts that the sequence contains zero or one items; raises a dynamic error if …
- abs() XSLT 2.0 Returns the absolute value of a numeric argument, removing any negative sign …
- apply() XSLT 3.0 Calls a function item with arguments supplied as an array, enabling dynamic …
- array:append() XSLT 3.0 Returns a new array with an additional member appended at the end.
- array:get() XSLT 3.0 Returns the member of an array at a specified 1-based position.
- array:head() XSLT 3.0 Returns the first member of an array; raises an error if the array is empty.
- array:join() XSLT 3.0 Concatenates a sequence of arrays into a single array by combining all their …
- array:put() XSLT 3.0 Returns a new array with the member at a given position replaced by a new value.
- array:reverse() XSLT 3.0 Returns a new array with the members in reverse order.
- array:size() XSLT 3.0 Returns the number of members in an array.
- array:subarray() XSLT 3.0 Returns a contiguous sub-array starting at a given position, with optional …
- array:tail() XSLT 3.0 Returns a new array containing all members except the first; raises an error if …
- avg() XSLT 2.0 Returns the arithmetic mean of a sequence of numeric values, or the empty …
- base-uri() XSLT 2.0 Returns the base URI of a node as an xs:anyURI, combining the document's URI …
- boolean() XSLT 1.0 Converts any XPath value — node-set, string, number, or boolean — to a boolean …
- ceiling() XSLT 1.0 Returns the smallest integer not less than the argument — equivalent to rounding …
- codepoints-to-string() XSLT 2.0 Constructs a string from a sequence of Unicode codepoint integers, enabling …
- collection() XSLT 2.0 Returns a sequence of nodes from a named collection, enabling batch processing …
- compare() XSLT 2.0 Compares two strings using a collation and returns -1, 0, or 1 indicating their …
- concat() XSLT 1.0 Concatenates two or more strings into a single string, accepting any number of …
- contains() XSLT 1.0 Returns true if the first string contains the second string as a substring, …
- count() XSLT 1.0 Returns the number of nodes in a node-set or items in a sequence as an integer.
- current-date() XSLT 2.0 Returns the current date as an xs:date value, stable for the duration of the …
- current-dateTime() XSLT 2.0 Returns the current date and time as an xs:dateTime value, fixed for the …
- current-group() XSLT 2.0 Returns the sequence of items in the current group inside an xsl:for-each-group …
- current-grouping-key() XSLT 2.0 Returns the grouping key of the current group inside an xsl:for-each-group …
- current-output-uri() XSLT 2.0 Returns the URI of the current result document being written inside an …
- current-time() XSLT 2.0 Returns the current time as an xs:time value, stable and fixed for the duration …
- current() XSLT 1.0 Returns the context node of the innermost xsl:template or xsl:for-each, …
- day-from-date() XSLT 2.0 Extracts the day-of-month component from an xs:date value as an xs:integer in …
- distinct-values() XSLT 2.0 Returns a sequence containing only the distinct values from the input sequence, …
- document-uri() XSLT 2.0 Returns the URI of the document node that contains the given node, as an …
- document() XSLT 1.0 Loads an external XML document by URI and returns its root node as a node-set, …
- element-available() XSLT 1.0 Returns true if the named XSLT instruction or extension element is supported by …
- empty() XSLT 2.0 Returns true if the sequence has zero items, and false if it contains one or …
- ends-with() XSLT 2.0 Returns true if the first string ends with the second string, using optional …
- exists() XSLT 2.0 Returns true if the sequence contains at least one item, and false if it is …
- false() XSLT 1.0 Returns the boolean value false. Used in XPath expressions where an explicit …
- filter() XSLT 3.0 Returns items from a sequence for which a predicate function returns true, …
- floor() XSLT 1.0 Returns the largest integer not greater than the argument — equivalent to …
- fold-left() XSLT 3.0 Accumulates a result by applying a function left-to-right over a sequence, …
- fold-right() XSLT 3.0 Accumulates a result by applying a function right-to-left over a sequence, …
- for-each-pair() XSLT 3.0 Applies a binary function to corresponding items from two sequences, returning …
- for-each() XSLT 3.0 Applies a function to each item of a sequence and returns the concatenation of …
- format-date() XSLT 2.0 Formats an xs:date value into a human-readable string using a picture pattern, …
- format-dateTime() XSLT 2.0 Formats an xs:dateTime value into a human-readable string using a picture …
- format-number() XSLT 1.0 Formats a number as a string using a picture pattern and an optional named …
- format-time() XSLT 2.0 Formats an xs:time value into a human-readable string using a picture pattern, …
- function-arity() XSLT 3.0 Returns the number of arguments (arity) that a function item accepts.
- function-available() XSLT 1.0 Returns true if the named function is available in the current XSLT processor, …
- function-lookup() XSLT 3.0 Returns a function item identified by its QName and arity, or the empty sequence …
- function-name() XSLT 3.0 Returns the QName of a named function item, or the empty sequence if the …
- generate-id() XSLT 1.0 Returns a unique string identifier for a node, guaranteed to be a valid XML name …
- hours-from-time() XSLT 2.0 Extracts the hours component from an xs:time value as an xs:integer in the range …
- id() XSLT 1.0 Selects elements in the document whose ID attribute value matches the given …
- implicit-timezone() XSLT 2.0 Returns the processor's implicit timezone as an xs:dayTimeDuration, used when …
- index-of() XSLT 2.0 Returns a sequence of 1-based integer positions where a value occurs in a …
- insert-before() XSLT 2.0 Returns a new sequence with one or more items inserted at a specified 1-based …
- key() XSLT 1.0 Looks up nodes using a named xsl:key index, returning all nodes whose key value …
- lang() XSLT 1.0 Returns true if the context node's xml:lang attribute matches the given language …
- last() XSLT 1.0 Returns the size of the context node-set, i.e. the index of the last item in the …
- local-name() XSLT 1.0 Returns the local part of the expanded name of a node, stripping any namespace …
- lower-case() XSLT 2.0 Converts every character of a string to its Unicode lowercase equivalent using …
- map:contains() XSLT 3.0 Returns true if a map contains an entry with the specified key, false otherwise.
- map:entry() XSLT 3.0 Creates a singleton map containing exactly one key-value pair.
- map:get() XSLT 3.0 Returns the value associated with a key in a map, or the empty sequence if the …
- map:keys() XSLT 3.0 Returns all keys of a map as a sequence of atomic values in …
- map:merge() XSLT 3.0 Merges multiple maps into one, with duplicate key handling controlled by an …
- map:put() XSLT 3.0 Returns a new map with a key-value entry added or updated, leaving the original …
- map:remove() XSLT 3.0 Returns a new map with one or more specified keys removed, leaving the original …
- map:size() XSLT 3.0 Returns the number of key-value entries in a map.
- matches() XSLT 2.0 Tests whether a string matches a regular expression, returning true or false.
- max() XSLT 2.0 Returns the largest value in a sequence of comparable items, optionally using a …
- min() XSLT 2.0 Returns the smallest value in a sequence of comparable items, optionally using a …
- minutes-from-time() XSLT 2.0 Extracts the minutes component from an xs:time value as an xs:integer in the …
- month-from-date() XSLT 2.0 Extracts the month component from an xs:date value as an xs:integer in the range …
- name() XSLT 1.0 Returns the qualified name (including namespace prefix, if any) of a node as it …
- namespace-uri() XSLT 1.0 Returns the namespace URI of a node's expanded name, or an empty string if the …
- nilled() XSLT 2.0 Returns true if an element node is schema-validated and marked as nilled with …
- node-name() XSLT 2.0 Returns the name of a node as an xs:QName value, capturing both the namespace …
- normalize-space() XSLT 1.0 Strips leading and trailing whitespace from a string and collapses all internal …
- normalize-unicode() XSLT 2.0 Applies Unicode normalization (NFC, NFD, NFKC, NFKD, or FULLY-NORMALIZED) to a …
- not() XSLT 1.0 Returns true if its boolean argument is false, and false if it is true — the …
- number() XSLT 1.0 Converts a string, boolean, or node-set to a number following XPath 1.0 …
- parse-xml-fragment() XSLT 2.0 Parses a well-balanced XML fragment string and returns it as a document node, …
- parse-xml() XSLT 2.0 Parses a well-formed XML string and returns it as a new document node, usable …
- position() XSLT 1.0 Returns the position of the context node within the current node-set, starting …
- QName() XSLT 2.0 Constructs an xs:QName value from a namespace URI and a lexical qualified name …
- random-number-generator() XSLT 3.0 Returns a deterministic pseudo-random number generator as a map, optionally …
- regex-group() XSLT 2.0 Returns the string matched by a numbered capture group of the current regex …
- remove() XSLT 2.0 Returns a new sequence with the item at a specified 1-based position removed, …
- replace() XSLT 2.0 Replaces all substrings of a string that match a regular expression with a …
- round() XSLT 1.0 Returns the integer closest to the argument, rounding half-values toward …
- seconds-from-time() XSLT 2.0 Extracts the seconds component from an xs:time value as an xs:decimal, including …
- sort() XSLT 3.0 Sorts a sequence of items using an optional collation and key function, …
- starts-with() XSLT 1.0 Returns true if the first string begins with the second string as an exact …
- static-base-uri() XSLT 2.0 Returns the static base URI of the stylesheet module as an xs:anyURI, i.e., the …
- string-join() XSLT 2.0 Joins a sequence of strings into a single string with a specified separator …
- string-length() XSLT 1.0 Returns the number of characters in a string, or the length of the context …
- string-to-codepoints() XSLT 2.0 Returns a sequence of integers representing the Unicode codepoints of each …
- string() XSLT 1.0 Converts a node-set, number, or boolean to its XPath string value, or returns …
- substring-after() XSLT 1.0 Returns the part of a string that appears after the first occurrence of a given …
- substring-before() XSLT 1.0 Returns the part of a string that appears before the first occurrence of a given …
- substring() XSLT 1.0 Extracts a portion of a string by start position and optional length, returning …
- sum() XSLT 1.0 Returns the sum of the numeric values in a node-set or sequence, or a specified …
- system-property() XSLT 1.0 Returns the value of a named XSLT system property such as the XSLT version, …
- tokenize() XSLT 2.0 Splits a string into a sequence of substrings using a regular expression as the …
- translate() XSLT 1.0 Replaces characters in a string one-for-one using a from/to mapping, or removes …
- true() XSLT 1.0 Returns the boolean value true. Used in XPath expressions and xsl:if tests where …
- unparsed-entity-uri() XSLT 1.0 Returns the URI of an unparsed entity declared in the DTD of the source …
- unparsed-text-available() XSLT 2.0 Returns true if unparsed-text() would succeed for the given URI and encoding, …
- unparsed-text-lines() XSLT 2.0 Reads a text file from a URI and returns its lines as a sequence of strings, one …
- unparsed-text() XSLT 2.0 Reads a plain text file from a URI and returns its contents as an xs:string, …
- upper-case() XSLT 2.0 Converts every character of a string to its Unicode uppercase equivalent using …
- uri-collection() XSLT 2.0 Returns a sequence of xs:anyURI values from a named collection, giving the URIs …
- year-from-date() XSLT 2.0 Extracts the year component from an xs:date value as an xs:integer.