XPath and XQuery built in functions

http://www.w3.org/2005/xpath-functions

This module is statically bound to the prefix "fn".

Description

XPath and XQuery built-in functions.

The optional function fn:transform is not implemented and will throw error err:FOXT0001 when used.

The functions fn:available-environment-variables and fn:environment-variable will only return values if the application configuration value environment_access is set to true.

Functions

fn:abs


Signature
fn:abs($arg as xs:numeric?) as xs:numeric?
Description

Returns the absolute value of $arg.

back to top

fn:adjust-date-to-timezone


Signature
fn:adjust-date-to-timezone($arg as xs:date?) as xs:date?
fn:adjust-date-to-timezone($arg as xs:date?, $timezone as xs:dayTimeDuration?) as xs:date?
Description

Adjusts an xs:date value to a specific timezone, or to no timezone at all; the result is the date in the target timezone that contains the starting instant of the supplied date.

back to top

fn:adjust-dateTime-to-timezone


Signature
fn:adjust-dateTime-to-timezone($arg as xs:dateTime?) as xs:dateTime?
fn:adjust-dateTime-to-timezone($arg as xs:dateTime?, $timezone as xs:dayTimeDuration?) as xs:dateTime?
Description

Adjusts an xs:dateTime value to a specific timezone, or to no timezone at all.

back to top

fn:adjust-time-to-timezone


Signature
fn:adjust-time-to-timezone($arg as xs:time?) as xs:time?
fn:adjust-time-to-timezone($arg as xs:time?, $timezone as xs:dayTimeDuration?) as xs:time?
Description

Adjusts an xs:time value to a specific timezone, or to no timezone at all.

back to top

fn:analyze-string


Signature
fn:analyze-string($input as xs:string?, $pattern as xs:string) as element(fn:analyze-string-result)
fn:analyze-string($input as xs:string?, $pattern as xs:string, $flags as xs:string) as element(fn:analyze-string-result)
Description

Analyzes a string using a regular expression, returning an XML structure that identifies which parts of the input string matched or failed to match the regular expression, and in the case of matched substrings, which substrings matched each capturing group in the regular expression.

back to top

fn:apply


Signature
fn:apply($function as function(*), $array as array(*)) as item()*
Description

Makes a dynamic call on a function with an argument list supplied in the form of an array.

back to top

fn:available-environment-variables


Signature
fn:available-environment-variables() as xs:string*
Description

Returns a list of environment variable names that are suitable for passing to fn:environment-variable, as a (possibly empty) sequence of strings.

back to top

fn:avg


Signature
fn:avg($arg as xs:anyAtomicType*) as xs:anyAtomicType?
Description

Returns the average of the values in the input sequence $arg, that is, the sum of the values divided by the number of values.

back to top

fn:base-uri


Signature
fn:base-uri() as xs:anyURI?
fn:base-uri($arg as node()?) as xs:anyURI?
Description

Returns the base URI of a node.

back to top

fn:boolean


Signature
fn:boolean($arg as item()*) as xs:boolean
Description

Computes the effective boolean value of the sequence $arg.

back to top

fn:ceiling


Signature
fn:ceiling($arg as xs:numeric?) as xs:numeric?
Description

Rounds $arg upwards to a whole number.

back to top

fn:codepoint-equal


Signature
fn:codepoint-equal($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:boolean?
Description

Returns true if two strings are equal, considered codepoint-by-codepoint.

back to top

fn:codepoints-to-string


Signature
fn:codepoints-to-string($arg as xs:integer*) as xs:string
Description

Returns an xs:string whose characters have supplied codepoints.

back to top

fn:collation-key


Signature
fn:collation-key($key as xs:string) as xs:base64Binary
fn:collation-key($key as xs:string, $collation as xs:string) as xs:base64Binary
Description

Given a string value and a collation, generates an internal value called a collation key, with the property that the matching and ordering of collation keys reflects the matching and ordering of strings under the specified collation.

back to top

fn:collection


Signature
fn:collection() as item()*
fn:collection($arg as xs:string?) as item()*
Description

Returns a sequence of items identified by a collection URI; or a default collection if no URI is supplied.

back to top

fn:compare


Signature
fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:integer?
fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?, $collation as xs:string) as xs:integer?
Description

Returns -1, 0, or 1, depending on whether $comparand1 collates before, equal to, or after $comparand2 according to the rules of a selected collation.

back to top

fn:concat


Signature
fn:concat($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:string
Description

Returns the concatenation of the string values of the arguments.

back to top

fn:contains


Signature
fn:contains($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean
fn:contains($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean
Description

Returns true if the string $arg1 contains $arg2 as a substring, taking collations into account.

back to top

fn:contains-token


Signature
fn:contains-token($input as xs:string*, $token as xs:string) as xs:boolean
fn:contains-token($input as xs:string*, $token as xs:string, $collation as xs:string) as xs:boolean
Description

Determines whether or not any of the supplied strings, when tokenized at whitespace boundaries, contains the supplied token, under the rules of the supplied collation.

back to top

fn:count


Signature
fn:count($arg as item()*) as xs:integer
Description

Returns the number of items in a sequence.

back to top

fn:current-date


Signature
fn:current-date() as xs:date
Description

Returns the current date.

back to top

fn:current-dateTime


Signature
fn:current-dateTime() as xs:dateTimeStamp
Description

Returns the current date and time (with timezone).

back to top

fn:current-time


Signature
fn:current-time() as xs:time
Description

Returns the current time.

back to top

fn:data


Signature
fn:data() as xs:anyAtomicType*
fn:data($arg as item()*) as xs:anyAtomicType*
Description

Returns the result of atomizing a sequence. This process flattens arrays, and replaces nodes by their typed values.

back to top

fn:dateTime


Signature
fn:dateTime($arg1 as xs:date?, $arg2 as xs:time?) as xs:dateTime?
Description

Returns an xs:dateTime value created by combining an xs:date and an xs:time.

back to top

fn:day-from-date


Signature
fn:day-from-date($arg as xs:date?) as xs:integer?
Description

Returns the day component of an xs:date.

back to top

fn:day-from-dateTime


Signature
fn:day-from-dateTime($arg as xs:dateTime?) as xs:integer?
Description

Returns the day component of an xs:dateTime.

back to top

fn:days-from-duration


Signature
fn:days-from-duration($arg as xs:duration?) as xs:integer?
Description

Returns the number of days in a duration.

back to top

fn:deep-equal


Signature
fn:deep-equal($parameter1 as item()*, $parameter2 as item()*) as xs:boolean
fn:deep-equal($parameter1 as item()*, $parameter2 as item()*, $collation as xs:string) as xs:boolean
Description

This function assesses whether two sequences are deep-equal to each other. To be deep-equal, they must contain items that are pairwise deep-equal; and for two items to be deep-equal, they must either be atomic values that compare equal, or nodes of the same kind, with the same name, whose children are deep-equal, or maps with matching entries, or arrays with matching members.

back to top

fn:default-collation


Signature
fn:default-collation() as xs:string
Description

Returns the value of the default collation property from the static context.

back to top

fn:default-language


Signature
fn:default-language() as xs:language
Description

Returns the value of the default language property from the dynamic context.

back to top

fn:distinct-values


Signature
fn:distinct-values($arg as xs:anyAtomicType*) as xs:anyAtomicType*
fn:distinct-values($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType*
Description

Returns the values that appear in a sequence, with duplicates eliminated.

back to top

fn:doc


Signature
fn:doc($uri as xs:string?) as document-node()?
Description

Retrieves a document using a URI supplied as an xs:string, and returns the corresponding document node.

back to top

fn:doc-available


Signature
fn:doc-available($uri as xs:string?) as xs:boolean
Description

The function returns true if and only if the function call fn:doc($uri) would return a document node.

back to top

fn:document-uri


Signature
fn:document-uri() as xs:anyURI?
fn:document-uri($arg as node()?) as xs:anyURI?
Description

Returns the URI of a resource where a document can be found, if available.

back to top

fn:element-with-id


Signature
fn:element-with-id($arg as xs:string*) as element()*
fn:element-with-id($arg as xs:string*, $node as node()) as element()*
Description

Returns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $arg.

back to top

fn:empty


Signature
fn:empty($arg as item()*) as xs:boolean
Description

Returns true if the argument is the empty sequence.

back to top

fn:encode-for-uri


Signature
fn:encode-for-uri($uri-part as xs:string?) as xs:string
Description

Encodes reserved characters in a string that is intended to be used in the path segment of a URI.

back to top

fn:ends-with


Signature
fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean
fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean
Description

Returns true if the string $arg1 contains $arg2 as a trailing substring, taking collations into account.

back to top

fn:environment-variable


Signature
fn:environment-variable($name as xs:string) as xs:string?
Description

Returns the value of a system environment variable, if it exists.

back to top

fn:error


Signature
fn:error() as none
fn:error($code as xs:QName?) as none

fn:error($code as xs:QName?, $description as xs:string) as none

fn:error($code as xs:QName?, $description as xs:string, $error-object as item()*) as none
Description

Calling the fn:error function raises an application-defined error.

back to top

fn:escape-html-uri


Signature
fn:escape-html-uri($uri as xs:string?) as xs:string
Description

Escapes a URI in the same way that HTML user agents handle attribute values expected to contain URIs.

back to top

fn:exactly-one


Signature
fn:exactly-one($arg as item()*) as item()
Description

Returns $arg if it contains exactly one item. Otherwise, raises an error.

back to top

fn:exists


Signature
fn:exists($arg as item()*) as xs:boolean
Description

Returns true if the argument is a non-empty sequence.

back to top

fn:false


Signature
fn:false() as xs:boolean
Description

Returns the xs:boolean value false.

back to top

fn:filter


Signature
fn:filter($seq as item()*, $f as function(item()) as xs:boolean) as item()*
Description

Returns those items from the sequence $seq for which the supplied function $f returns true.

back to top

fn:floor


Signature
fn:floor($arg as xs:numeric?) as xs:numeric?
Description

Rounds $arg downwards to a whole number.

back to top

fn:fold-left


Signature
fn:fold-left($seq as item()*, $zero as item()*, $f as function(item()*, item()) as item()*) as item()*
Description

Processes the supplied sequence from left to right, applying the supplied function repeatedly to each item in turn, together with an accumulated result value.

back to top

fn:fold-right


Signature
fn:fold-right($seq as item()*, $zero as item()*, $f as function(item(), item()*) as item()*) as item()*
Description

Processes the supplied sequence from right to left, applying the supplied function repeatedly to each item in turn, together with an accumulated result value.

back to top

fn:for-each


Signature
fn:for-each($seq as item()*, $action as function(item()) as item()*) as item()*
Description

Applies the function item $action to every item from the sequence $seq in turn, returning the concatenation of the resulting sequences in order.

back to top

fn:for-each-pair


Signature
fn:for-each-pair($seq1 as item()*, $seq2 as item()*, $action as function(item(), item()) as item()*) as item()*
Description

Applies the function item $action to successive pairs of items taken one from $seq1 and one from $seq2, returning the concatenation of the resulting sequences in order.

back to top

fn:format-date


Signature
fn:format-date($value as xs:date?, $picture as xs:string) as xs:string?
fn:format-date($value as xs:date?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string?
Description

Returns a string containing an xs:date value formatted for display.

back to top

fn:format-dateTime


Signature
fn:format-dateTime($value as xs:dateTime?, $picture as xs:string) as xs:string?
fn:format-dateTime($value as xs:dateTime?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string?
Description

Returns a string containing an xs:dateTime value formatted for display.

back to top

fn:format-integer


Signature
fn:format-integer($value as xs:integer?, $picture as xs:string) as xs:string
fn:format-integer($value as xs:integer?, $picture as xs:string, $lang as xs:string?) as xs:string
Description

Formats an integer according to a given picture string, using the conventions of a given natural language if specified.

back to top

fn:format-number


Signature
fn:format-number($value as xs:numeric?, $picture as xs:string) as xs:string
fn:format-number($value as xs:numeric?, $picture as xs:string, $decimal-format-name as xs:string?) as xs:string
Description

Returns a string containing a number formatted according to a given picture string, taking account of decimal formats specified in the static context.

back to top

fn:format-time


Signature
fn:format-time($value as xs:time?, $picture as xs:string) as xs:string?
fn:format-time($value as xs:time?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string?
Description

Returns a string containing an xs:time value formatted for display.

back to top

fn:function-arity


Signature
fn:function-arity($func as function(*)) as xs:integer
Description

Returns the arity of the function identified by a function item.

back to top

fn:function-lookup


Signature
fn:function-lookup($name as xs:QName, $arity as xs:integer) as function(*)?
Description

Returns the function having a given name and arity, if there is one.

back to top

fn:function-name


Signature
fn:function-name($func as function(*)) as xs:QName?
Description

Returns the name of the function identified by a function item.

back to top

fn:generate-id


Signature
fn:generate-id() as xs:string
fn:generate-id($arg as node()?) as xs:string
Description

This function returns a string that uniquely identifies a given node.

back to top

fn:has-children


Signature
fn:has-children() as xs:boolean
fn:has-children($node as node()?) as xs:boolean
Description

Returns true if the supplied node has one or more child nodes (of any kind).

back to top

back to top

fn:hours-from-dateTime


Signature
fn:hours-from-dateTime($arg as xs:dateTime?) as xs:integer?
Description

Returns the hours component of an xs:dateTime.

back to top

fn:hours-from-duration


Signature
fn:hours-from-duration($arg as xs:duration?) as xs:integer?
Description

Returns the number of hours in a duration.

back to top

fn:hours-from-time


Signature
fn:hours-from-time($arg as xs:time?) as xs:integer?
Description

Returns the hours component of an xs:time.

back to top

fn:id


Signature
fn:id($arg as xs:string*) as element()*
fn:id($arg as xs:string*, $node as node()) as element()*
Description

Returns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $arg.

back to top

fn:idref


Signature
fn:idref($arg as xs:string*) as node()*
fn:idref($arg as xs:string*, $node as node()) as node()*
Description

Returns the sequence of element or attribute nodes with an IDREF value matching the value of one or more of the ID values supplied in $arg.

back to top

fn:implicit-timezone


Signature
fn:implicit-timezone() as xs:dayTimeDuration
Description

Returns the value of the implicit timezone property from the dynamic context.

back to top

fn:in-scope-prefixes


Signature
fn:in-scope-prefixes($element as element()) as xs:string*
Description

Returns the prefixes of the in-scope namespaces for an element node.

back to top

fn:index-of


Signature
fn:index-of($seq as xs:anyAtomicType*, $search as xs:anyAtomicType) as xs:integer*
fn:index-of($seq as xs:anyAtomicType*, $search as xs:anyAtomicType, $collation as xs:string) as xs:integer*
Description

Returns a sequence of positive integers giving the positions within the sequence $seq of items that are equal to $search.

back to top

fn:innermost


Signature
fn:innermost($nodes as node()*) as node()*
Description

Returns every node within the input sequence that is not an ancestor of another member of the input sequence; the nodes are returned in document order with duplicates eliminated.

back to top

fn:insert-before


Signature
fn:insert-before($target as item()*, $position as xs:integer, $inserts as item()*) as item()*
Description

Returns a sequence constructed by inserting an item or a sequence of items at a given position within an existing sequence.

back to top

fn:iri-to-uri


Signature
fn:iri-to-uri($iri as xs:string?) as xs:string
Description

Converts a string containing an IRI into a URI according to the rules of [RFC 3987].

back to top

fn:json-doc


Signature
fn:json-doc($href as xs:string?) as item()?
fn:json-doc($href as xs:string?, $options as map(*)) as item()?
Description

Reads an external resource containing JSON, and returns the result of parsing the resource as JSON.

back to top

fn:json-to-xml


Signature
fn:json-to-xml($json-text as xs:string?) as document-node()?
fn:json-to-xml($json-text as xs:string?, $options as map(*)) as document-node()?
Description

Parses a string supplied in the form of a JSON text, returning the results in the form of an XML document node.

back to top

fn:lang


Signature
fn:lang($testlang as xs:string?) as xs:boolean
fn:lang($testlang as xs:string?, $node as node()) as xs:boolean
Description

This function tests whether the language of $node, or the context item if the second argument is omitted, as specified by xml:lang attributes is the same as, or is a sublanguage of, the language specified by $testlang.

back to top

fn:last


Signature
fn:last() as xs:integer
Description

Returns the context size from the dynamic context.

back to top

fn:load-xquery-module


Signature
fn:load-xquery-module($module-uri as xs:string) as map(*)
fn:load-xquery-module($module-uri as xs:string, $options as map(*)) as map(*)
Description

Throws error FOQM0006 when used.

Provides access to the public functions and global variables of a dynamically-loaded XQuery library module.

back to top

fn:local-name


Signature
fn:local-name() as xs:string
fn:local-name($arg as node()?) as xs:string
Description

Returns the local part of the name of $arg as an xs:string that is either the zero-length string, or has the lexical form of an xs:NCName.

back to top

fn:local-name-from-QName


Signature
fn:local-name-from-QName($arg as xs:QName?) as xs:NCName?
Description

Returns the local part of the supplied QName.

back to top

fn:lower-case


Signature
fn:lower-case($arg as xs:string?) as xs:string
Description

Converts a string to lower case.

back to top

fn:matches


Signature
fn:matches($input as xs:string?, $pattern as xs:string) as xs:boolean
fn:matches($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:boolean
Description

Returns true if the supplied string matches a given regular expression.

back to top

fn:max


Signature
fn:max($arg as xs:anyAtomicType*) as xs:anyAtomicType?
fn:max($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType?
Description

Returns a value that is equal to the highest value appearing in the input sequence.

back to top

fn:min


Signature
fn:min($arg as xs:anyAtomicType*) as xs:anyAtomicType?
fn:min($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType?
Description

Returns a value that is equal to the lowest value appearing in the input sequence.

back to top

fn:minutes-from-dateTime


Signature
fn:minutes-from-dateTime($arg as xs:dateTime?) as xs:integer?
Description

Returns the minute component of an xs:dateTime.

back to top

fn:minutes-from-duration


Signature
fn:minutes-from-duration($arg as xs:duration?) as xs:integer?
Description

Returns the number of minutes in a duration.

back to top

fn:minutes-from-time


Signature
fn:minutes-from-time($arg as xs:time?) as xs:integer?
Description

Returns the minutes component of an xs:time.

back to top

fn:month-from-date


Signature
fn:month-from-date($arg as xs:date?) as xs:integer?
Description

Returns the month component of an xs:date.

back to top

fn:month-from-dateTime


Signature
fn:month-from-dateTime($arg as xs:dateTime?) as xs:integer?
Description

Returns the month component of an xs:dateTime.

back to top

fn:months-from-duration


Signature
fn:months-from-duration($arg as xs:duration?) as xs:integer?
Description

Returns the number of months in a duration.

back to top

fn:name


Signature
fn:name() as xs:string
fn:name($arg as node()?) as xs:string
Description

Returns the name of a node, as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName.

back to top

fn:namespace-uri


Signature
fn:namespace-uri() as xs:anyURI
fn:namespace-uri($arg as node()?) as xs:anyURI
Description

Returns the namespace URI part of the name of $arg, as an xs:anyURI value.

back to top

fn:namespace-uri-for-prefix


Signature
fn:namespace-uri-for-prefix($prefix as xs:string?, $element as element()) as xs:anyURI?
Description

Returns the namespace URI of one of the in-scope namespaces for $element, identified by its namespace prefix.

back to top

fn:namespace-uri-from-QName


Signature
fn:namespace-uri-from-QName($arg as xs:QName?) as xs:anyURI?
Description

Returns the namespace URI part of the supplied QName.

back to top

fn:nilled


Signature
fn:nilled() as xs:boolean?
fn:nilled($arg as node()?) as xs:boolean?
Description

Returns true for an element that is nilled.

back to top

fn:node-name


Signature
fn:node-name() as xs:QName?
fn:node-name($arg as node()?) as xs:QName?
Description

Returns the name of a node, as an xs:QName.

back to top

fn:normalize-space


Signature
fn:normalize-space() as xs:string
fn:normalize-space($arg as xs:string?) as xs:string
Description

Returns the value of $arg with leading and trailing whitespace removed, and sequences of internal whitespace reduced to a single space character.

back to top

fn:normalize-unicode


Signature
fn:normalize-unicode($arg as xs:string?) as xs:string
fn:normalize-unicode($arg as xs:string?, $normalizationForm as xs:string) as xs:string
Description

Returns the value of $arg after applying Unicode normalization.

back to top

fn:not


Signature
fn:not($arg as item()*) as xs:boolean
Description

Returns true if the effective boolean value of $arg is false, or false if it is true.

back to top

fn:number


Signature
fn:number() as xs:double
fn:number($arg as xs:anyAtomicType?) as xs:double
Description

Returns the value indicated by $argor, if $arg is not specified, the context item after atomization, converted to an xs:double.

back to top

fn:one-or-more


Signature
fn:one-or-more($arg as item()*) as item()+
Description

Returns $arg if it contains one or more items. Otherwise, raises an error.

back to top

fn:outermost


Signature
fn:outermost($nodes as node()*) as node()*
Description

Returns every node within the input sequence that has no ancestor that is itself a member of the input sequence; the nodes are returned in document order with duplicates eliminated.

back to top

fn:parse-ietf-date


Signature
fn:parse-ietf-date($value as xs:string?) as xs:dateTime?
Description

Parses a string containing the date and time in IETF format, returning the corresponding xs:dateTime value.

back to top

fn:parse-json


Signature
fn:parse-json($json-text as xs:string?) as item()?
fn:parse-json($json-text as xs:string?, $options as map(*)) as item()?
Description

Parses a string supplied in the form of a JSON text, returning the results typically in the form of a map or array.

back to top

fn:parse-xml


Signature
fn:parse-xml($arg as xs:string?) as document-node(element(*))?
Description

This function takes as input an XML document represented as a string, and returns the document node at the root of an XDM tree representing the parsed document.

back to top

fn:parse-xml-fragment


Signature
fn:parse-xml-fragment($arg as xs:string?) as document-node()?
Description

This function takes as input an XML external entity represented as a string, and returns the document node at the root of an XDM tree representing the parsed document fragment.

back to top

fn:path


Signature
fn:path() as xs:string?
fn:path($arg as node()?) as xs:string?
Description

Returns a path expression that can be used to select the supplied node relative to the root of its containing document.

back to top

fn:position


Signature
fn:position() as xs:integer
Description

Returns the context position from the dynamic context.

back to top

fn:prefix-from-QName


Signature
fn:prefix-from-QName($arg as xs:QName?) as xs:NCName?
Description

Returns the prefix component of the supplied QName.

back to top

fn:QName


Signature
fn:QName($paramURI as xs:string?, $paramQName as xs:string) as xs:QName
Description

Returns an xs:QName value formed using a supplied namespace URI and lexical QName.

back to top

fn:random-number-generator


Signature
fn:random-number-generator() as map(xs:string, item())
fn:random-number-generator($seed as xs:anyAtomicType?) as map(xs:string, item())
Description

Returns a random number generator, which can be used to generate sequences of random numbers.

back to top

fn:remove


Signature
fn:remove($target as item()*, $position as xs:integer) as item()*
Description

Returns a new sequence containing all the items of $target except the item at position $position.

back to top

fn:replace


Signature
fn:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string
fn:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) as xs:string
Description

Returns a string produced from the input string by replacing any substrings that match a given regular expression with a supplied replacement string.

back to top

fn:resolve-QName


Signature
fn:resolve-QName($qname as xs:string?, $element as element()) as xs:QName?
Description

Returns an xs:QName value (that is, an expanded-QName) by taking an xs:string that has the lexical form of an xs:QName (a string in the form "prefix:local-name" or "local-name") and resolving it using the in-scope namespaces for a given element.

back to top

fn:resolve-uri


Signature
fn:resolve-uri($relative as xs:string?) as xs:anyURI?
fn:resolve-uri($relative as xs:string?, $base as xs:string) as xs:anyURI?
Description

Resolves a relative IRI reference against an absolute IRI.

back to top

fn:reverse


Signature
fn:reverse($arg as item()*) as item()*
Description

Reverses the order of items in a sequence.

back to top

fn:root


Signature
fn:root() as node()
fn:root($arg as node()?) as node()?
Description

Returns the root of the tree to which $arg belongs. This will usually, but not necessarily, be a document node.

back to top

fn:round


Signature
fn:round($arg as xs:numeric?) as xs:numeric?
fn:round($arg as xs:numeric?, $precision as xs:integer) as xs:numeric?
Description

Rounds a value to a specified number of decimal places, rounding upwards if two such values are equally near.

back to top

fn:round-half-to-even


Signature
fn:round-half-to-even($arg as xs:numeric?) as xs:numeric?
fn:round-half-to-even($arg as xs:numeric?, $precision as xs:integer) as xs:numeric?
Description

Rounds a value to a specified number of decimal places, rounding to make the last digit even if two such values are equally near.

back to top

fn:seconds-from-dateTime


Signature
fn:seconds-from-dateTime($arg as xs:dateTime?) as xs:decimal?
Description

Returns the seconds component of an xs:dateTime.

back to top

fn:seconds-from-duration


Signature
fn:seconds-from-duration($arg as xs:duration?) as xs:decimal?
Description

Returns the number of seconds in a duration.

back to top

fn:seconds-from-time


Signature
fn:seconds-from-time($arg as xs:time?) as xs:decimal?
Description

Returns the seconds component of an xs:time.

back to top

fn:serialize


Signature
fn:serialize($arg as item()*) as xs:string
fn:serialize($arg as item()*, $params as item()?) as xs:string
Description

This function serializes the supplied input sequence $arg as described in [XSLT and XQuery Serialization 3.1], returning the serialized representation of the sequence as a string.

back to top

fn:sort


Signature
fn:sort($input as item()*) as item()*
fn:sort($input as item()*, $collation as xs:string?) as item()*

fn:sort($input as item()*, $collation as xs:string?, $key as function(item()) as xs:anyAtomicType*) as item()*
Description

Sorts a supplied sequence, based on the value of a sort key supplied as a function.

back to top

fn:starts-with


Signature
fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean
fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean
Description

Returns true if the string $arg1 contains $arg2 as a leading substring, taking collations into account.

back to top

fn:static-base-uri


Signature
fn:static-base-uri() as xs:anyURI?
Description

This function returns the value of the static base URI property from the static context.

back to top

fn:string


Signature
fn:string() as xs:string
fn:string($arg as item()?) as xs:string
Description

Returns the value of $arg represented as an xs:string.

back to top

fn:string-join


Signature
fn:string-join($arg1 as xs:anyAtomicType*) as xs:string
fn:string-join($arg1 as xs:anyAtomicType*, $arg2 as xs:string) as xs:string
Description

Returns a string created by concatenating the items in a sequence, with a defined separator between adjacent items.

back to top

fn:string-length


Signature
fn:string-length() as xs:integer
fn:string-length($arg as xs:string?) as xs:integer
Description

Returns the number of characters in a string.

back to top

fn:string-to-codepoints


Signature
fn:string-to-codepoints($arg as xs:string?) as xs:integer*
Description

Returns the sequence of codepoints that constitute an xs:string value.

back to top

fn:subsequence


Signature
fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double) as item()*
fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double, $length as xs:double) as item()*
Description

Returns the contiguous sequence of items in the value of $sourceSeq beginning at the position indicated by the value of $startingLoc and continuing for the number of items indicated by the value of $length.

back to top

fn:substring


Signature
fn:substring($sourceString as xs:string?, $start as xs:double) as xs:string
fn:substring($sourceString as xs:string?, $start as xs:double, $length as xs:double) as xs:string
Description

Returns the portion of the value of $sourceString beginning at the position indicated by the value of $start and continuing for the number of characters indicated by the value of $length.

back to top

fn:substring-after


Signature
fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?) as xs:string
fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string
Description

Returns the part of $arg1 that follows the first occurrence of $arg2, taking collations into account.

back to top

fn:substring-before


Signature
fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?) as xs:string
fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string
Description

Returns the part of $arg1 that precedes the first occurrence of $arg2, taking collations into account.

back to top

fn:sum


Signature
fn:sum($arg as xs:anyAtomicType*) as xs:anyAtomicType
fn:sum($arg as xs:anyAtomicType*, $zero as xs:anyAtomicType?) as xs:anyAtomicType?
Description

Returns a value obtained by adding together the values in $arg.

back to top

fn:tail


Signature
fn:tail($arg as item()*) as item()*
Description

Returns all but the first item in a sequence.

back to top

fn:timezone-from-date


Signature
fn:timezone-from-date($arg as xs:date?) as xs:dayTimeDuration?
Description

Returns the timezone component of an xs:date.

back to top

fn:timezone-from-dateTime


Signature
fn:timezone-from-dateTime($arg as xs:dateTime?) as xs:dayTimeDuration?
Description

Returns the timezone component of an xs:dateTime.

back to top

fn:timezone-from-time


Signature
fn:timezone-from-time($arg as xs:time?) as xs:dayTimeDuration?
Description

Returns the timezone component of an xs:time.

back to top

fn:tokenize


Signature
fn:tokenize($input as xs:string?) as xs:string*
fn:tokenize($input as xs:string?, $pattern as xs:string) as xs:string*

fn:tokenize($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:string*
Description

Returns a sequence of strings constructed by splitting the input wherever a separator is found; the separator is any substring that matches a given regular expression.

back to top

fn:trace


Signature
fn:trace($value as item()*) as item()*
fn:trace($value as item()*, $label as xs:string) as item()*
Description

Provides an execution trace intended to be used in debugging queries.

back to top

fn:transform


Signature
fn:transform($options as map(*)) as map(*)
Description

Throws error FOXT0004 when invoked.

Invokes a transformation using a dynamically-loaded XSLT stylesheet.

back to top

fn:translate


Signature
fn:translate($arg as xs:string?, $mapString as xs:string, $transString as xs:string) as xs:string
Description

Returns the value of $arg modified by replacing or removing individual characters.

back to top

fn:true


Signature
fn:true() as xs:boolean
Description

Returns the xs:boolean value true.

back to top

fn:unordered


Signature
fn:unordered($sourceSeq as item()*) as item()*
Description

Returns the items of $sourceSeq in an implementation-dependent order.

back to top

fn:unparsed-text


Signature
fn:unparsed-text($href as xs:string?) as xs:string?
fn:unparsed-text($href as xs:string?, $encoding as xs:string) as xs:string?
Description

The fn:unparsed-text function reads an external resource (for example, a file) and returns a string representation of the resource.

back to top

fn:unparsed-text-available


Signature
fn:unparsed-text-available($href as xs:string?) as xs:boolean
fn:unparsed-text-available($href as xs:string?, $encoding as xs:string) as xs:boolean
Description

Because errors in evaluating the fn:unparsed-text function are non-recoverable, these two functions are provided to allow an application to determine whether a call with particular arguments would succeed.

back to top

fn:unparsed-text-lines


Signature
fn:unparsed-text-lines($href as xs:string?) as xs:string*
fn:unparsed-text-lines($href as xs:string?, $encoding as xs:string) as xs:string*
Description

The fn:unparsed-text-lines function reads an external resource (for example, a file) and returns its contents as a sequence of strings, one for each line of text in the string representation of the resource.

back to top

fn:upper-case


Signature
fn:upper-case($arg as xs:string?) as xs:string
Description

Converts a string to upper case.

back to top

fn:uri-collection


Signature
fn:uri-collection() as xs:anyURI*
fn:uri-collection($arg as xs:string?) as xs:anyURI*
Description

Returns a sequence of xs:anyURI values representing the URIs in a URI collection.

back to top

fn:xml-to-json


Signature
fn:xml-to-json($input as node()?) as xs:string?
fn:xml-to-json($input as node()?, $options as map(*)) as xs:string?
Description

Converts an XML tree, whose format corresponds to the XML representation of JSON defined in this specification, into a string conforming to the JSON grammar.

back to top

fn:year-from-date


Signature
fn:year-from-date($arg as xs:date?) as xs:integer?
Description

Returns the year component of an xs:date.

back to top

fn:year-from-dateTime


Signature
fn:year-from-dateTime($arg as xs:dateTime?) as xs:integer?
Description

Returns the year component of an xs:dateTime.

back to top

fn:years-from-duration


Signature
fn:years-from-duration($arg as xs:duration?) as xs:integer?
Description

Returns the number of years in a duration.

back to top

fn:zero-or-one


Signature
fn:zero-or-one($arg as item()*) as item()?
Description

Returns $arg if it contains zero or one items. Otherwise, raises an error.

back to top