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
Returns 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
Returns the absolute value of the argument $number.If the argument is negative returns -$number otherwise returns $number.
- Parameters:
-
$number? The number - Returns:
- numeric : The absolute value of the argument
adjust-date-to-timezone
Adjusts 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
Adjusts 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
Adjusts 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
Adjusts 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
Adjusts 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
Adjusts 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
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
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
available-environment-variables
Returns 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
Returns 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
Returns the value of the base URI property for the context item.
- Returns:
- xs:anyURI? : The base URI from the context item
base-uri
Returns the value of the base URI property for $uri. If $uri is the empty sequence, the empty sequence is returned.
- Parameters:
-
$uri? The URI - Returns:
- xs:anyURI? : the base URI from $uri
boolean
Computes the xs:boolean value of the sequence items.
- Parameters:
-
$items* The items - Returns:
- xs:boolean : The boolean value, ebv, of the items
ceiling
Returns 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:
- numeric : The non-fractional number not less than $number
codepoint-equal
Returns 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
Creates 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
collection
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 subcollections 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:
- node()* : The document nodes contained in or under the given collections
compare
Returns 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
Returns 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 relative so 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
Accepts 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
Returns 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
Returns 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 relative so 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
count
Returns 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
Returns 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
Returns the xs:dateTime (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:dateTime : the date-time current within query execution time span
current-time
Returns 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
Returns the sequence of atomic values from the items in $items.
- Parameters:
-
$items* The items - Returns:
- xs:anyAtomicType* : the atomic values of the items in $items
dateTime
Creates 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
Returns 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
Returns 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
Returns 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:dayTimeDuration - Returns:
- xs:integer? : the days component of $duration
deep-equal
Returns 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
Returns 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 relative so 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
Returns 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
distinct-values
Returns 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
Returns 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
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:
- node()? : the document node of $document-uri
doc-available
Returns 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
Returns the absolute URI of the resource from which the document node $document-node was constructed. If none such URI exists returns the empty sequence. If $document-node is the empty sequence, returns the empty sequence.
- Parameters:
-
$document-node? The document node - Returns:
- xs:anyURI? : the document URI of $document-node
empty
Returns 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
Escapes 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
Returns 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
Returns 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 relative so 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
Returns 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
Returns 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
Returns 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 relative so 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
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()
error
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()
error
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()
error
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()
escape-html-uri
Replaces 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
This 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
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
Returns 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
Always returns the boolean value false
- Returns:
- xs:boolean : false
filter
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
Returns the largets number not greater than the value of $number. If $number is the empty sequence, returns the empty sequence.
- Parameters:
-
$number* The number - Returns:
- numeric : the largets number without fraction part not greater than the value of $number
fold-left
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
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
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
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
Returns 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
Returns 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
Returns 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
Returns 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-number
The formatting of a number is controlled by a picture string. The picture string is a sequence of ·characters·, in which the characters assigned to the variables decimal-separator-sign, grouping-sign, decimal-digit-family, optional-digit-sign and pattern-separator-sign are classified as active characters, and all other characters (including the percent-sign and per-mille-sign) are classified as passive characters.
- Parameters:
-
$value? The number to format $picture The format pattern string. Please see the JavaDoc for java.text.DecimalFormat to get the specifics of this format string. - Returns:
- xs:string : the formatted string
format-number
- Parameters:
-
$value? The number to format $picture The format pattern string. Please see the JavaDoc for java.text.DecimalFormat to get the specifics of this format string. $decimal-format-name The decimal-format name must be a QName, which is expanded as described in [2.4 Qualified Names]. It is an error if the stylesheet does not contain a declaration of the decimal-format with the specified expanded-name. - Returns:
- xs:string : the formatted string
format-time
Returns 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
Returns 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
Returns 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
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
Returns 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
This 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
This function returns a string that uniquely identifies a given node.
- 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
head
The function returns the value of the expression $arg[1], i.e. the first item in the passed in sequence.
- Parameters:
-
$arg* $arg* - Returns:
- item()? : the first item or the empty sequence
hours-from-dateTime
Returns 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
Returns 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:dayTimeDuration - Returns:
- xs:integer? : the hours component of $duration
hours-from-time
Returns 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
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
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
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
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
Returns 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
Returns 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
Returns 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
Returns 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 relative so 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
insert-before
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
This 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
lang
Tests 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
Tests 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
Returns 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
local-name
Returns 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
Returns 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
Returns 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
Returns 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
map
Applies the function item $function to every item from the sequence $sequence in turn, returning the concatenation of the resulting sequences in order.
- Parameters:
-
$function the function to call $sequence* the sequence on which to apply the function - Returns:
- item()* : result of applying the function to each item of the sequence
- Deprecated:
- Moved to the module: http://www.w3.org/2005/xpath-functions, you should now use 'null:for-each' instead! This function could be removed in the next major release version.
map-pairs
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:
-
$function the function to call $seq1* first sequence to take items from $seq2* second sequence to take items from - Returns:
- item()* : result of the map-pairs operation
- Deprecated:
- Moved to the module: http://www.w3.org/2005/xpath-functions, you should now use 'null:for-each-pair' instead! This function could be removed in the next major release version.
matches
The function returns true if $input matches the regular expression supplied as $pattern, if present; otherwise, it returns false.
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.
- Parameters:
-
$input* The input string $pattern The pattern - Returns:
- xs:boolean : true if the pattern is a match, false otherwise
matches
The 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 a zero-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
Selects 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
Selects 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
Selects 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
Selects 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
Returns 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
Returns 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:dayTimeDuration - Returns:
- xs:integer? : the minutes component of $duration
minutes-from-time
Returns 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
Returns 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
Returns 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
Returns 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:yearMonthDuration - Returns:
- xs:integer? : the months component of $duration
name
Returns 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
Returns 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
Returns 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
Returns 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
Returns 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
Returns 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
Returns 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:
-
$arg? The input node - Returns:
- xs:boolean? : true if the argument node is "nilled"
node-name
Returns 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
Returns 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
Returns 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
Returns 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
Returns 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
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
Returns 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
Returns 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
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.
parse-xml
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
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:
- element()* : the parsed document fragment
position
Returns 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
Returns 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
remove
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
The 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. 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
The 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
Returns an xs:QName value (that is, an expanded-QName) by taking an xs:string that has the lexical form of an xs:QName (a string in the form "prefix:local-name" or "local-name") and resolving it using the in-scope namespaces for a given element.
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
Resolves $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
Resolves $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
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
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
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
Returns the number with no fractional part that is closest to the argument $arg. If there are two such numbers, then the one that is closest to positive infinity is returned. If 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.
For xs:float and xs:double arguments, if the argument is positive infinity, then positive infinity is returned. If the argument is negative infinity, then negative infinity is returned. If the argument is positive zero, then positive zero is returned. If the argument is negative zero, then negative zero is returned. If the argument is less than zero, but greater than or equal to -0.5, then negative zero is returned. In the cases where positive zero or negative zero is returned, negative zero or positive zero may be returned as [XML Schema Part 2: Datatypes Second Edition] does not distinguish between the values positive zero and negative zero.
- Parameters:
-
$arg? The input number - Returns:
- numeric : the rounded value
round-half-to-even
The 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:
- numeric : the rounded value
round-half-to-even
The 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? The precision factor - Returns:
- numeric : the rounded value
seconds-from-dateTime
Returns 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
Returns 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:dayTimeDuration - Returns:
- xs:decimal? : the seconds component of $duration
seconds-from-time
Returns 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
This 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
This 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 - Returns:
- xs:string : the string containing the serialized node set.
starts-with
Returns 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
Returns 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 relative so 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
Returns the value of the 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
Returns 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
Returns 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 vaule of as an xs:string - Returns:
- xs:string : the value of $arg as an xs:string
string-join
Returns 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
Returns 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
Returns 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
Returns 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
Returns 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
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
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
Returns 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
Returns 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
Returns 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
Returns 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 relative so 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
Returns 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
Returns 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 relative so 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
Returns 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
Returns 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
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
Returns 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
Returns 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
Returns 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
Breaks the input string $input into a sequence of strings, treating any substring that matches pattern $pattern as a separator. The separators themselves are not returned.
- Parameters:
-
$input? The input string $pattern The tokenization pattern - Returns:
- xs:string+ : the token sequence
tokenize
Breaks the input string $input into a sequence of strings, treating any substring that matches pattern $pattern as a separator using $flags, see http://www.w3.org/TR/xpath-functions/#flags. The separators themselves are not returned.
- Parameters:
-
$input? The input string $pattern The tokenization pattern $flags The flags - Returns:
- xs:string+ : the token sequence
trace
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, converted to an xs:string, and $label is directed to a trace data set in the eXist log files.
- Parameters:
-
$value* The value $label The label in the log file - Returns:
- item()* : the labelled $value in the log
translate
Returns 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
Always returns the boolean value true
- Returns:
- xs:boolean : true
unordered
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
upper-case
Returns 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
year-from-date
Returns 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
Returns 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
Returns 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:yearMonthDuration - Returns:
- xs:integer? : the years component of $duration
zero-or-one
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.