XQuery Function Documentation
http://www.w3.org/2005/xpath-functions
java:org.exist.xquery.functions.fn.FnModule
A module with the XQuery/XPath Core Library Functions
QName #2
QName ($uri as xs:string?, $qname as xs:string) as xs:QNameReturns an xs:QName with the namespace URI given in $uri. If $uri is the zero-length string or the empty sequence, it represents "no namespace"; in this case, if the value of $qname contains a colon (:), an error is raised [err:FOCA0002]. The prefix (or absence of a prefix) in $qname is retained in the returned xs:QName value. The local name in the result is taken from the local part of $qname.
If $qname does not have the correct lexical form for xs:QName an error is raised [err:FOCA0002].
Note that unlike xs:QName this function does not require a xs:string literal as the argument.
- Parameters:
$uri The namespace URI $qname The prefix - Returns:
- xs:QName : the xs:QName with the namespace URI given in $uri
abs #1
abs ($number as xs:numeric?) as xs:numericReturns the absolute value of the argument $number.If the argument is negative returns -$number otherwise returns $number.
- Parameters:
$number The number - Returns:
- xs:numeric? : The absolute value of the argument
adjust-date-to-timezone #1
adjust-date-to-timezone ($date as xs:date?) as xs:dateAdjusts the xs:date value $date to the implicit timezone of the current locale.
- Parameters:
$date The date - Returns:
- xs:date? : the adjusted date
adjust-date-to-timezone #2
adjust-date-to-timezone ($date as xs:date?, $duration as xs:dayTimeDuration?) as xs:dateAdjusts the xs:date value $date to a specific timezone, or to no timezone at all. If $duration is the empty sequence, returns an xs:date without a timezone.
- Parameters:
$date The date $duration The duration - Returns:
- xs:date? : the adjusted date
adjust-dateTime-to-timezone #1
adjust-dateTime-to-timezone ($date-time as xs:dateTime?) as xs:dateTimeAdjusts the xs:dateTime value $date-time to the implicit timezone of the current locale.
- Parameters:
$date-time The date-time - Returns:
- xs:dateTime? : the adjusted date-time
adjust-dateTime-to-timezone #2
adjust-dateTime-to-timezone ($date-time as xs:dateTime?, $duration as xs:dayTimeDuration?) as xs:dateTimeAdjusts the xs:dateTime value $date-time to a specific timezone, or to no timezone at all. If $duration is the empty sequence, returns an xs:dateTime without a timezone.
- Parameters:
$date-time The date-time $duration The duration - Returns:
- xs:dateTime? : the adjusted date-time
adjust-time-to-timezone #1
adjust-time-to-timezone ($time as xs:time?) as xs:timeAdjusts the xs:time value $time to the implicit timezone of the current locale.
- Parameters:
$time The time - Returns:
- xs:time? : the adjusted time
adjust-time-to-timezone #2
adjust-time-to-timezone ($time as xs:time?, $duration as xs:dayTimeDuration?) as xs:timeAdjusts the xs:time value $time to a specific timezone, or to no timezone at all. If $duration is the empty sequence, returns an xs:time without a timezone.
- Parameters:
$time The time $duration The duration - Returns:
- xs:time? : the adjusted time
analyze-string #2
analyze-string ($input as xs:string?, $pattern as xs:string) as element()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.
- Parameters:
$input The input string $pattern The pattern - Returns:
- element() : The result of the analysis
analyze-string #3
analyze-string ($input as xs:string?, $pattern as xs:string, $flags as xs:string) as element()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.
- Parameters:
$input The input string $pattern The pattern $flags Flags - Returns:
- element() : The result of the analysis
apply #2
apply ($function as function(*), $array as array(*)) as item()Processes the supplied sequence from right to left, applying the supplied function repeatedly to each item in turn, together with an accumulated result value.
- Parameters:
$function the function to call $array an array containing the arguments to pass to the function - Returns:
- item()* : return value of the function call
available-environment-variables #0
available-environment-variables () as xs:stringReturns a list of environment variable names.
- Returns:
- xs:string* : Returns a sequence of strings, being the names of the environment variables. User must be DBA.
avg #1
avg ($values as xs:anyAtomicType*) as xs:anyAtomicTypeReturns the average of the values in the input sequence $values, that is, the sum of the values divided by the number of values.
- Parameters:
$values The values - Returns:
- xs:anyAtomicType? : The average of the values in the input sequence
base-uri #0
base-uri () as xs:anyURIReturns the base URI of the context node. It is equivalent to calling fn:base-uri(.).
- Returns:
- xs:anyURI? : The base URI from the context node.
base-uri #1
base-uri ($arg as node()?) as xs:anyURIReturns the base URI of a node.If $arg is the empty sequence, the empty sequence is returned.
- Parameters:
$arg The node. - Returns:
- xs:anyURI? : The base URI from $arg.
boolean #1
boolean ($items as item()*) as xs:booleanComputes the xs:boolean value of the sequence items.
- Parameters:
$items The items - Returns:
- xs:boolean : The boolean value, ebv, of the items
ceiling #1
ceiling ($number as xs:numeric?) as xs:numericReturns a value of the same type as the argument. Specifically, returns the smallest (closest to negative infinity) number with no fractional part that is not less than the value of the argument, $number.
- Parameters:
$number The number - Returns:
- xs:numeric? : The non-fractional number not less than $number
codepoint-equal #2
codepoint-equal ($string-1 as xs:string?, $string-2 as xs:string?) as xs:booleanReturns true or false depending on whether the value of $string-1 is equal to the value of $string-2, according to the Unicode code point collation.
- Parameters:
$string-1 The first string $string-2 The second string - Returns:
- xs:boolean? : true() if the codepoints are equal, false() otherwise
codepoints-to-string #1
codepoints-to-string ($codepoints as xs:integer*) as xs:stringCreates an xs:string from a sequence of code points. Returns the zero-length string if $codepoints is the empty sequence. If any of the code points in $codepoints is not a legal XML character, an error is raised
- Parameters:
$codepoints The codepoints as a sequence of xs:integer values - Returns:
- xs:string : The string constructed from the codepoints if valid
collation-key #1
collation-key ($value-string as xs:string) as xs:base64BinaryGiven a $value-string value and a $collation-string 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.
- Parameters:
$value-string The value string - Returns:
- xs:base64Binary? : the collation key
collation-key #2
collation-key ($value-string as xs:string, $collation-string as xs:string) as xs:base64BinaryGiven a $value-string value and a $collation-string 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.
- Parameters:
$value-string The value string $collation-string The collation string - Returns:
- xs:base64Binary? : the collation key
collection #1
collection ($collection-uris as xs:string*) as item()Returns the documents contained in the collections specified in the input sequence. Collection URIs can be specified either as a simple collection path or an XMLDB URI. Documents contained in sub-collections are also included. If no value is supplied, the statically know documents are used, for the REST Server this could be the addressed collection.
- Parameters:
$collection-uris The collection-URIs for which to include the documents - Returns:
- item()* : The document nodes contained in or under the given collections
compare #2
compare ($string-1 as xs:string?, $string-2 as xs:string?) as xs:integerReturns the collatable comparison between $string-1 and $string-2, using $collation-uri. -1 if $string-1 is inferior to $string-2, 0 if $string-1 is equal to $string-2, 1 if $string-1 is superior to $string-2. If either comparand is the empty sequence, the empty sequence is returned. Please remember to specify the collation in the context or use, the three argument version if you don't want the system default.
- Parameters:
$string-1 The first string $string-2 The second string - Returns:
- xs:integer? : -1 if $string-1 is inferior to $string-2, 0 if $string-1 is equal to $string-2, 1 if $string-1 is superior to $string-2. If either comparand is the empty sequence, the empty sequence is returned.
compare #3
compare ($string-1 as xs:string?, $string-2 as xs:string?, $collation-uri as xs:string) as xs:integerReturns the collatable comparison between $string-1 and $string-2, using $collation-uri. -1 if $string-1 is inferior to $string-2, 0 if $string-1 is equal to $string-2, 1 if $string-1 is superior to $string-2. If either comparand is the empty sequence, the empty sequence is returned. The third argument $collation-uri is either: 1) the full URI e.g. "http://www.w3.org/2013/collation/UCA?lang=en;strength=secondary", or 2) relative where you only need to specify the last part of a valid full collation-uri, e.g. "?lang=sv-SE", "lang=sv-SE;strength=primary;decomposition=standard" or "swedish".
- Parameters:
$string-1 The first string $string-2 The second string $collation-uri The relative collation URI - Returns:
- xs:integer? : -1 if $string-1 is inferior to $string-2, 0 if $string-1 is equal to $string-2, 1 if $string-1 is superior to $string-2. If either comparand is the empty sequence, the empty sequence is returned.
concat #1
concat ($atomizable-values as xs:anyAtomicType?) as xs:stringAccepts two or more xdt:anyAtomicType arguments, $atomizable-values, and converts them to xs:string. Returns the xs:string that is the concatenation of the values of its arguments after conversion. If any of the arguments is the empty sequence, the argument is treated as the zero-length string.
- Parameters:
$atomizable-values The atomizable values - Returns:
- xs:string : The concatenated values
contains #2
contains ($source-string as xs:string?, $substring as xs:string?) as xs:booleanReturns an xs:boolean indicating whether or not the value of $source-string contains (at the beginning, at the end, or anywhere within) at least one sequence of collation units that provides a minimal match to the collation units in the value of $substring, according to the default collation.
- Parameters:
$source-string The source-string $substring The substring - Returns:
- xs:boolean : true() if $source-string contains $substring, false() otherwise
contains #3
contains ($source-string as xs:string?, $substring as xs:string?, $collation-uri as xs:string) as xs:booleanReturns an xs:boolean indicating whether or not the value of $source-string contains (at the beginning, at the end, or anywhere within) at least one sequence of collation units that provides a minimal match to the collation units in the value of $substring, according to the collation that is specified in $collation-uri.The third argument $collation-uri is either: 1) the full URI e.g. "http://www.w3.org/2013/collation/UCA?lang=en;strength=secondary", or 2) relative where you only need to specify the last part of a valid full collation-uri, e.g. "?lang=sv-SE", "lang=sv-SE;strength=primary;decomposition=standard" or "swedish".
- Parameters:
$source-string The source-string $substring The substring $collation-uri The collation URI - Returns:
- xs:boolean : true() if $source-string contains $substring, false() otherwise
contains-token #2
contains-token ($input as xs:string*, $token as xs:string) as xs:booleanDetermines whether or not any of the supplied strings, when tokenized at whitespace boundaries, contains the supplied token, under the rules of the supplied collation.
- Parameters:
$input The input string $token The token to be searched for - Returns:
- xs:boolean : The function returns true if and only if there is string in $input which, after tokenizing at whitespace boundaries, contains a token that is equal to the trimmed value of $token under the rules of the selected collation.
contains-token #3
contains-token ($input as xs:string*, $token as xs:string, $pattern as xs:string) as xs:booleanDetermines whether or not any of the supplied strings, when tokenized at whitespace boundaries, contains the supplied token, under the rules of the supplied collation.
- Parameters:
$input The input string $token The token to be searched for $pattern Collation to use - Returns:
- xs:boolean : The function returns true if and only if there is string in $input which, after tokenizing at whitespace boundaries, contains a token that is equal to the trimmed value of $token under the rules of the selected collation.
count #1
count ($items as item()*) as xs:integerReturns the number of items in the argument sequence, $items.
- Parameters:
$items The items - Returns:
- xs:integer : The number of items in the argument sequence
current-date #0
current-date () as xs:dateReturns the xs:date (with timezone) that is current at some time during the evaluation of a query or transformation in which fn:current-date() is executed.
- Returns:
- xs:date : the date current within the query execution time span
current-dateTime #0
current-dateTime () as xs:dateTimeStampReturns the xs:dateTimeStamp (with timezone) that is current at some time during the evaluation of a query or transformation in which fn:current-dateTime() is executed.
- Returns:
- xs:dateTimeStamp : the date-time current within query execution time span
current-time #0
current-time () as xs:timeReturns the xs:time (with timezone) that is current at some time during the evaluation of a query or transformation in which fn:current-time() is executed.
- Returns:
- xs:time : the time current within query execution time span
data #0
data () as xs:anyAtomicTypeAtomizes the context item, replacing all nodes in the sequence by their typed values.
- Returns:
- xs:anyAtomicType* : the atomic values of the items in $items
data #1
data ($items as item()*) as xs:anyAtomicTypeAtomizes the sequence $items, replacing all nodes in the sequence by their typed values.
- Parameters:
$items The items - Returns:
- xs:anyAtomicType* : the atomic values of the items in $items
dateTime #2
dateTime ($date as xs:date?, $time as xs:time?) as xs:dateTimeCreates an xs:dateTime from an xs:date, $date, and an xs:time, $time.
- Parameters:
$date The date as xs:date $time The time as xs:time - Returns:
- xs:dateTime? : the combined date and time as xs:dateTime
day-from-date #1
day-from-date ($date as xs:date?) as xs:integerReturns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $date.
- Parameters:
$date The date as xs:date - Returns:
- xs:integer? : the day component from $date
day-from-dateTime #1
day-from-dateTime ($date-time as xs:dateTime?) as xs:integerReturns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $date-time.
- Parameters:
$date-time The date-time as xs:dateTime - Returns:
- xs:integer? : the day component from $date-time
days-from-duration #1
days-from-duration ($duration as xs:duration?) as xs:integerReturns an xs:integer representing the days component in the canonical lexical representation of the value of $duration. The result may be negative.
- Parameters:
$duration The duration as xs:duration - Returns:
- xs:integer? : the days component of $duration
deep-equal #2
deep-equal ($items-1 as item()*, $items-2 as item()*) as xs:booleanReturns true() iff every item in $items-1 is deep-equal to the item at the same position in $items-2, false() otherwise. If both $items-1 and $items-2 are the empty sequence, returns true().
- Parameters:
$items-1 The first item sequence $items-2 The second item sequence - Returns:
- xs:boolean : true() if the sequences are deep-equal, false() otherwise
deep-equal #3
deep-equal ($items-1 as item()*, $items-2 as item()*, $collation-uri as xs:string) as xs:booleanReturns true() iff every item in $items-1 is deep-equal to the item at the same position in $items-2, false() otherwise. If both $items-1 and $items-2 are the empty sequence, returns true(). Comparison collation is specified by $collation-uri. The third argument $collation-uri is either: 1) the full URI e.g. "http://www.w3.org/2013/collation/UCA?lang=en;strength=secondary", or 2) relative where you only need to specify the last part of a valid full collation-uri, e.g. "?lang=sv-SE", "lang=sv-SE;strength=primary;decomposition=standard" or "swedish".
- Parameters:
$items-1 The first item sequence $items-2 The second item sequence $collation-uri The collation URI - Returns:
- xs:boolean : true() if the sequences are deep-equal, false() otherwise
default-collation #0
default-collation () as xs:stringReturns the context's default collation. E.g. http://www.w3.org/2005/xpath-functions/collation/codepoint.
- Returns:
- xs:string : the default collation from the context
default-language #0
default-language () as xs:languageReturns the xs:language that is the value of the default language property from the dynamic context during the evaluation of a query or transformation in which fn:default-language() is executed.
- Returns:
- xs:language : the default language within query execution time span
distinct-values #1
distinct-values ($atomic-values as xs:anyAtomicType*) as xs:anyAtomicTypeReturns a sequence where duplicate values of $atomic-values, based on value equality, have been deleted.
- Parameters:
$atomic-values The atomic values - Returns:
- xs:anyAtomicType* : the distinct values sequence
distinct-values #2
distinct-values ($atomic-values as xs:anyAtomicType*, $collation-uri as xs:string) as xs:anyAtomicTypeReturns a sequence where duplicate values of $atomic-values, based on value equality specified by collation $collation-uri, have been deleted.
- Parameters:
$atomic-values The atomic values $collation-uri The collation URI - Returns:
- xs:anyAtomicType* : the distinct values sequence
doc #1
doc ($document-uri as xs:string?) as document-node()Returns the document node of $document-uri. Resource URIs can be specified either as a simple collection path, an XMLDB URI or any URI.
- Parameters:
$document-uri The document URI - Returns:
- document-node()? : the document node of $document-uri
doc-available #1
doc-available ($document-uri as xs:string?) as xs:booleanReturns whether or not the document, $document-uri, specified in the input sequence is available. Resource URIs can be specified either as a simple collection path, an XMLDB URI or any URI.
- Parameters:
$document-uri The document URI - Returns:
- xs:boolean : true() if the document is available, false() otherwise
document-uri #0
document-uri () as xs:anyURIReturns the URI of a resource where a document can be found, if available.
- Returns:
- xs:anyURI? : The URI of a resource.
document-uri #1
document-uri ($value as node()*) as xs:anyURIReturns the URI of a resource where a document can be found, if available.
- Parameters:
$value The document node. - Returns:
- xs:anyURI? : The URI of a resource.
element-with-id #0
element-with-id () as xs:stringReturns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $idrefs. If none is matching or $idrefs is the empty sequence, returns the empty sequence.
- Returns:
- xs:string* : the elements with IDs matching IDREFs from $idref-sequence
element-with-id #1
element-with-id ($idrefs as xs:string*) as xs:stringReturns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $idrefs. If none is matching or $idrefs is the empty sequence, returns the empty sequence.
- Parameters:
$idrefs The IDREF sequence - Returns:
- xs:string* : the elements with IDs matching IDREFs from $idref-sequence
empty #1
empty ($items as item()*) as xs:booleanReturns true() if the value of $items is the empty sequence, false() otherwise.
- Parameters:
$items The item sequence - Returns:
- xs:boolean : true() if the empty sequence, false() otherwise
encode-for-uri #1
encode-for-uri ($uri-part as xs:string?) as xs:stringEscapes reserved characters in $uri-part by replacing it with its percent-encoded form as described in [RFC 3986]. If $uri-part is the empty sequence, returns the zero-length string.
- Parameters:
$uri-part The URI part to encode - Returns:
- xs:string : the URI part with reserved characters percent encoded
ends-with #2
ends-with ($source-string as xs:string?, $suffix as xs:string?) as xs:booleanReturns true() if the string value of $suffix is a suffix of the string value of $source-string, false() otherwise. If either $source-string or $suffix is the empty sequence, the empty sequence is returned.
- Parameters:
$source-string The source-string $suffix The suffix - Returns:
- xs:boolean : true() if $suffix is suffix of $source-string, false() otherwise
ends-with #3
ends-with ($source-string as xs:string?, $suffix as xs:string?, $collation-uri as xs:string) as xs:booleanReturns true() if the string value of $suffix is a suffix of the string value of $source-string using collation $collation-uri, false() otherwise. If either $source-string or $suffix is the empty sequence, the empty sequence is returned. The third argument $collation-uri is either: 1) the full URI e.g. "http://www.w3.org/2013/collation/UCA?lang=en;strength=secondary", or 2) relative where you only need to specify the last part of a valid full collation-uri, e.g. "?lang=sv-SE", "lang=sv-SE;strength=primary;decomposition=standard" or "swedish".
- Parameters:
$source-string The source string $suffix The suffix $collation-uri The collation URI - Returns:
- xs:boolean : true() if $suffix is suffix of $source-string, false() otherwise
environment-variable #1
environment-variable ($name as xs:string) as xs:stringReturns the value of a system environment variable, if it exists.
- Parameters:
$name Name of environment variable. - Returns:
- xs:string? : Corrensponding value of the environment variable, if there is no environment variable with a matching name, the function returns the empty sequence. User must be DBA.
equals #2
equals ($source-string as xs:string?, $substring as xs:string?) as xs:booleanReturns an xs:boolean indicating whether or not the value of $source-string equals the collation units in the value of $substring, according to the default collation. This function is similar to the '=' expression, except that it uses the default collation for comparisons.
- Parameters:
$source-string The source-string $substring The substring - Returns:
- xs:boolean : true() if $source-string equals $substring, false() otherwise
equals #3
equals ($source-string as xs:string?, $substring as xs:string?, $collation-uri as xs:string) as xs:booleanReturns an xs:boolean indicating whether or not the value of $source-string equals the collation units in the value of $substring, according to the collation that is specified in $collation-uri. This function is similar to the '=' expression, except that it uses the specified collation for comparisons.The third argument $collation-uri is either: 1) the full URI e.g. "http://www.w3.org/2013/collation/UCA?lang=en;strength=secondary", or 2) relative where you only need to specify the last part of a valid full collation-uri, e.g. "?lang=sv-SE", "lang=sv-SE;strength=primary;decomposition=standard" or "swedish".
- Parameters:
$source-string The source-string $substring The substring $collation-uri The collation URI - Returns:
- xs:boolean : true() if $source-string equals $substring, false() otherwise
error #0
error () as empty-sequence()Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception using the default qname, 'http://www.w3.org/2004/07/xqt-errors#err:FOER0000', and the default error message, 'An error has been raised by the query'.
- Returns:
- empty-sequence()
error #1
error ($qname as xs:QName?) as empty-sequence()Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception using $qname and the default message, 'An error has been raised by the query'.
- Parameters:
$qname The qname - Returns:
- empty-sequence()
error #2
error ($qname as xs:QName?, $message as xs:string) as empty-sequence()Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception using $qname and $message.
- Parameters:
$qname The qname $message The message - Returns:
- empty-sequence()
error #3
error ($qname as xs:QName?, $message as xs:string, $error-object as item()*) as empty-sequence()Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception using $qname and $message with $error-object appended.
- Parameters:
$qname The qname $message The message $error-object The error object - Returns:
- empty-sequence()
escape-html-uri #1
escape-html-uri ($html-uri as xs:string?) as xs:stringReplaces all non-printable ASCII characters in the string value of $html-uri by an escape sequence represented as a hexadecimal octet in the form %XX. If $html-uri is the empty sequence, returns the zero-length string.
- Parameters:
$html-uri The html URI - Returns:
- xs:string : all nonprintable ASCII characters in $html-uri encoded by escape sequences
escape-uri #2
escape-uri ($uri as xs:string?, $escape-reserved as xs:boolean) as xs:stringThis function applies the URI escaping rules defined in section 2 of [RFC 2396] as amended by [RFC 2732], with one exception, to the string supplied as $uri, which typically represents all or part of a URI. The effect of the function is to escape a set of identified characters in the string. Each such character is replaced in the string by an escape sequence, which is formed by encoding the character as a sequence of octets in UTF-8, and then representing each of these octets in the form %HH, where HH is the hexadecimal representation of the octet. $escape-reserved indicates whether to escape reserved characters.
- Parameters:
$uri The URI $escape-reserved The escaped-reserved - Returns:
- xs:string : the identified characters in $uri encoded with escape sequences
exactly-one #1
exactly-one ($items as item()*) as item()Returns the argument sequence, $items, if it contains exactly one item. Otherwise, raises an error.
- Parameters:
$items The item sequence - Returns:
- item() : the sole item in $items if it contains exactly one item. Otherwise, an error is raised.
exists #1
exists ($items as item()*) as xs:booleanReturns true if the argument $items is not the empty sequence, false otherwise.
- Parameters:
$items The item sequence - Returns:
- xs:boolean : true() if not the empty-sequence, false() otherwise
false #0
false () as xs:booleanAlways returns the boolean value false
- Returns:
- xs:boolean : false
filter #2
filter ($sequence as item()*, $function as function(*)) as item()Returns those items from the sequence $sequence for which the supplied function $function returns true.
- Parameters:
$sequence the sequence to filter $function the function to call - Returns:
- item()* : result of filtering the sequence
floor #1
floor ($number as xs:numeric?) as xs:numericReturns the largest number not greater than the value of $number. If $number is the empty sequence, returns the empty sequence.
- Parameters:
$number The number - Returns:
- xs:numeric? : the largest number without fraction part not greater than the value of $number
fold-left #3
fold-left ($sequence as item()*, $zero as item()*, $function as function(*)) as item()Processes the supplied sequence from left to right, applying the supplied function repeatedly to each item in turn, together with an accumulated result value.
- Parameters:
$sequence the sequence to filter $zero initial value to start with $function the function to call - Returns:
- item()* : result of the fold-left operation
fold-right #3
fold-right ($sequence as item()*, $zero as item()*, $function as function(*)) as item()Processes the supplied sequence from right to left, applying the supplied function repeatedly to each item in turn, together with an accumulated result value.
- Parameters:
$sequence the sequence to filter $zero initial value to start with $function the function to call - Returns:
- item()* : result of the fold-right operation
for-each #2
for-each ($sequence as item()*, $function as function(*)) as item()Applies the function item $function to every item from the sequence $sequence in turn, returning the concatenation of the resulting sequences in order.
- Parameters:
$sequence the sequence on which to apply the function $function the function to call - Returns:
- item()* : result of applying the function to each item of the sequence
for-each-pair #3
for-each-pair ($seq1 as item()*, $seq2 as item()*, $function as function(*)) as item()Applies the function item $f to successive pairs of items taken one from $seq1 and one from $seq2, returning the concatenation of the resulting sequences in order.
- Parameters:
$seq1 first sequence to take items from $seq2 second sequence to take items from $function the function to call - Returns:
- item()* : concatenation of resulting sequences
format-date #2
format-date ($value as xs:date?, $picture as xs:string) as xs:stringReturns a string containing an xs:date value formatted for display.
Read more- Parameters:
$value The date $picture The picture string - Returns:
- xs:string? : The formatted date
format-date #5
format-date ($value as xs:date?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:stringReturns a string containing an xs:date value formatted for display.
Read more- Parameters:
$value The date $picture The picture string $language The language string $calendar The calendar string $place The place string - Returns:
- xs:string? : The formatted date
format-dateTime #2
format-dateTime ($value as xs:dateTime?, $picture as xs:string) as xs:stringReturns a string containing an xs:date value formatted for display.
- Parameters:
$value The datetime $picture The picture string - Returns:
- xs:string? : The formatted date
format-dateTime #5
format-dateTime ($value as xs:dateTime?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:stringReturns a string containing an xs:date value formatted for display.
- Parameters:
$value The datetime $picture The picture string $language The language string $calendar The calendar string $place The place string - Returns:
- xs:string? : The formatted date
format-integer #2
format-integer ($value as xs:numeric?, $picture as xs:string) as xs:stringReturns a string containing an integer formatted according to a given picture string.
- Parameters:
$value The number to format $picture The picture string to use for formatting. To understand the picture string syntax, see: https://www.w3.org/TR/xpath-functions-31/#func-format-number - Returns:
- xs:string : The formatted string representation of the supplied integer
format-integer #3
format-integer ($value as xs:numeric?, $picture as xs:string, $lang as xs:string?) as xs:stringReturns a string containing an integer formatted according to a given picture string.
- Parameters:
$value The number to format $picture The picture string to use for formatting. To understand the picture string syntax, see: https://www.w3.org/TR/xpath-functions-31/#func-format-number $lang The language in which to format the integers. - Returns:
- xs:string : The formatted string representation of the supplied integer
format-number #2
format-number ($value as xs:numeric?, $picture as xs:string) as xs:stringReturns a string containing a number formatted according to a given picture string, taking account of decimal formats specified in the static context.
- Parameters:
$value The number to format $picture The picture string to use for formatting. To understand the picture string syntax, see: https://www.w3.org/TR/xpath-functions-31/#func-format-number - Returns:
- xs:string : The formatted string representation of the supplied number
format-number #3
format-number ($value as xs:numeric?, $picture as xs:string, $decimal-format-name as xs:string?) as xs:stringReturns a string containing a number formatted according to a given picture string, taking account of decimal formats specified in the static context.
- Parameters:
$value The number to format $picture The picture string to use for formatting. To understand the picture string syntax, see: https://www.w3.org/TR/xpath-functions-31/#func-format-number $decimal-format-name The name (as an EQName) of a decimal format to use. - Returns:
- xs:string : The formatted string representation of the supplied number
format-time #2
format-time ($value as xs:time?, $picture as xs:string) as xs:stringReturns a string containing an xs:time value formatted for display.
- Parameters:
$value The time $picture The picture string - Returns:
- xs:string? : The formatted date
format-time #5
format-time ($value as xs:time?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:stringReturns a string containing an xs:time value formatted for display.
- Parameters:
$value The time $picture The picture string $language The language string $calendar The calendar string $place The place string - Returns:
- xs:string? : The formatted date
function-arity #1
function-arity ($function as function(*)) as xs:integerReturns the arity of the function identified by a function item.
- Parameters:
$function The function item - Returns:
- xs:integer : The arity of the function.
function-lookup #2
function-lookup ($name as xs:QName, $arity as xs:integer) as function(*)Returns a reference to the function having a given name and arity, if there is one, the empty sequence otherwise
- Parameters:
$name Qualified name of the function $arity The arity (number of arguments) of the function - Returns:
- function(*)? : The function if found, empty sequence otherwise
function-name #1
function-name ($function as function(*)) as xs:QNameReturns the name of the function identified by a function item.
- Parameters:
$function The function item - Returns:
- xs:QName? : The name of the function or the empty sequence if $function is an anonymous function.
generate-id #0
generate-id () as xs:stringThis function returns a string that uniquely identifies a given node. Without an argument, the node to identify is taken from the current context item.
- Returns:
- xs:string : Unique identifier for the node
generate-id #1
generate-id ($node as node()?) as xs:stringThis function returns a string that uniquely identifies a given node. Without an argument, the node to identify is taken from the current context item.
- Parameters:
$node The node for which an identifier will be generated. If it is the empty sequence, the result will be the empty string - Returns:
- xs:string : Unique identifier for the node
has-children #0
has-children () as xs:booleanReturns true if the context item has one or more child nodes
- Returns:
- xs:boolean : true if the context item has one of more child nodes, false otherwise
has-children #1
has-children ($node as node()?) as xs:booleanReturns true if the supplied node has one or more child nodes
- Parameters:
$node The node to test - Returns:
- xs:boolean : true if $node has one of more child nodes, false otherwise
head #1
head ($arg as item()*) as item()The function returns the value of the expression $arg[1], i.e. the first item in the passed in sequence.
- Parameters:
$arg - Returns:
- item()? : the first item or the empty sequence
hours-from-dateTime #1
hours-from-dateTime ($date-time as xs:dateTime?) as xs:integerReturns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $date-time.
- Parameters:
$date-time The date-time as xs:dateTime - Returns:
- xs:integer? : the hours component from $date-time
hours-from-duration #1
hours-from-duration ($duration as xs:duration?) as xs:integerReturns an xs:integer representing the hours component in the canonical lexical representation of the value of $duration. The result may be negative.
- Parameters:
$duration The duration as xs:duration - Returns:
- xs:integer? : the hours component of $duration
hours-from-time #1
hours-from-time ($time as xs:time?) as xs:integerReturns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $time.
- Parameters:
$time The time as xs:time - Returns:
- xs:integer? : the hours component from $time
id #1
id ($idrefs as xs:string*) as element()Returns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $idrefs. If none is matching or $idrefs is the empty sequence, returns the empty sequence.
- Parameters:
$idrefs The IDREF sequence - Returns:
- element()* : the elements with IDs matching IDREFs from $idref-sequence
id #2
id ($idrefs as xs:string*, $node-in-document as node()) as element()Returns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $idrefs and is in the same document as $node-in-document. If none is matching or $idrefs is the empty sequence, returns the empty sequence.
- Parameters:
$idrefs The IDREF sequence $node-in-document The node in document - Returns:
- element()* : the elements with IDs matching IDREFs from $idrefs in the same document as $node-in-document
idref #1
idref ($ids as xs:string*) as node()Returns the sequence of element or attributes nodes with an IDREF value matching the value of one or more of the ID values supplied in $ids. If none is matching or $ids is the empty sequence, returns the empty sequence.
- Parameters:
$ids The ID sequence - Returns:
- node()* : the elements with matching IDREF values from IDs in $ids
idref #2
idref ($ids as xs:string*, $node-in-document as node()) as node()Returns the sequence of element or attributes nodes with an IDREF value matching the value of one or more of the ID values supplied in $ids. If none is matching or $ids is the empty sequence, returns the empty sequence.
- Parameters:
$ids The ID sequence $node-in-document The node in document - Returns:
- node()* : the elements with matching IDREF values from IDs in $ids in the same document as $node-in-document
implicit-timezone #0
implicit-timezone () as xs:dayTimeDurationReturns the value of the implicit timezone property from the dynamic context.
- Returns:
- xs:dayTimeDuration : the implicit timezone daytime-duration from the dynamic context
in-scope-prefixes #1
in-scope-prefixes ($element as element()) as xs:stringReturns the prefixes of the in-scope namespaces for $element. For namespaces that have a prefix, it returns the prefix as an xs:NCName. For the default namespace, which has no prefix, it returns the zero-length string.
- Parameters:
$element The element - Returns:
- xs:string* : the prefixes
index-of #2
index-of ($source as xs:anyAtomicType*, $search as xs:anyAtomicType) as xs:integerReturns a sequence of positive integers giving the positions within the sequence of atomic values $source that are equal to $search.
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. The collation is used when string comparison is required.
The items in the sequence $source are compared with $search under the rules for the 'eq' operator. Values of type xs:untypedAtomic are compared as if they were of type xs:string. Values that cannot be compared, i.e. the 'eq' operator is not defined for their types, are considered to be distinct. If an item compares equal, then the position of that item in the sequence $source is included in the result.
If the value of $source is the empty sequence, or if no item in $source matches $search, then the empty sequence is returned.
The first item in a sequence is at position 1, not position 0.
The result sequence is in ascending numeric order.
- Parameters:
$source The source sequence $search The search component - Returns:
- xs:integer* : the sequence of positive integers giving the positions within the sequence
index-of #3
index-of ($source as xs:anyAtomicType*, $search as xs:anyAtomicType, $collation-uri as xs:string) as xs:integerReturns a sequence of positive integers giving the positions within the sequence of atomic values $source that are equal to $search.
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. The collation is used when string comparison is required.
The items in the sequence $source are compared with $search under the rules for the 'eq' operator. Values of type xs:untypedAtomic are compared as if they were of type xs:string. Values that cannot be compared, i.e. the 'eq' operator is not defined for their types, are considered to be distinct. If an item compares equal, then the position of that item in the sequence $source is included in the result.
If the value of $source is the empty sequence, or if no item in $source matches $search, then the empty sequence is returned.
The first item in a sequence is at position 1, not position 0.
The result sequence is in ascending numeric order. The third argument $collation-uri is either: 1) the full URI e.g. "http://www.w3.org/2013/collation/UCA?lang=en;strength=secondary", or 2) relative where you only need to specify the last part of a valid full collation-uri, e.g. "?lang=sv-SE", "lang=sv-SE;strength=primary;decomposition=standard" or "swedish".
- Parameters:
$source The source sequence $search The search component $collation-uri The collation URI - Returns:
- xs:integer* : the sequence of positive integers giving the positions within the sequence
innermost #1
innermost ($nodes as node()*) as node()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.
- Parameters:
$nodes The nodes to test - Returns:
- node()* : The nodes that are not an ancestor of another node in the input sequence
insert-before #3
insert-before ($target as item()*, $position as xs:integer, $inserts as item()*) as item()Returns a new sequence constructed from the value of $target with the value of $inserts inserted at the position specified by the value of $position. (The value of $target is not affected by the sequence construction.)
If $target is the empty sequence, $inserts is returned. If $inserts is the empty sequence, $target is returned.
The value returned by the function consists of all items of $target whose index is less than $position, followed by all items of $inserts, followed by the remaining elements of $target, in that sequence.
If $position is less than one (1), the first position, the effective value of $position is one (1). If $position is greater than the number of items in $target, then the effective value of $position is equal to the number of items in $target plus 1.
- Parameters:
$target The target $position The position to insert before $inserts The data to insert - Returns:
- item()* : the new sequence
iri-to-uri #1
iri-to-uri ($iri as xs:string?) as xs:stringThis function converts an xs:string containing an IRI into a URI according to the rules spelled out in Section 3.1 of [RFC 3987]. It is idempotent but not invertible. If $iri contains a character that is invalid in an IRI, such as the space character (see note below), the invalid character is replaced by its percent-encoded form as described in [RFC 3986] before the conversion is performed. If $iri is the empty sequence, returns the zero-length string. Since [RFC 3986] recommends that, for consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent-encodings, this function must always generate hexadecimal values using the upper-case letters A-F. Notes: This function does not check whether $iri is a legal IRI. It treats it as an xs:string and operates on the characters in the xs:string. The following printable ASCII characters are invalid in an IRI: "<", ">", " " " (double quote), space, "{", "}", "|", "\", "^", and "`". Since these characters should not appear in an IRI, if they do appear in $iri they will be percent-encoded. In addition, characters outside the range x20-x126 will be percent-encoded because they are invalid in a URI. Since this function does not escape the PERCENT SIGN "%" and this character is not allowed in data within a URI, users wishing to convert character strings, such as file names, that include "%" to a URI should manually escape "%" by replacing it with "%25".
- Parameters:
$iri The IRI - Returns:
- xs:string : the URI
json-doc #1
json-doc ($href as xs:string?) as item()Reads an external (or database) resource containing JSON, and returns the results of parsing the resource as JSON. An URL parameter without scheme or scheme 'xmldb:' is considered to point to a database resource.
- Parameters:
$href URL pointing to a JSON resource - Returns:
- item()? : The parsed data, typically a map, array or atomic value
json-doc #2
json-doc ($href as xs:string?, $options as map(*)) as item()Reads an external (or database) resource containing JSON, and returns the results of parsing the resource as JSON. An URL parameter without scheme or scheme 'xmldb:' is considered to point to a database resource.
- Parameters:
$href URL pointing to a JSON resource $options Parsing options - Returns:
- item()? : The parsed data, typically a map, array or atomic value
json-to-xml #1
json-to-xml ($json-text as xs:string?) as item()Parses a string supplied in the form of a JSON text, returning the results in the form of an XML document node.
- Parameters:
$json-text JSON text as defined in [RFC 7159]. The function parses this string to return an XDM value - Returns:
- item()? : The parsed data as XML
json-to-xml #2
json-to-xml ($json-text as xs:string?, $options as map(*)) as item()Parses a string supplied in the form of a JSON text, returning the results in the form of an XML document node.
- Parameters:
$json-text JSON text as defined in [RFC 7159]. The function parses this string to return an XDM value $options Parsing options - Returns:
- item()? : The parsed data as XML
lang #1
lang ($lang as xs:string?) as xs:booleanTests whether the language of the context item as specified by xml:lang attributes is the same as, or is a sublanguage of, the language specified by $lang. The behavior of the function if the second argument is omitted is exactly the same as if the context item (.) had been passed as the second argument. The language of the argument node, or the context item if the second argument is omitted, is determined by the value of the xml:lang attribute on the node, or, if the node has no such attribute, by the value of the xml:lang attribute on the nearest ancestor of the node that has an xml:lang attribute. If there is no such ancestor, then the function returns false().
The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.
If $lang is the empty sequence it is interpreted as the zero-length string.
- Parameters:
$lang The language code - Returns:
- xs:boolean : true if the language code matches, false otherwise
lang #2
lang ($lang as xs:string?, $node as node()) as xs:booleanTests whether the language of $node as specified by xml:lang attributes is the same as, or is a sublanguage of, the language specified by $lang. The behavior of the function if the second argument is omitted is exactly the same as if the context item (.) had been passed as the second argument. The language of the argument node, or the context item if the second argument is omitted, is determined by the value of the xml:lang attribute on the node, or, if the node has no such attribute, by the value of the xml:lang attribute on the nearest ancestor of the node that has an xml:lang attribute. If there is no such ancestor, then the function returns false().
The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.
If $lang is the empty sequence it is interpreted as the zero-length string.
- Parameters:
$lang The language code $node The node - Returns:
- xs:boolean : true if the language code matches, false otherwise
last #0
last () as xs:integerReturns the context size from the dynamic context. If the context item is undefined, an error is raised.
- Returns:
- xs:integer : the context size from the dynamic context
load-xquery-module #1
load-xquery-module ($module-uri as xs:string) as map(*)Provides access to the public functions and global variables of a dynamically-loaded XQuery library module.
- Parameters:
$module-uri The target namespace of the module - Returns:
- map(*) : a map with two entries: 1) 'variables': a map with one entry for each public global variable declared in the library module. The key of the entry is the name of the variable, as an xs:QName value; the associated value is the value of the variable; 2) 'functions': a map which contains one entry for each public function declared in the library module, except that when two functions have the same name (but different arity), they share the same entry. The key of the entry is the name of the function(s), as an xs:QName value; the associated value is a map A. This map (A) contains one entry for each function with the given name; its key is the arity of the function, as an xs:integer value, and its associated value is the function itself, as a function item. The function can be invoked using the rules for dynamic function invocation.
load-xquery-module #2
load-xquery-module ($module-uri as xs:string, $options as map(*)) as map(*)Provides access to the public functions and global variables of a dynamically-loaded XQuery library module.
- Parameters:
$module-uri The target namespace of the module $options Options for loading the module - Returns:
- map(*) : a map with two entries: 1) 'variables': a map with one entry for each public global variable declared in the library module. The key of the entry is the name of the variable, as an xs:QName value; the associated value is the value of the variable; 2) 'functions': a map which contains one entry for each public function declared in the library module, except that when two functions have the same name (but different arity), they share the same entry. The key of the entry is the name of the function(s), as an xs:QName value; the associated value is a map A. This map (A) contains one entry for each function with the given name; its key is the arity of the function, as an xs:integer value, and its associated value is the function itself, as a function item. The function can be invoked using the rules for dynamic function invocation.
local-name #0
local-name () as xs:stringReturns the local part of the name of $arg as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName.
If the argument is omitted, it defaults to the context item (.). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument.
The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.
If the argument is supplied and is the empty sequence, the function returns the zero-length string.
If the target node has no name (that is, if it is a document node, a comment, or a text node), the function returns the zero-length string.
Otherwise, the value returned will be the local part of the expanded-QName of the target node (as determined by the dm:node-name accessor in Section 5.11 node-name AccessorDM. This will be an xs:string whose lexical form is an xs:NCName.
- Returns:
- xs:string : the local name
local-name #1
local-name ($arg as node()?) as xs:stringReturns the local part of the name of $arg as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName.
If the argument is omitted, it defaults to the context item (.). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument.
The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.
If the argument is supplied and is the empty sequence, the function returns the zero-length string.
If the target node has no name (that is, if it is a document node, a comment, or a text node), the function returns the zero-length string.
Otherwise, the value returned will be the local part of the expanded-QName of the target node (as determined by the dm:node-name accessor in Section 5.11 node-name AccessorDM. This will be an xs:string whose lexical form is an xs:NCName.
- Parameters:
$arg The node to retrieve the local name from - Returns:
- xs:string : the local name
local-name-from-QName #1
local-name-from-QName ($arg as xs:QName?) as xs:NCNameReturns an xs:NCName representing the local part of $arg. If $arg is the empty sequence, returns the empty sequence.
- Parameters:
$arg The QName - Returns:
- xs:NCName? : the local name
lower-case #1
lower-case ($arg as xs:string?) as xs:stringReturns the value of $arg after translating every character to its lower-case correspondent as defined in the appropriate case mappings section in the Unicode standard. For versions of Unicode beginning with the 2.1.8 update, only locale-insensitive case mappings should be applied. Beginning with version 3.2.0 (and likely future versions) of Unicode, precise mappings are described in default case operations, which are full case mappings in the absence of tailoring for particular languages and environments. Every upper-case character that does not have a lower-case correspondent, as well as every lower-case character, is included in the returned value in its original form.
- Parameters:
$arg The text to be converted to all lower-case characters - Returns:
- xs:string : the resulting lower-case text
matches #2
matches ($input as xs:string?, $pattern as xs:string) as xs:booleanThe function returns true if $input matches the regular expression supplied as $pattern as influenced by the value of $flags, if present; otherwise, it returns false.
The effect of calling this version of the function with the $flags argument set to azero-length string is the same as using the other two argument version. Flags are defined in 7.6.1.1 Flags.
If $input is the empty sequence, it is interpreted as the zero-length string.
Unless the metacharacters ^ and $ are used as anchors, the string is considered to match the pattern if any substring matches the pattern. But if anchors are used, the anchors must match the start/end of the string (in string mode), or the start/end of a line (in multiline mode).
Note:
This is different from the behavior of patterns in [XML Schema Part 2: Datatypes Second Edition], where regular expressions are implicitly anchored.
Please note that - in contrast - with the specification - this method allows zero or more items for the string argument.
An error is raised [err:FORX0002] if the value of $pattern is invalid according to the rules described in section 7.6.1 Regular Expression Syntax.
An error is raised [err:FORX0001] if the value of $flags is invalid according to the rules described in section 7.6.1 Regular Expression Syntax.
- Parameters:
$input The input string $pattern The pattern - Returns:
- xs:boolean : true if the pattern is a match, false otherwise
matches #3
matches ($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:booleanThe function returns true if $input matches the regular expression supplied as $pattern as influenced by the value of $flags, if present; otherwise, it returns false.
The effect of calling this version of the function with the $flags argument set to azero-length string is the same as using the other two argument version. Flags are defined in 7.6.1.1 Flags.
If $input is the empty sequence, it is interpreted as the zero-length string.
Unless the metacharacters ^ and $ are used as anchors, the string is considered to match the pattern if any substring matches the pattern. But if anchors are used, the anchors must match the start/end of the string (in string mode), or the start/end of a line (in multiline mode).
Note:
This is different from the behavior of patterns in [XML Schema Part 2: Datatypes Second Edition], where regular expressions are implicitly anchored.
Please note that - in contrast - with the specification - this method allows zero or more items for the string argument.
An error is raised [err:FORX0002] if the value of $pattern is invalid according to the rules described in section 7.6.1 Regular Expression Syntax.
An error is raised [err:FORX0001] if the value of $flags is invalid according to the rules described in section 7.6.1 Regular Expression Syntax.
- Parameters:
$input The input string $pattern The pattern $flags The flags - Returns:
- xs:boolean : true if the pattern is a match, false otherwise
max #1
max ($arg as xs:anyAtomicType*) as xs:anyAtomicTypeSelects an item from the input sequence $arg whose value is greater than or equal to the value of every other item in the input sequence. If there are two or more such items, then the specific item whose value is returned is implementation dependent.
The following rules are applied to the input sequence:
- Values of type xs:untypedAtomic in $arg are cast to xs:double.
- Numeric and xs:anyURI values are converted to the least common type that supports the 'ge' operator by a combination of type promotion and subtype substitution. See Section B.1 Type PromotionXP and Section B.2 Operator MappingXP.
The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. This function returns an item from the converted sequence rather than the input sequence.
If the converted sequence is empty, the empty sequence is returned.
All items in $arg must be numeric or derived from a single base type for which the 'ge' operator is defined. In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for purposes of comparison. Duration values must either all be xs:yearMonthDuration values or must all be xs:dayTimeDuration values.
If any of these conditions is not met, then a type error is raised [err:FORG0006].
If the converted sequence contains the value NaN, the value NaN is returned.
If the items in the value of $arg are of type xs:string or types derived by restriction from xs:string, then the determination of the item with the largest value is made according to the collation that is used.The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations.
- Parameters:
$arg The input sequence - Returns:
- xs:anyAtomicType? : the max value
max #2
max ($arg as xs:anyAtomicType*, $collation-uri as xs:string) as xs:anyAtomicTypeSelects an item from the input sequence $arg whose value is greater than or equal to the value of every other item in the input sequence. If there are two or more such items, then the specific item whose value is returned is implementation dependent.
The following rules are applied to the input sequence:
- Values of type xs:untypedAtomic in $arg are cast to xs:double.
- Numeric and xs:anyURI values are converted to the least common type that supports the 'ge' operator by a combination of type promotion and subtype substitution. See Section B.1 Type PromotionXP and Section B.2 Operator MappingXP.
The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. This function returns an item from the converted sequence rather than the input sequence.
If the converted sequence is empty, the empty sequence is returned.
All items in $arg must be numeric or derived from a single base type for which the 'ge' operator is defined. In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for purposes of comparison. Duration values must either all be xs:yearMonthDuration values or must all be xs:dayTimeDuration values.
If any of these conditions is not met, then a type error is raised [err:FORG0006].
If the converted sequence contains the value NaN, the value NaN is returned.
If the items in the value of $arg are of type xs:string or types derived by restriction from xs:string, then the determination of the item with the largest value is made according to the collation that is used.If the type of the items in $arg is not xs:string and $collation-uri is specified, the collation is ignored.
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations.
- Parameters:
$arg The input sequence $collation-uri The collation URI - Returns:
- xs:anyAtomicType? : the max value
min #1
min ($arg as xs:anyAtomicType*) as xs:anyAtomicTypeSelects an item from the input sequence $arg whose value is less than or equal to the value of every other item in the input sequence. If there are two or more such items, then the specific item whose value is returned is implementation dependent.
The following rules are applied to the input sequence:
- Values of type xs:untypedAtomic in $arg are cast to xs:double.
- Numeric and xs:anyURI values are converted to the least common type that supports the 'le' operator by a combination of type promotion and subtype substitution. See Section B.1 Type PromotionXP and Section B.2 Operator MappingXP.
The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. This function returns an item from the converted sequence rather than the input sequence.
If the converted sequence is empty, the empty sequence is returned.
All items in $arg must be numeric or derived from a single base type for which the 'le' operator is defined. In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for the purpose of comparison. Duration values must either all be xs:yearMonthDuration values or must all be xs:dayTimeDuration values.
If any of these conditions is not met, a type error is raised [err:FORG0006].
If the converted sequence contains the value NaN, the value NaN is returned.
If the items in the value of $arg are of type xs:string or types derived by restriction from xs:string, then the determination of the item with the smallest value is made according to the collation that is used. The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations.
- Parameters:
$arg The input sequence - Returns:
- xs:anyAtomicType? : the minimum value
min #2
min ($arg as xs:anyAtomicType*, $collation-uri as xs:string) as xs:anyAtomicTypeSelects an item from the input sequence $arg whose value is less than or equal to the value of every other item in the input sequence. If there are two or more such items, then the specific item whose value is returned is implementation dependent.
The following rules are applied to the input sequence:
- Values of type xs:untypedAtomic in $arg are cast to xs:double.
- Numeric and xs:anyURI values are converted to the least common type that supports the 'le' operator by a combination of type promotion and subtype substitution. See Section B.1 Type PromotionXP and Section B.2 Operator MappingXP.
The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. This function returns an item from the converted sequence rather than the input sequence.
If the converted sequence is empty, the empty sequence is returned.
All items in $arg must be numeric or derived from a single base type for which the 'le' operator is defined. In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for the purpose of comparison. Duration values must either all be xs:yearMonthDuration values or must all be xs:dayTimeDuration values.
If any of these conditions is not met, a type error is raised [err:FORG0006].
If the converted sequence contains the value NaN, the value NaN is returned.
If the items in the value of $arg are of type xs:string or types derived by restriction from xs:string, then the determination of the item with the smallest value is made according to the collation that is used. If the type of the items in $arg is not xs:string and $collation is specified, the collation is ignored.
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations.
- Parameters:
$arg The input sequence $collation-uri The collation URI - Returns:
- xs:anyAtomicType? : the minimum value
minutes-from-dateTime #1
minutes-from-dateTime ($date-time as xs:dateTime?) as xs:integerReturns an xs:integer value between 0 to 59, both inclusive, representing the value of the minutes component in the localized value of $date-time.
- Parameters:
$date-time The date-time as xs:dateTime - Returns:
- xs:integer? : the minutes component from $date-time
minutes-from-duration #1
minutes-from-duration ($duration as xs:duration?) as xs:integerReturns an xs:integer representing the minutes component in the canonical lexical representation of the value of $duration. The result may be negative.
- Parameters:
$duration The duration as xs:duration - Returns:
- xs:integer? : the minutes component of $duration
minutes-from-time #1
minutes-from-time ($time as xs:time?) as xs:integerReturns an xs:integer value between 0 to 59, both inclusive, representing the value of the minutes component in the localized value of $time.
- Parameters:
$time The time as xs:time - Returns:
- xs:integer? : the minutes component from $time
month-from-date #1
month-from-date ($date as xs:date?) as xs:integerReturns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $date.
- Parameters:
$date The date as xs:date - Returns:
- xs:integer? : the month component from $date
month-from-dateTime #1
month-from-dateTime ($date-time as xs:dateTime?) as xs:integerReturns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $date-time.
- Parameters:
$date-time The date-time as xs:dateTime - Returns:
- xs:integer? : the month component from $date-time
months-from-duration #1
months-from-duration ($duration as xs:duration?) as xs:integerReturns an xs:integer representing the months component in the canonical lexical representation of the value of $duration. The result may be negative.
- Parameters:
$duration The duration as xs:duration - Returns:
- xs:integer? : the months component of $duration
name #0
name () as xs:stringReturns the name of the context item as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName.
The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument.
The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.
If the argument is supplied and is the empty sequence, the function returns the zero-length string.
If the target node has no name (that is, if it is a document node, a comment, a text node, or a namespace binding having no name), the function returns the zero-length string.
Otherwise, the value returned is fn:string(fn:node-name($arg)).
- Returns:
- xs:string : the name
name #1
name ($arg as node()?) as xs:stringReturns the name of $arg as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName.
If the argument is omitted, it defaults to the context item (.). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument.
The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.
If the argument is supplied and is the empty sequence, the function returns the zero-length string.
If the target node has no name (that is, if it is a document node, a comment, a text node, or a namespace binding having no name), the function returns the zero-length string.
Otherwise, the value returned is fn:string(fn:node-name($arg)).
- Parameters:
$arg The input node - Returns:
- xs:string : the name
namespace-uri #0
namespace-uri () as xs:anyURIReturns the namespace URI of the xs:QName of the context item.
The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument.
The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.
If $arg is neither an element nor an attribute node, or if it is an element or attribute node whose expanded-QName (as determined by the dm:node-name accessor in the Section 5.11 node-name AccessorDM) is in no namespace, then the function returns the xs:anyURI corresponding to the zero-length string.
- Returns:
- xs:anyURI : the namespace URI
namespace-uri #1
namespace-uri ($arg as node()?) as xs:anyURIReturns the namespace URI of the xs:QName of $arg.
If the argument is omitted, it defaults to the context node (.). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument.
The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP.
If $arg is neither an element nor an attribute node, or if it is an element or attribute node whose expanded-QName (as determined by the dm:node-name accessor in the Section 5.11 node-name AccessorDM) is in no namespace, then the function returns the xs:anyURI corresponding to the zero-length string.
- Parameters:
$arg The input node - Returns:
- xs:anyURI : the namespace URI
namespace-uri-for-prefix #2
namespace-uri-for-prefix ($prefix as xs:string?, $element as element()) as xs:anyURIReturns the namespace URI of one of the in-scope namespaces for $element, identified by its namespace prefix.
If $element has an in-scope namespace whose namespace prefix is equal to $prefix, it returns the namespace URI of that namespace. If $prefix is the zero-length string or the empty sequence, it returns the namespace URI of the default (unnamed) namespace. Otherwise, it returns the empty sequence.
Prefixes are equal only if their Unicode code points match exactly.
- Parameters:
$prefix The namespace prefix $element The element - Returns:
- xs:anyURI? : the namespace URI
namespace-uri-from-QName #1
namespace-uri-from-QName ($arg as xs:QName?) as xs:anyURIReturns the namespace URI for $arg. If $arg is the empty sequence, returns the empty sequence.
- Parameters:
$arg The QName - Returns:
- xs:anyURI? : the namespace URI
nilled #0
nilled () as xs:booleanReturns an xs:boolean indicating whether the default (context) item is "nilled". If the context item is not an element node, returns the empty sequence. If the context item is the empty sequence, returns the empty sequence.
- Returns:
- xs:boolean : true if the argument node is "nilled"
nilled #1
nilled ($node as node()*) as xs:booleanReturns an xs:boolean indicating whether the argument node is "nilled". If the argument is not an element node, returns the empty sequence. If the argument is the empty sequence, returns the empty sequence.
- Parameters:
$node node to test - Returns:
- xs:boolean : true if the argument node is "nilled"
node-name #0
node-name () as xs:QNameReturns an expanded-QName for node kinds that can have names. For other kinds of nodes it returns the empty sequence. If the context item is the empty sequence, the empty sequence is returned.
- Returns:
- xs:QName? : the expanded QName
node-name #1
node-name ($arg as node()?) as xs:QNameReturns an expanded-QName for node kinds that can have names. For other kinds of nodes it returns the empty sequence. If $arg is the empty sequence, the empty sequence is returned.
- Parameters:
$arg The input node - Returns:
- xs:QName? : the expanded QName
normalize-space #0
normalize-space () as xs:stringReturns the calculated string value of the context item with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of one or more than one whitespace character with a single space, #x20.
The whitespace characters are defined in the metasymbol S (Production 3) of [Extensible Markup Language (XML) 1.0 Recommendation (Third Edition)].
Note:
The definition of the metasymbol S (Production 3), is unchanged in [Extensible Markup Language (XML) 1.1 Recommendation].
If no argument is supplied, $arg defaults to the string value (calculated using fn:string()) of the context item (.). If no argument is supplied or if the argument is the context item and the context item is undefined an error is raised: [err:XPDY0002].
- Returns:
- xs:string : the normalized text
normalize-space #1
normalize-space ($arg as xs:string?) as xs:stringReturns the value of $arg with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of one or more than one whitespace character with a single space, #x20.
The whitespace characters are defined in the metasymbol S (Production 3) of [Extensible Markup Language (XML) 1.0 Recommendation (Third Edition)].
Note:
The definition of the metasymbol S (Production 3), is unchanged in [Extensible Markup Language (XML) 1.1 Recommendation].
If the value of $arg is the empty sequence, returns the zero-length string.
If no argument is supplied, $arg defaults to the string value (calculated using fn:string()) of the context item (.). If no argument is supplied or if the argument is the context item and the context item is undefined an error is raised: [err:XPDY0002].
- Parameters:
$arg The string to normalize - Returns:
- xs:string : the normalized text
normalize-unicode #1
normalize-unicode ($arg as xs:string?) as xs:stringReturns the value of the context item normalized according to the nomalization form "NFC"
- Parameters:
$arg The unicode string to normalize - Returns:
- xs:string : the normalized text
normalize-unicode #2
normalize-unicode ($arg as xs:string?, $normalization-form as xs:string) as xs:stringReturns the value of $arg normalized according to the normalization criteria for a normalization form identified by the value of $normalization-form. The effective value of the $normalization-form is computed by removing leading and trailing blanks, if present, and converting to upper case.
If the value of $arg is the empty sequence, returns the zero-length string.
See [Character Model for the World Wide Web 1.0: Normalization] for a description of the normalization forms.
- If the effective value of $normalization-form is "NFC", then the value returned by the function is the value of $arg in Unicode Normalization Form C (NFC).
- If the effective value of $normalization-form is "NFD", then the value returned by the function is the value of $arg in Unicode Normalization Form D (NFD).
- If the effective value of $normalization-form is "NFKC", then the value returned by the function is the value of $arg in Unicode Normalization Form KC (NFKC).
- If the effective value of $normalization-form is "NFKD", then the value returned by the function is the value of $arg in Unicode Normalization Form KD (NFKD).
- If the effective value of $normalization-form is "FULLY-NORMALIZED", then the value returned by the function is the value of $arg in the fully normalized form.
- If the effective value of $normalization-form is the zero-length string, no normalization is performed and $arg is returned.
Conforming implementations must support normalization form "NFC" and may support normalization forms "NFD", "NFKC", "NFKD", "FULLY-NORMALIZED". They may also support other normalization forms with implementation-defined semantics. If the effective value of the $normalization-form is other than one of the values supported by the implementation, then an error is raised [err:FOCH0003].
- Parameters:
$arg The unicode string to normalize $normalization-form The normalization form - Returns:
- xs:string : the normalized text
not #1
not ($arg as item()*) as xs:boolean Returns true if the effective boolean value is false, and false if the effective boolean value is true.
$arg is reduced to an effective boolean value by applying the fn:boolean() function.
- Parameters:
$arg The input items - Returns:
- xs:boolean : the negated effective boolean value (ebv) of $arg
number #0
number () as xs:doubleReturns the value of the context item after atomization, converted to an xs:double.
If the context item cannot be converted to an xs:double, the xs:double value NaN is returned. If the context item is undefined an error is raised: [err:XPDY0002]XP.
- Returns:
- xs:double : the numerical value
number #1
number ($arg as xs:anyAtomicType?) as xs:doubleReturns the value indicated by $arg or, if $arg is not specified, the context item after atomization, converted to an xs:double.
Calling the zero-argument version of the function is defined to give the same result as calling the single-argument version with the context item (.). That is, fn:number() is equivalent to fn:number(.).
If $arg is the empty sequence or if $arg or the context item cannot be converted to an xs:double, the xs:double value NaN is returned. If the context item is undefined an error is raised: [err:XPDY0002]XP.
If $arg is the empty sequence, NaN is returned. Otherwise, $arg, or the context item after atomization, is converted to an xs:double following the rules of 17.1.3.2 Casting to xs:double. If the conversion to xs:double fails, the xs:double value NaN is returned.
- Parameters:
$arg The input item - Returns:
- xs:double : the numerical value
one-or-more #1
one-or-more ($arg as item()*) as item()Returns $arg if it contains one or more items. Otherwise, raises an error.
- Parameters:
$arg The input sequence - Returns:
- item()+ : the sequence passed in by $arg if it contains one or more items.
outermost #1
outermost ($nodes as node()*) as node()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.
- Parameters:
$nodes The nodes to test - Returns:
- node()* : The nodes that have no ancestor which is itself in the input sequence
parse-ietf-date #1
parse-ietf-date ($value as xs:string?) as xs:dateTimeParses a string containing the date and time in IETF format, returning the corresponding xs:dateTime value.
- Parameters:
$value The IETF-dateTime string - Returns:
- xs:dateTime? : The parsed date
parse-json #1
parse-json ($json-text as xs:string?) as item()Parses a string supplied in the form of a JSON text, returning the results typically in the form of a map or array.
- Parameters:
$json-text JSON text as defined in [RFC 7159]. The function parses this string to return an XDM value - Returns:
- item()? : The parsed data, typically a map, array or atomic value
parse-json #2
parse-json ($json-text as xs:string?, $options as map(*)) as item()Parses a string supplied in the form of a JSON text, returning the results typically in the form of a map or array.
- Parameters:
$json-text JSON text as defined in [RFC 7159]. The function parses this string to return an XDM value $options Parsing options - Returns:
- item()? : The parsed data, typically a map, array or atomic value
parse-xml #1
parse-xml ($arg as xs:string?) as document-node()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.
- Parameters:
$arg The string to be parsed - Returns:
- document-node()? : the parsed document
parse-xml-fragment #1
parse-xml-fragment ($arg as xs:string?) as document-node()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.
- Parameters:
$arg The string to be parsed - Returns:
- document-node()? : the parsed document fragment
path #0
path () as xs:stringReturns a path expression that can be used to select the supplied node relative to the root of its containing document.
- Returns:
- xs:string? : The path expression, or any empty sequence
path #1
path ($node as node()?) as xs:stringReturns a path expression that can be used to select the supplied node relative to the root of its containing document.
- Parameters:
$node The node for which to calculate a path expression - Returns:
- xs:string? : The path expression, or any empty sequence
position #0
position () as xs:integerReturns the context position from the dynamic context. If the context item is undefined, raises an error.
- Returns:
- xs:integer : the context position
prefix-from-QName #1
prefix-from-QName ($arg as xs:QName?) as xs:NCNameReturns an xs:NCName representing the prefix of $arg. If $arg is the empty sequence, returns the empty sequence.
- Parameters:
$arg The QName - Returns:
- xs:NCName? : the prefix
random-number-generator #0
random-number-generator () as map(*)Returns a random number generator, which can be used to generate sequences of random numbers.
- Returns:
- map(*) : The function returns a random number generator. A random number generator is represented as a map containing three entries. The keys of each entry are strings: `number`, `next`, and `permute`.
random-number-generator #1
random-number-generator ($seed as xs:anyAtomicType?) as map(*)Returns a random number generator, which can be used to generate sequences of random numbers.
- Parameters:
$seed A seed value for the random generator - Returns:
- map(*) : The function returns a random number generator. A random number generator is represented as a map containing three entries. The keys of each entry are strings: `number`, `next`, and `permute`.
remove #2
remove ($target as item()*, $position as xs:integer) as item()Returns a new sequence constructed from the value of $target with the item at $position removed.
If $position is less than 1 or greater than the number of items in $target, $target is returned. Otherwise, the value returned by the function consists of all items of $target whose index is less than $position, followed by all items of $target whose index is greater than $position. If $target is the empty sequence, the empty sequence is returned.
- Parameters:
$target The input sequence $position The position of the value to be removed - Returns:
- item()* : the new sequence with the item at the position specified by the value of $position removed.
replace #3
replace ($input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:stringThe function returns the xs:string that is obtained by replacing each non-overlapping substring of $input that matches the given $pattern with an occurrence of the $replacement string. The $flags argument is interpreted in the same manner as for the fn:matches() function. Calling the four argument version with the $flags argument set to a zero-length string gives the same effect as using the three argument version. If $input is the empty sequence, it is interpreted as the zero-length string. If two overlapping substrings of $input both match the $pattern, then only the first one (that is, the one whose first character comes first in the $input string) is replaced. Within the $replacement string, a variable $N may be used to refer to the substring captured by the Nth parenthesized sub-expression in the regular expression. For each match of the pattern, these variables are assigned the value of the content matched by the relevant sub-expression, and the modified replacement string is then substituted for the characters in $input that matched the pattern. $0 refers to the substring captured by the regular expression as a whole. More specifically, the rules are as follows, where S is the number of parenthesized sub-expressions in the regular expression, and N is the decimal number formed by taking all the digits that consecutively follow the $ character: 1. If N=0, then the variable is replaced by the substring matched by the regular expression as a whole. 2. If 1<=N<=S, then the variable is replaced by the substring captured by the Nth parenthesized sub-expression. If the Nth parenthesized sub-expression was not matched, then the variable is replaced by the zero-length string. 3. If S<N<=9, then the variable is replaced by the zero-length string. 4. Otherwise (if N>S and N>9), the last digit of N is taken to be a literal character to be included "as is" in the replacement string, and the rules are reapplied using the number N formed by stripping off this last digit.
- Parameters:
$input The input string $pattern The pattern to match $replacement The string to replace the pattern with - Returns:
- xs:string : the altered string
replace #4
replace ($input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) as xs:stringThe function returns the xs:string that is obtained by replacing each non-overlapping substring of $input that matches the given $pattern with an occurrence of the $replacement string. The $flags argument is interpreted in the same manner as for the fn:matches() function. Calling the four argument version with the $flags argument set to a zero-length string gives the same effect as using the three argument version. If $input is the empty sequence, it is interpreted as the zero-length string. If two overlapping substrings of $input both match the $pattern, then only the first one (that is, the one whose first character comes first in the $input string) is replaced. Within the $replacement string, a variable $N may be used to refer to the substring captured by the Nth parenthesized sub-expression in the regular expression. For each match of the pattern, these variables are assigned the value of the content matched by the relevant sub-expression, and the modified replacement string is then substituted for the characters in $input that matched the pattern. $0 refers to the substring captured by the regular expression as a whole. More specifically, the rules are as follows, where S is the number of parenthesized sub-expressions in the regular expression, and N is the decimal number formed by taking all the digits that consecutively follow the $ character: 1. If N=0, then the variable is replaced by the substring matched by the regular expression as a whole. 2. If 1<=N<=S, then the variable is replaced by the substring captured by the Nth parenthesized sub-expression. If the Nth parenthesized sub-expression was not matched, then the variable is replaced by the zero-length string. 3. If S<N<=9, then the variable is replaced by the zero-length string. 4. Otherwise (if N>S and N>9), the last digit of N is taken to be a literal character to be included "as is" in the replacement string, and the rules are reapplied using the number N formed by stripping off this last digit.
- Parameters:
$input The input string $pattern The pattern to match $replacement The string to replace the pattern with $flags The flags - Returns:
- xs:string : the altered string
resolve-QName #2
resolve-QName ($qname as xs:string?, $element as element()) as xs:QNameReturns 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.
If $qname does not have the correct lexical form for xs:QName an error is raised [err:FOCA0002].
If $qname is the empty sequence, returns the empty sequence.
More specifically, the function searches the namespace bindings of $element for a binding whose name matches the prefix of $qname, or the zero-length string if it has no prefix, and constructs an expanded-QName whose local name is taken from the supplied $qname, and whose namespace URI is taken from the string value of the namespace binding.
If the $qname has a prefix and if there is no namespace binding for $element that matches this prefix, then an error is raised [err:FONS0004].
If the $qname has no prefix, and there is no namespace binding for $element corresponding to the default (unnamed) namespace, then the resulting expanded-QName has no namespace part.
The prefix (or absence of a prefix) in the supplied $qname argument is retained in the returned expanded-QName.
- Parameters:
$qname The QName name $element The element - Returns:
- xs:QName? : the QName of $element with lexical form $qname
resolve-uri #1
resolve-uri ($relative as xs:string?) as xs:anyURIResolves $relative against the value of the base-uri property from the static context using an algorithm such as the ones described in [RFC 2396] or [RFC 3986], and the resulting absolute URI reference is returned. An error may be raised [err:FORG0009] in the resolution process.
If $relative is an absolute URI reference, it is returned unchanged.
If $relative or $base is not a valid xs:anyURI an error is raised [err:FORG0002].
If $relative is the empty sequence, the empty sequence is returned.
- Parameters:
$relative The relative URI - Returns:
- xs:anyURI? : the absolute URI
resolve-uri #2
resolve-uri ($relative as xs:string?, $base as xs:string) as xs:anyURIResolves $relative against $base using an algorithm such as the ones described in [RFC 2396] or [RFC 3986], and the resulting absolute URI reference is returned. An error may be raised [err:FORG0009] in the resolution process.
If $relative is an absolute URI reference, it is returned unchanged.
If $relative or $base is not a valid xs:anyURI an error is raised [err:FORG0002].
If $relative is the empty sequence, the empty sequence is returned.
- Parameters:
$relative The relative URI $base The base URI - Returns:
- xs:anyURI? : the absolute URI
reverse #1
reverse ($arg as item()*) as item()Reverses the order of items in a sequence. If the argument is an emptysequence, the empty sequence is returned.
- Parameters:
$arg The sequence to reverse - Returns:
- item()* : the reverse order sequence
root #0
root () as node()Returns the root of the tree to which the context item belongs.
- Returns:
- node() : the root node of the tree to which the context node belongs
root #1
root ($arg as node()?) as node()Returns the root of the tree to which $arg belongs. This will usually, but not necessarily, be a document node.
If $arg is the empty sequence, the empty sequence is returned.
If $arg is a document node, $arg is returned.
The behavior of the zero argument version of the function is exactly the same as if the context item had been passed in $arg.
- Parameters:
$arg The input node - Returns:
- node()? : the root node of the tree to which $arg belongs
round #1
round ($arg as xs:numeric?) as xs:numericThe function returns the nearest (that is, numerically closest) value to $arg that is a multiple of ten to the power of minus $precision. If two such values are equally near (for example, if the fractional part in $arg is exactly .5), the function returns the one that is closest to positive infinity. For the four types xs:float, xs:double, xs:decimal and xs:integer, it is guaranteed that if the type of $arg is an instance of type T then the result will also be an instance of T. The result may also be an instance of a type derived from one of these four by restriction. For example, if $arg is an instance of xs:decimal and $precision is less than one, then the result may be an instance of xs:integer. The single-argument version of this function produces the same result as the two-argument version with $precision=0 (that is, it rounds to a whole number). When $arg is of type xs:float and xs:double: If $arg is NaN, positive or negative zero, or positive or negative infinity, then the result is the same as the argument. For other values, the argument is cast to xs:decimal using an implementation of xs:decimal that imposes no limits on the number of digits that can be represented. The function is applied to this xs:decimal value, and the resulting xs:decimal is cast back to xs:float or xs:double as appropriate to form the function result. If the resulting xs:decimal value is zero, then positive or negative zero is returned according to the sign of $arg.
- Parameters:
$arg The input number - Returns:
- xs:numeric? : the rounded value
round #2
round ($arg as xs:numeric?, $precision as xs:integer?) as xs:numericThe function returns the nearest (that is, numerically closest) value to $arg that is a multiple of ten to the power of minus $precision. If two such values are equally near (for example, if the fractional part in $arg is exactly .5), the function returns the one that is closest to positive infinity. For the four types xs:float, xs:double, xs:decimal and xs:integer, it is guaranteed that if the type of $arg is an instance of type T then the result will also be an instance of T. The result may also be an instance of a type derived from one of these four by restriction. For example, if $arg is an instance of xs:decimal and $precision is less than one, then the result may be an instance of xs:integer. The single-argument version of this function produces the same result as the two-argument version with $precision=0 (that is, it rounds to a whole number). When $arg is of type xs:float and xs:double: If $arg is NaN, positive or negative zero, or positive or negative infinity, then the result is the same as the argument. For other values, the argument is cast to xs:decimal using an implementation of xs:decimal that imposes no limits on the number of digits that can be represented. The function is applied to this xs:decimal value, and the resulting xs:decimal is cast back to xs:float or xs:double as appropriate to form the function result. If the resulting xs:decimal value is zero, then positive or negative zero is returned according to the sign of $arg.
- Parameters:
$arg The input number $precision The input number - Returns:
- xs:numeric? : the rounded value
round-half-to-even #1
round-half-to-even ($arg as xs:numeric?) as xs:numericThe value returned is the nearest (that is, numerically closest) value to $arg that is a multiple of ten to the power of minus 0. If two such values are equally near (e.g. if the fractional part in $arg is exactly .500...), the function returns the one whose least significant digit is even.
If the type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the type of $arg. If the type of $arg is a type derived from one of the numeric types, the result is an instance of the base numeric type.
The three argument version of the function with $precision = 0 produces the same result as the two argument version.
For arguments of type xs:float and xs:double, if the argument is NaN, positive or negative zero, or positive or negative infinity, then the result is the same as the argument. In all other cases, the argument is cast to xs:decimal, the function is applied to this xs:decimal value, and the resulting xs:decimal is cast back to xs:float or xs:double as appropriate to form the function result. If the resulting xs:decimal value is zero, then positive or negative zero is returned according to the sign of the original argument.
Note that the process of casting to xs:decimal may result in an error [err:FOCA0001].
If $arg is of type xs:float or xs:double, rounding occurs on the value of the mantissa computed with exponent = 0.
- Parameters:
$arg The input number - Returns:
- xs:numeric? : the rounded value
round-half-to-even #2
round-half-to-even ($arg as xs:numeric?, $precision as xs:integer?) as xs:numericThe value returned is the nearest (that is, numerically closest) value to $arg that is a multiple of ten to the power of minus $precision. If two such values are equally near (e.g. if the fractional part in $arg is exactly .500...), the function returns the one whose least significant digit is even.
If the type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the type of $arg. If the type of $arg is a type derived from one of the numeric types, the result is an instance of the base numeric type.
The three argument version of the function with $precision = 0 produces the same result as the two argument version.
For arguments of type xs:float and xs:double, if the argument is NaN, positive or negative zero, or positive or negative infinity, then the result is the same as the argument. In all other cases, the argument is cast to xs:decimal, the function is applied to this xs:decimal value, and the resulting xs:decimal is cast back to xs:float or xs:double as appropriate to form the function result. If the resulting xs:decimal value is zero, then positive or negative zero is returned according to the sign of the original argument.
Note that the process of casting to xs:decimal may result in an error [err:FOCA0001].
If $arg is of type xs:float or xs:double, rounding occurs on the value of the mantissa computed with exponent = 0.
- Parameters:
$arg The input number $precision Precision to round to - Returns:
- xs:numeric? : the rounded value
seconds-from-dateTime #1
seconds-from-dateTime ($date-time as xs:dateTime?) as xs:decimalReturns an xs:decimal value between 0 and 60.999..., both inclusive, representing the seconds and fractional seconds in the localized value of $date-time. Note that the value can be greater than 60 seconds to accommodate occasional leap seconds used to keep human time synchronized with the rotation of the planet.
- Parameters:
$date-time The date-time as xs:dateTime - Returns:
- xs:decimal? : the seconds component from $date-time
seconds-from-duration #1
seconds-from-duration ($duration as xs:duration?) as xs:decimalReturns an xs:decimal representing the seconds component in the canonical lexical representation of the value of $duration. The result may be negative
- Parameters:
$duration The duration as xs:duration - Returns:
- xs:decimal? : the seconds component of $duration
seconds-from-time #1
seconds-from-time ($time as xs:time?) as xs:decimalReturns an xs:decimal value between 0 and 60.999..., both inclusive, representing the seconds and fractional seconds in the localized value of $date. Note that the value can be greater than 60 seconds to accommodate occasional leap seconds used to keep human time synchronized with the rotation of the planet.
- Parameters:
$time The time as xs:time - Returns:
- xs:decimal? : the seconds component from $time
serialize #1
serialize ($args as item()*) as xs:stringThis function serializes the supplied input sequence $arg as described in XSLT and XQuery Serialization 3.0, returning the serialized representation of the sequence as a string.
- Parameters:
$args The node set to serialize - Returns:
- xs:string : the string containing the serialized node set.
serialize #2
serialize ($args as item()*, $parameters as item()?) as xs:stringThis function serializes the supplied input sequence $arg as described in XSLT and XQuery Serialization 3.0, returning the serialized representation of the sequence as a string.
- Parameters:
$args The node set to serialize $parameters The serialization parameters as either a output:serialization-parameters element or a map - Returns:
- xs:string : the string containing the serialized node set.
sort #1
sort ($input as item()*) as item()Sorts a supplied sequence.
- Parameters:
$input - Returns:
- item()* : the first item or the empty sequence
sort #2
sort ($input as item()*, $collation as xs:string?) as item()Sorts a supplied sequence, based on the value of a sort key supplied as a function.
- Parameters:
$input $collation - Returns:
- item()* : the resulting sequence
sort #3
sort ($input as item()*, $collation as xs:string?, $key as function(*)) as item()Sorts a supplied sequence, based on the value of a sort key supplied as a function.
- Parameters:
$input $collation $key - Returns:
- item()* : the resulting sequence
starts-with #2
starts-with ($source as xs:string?, $prefix as xs:string?) as xs:booleanReturns an xs:boolean indicating whether or not the value of $source starts with a sequence of collation units that provides a minimal match to the collation units of $prefix according to the collation that is used.
Note:
"Minimal match" is defined in [Unicode Collation Algorithm].
If the value of $source or $prefix is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string.
If the value of $prefix is the zero-length string, then the function returns true. If the value of $source is the zero-length string and the value of $prefix is not the zero-length string, then the function returns false.
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. If the specified collation does not support collation units an error may be raised [err:FOCH0004].
- Parameters:
$source The source string $prefix The string to determine if is a prefix of $source - Returns:
- xs:boolean : true if $prefix is a prefix of the string $source
starts-with #3
starts-with ($source as xs:string?, $prefix as xs:string?, $collation-uri as xs:string) as xs:booleanReturns an xs:boolean indicating whether or not the value of $source starts with a sequence of collation units that provides a minimal match to the collation units of $prefix according to the collation that is used.
Note:
"Minimal match" is defined in [Unicode Collation Algorithm].
If the value of $source or $prefix is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string.
If the value of $prefix is the zero-length string, then the function returns true. If the value of $source is the zero-length string and the value of $prefix is not the zero-length string, then the function returns false.
The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. If the specified collation does not support collation units an error may be raised [err:FOCH0004]. The third argument $collation-uri is either: 1) the full URI e.g. "http://www.w3.org/2013/collation/UCA?lang=en;strength=secondary", or 2) relative where you only need to specify the last part of a valid full collation-uri, e.g. "?lang=sv-SE", "lang=sv-SE;strength=primary;decomposition=standard" or "swedish".
- Parameters:
$source The source string $prefix The string to determine if is a prefix of $source $collation-uri The collation URI - Returns:
- xs:boolean : true if $prefix is a prefix of the string $source
static-base-uri #0
static-base-uri () as xs:anyURIReturns the value of the static base URI property from the static context. If the base-uri property is undefined, the empty sequence is returned.
- Returns:
- xs:anyURI? : The base URI from the static context.
string #0
string () as xs:stringReturns the value of the context item as xs:string. If the context item is undefined, an error is raised.
- Returns:
- xs:string : the value of the context item as an xs:string
string #1
string ($arg as item()?) as xs:stringReturns the value of $arg as xs:string. If the value of $arg is the empty sequence, the zero-length string is returned. If the context item of $arg is undefined, an error is raised.
- Parameters:
$arg The sequence to get the value of as an xs:string - Returns:
- xs:string : the value of $arg as an xs:string
string-join #1
string-join ($arg as xs:anyAtomicType*) as xs:stringReturns a xs:string created by concatenating the members of the $arg sequence using $separator as a separator. If the value of the separator is the zero-length string, then the members of the sequence are concatenated without a separator. The effect of calling the single-argument version of this function is the same as calling the two-argument version with $separator set to a zero-length string.
- Parameters:
$arg The sequence to be joined to form the string. If it is empty, a zero-length string is returned. - Returns:
- xs:string : the joined string
string-join #2
string-join ($arg as xs:anyAtomicType*, $separator as xs:string) as xs:stringReturns a xs:string created by concatenating the members of the $arg sequence using $separator as a separator. If the value of the separator is the zero-length string, then the members of the sequence are concatenated without a separator.
- Parameters:
$arg The sequence to be joined to form the string. If it is empty, a zero-length string is returned. $separator The separator to be placed in the string between the items of $arg - Returns:
- xs:string : the joined string
string-length #0
string-length () as xs:integerReturns an xs:integer equal to the length in characters of the value of the context item. If the context item is undefined an error is raised.
- Returns:
- xs:integer : the length in characters
string-length #1
string-length ($arg as xs:string?) as xs:integerReturns an xs:integer equal to the length in characters of the value of $arg. If the value of $arg is the empty sequence, the xs:integer 0 is returned. If no argument is supplied, $arg defaults to the string value (calculated using fn:string()) of the context item (.). If no argument is supplied or if the argument is the context item and the context item is undefined an error is raised
- Parameters:
$arg The input string - Returns:
- xs:integer : the length in characters
string-to-codepoints #1
string-to-codepoints ($arg as xs:string?) as xs:integerReturns the sequence of unicode code points that constitute an xs:string. If $arg is a zero-length string or the empty sequence, the empty sequence is returned.
- Parameters:
$arg The input string - Returns:
- xs:integer* : the sequence of code points
subsequence #2
subsequence ($source as item()*, $starting-at as xs:double) as item()Returns a subsequence of the items in $source-sequence, items starting at the position, $starting-at, up to the end of the sequence are included.
- Parameters:
$source The source sequence $starting-at The starting position in the $source - Returns:
- item()* : the subsequence
subsequence #3
subsequence ($source as item()*, $starting-at as xs:double, $length as xs:double) as item()Returns a subsequence of the items in $source, starting at the position, $starting-at, including the number of items indicated by $length.
- Parameters:
$source The source sequence $starting-at The starting position in the $source $length The length of the subsequence - Returns:
- item()* : the subsequence
substring #2
substring ($source as xs:string?, $starting-at as xs:double) as xs:stringReturns the portion of the value of $source beginning at the position indicated by the value of $starting-at and continuing to the end of $source. The characters returned do not extend beyond the end of $source. If $starting-at is zero or negative, only those characters in positions greater than zero are returned.If the value of $source is the empty sequence, the zero-length string is returned.
- Parameters:
$source The source string $starting-at The starting position - Returns:
- xs:string : the substring
substring #3
substring ($source as xs:string?, $starting-at as xs:double, $length as xs:double) as xs:stringReturns the portion of the value of $source beginning at the position indicated by the value of $starting-at and continuing for the number of characters indicated by the value of $length. The characters returned do not extend beyond the end of $source. If $starting-at is zero or negative, only those characters in positions greater than zero are returned. If the value of $source is the empty sequence, the zero-length string is returned.
- Parameters:
$source The source string $starting-at The starting position $length The number of characters in the substring - Returns:
- xs:string : the substring
substring-after #2
substring-after ($source as xs:string?, $search as xs:string?) as xs:stringReturns the substring of the value of $source that follows the first occurrence of a sequence of the value of $search. If the value of $source or $search is the empty sequence it is interpreted as the zero-length string. If the value of $search is the zero-length string, the zero-length string is returned. If the value of $source does not contain a string that is equal to the value of $search, the zero-length string is returned.
- Parameters:
$source The input string $search The search string - Returns:
- xs:string : the substring after $search
substring-after #3
substring-after ($source as xs:string?, $search as xs:string?, $collation-uri as xs:string) as xs:stringReturns the substring of the value of $source that follows the first occurrence of a sequence of the value of $search in the collation $collation-uri. If the value of $source or $search is the empty sequence it is interpreted as the zero-length string. If the value of $search is the zero-length string, the zero-length string is returned. If the value of $source does not contain a string that is equal to the value of $search, the zero-length string is returned. The third argument $collation-uri is either: 1) the full URI e.g. "http://www.w3.org/2013/collation/UCA?lang=en;strength=secondary", or 2) relative where you only need to specify the last part of a valid full collation-uri, e.g. "?lang=sv-SE", "lang=sv-SE;strength=primary;decomposition=standard" or "swedish".
- Parameters:
$source The input string $search The search string $collation-uri The collation URI - Returns:
- xs:string : the substring after $search
substring-before #2
substring-before ($source as xs:string?, $search as xs:string?) as xs:stringReturns the substring of the value of $source that precedes the first occurrence of a sequence of the value of $search. If the value of $source or $search is the empty sequence it is interpreted as the zero-length string. If the value of $search is the zero-length string, the zero-length string is returned. If the value of $source does not contain a string that is equal to the value of $search, the zero-length string is returned.
- Parameters:
$source The input string $search The search string - Returns:
- xs:string : the substring before $search
substring-before #3
substring-before ($source as xs:string?, $search as xs:string?, $collation-uri as xs:string) as xs:stringReturns the substring of the value of $source that precedes the first occurrence of a sequence of the value of $search in the collation $collation-uri. If the value of $source or $search is the empty sequence it is interpreted as the zero-length string. If the value of $search is the zero-length string, the zero-length string is returned. If the value of $source does not contain a string that is equal to the value of $search, the zero-length string is returned. The third argument $collation-uri is either: 1) the full URI e.g. "http://www.w3.org/2013/collation/UCA?lang=en;strength=secondary", or 2) relative where you only need to specify the last part of a valid full collation-uri, e.g. "?lang=sv-SE", "lang=sv-SE;strength=primary;decomposition=standard" or "swedish".
- Parameters:
$source The input string $search The search string $collation-uri The collation URI - Returns:
- xs:string : the substring before $search
sum #1
sum ($arg as xs:anyAtomicType*) as xs:anyAtomicTypeReturns a value obtained by adding together the values in $arg. If $arg is the the empty sequence the xs:double value 0.0e0 is returned.
- Parameters:
$arg The sequence of numbers to be summed up - Returns:
- xs:anyAtomicType : the sum of all numbers in $arg
sum #2
sum ($arg as xs:anyAtomicType*, $default as xs:anyAtomicType?) as xs:anyAtomicTypeReturns a value obtained by adding together the values in $arg. If $arg is the the empty sequence then $default is returned.
- Parameters:
$arg The sequence of numbers to be summed up $default The default value if $arg computes to the empty sequence - Returns:
- xs:anyAtomicType? : the sum of all numbers in $arg
tail #1
tail ($sequence as item()*) as item()The function returns the value of the expression subsequence($sequence, 2), i.e. a new sequence containing all items of the input sequence except the first.
- Parameters:
$sequence The source sequence - Returns:
- item()* : the resulting sequence
timezone-from-date #1
timezone-from-date ($date as xs:date?) as xs:dayTimeDurationReturns the timezone component of $date if any. If $date has a timezone component, then the result is an xs:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. Otherwise, the result is the empty sequence.If $date is the empty sequence, returns the empty sequence.
- Parameters:
$date The date as xs:date - Returns:
- xs:dayTimeDuration? : the timezone component from $date
timezone-from-dateTime #1
timezone-from-dateTime ($date-time as xs:dateTime?) as xs:dayTimeDurationReturns the timezone component of $date-time if any. If $date-time has a timezone component, then the result is an xdt:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. Otherwise, the result is the empty sequence.
- Parameters:
$date-time The date-time as xs:dateTime - Returns:
- xs:dayTimeDuration? : the timezone component from $date-time
timezone-from-time #1
timezone-from-time ($time as xs:time?) as xs:dayTimeDurationReturns the timezone component of $time if any. If $time has a timezone component, then the result is an xdt:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. Otherwise, the result is the empty sequence.
- Parameters:
$time The time as xs:time - Returns:
- xs:dayTimeDuration? : the timezone component from $time
tokenize #1
tokenize ($input as xs:string?) as xs:stringBreaks the input string $input into a sequence of strings,
- Parameters:
$input The input string - Returns:
- xs:string* : the token sequence
tokenize #2
tokenize ($input as xs:string?, $pattern as xs:string) as xs:stringBreaks the input string $input into a sequence of strings,
- Parameters:
$input The input string $pattern The tokenization pattern - Returns:
- xs:string* : the token sequence
tokenize #3
tokenize ($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:stringBreaks the input string $input into a sequence of strings,
- Parameters:
$input The input string $pattern The tokenization pattern $flags The flags - Returns:
- xs:string* : the token sequence
trace #1
trace ($value as item()*) as item()This function is intended to be used in debugging queries by providing a trace of their execution. The input $value is returned, unchanged, as the result of the function. In addition, the inputs $value is serialized with adaptive settings and is written into the eXist log files.
- Parameters:
$value The values - Returns:
- item()* : The unlabelled $value in the log
trace #2
trace ($value as item()*, $label as xs:string) as item()This function is intended to be used in debugging queries by providing a trace of their execution. The input $value is returned, unchanged, as the result of the function. In addition, the inputs $value is serialized with adaptive settings and is written together with $label into the eXist log files.
- Parameters:
$value The values $label The label in the log file - Returns:
- item()* : The labelled $value in the log
transform #1
transform ($options as map(*)) as map(*)Invokes a transformation using a dynamically-loaded XSLT stylesheet.
- Parameters:
$options The inputs to the transformation are supplied in the form of a map - Returns:
- map(*)* : The result of the transformation is returned as a map. There is one entry in the map for the principal result document, and one for each secondary result document. The key is a URI in the form of an xs:string value. The key for the principal result document is the base output URI if specified, or the string "output" otherwise. The key for secondary result documents is the URI of the document, as an absolute URI. The associated value in each entry depends on the requested delivery format. If the delivery format is document, the value is a document node. If the delivery format is serialized, the value is a string containing the serialized result.
translate #3
translate ($arg as xs:string?, $map as xs:string, $trans as xs:string) as xs:stringReturns the value of $arg modified so that every character in the value of $arg that occurs at some position N in the value of $map has been replaced by the character that occurs at position N in the value of $trans.
If the value of $arg is the empty sequence, the zero-length string is returned.
Every character in the value of $arg that does not appear in the value of $map is unchanged.
Every character in the value of $arg that appears at some position M in the value of $map, where the value of $trans is less than M characters in length, is omitted from the returned value. If $map is the zero-length string $arg is returned.
If a character occurs more than once in $map, then the first occurrence determines the replacement character. If $trans is longer than $map, the excess characters are ignored.
i.e. fn:translate("bar","abc","ABC") returns "BAr"
- Parameters:
$arg The string to be translated $map The map string $trans The translation string - Returns:
- xs:string : the translated string
true #0
true () as xs:booleanAlways returns the boolean value true
- Returns:
- xs:boolean : true
unordered #1
unordered ($arg as item()*) as item()Takes a sequence $arg as input and returns an arbitrary implementation dependent permutation of it. Currently, this has no effect in eXist, but it might be used for future optimizations.
- Parameters:
$arg The input sequence - Returns:
- item()* : the input sequence in an arbitrary implementation dependent permutation
unparsed-text #1
unparsed-text ($href as xs:string?) as xs:stringreads an external resource (for example, a file) and returns a string representation of the resource
- Parameters:
$href the URI to load text from - Returns:
- xs:string?
unparsed-text #2
unparsed-text ($href as xs:string?, $encoding as xs:string) as xs:stringreads an external resource (for example, a file) and returns a string representation of the resource
- Parameters:
$href the URI to load text from $encoding character encoding of the resource - Returns:
- xs:string?
unparsed-text-available #1
unparsed-text-available ($href as xs:string?) as xs:booleandetermines whether a call on the fn:unparsed-text function with identical arguments would return a string
- Parameters:
$href the URI to load text from - Returns:
- xs:boolean
unparsed-text-available #2
unparsed-text-available ($href as xs:string?, $encoding as xs:string) as xs:booleandetermines whether a call on the fn:unparsed-text function with identical arguments would return a string
- Parameters:
$href the URI to load text from $encoding character encoding of the resource - Returns:
- xs:boolean
unparsed-text-lines #1
unparsed-text-lines ($href as xs:string?) as xs:stringreads 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
- Parameters:
$href the URI to load text from - Returns:
- xs:string*
unparsed-text-lines #2
unparsed-text-lines ($href as xs:string?, $encoding as xs:string) as xs:stringreads 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
- Parameters:
$href the URI to load text from $encoding character encoding of the resource - Returns:
- xs:string*
upper-case #1
upper-case ($arg as xs:string?) as xs:stringReturns the value of $arg after translating every character to its upper-case correspondent as defined in the appropriate case mappings section in the Unicode standard. For versions of Unicode beginning with the 2.1.8 update, only locale-insensitive case mappings should be applied. Beginning with version 3.2.0 (and likely future versions) of Unicode, precise mappings are described in default case operations, which are full case mappings in the absence of tailoring for particular languages and environments. Every lower-case character that does not have an upper-case correspondent, as well as every upper-case character, is included in the returned value in its original form.
- Parameters:
$arg The text to be converted to all upper-case characters - Returns:
- xs:string : the resulting upper-case text
uri-collection #0
uri-collection () as xs:anyURIReturns a sequence of xs:anyURI values that represent the URIs in a URI collection.
- Returns:
- xs:anyURI* : the default URI collection, if $arg is not specified or is an empty sequence, or the sequence of URIs that correspond to the supplied URI
uri-collection #1
uri-collection ($arg as xs:string?) as xs:anyURIReturns a sequence of xs:anyURI values that represent the URIs in a URI collection.
- Parameters:
$arg An xs:string identifying a URI Collection. The argument is interpreted as either an absolute xs:anyURI, or a relative xs:anyURI resolved against the base-URI property from the static context. In eXist-db this function consults the query hierarchy of the database. Query String parameters may be provided to control the URIs returned by this function. The parameter `match` may be used to provide a Regular Expression against which the result sequence of URIs are filtered. The parameter `content-type` may be used to determine the Internet Media Type (or generally whether XML, Binary, and/or (Sub) Collection) URIs that are returned in the result sequence; the special values: 'application/vnd.existdb.collection' includes (Sub) Collections, 'application/vnd.existdb.document' includes any document, 'application/vnd.existdb.document+xml' includes only XML documents, and 'application/vnd.existdb.document+binary' includes only Binary documents. By default, `content-type=application/vnd.existdb.collection,application/vnd.existdb.document` (i.e. all Collections and Documents). The parameter `stable` may be used to determine if the function is deterministic. By default `stable=yes` to ensure that the same results are returned by each call within the same query. - Returns:
- xs:anyURI* : the default URI collection, if $arg is not specified or is an empty sequence, or the sequence of URIs that correspond to the supplied URI
xml-to-json #1
xml-to-json ($node as node()?) as xs:stringConverts an XML tree (in w3c 'XML Representation of JSON' format) into a string conforming to the JSON grammar. Basic string (un)escaping.
Read more- Parameters:
$node The input node - Returns:
- xs:string? : The JSON representation of the input node
xml-to-json #2
xml-to-json ($node as node()?, $options as map(*)?) as xs:stringConverts an XML tree (in w3c 'XML Representation of JSON' format) into a string conforming to the JSON grammar. Basic string (un)escaping.
Read more- Parameters:
$node The input node $options The options map - Returns:
- xs:string? : The JSON representation of the input node
year-from-date #1
year-from-date ($date as xs:date?) as xs:integerReturns an xs:integer representing the year in the localized value of $date. The value may be negative.
- Parameters:
$date The date as xs:date - Returns:
- xs:integer? : the year component from $date
year-from-dateTime #1
year-from-dateTime ($date-time as xs:dateTime?) as xs:integerReturns an xs:integer representing the year in the localized value of $date-time. The value may be negative.
- Parameters:
$date-time The date-time as xs:dateTime - Returns:
- xs:integer? : the year component from $date-time
years-from-duration #1
years-from-duration ($duration as xs:duration?) as xs:integerReturns an xs:integer representing the years component in the canonical lexical representation of the value of $duration. The result may be negative.
- Parameters:
$duration The duration as xs:duration - Returns:
- xs:integer? : the years component of $duration
zero-or-one #1
zero-or-one ($arg as item()*) as item()Returns the argument sequence $arg if it contains zero or one items. Otherwise, raises an error.
- Parameters:
$arg The sequence to be tested for cardinality - Returns:
- item()? : the input sequence if it contains zero or one items.