Available XQuery Functions

XQuery/XPath Core Library Functions (http://www.w3.org/2005/xpath-functions)
fn:QName
fn:QName($a as xs:string?, $b as xs:string) xs:QName
Returns an xs:QName with the namespace URI given in $a. If $a is the empty string or the empty sequence, it represents 'no namespace'. The prefix in $b is retained in the returned xs:QName value. The local name in the result is taken from the local part of $b
fn:abs
fn:abs($a as numeric?) numeric
Returns the absolute value of the argument. If the argument is negative returns -arg otherwise returns arg.
fn:adjust-date-to-timezone
fn:adjust-date-to-timezone($a as xs:date?) xs:date?
Adjusts an xs:date value to the implicit timezone of the current locale.
adjust-date-to-timezone($a as xs:date?, $b as xdt:dayTimeDuration?) xs:date?
Adjusts an xs:date value to a specific timezone, or to no timezone at all. If $b is the empty sequence, returns an xs:date without a timezone.
fn:adjust-dateTime-to-timezone
fn:adjust-dateTime-to-timezone($a as xs:dateTime?) xs:dateTime?
Adjusts an xs:dateTime value to the implicit timezone of the current locale.
adjust-dateTime-to-timezone($a as xs:dateTime?, $b as xdt:dayTimeDuration?) xs:dateTime?
Adjusts an xs:dateTime value to a specific timezone, or to no timezone at all. If $b is the empty sequence, returns an xs:dateTime without a timezone.
fn:adjust-time-to-timezone
fn:adjust-time-to-timezone($a as xs:time?) xs:time?
Adjusts an xs:time value to the implicit timezone of the current locale.
adjust-time-to-timezone($a as xs:time?, $b as xdt:dayTimeDuration?) xs:time?
Adjusts an xs:time value to a specific timezone, or to no timezone at all. If $b is the empty sequence, returns an xs:time without a timezone.
fn:avg
fn:avg($a as xdt:anyAtomicType*) xdt:anyAtomicType?
Returns the average of the values in the input sequence $a, that is, the sum of the values divided by the number of values.
fn:base-uri
fn:base-uri() xs:anyURI?
Returns the value of the base-uri property for the context item.
base-uri($a as node()?) xs:anyURI?
Returns the value of the base-uri property for $a. If $a is the empty sequence, the empty sequence is returned.
fn:boolean
fn:boolean($a as item()*) xs:boolean
Computes the xs:boolean value of the sequence argument.
fn:ceiling
fn:ceiling($a as numeric?) numeric
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.
fn:codepoint-equal
fn:codepoint-equal($a as xs:string?, $b as xs:string?) xs:boolean?
Returns true or false depending on whether the value of $a is equal to the value of $b, according to the Unicode code point collation
fn:codepoints-to-string
fn:codepoints-to-string($a as xs:integer*) xs:string
Creates an xs:string from a sequence of code points. Returns the zero-length string if $a is the empty sequence. If any of the code points in $a is not a legal XML character, an error is raised
fn:collection
fn:collection($a as xs:string*, ...) node()*
Returns the documents contained in the collections specified in the input sequence. The arguments are either collection pathes like '/db/shakespeare/plays' or XMLDB URIs like 'xmldb:exist://localhost:8081//db/shakespeare/plays'. Documents contained in subcollections are also included.
fn:compare
fn:compare($a as xs:string?, $b as xs:string?) xs:integer?
compare($a as xs:string?, $b as xs:string?, $c as xs:string) xs:integer?
fn:concat
fn:concat($a as xdt:anyAtomicType?, ...) xs:string?
Accepts two or more xdt:anyAtomicType arguments 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.
fn:contains
fn:contains($a as xs:string?, $b as xs:string?) xs:boolean
Returns an xs:boolean indicating whether or not the value of $arg1 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 $arg2, according to the default collation.
contains($a as xs:string?, $b as xs:string?, $c as xs:string) xs:boolean
Returns an xs:boolean indicating whether or not the value of $arg1 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 $arg2, according to the collation that is specified in $arg3.
fn:count
fn:count($a as item()*) xs:integer
Returns the number of items in the argument sequence.
fn:current-date
fn:current-date() xs: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.
fn:current-dateTime
fn:current-dateTime() xs: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.
fn:current-time
fn:current-time() xs: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.
fn:data
fn:data($a as item()*) xdt:anyAtomicType*
fn:data takes a sequence of items and returns a sequence of atomic values.
fn:dateTime
fn:dateTime($a as xs:date?, $b as xs:time?) xs:dateTime?
Creates an xs:dateTime from an xs:date and an xs:time.
fn:day-from-date
fn:day-from-date($a as xs:date?) xs:integer?
Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $a.
fn:day-from-dateTime
fn:day-from-dateTime($a as xs:dateTime?) xs:integer?
Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $a.
fn:days-from-duration
fn:days-from-duration($a as xdt:dayTimeDuration?) xs:integer?
Returns an xs:integer representing the days component in the canonical lexical representation of the value of $a. The result may be negative.
fn:deep-equal
fn:deep-equal($a as item()*, $b as item()*) xs:boolean
Returns true iff every item in $a is deep-equal to the item at the same position in $b, false otherwise. If both $a and $b are the empty sequence, returns true.
deep-equal($a as item()*, $b as item()*, $c as xs:string) xs:boolean
Returns true iff every item in $a is deep-equal to the item at the same position in $b, false otherwise. If both $a and $b are the empty sequence, returns true. Comparison collation is specified by $c
fn:default-collation
fn:default-collation() xs:string
Returns the context's default collation.
fn:distinct-values
fn:distinct-values($a as xdt:anyAtomicType*) xdt:anyAtomicType*
Returns a sequence where duplicate values of $a, based on value equality, have been deleted.
distinct-values($a as xdt:anyAtomicType*, $b as xs:string) xdt:anyAtomicType*
Returns a sequence where duplicate values of $a, based on value equality specified by collation $b, have been deleted.
fn:doc
fn:doc($a as xs:string?) node()?
Returns the documents specified in the input sequence. The arguments are either document paths like '/db/shakespeare/plays/hamlet.xml' or XMLDB URIs like 'xmldb:exist://localhost:8081//db/shakespeare/plays/hamlet.xml' or standard URLs starting with http://, file://, etc.
fn:doc-available
fn:doc-available($a as xs:string?) xs:boolean
Returns whether or not the document specified in the input sequence is available. The arguments are either document pathes like '/db/shakespeare/plays/hamlet.xml' or XMLDB URIs like 'xmldb:exist://localhost:8081//db/shakespeare/plays/hamlet.xml' or standard URLs, starting with http://, file://, etc.
fn:doctype
fn:doctype($a as xs:string+) node()*
Returns the document nodes of the documents whose DOCTYPE is given by $a.
fn:document
fn:document($a as xs:string+, ...) node()*
Returns the documents specified in the input sequence. This function is specific to eXist and will be replaced with the corresponding fn:doc function. The arguments are either document pathes like '/db/shakespeare/plays/hamlet.xml' or XMLDB URIs like 'xmldb:exist://localhost:8081//db/shakespeare/plays/hamlet.xml'. If the input sequence is empty, the function will load all documents in the database.
fn:document-uri
fn:document-uri($a as node()?) xs:anyURI?
Returns the absolute URI of the resource from which the document node $a was constructed, if none such URI exists returns the empty sequence. If $a is the empty sequence, returns the empty sequence.
fn:empty
fn:empty($a as item()*) xs:boolean
Returns true if the value of the argument is the empty sequence, false otherwise.
fn:encode-for-uri
fn:encode-for-uri($a as xs:string?) xs:string
fn:ends-with
fn:ends-with($a as xs:string?, $b as xs:string?) xs:boolean
Returns true if the string value of $b is a suffix of the string value of $a, false otherwise. If either $a or $b is the empty sequence, the empty sequence is returned.
ends-with($a as xs:string?, $b as xs:string?, $c as xs:string) xs:boolean?
Returns true if the string value of $b is a suffix of the string value of $a using collation $c, false otherwise. If either $a or $b is the empty sequence, the empty sequence is returned.
fn:error
fn:error() empty()
Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception.
error($a as xs:QName) empty()
Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception.
error($a as xs:QName?, $b as xs:string) empty()
Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception.
error($a as xs:QName?, $b as xs:string, $c as item()*) empty()
Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception.
fn:escape-html-uri
fn:escape-html-uri($a as xs:string?) xs:string
Replaces all nonprintable ASCII characters in the string value of $a by an escape sequence represented as a hexadecimal octet in the form %XX. If $a is the empty sequence, returns the zero-length string.
fn:escape-uri
fn:escape-uri($a as xs:string?, $b as xs:boolean) xs:string
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 $a, 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. $b indicates whether to escape reserved characters.
fn:exactly-one
fn:exactly-one($a as item()*) item()
Returns the argument sequence if it contains exactly one item. Otherwise, raises an error.
fn:exists
fn:exists($a as item()*) xs:boolean
If the argument is not the empty sequence, the function returns true; otherwise, the function returns false.
fn:false
fn:false() xs:boolean
Always returns the boolean value false
fn:floor
fn:floor($a as numeric*) numeric
Returns the largets number not greater than the value of $a.If $a is the empty sequence, returns the empty sequence.
fn:hours-from-dateTime
fn:hours-from-dateTime($a as xs:dateTime?) xs:integer?
Returns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $arg.
fn:hours-from-duration
fn:hours-from-duration($a as xdt:dayTimeDuration?) xs:integer?
Returns an xs:integer representing the hours component in the canonical lexical representation of the value of $a. The result may be negative.
fn:hours-from-time
fn:hours-from-time($a as xs:time?) xs:integer?
Returns an xs:integer between 0 and 23, both inclusive, representing the value of the hours component in the localized value of $arg.
fn:id
fn:id($a as xs:string*) element()*
Returns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $a. If none is matching or $a is the empty sequence, returns the empty sequence.
id($a as xs:string*, $b as node()) element()*
Returns the sequence of element nodes that have an ID value matching the value of one or more of the IDREF values supplied in $a. If none is matching or $a is the empty sequence, returns the empty sequence.
fn:idref
fn:idref($a as xs:string*) node()*
Returns the sequence of element or attributes nodes with an IDREF value matching the value of one or more of the ID values supplied in $a. If none is matching or $a is the empty sequence, returns the empty sequence.
idref($a as xs:string*, $b as node()) node()*
Returns the sequence of element or attributes nodes with an IDREF value matching the value of one or more of the ID values supplied in $a. If none is matching or $a is the empty sequence, returns the empty sequence.
fn:implicit-timezone
fn:implicit-timezone() xdt:dayTimeDuration
Returns the value of the implicit timezone property from the dynamic context.
fn:in-scope-prefixes
fn:in-scope-prefixes($a as element()) xs:string*
Returns the prefixes of the in-scope namespaces for $a. 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.
fn:index-of
fn:index-of($a as xdt:anyAtomicType*, $b as xdt:anyAtomicType) xs:integer?
Returns a sequence of positive integers giving the positions within the sequence $a of items that are equal to $b. If the value of $a is the empty sequence, or if no item in $a matches $b, then the empty sequence is returned.
index-of($a as xdt:anyAtomicType*, $b as xdt:anyAtomicType, $c as xs:string) xs:integer?
Returns a sequence of positive integers giving the positions within the sequence $a of items that are equal to $b. If the value of $a is the empty sequence, or if no item in $a matches $b, then the empty sequence is returned. Values are compared according to the collation specified in $c.
fn:insert-before
fn:insert-before($a as item()*, $b as xs:integer, $c as item()*) item()*
Returns a new sequence constructed from the value of the target sequencewith the value of the sequence to insert inserted at the position specified.
fn:iri-to-uri
fn:iri-to-uri($a as xs:string?) xs:string
Returns an URI as a xs:string if the value of $a is a valid IRI. Invald characters are escape sequence encoded before the conversion. If $a is the empty sequence, returns the zero-length string.
fn:item-at
fn:item-at($a as item()*, $b as xs:integer) xs:boolean?
Returns the item in the first argument sequence that is located at the position specified by the second argument.
fn:lang
fn:lang($a as xs:string?) xs:boolean
Returns true if the context items xml:lang attribute is equal to the value of $a, false otherwise.
lang($a as xs:string?, $b as node()) xs:boolean
Returns true if the context items xml:lang attribute is equal to the value of $a, false otherwise.
fn:last
fn:last() xs:integer?
Returns the context size from the dynamic context. If the context item is undefined, an error is raised.
fn:local-name
fn:local-name() xs:string
Returns the local part of the name of the context item as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName.
local-name($a as node()?) xs:string
Returns the local part of the name of the value of $a as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName.
fn:local-name-from-QName
fn:local-name-from-QName($a as xs:QName?) xs:NCName?
Returns an xs:NCName representing the local part of $a. If $a is the empty sequence, returns the empty sequence.
fn:lower-case
fn:lower-case($a as xs:string?) xs:string
fn:match-all
fn:match-all($a as node()*, $b as xs:string+, ...) node()*
eXist-specific extension function. Tries to match each of the regular expression strings passed in $b and all following parameters against the keywords contained in the fulltext index. The keywords found are then compared to the node set in $a. Every node containing all of the keywords is copied to the result sequence.
fn:match-any
fn:match-any($a as node()*, $b as xs:string+, ...) node()*
eXist-specific extension function. Tries to match each of the regular expression strings passed in $b and all following parameters against the keywords contained in the fulltext index. The keywords found are then compared to the node set in $a. Every node containing any of the keywords is copied to the result sequence.
fn:matches
fn:matches($a as xs:string*, $b as xs:string) xs:boolean
Returns true if the first argument string matches the regular expression specified by the second argument. This function is optimized internally if a range index of type xs:string is defined on the nodes passed to the first argument. Please note that - in contrast - with the specification - this method allows zero or more items for the string argument.
matches($a as xs:string*, $b as xs:string, $c as xs:string) xs:boolean
Returns true if the first argument string matches the regular expression specified by the second argument. This function is optimized internally if a range index of type xs:string is defined on the nodes passed to the first argument. Please note that - in contrast - with the specification - this method allows zero or more items for the string argument.
fn:max
fn:max($a as xdt:anyAtomicType*) xdt:anyAtomicType?
Selects an item from the input sequence $a whose value is greater than or equal to the value of every other item in the input sequence.
max($a as xdt:anyAtomicType*, $b as xs:string) xdt:anyAtomicType?
Selects an item from the input sequence $a whose value is greater than or equal to the value of every other item in the input sequence. The collation URI specified in $b will be used for string comparisons.
fn:min
fn:min($a as xdt:anyAtomicType*) xdt:anyAtomicType?
Selects an item from the input sequence $a whose value is less than or equal to the value of every other item in the input sequence.
min($a as xdt:anyAtomicType*, $b as xs:string) xdt:anyAtomicType?
Selects an item from the input sequence $a whose value is less than or equal to the value of every other item in the input sequence. The collation specified in $b is used for string comparisons.
fn:minutes-from-dateTime
fn:minutes-from-dateTime($a as xs:dateTime?) xs:integer?
Returns an xs:integer value between 0 to 59, both inclusive, representing the value of the minutes component in the localized value of $arg.
fn:minutes-from-duration
fn:minutes-from-duration($a as xdt:dayTimeDuration?) xs:integer?
Returns an xs:integer representing the minutes component in the canonical lexical representation of the value of $a. The result may be negative.
fn:minutes-from-time
fn:minutes-from-time($a as xs:time?) xs:integer?
Returns an xs:integer value between 0 to 59, both inclusive, representing the value of the minutes component in the localized value of $arg.
fn:month-from-date
fn:month-from-date($a as xs:date?) xs:integer?
Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $a.
fn:month-from-dateTime
fn:month-from-dateTime($a as xs:dateTime?) xs:integer?
Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $a.
fn:months-from-duration
fn:months-from-duration($a as xdt:yearMonthDuration?) xs:integer?
Returns an xs:integer representing the months component in the canonical lexical representation of the value of $a. The result may be negative.
fn:name
fn:name() xs:string?
Returns the name of a node, as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName
name($a as node()?) xs:string?
Returns the name of a node, as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName
fn:namespace-uri
fn:namespace-uri() xs:anyURI
Returns the namespace URI of the xs:QName of the context item. If the context item is in no namespace or is neither an element nor attribute node, returns the xs:anyURI equivalent to the zero-length string. Raises an error if the context item is undefined or not a node.
namespace-uri($a as node()?) xs:anyURI
Returns the namespace URI of the xs:QName value of $a. If $a is in no namespace or is neither an element nor attribute node, returns the xs:anyURI eqvivalent to the zero-length string. Raises an error if the context item is undefined or not a node.
fn:namespace-uri-for-prefix
fn:namespace-uri-for-prefix($a as xs:string?, $b as element()) xs:anyURI?
Returns the namespace URI of one of the in-scope namespaces for $b, identified by its namespace prefix. If $b has an in-scope namespace whose namespace prefix is equal to $a, it returns the namespace URI of that namespace. If $b 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.
fn:namespace-uri-from-QName
fn:namespace-uri-from-QName($a as xs:QName?) xs:anyURI?
Returns the namespace URI for $a. If $a is the empty sequence, returns the empty sequence.
fn:nilled
fn:nilled($a as node()?) xs:boolean?
Returns whether $a is nilled of not.
fn:node-name
fn:node-name($a as node()?) xs:QName?
Returns an expanded-QName for node kinds that can have names. For other kinds of nodes it returns the empty sequence. If $a is the empty sequence, the empty sequence is returned.
fn:normalize-space
fn:normalize-space() xs:string
Returns the value of the context item with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of one or more whitespace character with a single space.
normalize-space($a as xs:string?) xs:string
Returns the value of $a with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of one or more whitespace character with a single space.If the value of $a is the empty sequence, returns the zero-length string. If no argument is supplied $a defaults to the string value of the context item.
fn:normalize-unicode
fn:normalize-unicode($a as xs:string?) xs:boolean
Returns the value of $a normalized according to the normalization form NFC.
normalize-unicode($a as xs:string?, $b as xs:string) xs:boolean
Returns the value of $a normalized according to the normalization criteria for a normalization form identified by the value of $b.
fn:not
fn:not($a as item()*) xs:boolean
Returns true if the effective boolean value (ebv) is false, true otherwise.
fn:number
fn:number() xs:double
Returns the value of the context item as a xs:double. If the context item cannot be converted to a xs:double, NaN is returned.
number($a as xdt:anyAtomicType?) xs:double
Returns the value of $a as a xs:double. If the value of $a is the empty sequence or cannot be converted to a xs:double, NaN is returned.
fn:one-or-more
fn:one-or-more($a as item()*) item()+
Returns the argument sequence if it contains one or more items. Otherwise, raises an error.
fn:position
fn:position() xs:integer?
Returns the context position from the dynamic context.If the context item is undefined, raises an error.
fn:prefix-from-QName
fn:prefix-from-QName($a as xs:QName?) xs:NCName?
Returns an xs:NCName representing the prefix of $a. If $a is the empty sequence, returns the empty sequence.
fn:remove
fn:remove($a as item()*, $b as xs:integer) item()*
Returns a new sequence constructed from the value of the target sequencewith the item at the position specified removed.
fn:replace
fn:replace($a as xs:string?, $b as xs:string, $c as xs:string) xs:string?
The function returns the xs:string that is obtained by replacing all non-overlapping substrings of $a that match the given pattern $b with an occurrence of the $c replacement string.
replace($a as xs:string?, $b as xs:string, $c as xs:string, $d as xs:string) xs:string?
The function returns the xs:string that is obtained by replacing all non-overlapping substrings of $a that match the given pattern $b with an occurrence of the $c replacement string.
fn:resolve-QName
fn:resolve-QName($a as xs:string?, $b as element()) xs: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.
fn:resolve-uri
fn:resolve-uri($a as xs:string?) xs:anyURI?
The purpose of this function is to enable a relative URI $a to be resolved against the static context's base URI.
resolve-uri($a as xs:string?, $b as xs:string) xs:anyURI?
The purpose of this function is to enable a relative URI $a to be resolved against the absolute URI $b. If $a is the empty sequence, the empty sequence is returned.
fn:reverse
fn:reverse($a as item()*) item()*
Reverses the order of items in a sequence. If the argument is an emptysequence, the empty sequence is returned.
fn:root
fn:root() node()
Returns the root of the tree to which the context node belongs. This will usually, but not necessarily, be a document node.
root($a as node()?) node()?
Returns the root of the tree to which $arg belongs. This will usually, but not necessarily, be a document node.
fn:round
fn:round($a as numeric?) numeric
Returns the number with no fractional part that is closest to the value of $a. Always returns the number closest to +INF if there are two such numbers.
fn:round-half-to-even
fn:round-half-to-even($a as numeric?) numeric
The first signature of this function produces the same result as the second signature with $b=0.
round-half-to-even($a as numeric?, $b as numeric?) numeric
The value returned is the nearest (that is, numerically closest) numeric to $a that is a multiple of ten to the power of minus $b. If two such values are equally near (e.g. if the fractional part in $a is exactly .500...), returns the one whose least significant digit is even.
fn:seconds-from-dateTime
fn:seconds-from-dateTime($a as xs:dateTime?) xs:decimal?
Returns an xs:decimal value between 0 and 60.999..., both inclusive, representing the seconds and fractional seconds in the localized value of $arg. 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.
fn:seconds-from-duration
fn:seconds-from-duration($a as xdt:dayTimeDuration?) xs:decimal?
Returns an xs:decimal representing the seconds component in the canonical lexical representation of the value of $a. The result may be negative
fn:seconds-from-time
fn:seconds-from-time($a as xs:time?) xs:decimal?
Returns an xs:decimal value between 0 and 60.999..., both inclusive, representing the seconds and fractional seconds in the localized value of $arg. 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.
fn:starts-with
fn:starts-with($a as xs:string?, $b as xs:string?) xs:boolean?
Returns true if the string value of $b is a prefix of the string value of $a, false otherwise. If either $a or $b is the empty sequence, the empty sequence is returned.
starts-with($a as xs:string?, $b as xs:string?, $c as xs:string) xs:boolean?
Returns true if the string value of $b is a prefix of the string value of $a using collation $c, false otherwise. If either $a or $b is the empty sequence, the empty sequence is returned.
fn:static-base-uri
fn:static-base-uri() xs:anyURI?
Returns the value of the base-uri property from the static context. If the base-uri property is undefined, the empty sequence is returned.
fn:string
fn:string() xs:string
Returns the value of the context item as xs:string. If the context item is undefined, an error is raised.
string($a as item()?) xs:string
Returns the value of $a as xs:string. If the value of $ is the empty sequence, the zero-length string is returned. If the context item of $a is undefined, an error is raised.
fn:string-join
fn:string-join($a as xs:string*, $b as xs:string) xs:string
Returns a xs:string created by concatenating the members of the $a sequence using $b as a separator. If the value of $b is the zero-length string, then the members of $a are concatenated without a separator.
fn:string-length
fn:string-length() xs:integer?
string-length($a as xs:string?) xs:integer?
fn:string-pad
fn:string-pad($a as xs:string?, $b as xs:integer) xs:string?
Returns an xs:string consisting of a number copies of the first argument concatenated together without any separators. The number of copies is specified by the second argument.
fn:string-to-codepoints
fn:string-to-codepoints($a as xs:string?) xs:integer*
Returns the sequence of code points that constitute an xs:string. If $a is a zero-length string or the empty sequence, the empty sequence is returned.
fn:subsequence
fn:subsequence($a as item()*, $b as xs:double) item()*
Returns a subsequence of the values in the first argument sequence, starting at the position indicated by the value of the second argument and including the number of items indicated by the value of the optional thirdargument. If the third argument is missing, all items up to the end of the sequence are included.
subsequence($a as item()*, $b as xs:double, $c as xs:double) item()*
Returns a subsequence of the values in the first argument sequence, starting at the position indicated by the value of the second argument and including the number of items indicated by the value of the optional thirdargument. If the third argument is missing, all items up to the end of the sequence are included.
fn:substring
fn:substring($a as xs:string?, $b as xs:double) xs:string?
Returns the portion of the value of $a beginning at the position indicated by the value of $b and continuing to the end of $a. The characters returned do not extend beyond the end of $a. If $b is zero or negative, only those characters in positions greater than zero are returned. If the value of $a is the empty sequence, the zero-length string is returned.
substring($a as xs:string?, $b as xs:double, $c as xs:double) xs:string?
Returns the portion of the value of $a beginning at the position indicated by the value of $b and continuing for the number of characters indicated by the value of $c. The characters returned do not extend beyond the end of $a. If $b is zero or negative, only those characters in positions greater than zero are returned. If the value of $a is the empty sequence, the zero-length string is returned.
fn:substring-after
fn:substring-after($a as xs:string?, $b as xs:string?) xs:string?
Returns the substring of the value of $a that follows the first occurrence of a sequence of the value of $b. If the value of $a or $b is the empty sequence it is interpreted as the zero-length string. If the value of $b is the zero-length string, the zero-length string is returned. If the value of $a does not contain a string that is equal to the value of $b, the zero-length string is returned.
substring-after($a as xs:string?, $b as xs:string?, $c as xs:string) xs:string?
Returns the substring of the value of $a that follows the first occurrence of a sequence of the value of $b in the collation $c. If the value of $a or $b is the empty sequence it is interpreted as the zero-length string. If the value of $b is the zero-length string, the zero-length string is returned. If the value of $a does not contain a string that is equal to the value of $b, the zero-length string is returned.
fn:substring-before
fn:substring-before($a as xs:string?, $b as xs:string?) xs:string?
Returns the substring of the value of $a that precedes the first occurrence of a sequence of the value of $b. If the value of $a or $b is the empty sequence it is interpreted as the zero-length string. If the value of $b is the zero-length string, the zero-length string is returned. If the value of $a does not contain a string that is equal to the value of $b, the zero-length string is returned.
substring-before($a as xs:string?, $b as xs:string?, $c as xs:string) xs:string?
Returns the substring of the value of $a that precedes the first occurrence of a sequence of the value of $b in the collation $c. If the value of $a or $b is the empty sequence it is interpreted as the zero-length string. If the value of $b is the zero-length string, the zero-length string is returned. If the value of $a does not contain a string that is equal to the value of $b, the zero-length string is returned.
fn:sum
fn:sum($a as xdt:anyAtomicType*) xdt:anyAtomicType
Returns a value obtained by adding together the values in $a. If the single-argument form of the function is used, then the value returned for an empty sequence is the xs:double value 0.0e0.
sum($a as xdt:anyAtomicType*, $b as xdt:anyAtomicType?) xdt:anyAtomicType?
Returns a value obtained by adding together the values in $a. If the single-argument form of the function is used, then the value returned for an empty sequence is the xs:double value 0.0e0. If the two-argument form is used, then the value returned for an empty sequence is the value of the $b argument.
fn:timezone-from-date
fn:timezone-from-date($a as xs:date?) xdt:dayTimeDuration?
Returns an xs:integer representing the year in the localized value of $a. The value may be negative.
fn:timezone-from-dateTime
fn:timezone-from-dateTime($a as xs:dateTime?) xdt:dayTimeDuration?
Returns the timezone component of $arg if any. If $arg 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.
fn:timezone-from-time
fn:timezone-from-time($a as xs:time?) xdt:dayTimeDuration?
Returns the timezone component of $arg if any. If $arg 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.
fn:tokenize
fn:tokenize($a as xs:string?, $b as xs:string) xs:string+
This function breaks the input string $a into a sequence of strings, treating any substring that matches pattern $b as a separator. The separators themselves are not returned.
tokenize($a as xs:string?, $b as xs:string, $c as xs:string) xs:string+
This function breaks the input string $a into a sequence of strings, treating any substring that matches pattern $b as a separator. The separators themselves are not returned.
fn:trace
fn:trace($a as item()*, $b as xs:string) item()*
This function is intended to be used in debugging queries by providing a trace of their execution. The input $a is returned, unchanged, as the result of the function. In addition, the inputs $a, converted to an xs:string, and $b is directed to a trace data set in the eXist log files.
fn:translate
fn:translate($a as xs:string?, $b as xs:string, $c as xs:string) xs:string
Returns the value of $a modified so that every character in the value of $a that occurs at some position N in the value of $b has been replaced by the character that occurs at position N in the value of $c. If the value of $a is the empty sequence, the zero-length string is returned.
fn:true
fn:true() xs:boolean
Always returns the boolean value true
fn:unordered
fn:unordered($a as item()*) item()*
Takes a sequence as input and returns an arbitrary implementation dependent permutation of the input sequence. Currently, this has no effect in eXist, but it might be used for future optimizations.
fn:upper-case
fn:upper-case($a as xs:string?) xs:string
fn:xcollection
fn:xcollection($a as xs:string+, ...) node()*
Works like fn:collection(), but does not include documents found in sub-collections of the specified collections.
fn:year-from-date
fn:year-from-date($a as xs:date?) xs:integer?
Returns an xs:integer representing the year in the localized value of $a. The value may be negative.
fn:year-from-dateTime
fn:year-from-dateTime($a as xs:dateTime?) xs:integer?
Returns an xs:integer representing the year in the localized value of $a. The value may be negative.
fn:years-from-duration
fn:years-from-duration($a as xdt:yearMonthDuration?) xs:integer?
Returns an xs:integer representing the years component in the canonical lexical representation of the value of $a. The result may be negative.
fn:zero-or-one
fn:zero-or-one($a as item()*) item()?
Returns the argument sequence if it contains zero or one items. Otherwise, raises an error.
Functions for determining differences in XML documents. (http://exist-db.org/xquery/xmldiff)
xmldiff:compare
xmldiff:compare($a as node()*, $b as node()*) xs:boolean?
Returns the differences between XML documents
Database manipulation functions (http://exist-db.org/xquery/xmldb)
xmldb:authenticate
xmldb:authenticate($a as xs:string, $b as xs:string?, $c as xs:string?) xs:boolean
Check if a user is registered as database user. The function simply tries to read the database collection specified in the first parameter $a, using the supplied username in $b and password in $c. It returns true if the attempt succeeds, false otherwise.
xmldb:change-user
xmldb:change-user($a as xs:string, $b as xs:string?, $c as xs:string*, $d as xs:string?) empty()
Change properties of an existing user, you must have appropriate permissions to do this. $a is the username, $b is the password, $c is the sequence of group memberships, $d is the home collection. The username is mandatory but other values are optional, where if empty the existing value is used.
xmldb:chmod-collection
xmldb:chmod-collection($a as xs:string, $b as xs:integer) empty()
Sets the mode of the specified Collection. $a is the Collection path, $b is the mode (as xs:integer). PLEASE REMEMBER that 0755 is 7*64+5*8+5, NOT decimal 755.
xmldb:chmod-resource
xmldb:chmod-resource($a as xs:string, $b as xs:string, $c as xs:integer) empty()
Sets the mode of the specified Resource. $a is the collection path, $b is the resource name, $c is the mode (as xs:integer). PLEASE REMEMBER that 0755 is 7*64+5*8+5, NOT decimal 755.
xmldb:collection-available
xmldb:collection-available($a as xs:string) xs:boolean
Returns true as xs:boolean if there is a collection with the same name as the first argument as xs:string.
xmldb:collection-exists
xmldb:collection-exists($a as xs:string, ...) xs:boolean
Returns true as xs:boolean if there is a collection with the same name as the first argument as xs:string.
xmldb:copy
xmldb:copy($a as xs:string, $b as xs:string) empty()
Copy a collection $a to the collection $b. The collections can be specified either as a simple collection path or an XMLDB URI.
xmldb:copy($a as xs:string, $b as xs:string, $c as xs:string) empty()
Copy a resource $c from the collection specified in $a to collection in $b. The collections can be either specified as a simple collection path or an XMLDB URI.
xmldb:create-collection
xmldb:create-collection($a as xs:string, $b as xs:string) xs:string?
Create a new collection as a child of the collection specified in the first argument. The collection can be passed as a simple collection path or an XMLDB URI.The second argument specifies the name of the new collection. The function returns the path to the new collection as an xs:string or - if the collection could not be created - the empty sequence.
xmldb:create-user
xmldb:create-user($a as xs:string, $b as xs:string, $c as xs:string+, $d as xs:string?) empty()
Create a new user in the database. Arguments are: username, password, group memberships and home collection.
xmldb:created
xmldb:created($a as xs:string) xs:dateTime
Returns the creation date of a collection $a. The collection can be passed as a simple collection path or an XMLDB URI.
xmldb:created($a as xs:string, $b as xs:string) xs:dateTime
Returns the creation date of a resource $b in the collection specified by $a. The collection can be passed as a simple collection path or an XMLDB URI.
xmldb:decode
xmldb:decode($a as xs:string) xs:string
Decodes the string provided in $a such that any percent encoded octets will be translated to their decoded UTF-8 representation.
xmldb:decode-uri
xmldb:decode-uri($a as xs:anyURI) xs:string
Decodes the URI provided in $a such that any percent encoded octets will be translated to their decoded UTF-8 representation.
xmldb:delete-user
xmldb:delete-user($a as xs:string) empty()
Deletes an existing user in the database. Requires username. Does not delete the user's home collection.
xmldb:document
xmldb:document($a as xs:string+, ...) node()*
Returns the documents specified in the input sequence. The arguments are either document pathes like '/db/shakespeare/plays/hamlet.xml' or XMLDB URIs like 'xmldb:exist://localhost:8081//db/shakespeare/plays/hamlet.xml'. If the input sequence is empty, the function will load all documents in the database.
xmldb:document-has-lock
xmldb:document-has-lock($a as xs:string, $b as xs:string) xs:string?
Returns the name of the user that holds a write lock on the resource specified in $b in the collection $a. If no lock is in place, the empty sequence is returned. The collection can be passed as a simple collection path or an XMLDB URI.
xmldb:encode
xmldb:encode($a as xs:string) xs:string
Encodes the string provided in $a such that it will be a valid collection or resource path. Provides similar functionality to java's URLEncoder.encode() function, with some enhancements
xmldb:encode-uri
xmldb:encode-uri($a as xs:string) xs:anyURI
Encodes the string provided in $a such that it will be a valid collection or resource path. Provides similar functionality to java's URLEncoder.encode() function, with some enhancements. Returns an xs:anyURI object representing a valid XmldbURI
xmldb:exists-user
xmldb:exists-user($a as xs:string) xs:boolean
Returns true if user exists. Requires username.
xmldb:get-child-collections
xmldb:get-child-collections($a as xs:string) xs:string*
Returns a sequence of strings containing all the child collections of the collection specified in $a. The collection parameter can either be a simple collection path or an XMLDB URI.
xmldb:get-child-resources
xmldb:get-child-resources($a as item()) xs:string*
Returns all child resources in the specified collection.
xmldb:get-current-user
xmldb:get-current-user() xs:string
Returns the current user from the context of the xquery.
xmldb:get-group
xmldb:get-group($a as xs:string) xs:string?
Returns the owner group of the collection $a. The collection can be passed as a simple collection path or an XMLDB URI.
xmldb:get-group($a as xs:string, $b as xs:string) xs:string?
Returns the owner group of a resource in the collection specified by $a. The collection can be passed as a simple collection path or an XMLDB URI.
xmldb:get-mime-type
xmldb:get-mime-type($a as xs:anyURI) xs:string?
Returns the MIME Type of the resource indicated in $a or an empty sequence otherwise.
xmldb:get-owner
xmldb:get-owner($a as item()) xs:string?
Returns the owner of a collection. The collection can be passed as a simple collection path or an XMLDB URI.
xmldb:get-owner($a as item(), $b as xs:string) xs:string?
Returns the owner of the specified resource $b in collection $a. The collection can be passed as a simple collection path or an XMLDB URI.
xmldb:get-permissions
xmldb:get-permissions($a as xs:string) xs:int?
Returns the permissions assigned to the collection $a. The collection can be specified as a simple collection path or an XMLDB URI.
xmldb:get-permissions($a as xs:string, $b as xs:string) xs:int?
Returns the permissions assigned to the resource specified in $b which is a child of the collection $a. The collection can be specified as a simple collection path or an XMLDB URI.
xmldb:get-user-groups
xmldb:get-user-groups($a as xs:string) xs:string+
Receives the sequence of groups the specified user is a member of.
xmldb:get-user-home
xmldb:get-user-home($a as xs:string) xs:anyURI?
Returns the home collection of the specified user or the empty sequence if no home collection is assigned to the user.
xmldb:is-admin-user
xmldb:is-admin-user($a as xs:string) xs:boolean?
Returns true if user is an Admin. Requires username.
xmldb:last-modified
xmldb:last-modified($a as item(), $b as xs:string) xs:dateTime?
Returns the last-modification date of a resource, whose name is specified by $b, in the collection specified by $a. The collection can be passed as a simple collection path or an XMLDB URI.
xmldb:login
xmldb:login($a as xs:string, $b as xs:string?, $c as xs:string?) xs:boolean
Check if a user is registered as database user and change the user identity for the current XQuery script. The function simply tries to read the database collection specified in the first parameter $a, using the supplied username in $b and password in $c. Contrary to the authenticate function,login will set the current user for the xquery script to the authenticated user. It returns true if the attempt succeeds, false otherwise. If called from a HTTP contextthen the login is cached for the lifetime of the HTTP session and may be used for all XQueryscripts in that session.
xmldb:move
xmldb:move($a as xs:string, $b as xs:string) empty()
Move a collection $a. The collection can be specified either as a simple collection path or an XMLDB URI.
xmldb:move($a as xs:string, $b as xs:string, $c as xs:string) empty()
Move a resource $c from the collection specified in $a to collection in $b. The collection can be either specified as a simple collection path or an XMLDB URI.
xmldb:permissions-to-string
xmldb:permissions-to-string($a as xs:integer) xs:string?
Format the resource or collection permissions passed as an integer value into a string. The returned string shows the permissions following the usual Unix conventions, i.e. all permissions set is returned as rwurwurwu, where the first three chars are for user permissions, followed by group and world. 'r' denotes read, 'w' write and 'u' update permissions
xmldb:register-database
xmldb:register-database($a as xs:string, $b as xs:boolean) xs:boolean
Register an XMLDB driver class with the XMLDB Database Manager. This is only required if you want to access a database instance different from the one that executes the XQuery.
xmldb:reindex
xmldb:reindex($a as xs:string) empty()
Reindex collection $a. DBA only
xmldb:remove
xmldb:remove($a as xs:string) empty()
Remove a collection $a. The collection can be specified either as a simple collection path or an XMLDB URI.
xmldb:remove($a as xs:string, $b as xs:string) empty()
Remove a resource from the collection specified in $a. The collection can be either specified as a simple collection path or an XMLDB URI.
xmldb:rename
xmldb:rename($a as xs:string, $b as xs:string) empty()
Rename a collection $a. The collection can be specified either as a simple collection path or an XMLDB URI.
xmldb:rename($a as xs:string, $b as xs:string, $c as xs:string) empty()
Rename a resource $b in the collection specified in $a with name in $c. The collection can be either specified as a simple collection path or an XMLDB URI.
xmldb:set-collection-permissions
xmldb:set-collection-permissions($a as xs:string, $b as xs:string, $c as xs:string, $d as xs:integer) empty()
Sets the permissions of the specified collection. $a is the collection, which can be specified as a simple collection path or an XMLDB URI. $b specifies the user which will become the owner of the resource, $c the group. The final argument contains the permissions, specified as an xs:integer value. PLEASE REMEMBER that 0755 is 7*64+5*8+5, NOT decimal 755.
xmldb:set-resource-permissions
xmldb:set-resource-permissions($a as xs:string, $b as xs:string, $c as xs:string, $d as xs:string, $e as xs:integer) empty()
Sets the permissions of the specified resource. $a is the collection, which can be specified as a simple collection path or an XMLDB URI. $b denotes the resource tochange. $c specifies the user which will become the owner of the resource, $d the group. The final argument contains the permissions, specified as an xs:integer value. PLEASE REMEMBER that 0755 is 7*64+5*8+5, NOT decimal 755.
xmldb:size
xmldb:size($a as xs:string, $b as xs:string) xs:long
Returns the estimated size of a resource $b (in bytes) in the collection specified by $a. The estimation is based on the number of pages occupied by a resource. If the document is serialized back to a string, it's size may be different, as parts of the structural information are stored in compressed form. The collection can be passed as a simple collection path or an XMLDB URI.
xmldb:store
xmldb:store($a as xs:string, $b as xs:string?, $c as item()) xs:string?
Store a new resource into the database. The first argument denotes the collection where the resource should be stored. The collection can be either specified as a simple collection path or an XMLDB URI. The second argument is the name of the new resource. The third argument is either a node, an xs:string, a Java file object or an xs:anyURI. A node will be serialized to SAX. It becomes the root node of the new document. If the argument is of type xs:anyURI, the resource is loaded from that URI. The functions returns the path to the new document as an xs:string or - if the document could not be stored - the empty sequence.
xmldb:store($a as xs:string, $b as xs:string?, $c as item(), $d as xs:string) xs:string?
Store a new resource into the database. The first argument denotes the collection where the resource should be stored. The collection can be either specified as a simple collection path or an XMLDB URI. The second argument is the name of the new resource. The third argument is either a node, an xs:string, a Java file object or an xs:anyURI. A node will be serialized to SAX. It becomes the root node of the new document. If the argument is of type xs:anyURI, the resource is loaded from that URI. The final argument $d is used to specify a mime-type. If the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource. The functions returns the path to the new document as an xs:string or - if the document could not be stored - the empty sequence.
xmldb:store-files-from-pattern
xmldb:store-files-from-pattern($a as xs:string, $b as xs:string, $c as xs:string+) xs:string*
Store new resources into the database. Resources are read from the server's file system, using file patterns. The first argument denotes the collection where resources should be stored. The collection can be either specified as a simple collection path or an XMLDB URI. The second argument is the directory in the file system wherefrom the files are read.The third argument is the file pattern. File pattern matching is based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one. The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document.
xmldb:store-files-from-pattern($a as xs:string, $b as xs:string, $c as xs:string+, $d as xs:string) xs:string*
Store new resources into the database. Resources are read from the server's file system, using file patterns. The first argument denotes the collection where resources should be stored. The collection can be either specified as a simple collection path or an XMLDB URI. The second argument is the directory in the file system wherefrom the files are read.The third argument is the file pattern. File pattern matching is based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one. The fourth argument $d is used to specify a mime-type. If the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource.The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document.
xmldb:store-files-from-pattern($a as xs:string, $b as xs:string, $c as xs:string+, $d as xs:string, $e as xs:boolean) xs:string*
Store new resources into the database. Resources are read from the server's file system, using file patterns. The first argument denotes the collection where resources should be stored. The collection can be either specified as a simple collection path or an XMLDB URI. The second argument is the directory in the file system wherefrom the files are read.The third argument is the file pattern. File pattern matching is based on code from Apache's Ant, thus following the same conventions. For example: *.xml matches any file ending with .xml in the current directory, **/*.xml matches files in any directory below the current one. The fourth argument $d is used to specify a mime-type. If the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource.If the final boolean argument is true(), the directory structure will be kept in the collection, otherwise all the matching resources, including the ones in sub-directories, will be stored in the collection given in the first argument flatly.The function returns a sequence of all document paths added to the db. These can be directly passed to fn:doc() to retrieve the document.
xmldb:update
xmldb:update($a as xs:string, $b as node()) xs:integer
Process an XUpdate request against a collection. The first argument specifies the collection as a simple collection path or an XMLDB URI. The second argument specifies the XUpdate modifications to be processed. Modifications are passed in a document conforming to the XUpdate specification. The function returns the number of modifications caused by the XUpdate.
xmldb:xcollection
xmldb:xcollection($a as xs:string+) node()*
Works like fn:collection(), but does not include documents found in sub-collections of the specified collections.
XML validation and grammars functions. (http://exist-db.org/xquery/validation)
validation:clear-grammar-cache
validation:clear-grammar-cache() xs:integer
Remove all cached grammers.
validation:pre-parse-grammar
validation:pre-parse-grammar($a as xs:anyURI*) xs:string*
Pre parse grammars specified by $a and add to grammar cache. Only for XML schemas (.xsd).
validation:show-grammar-cache
validation:show-grammar-cache() node()
Show all cached grammars.
validation:validate
validation:validate($a as item()) xs:boolean
Validate document specified by $a. $a is of type xs:anyURI, or a node (element or returned by fn:doc()). The grammar files (DTD, XML Schema) are resolved using the global catalog file(s).
validation:validate($a as item(), $b as xs:anyURI) xs:boolean
Validate document specified by $a using $b. $a is of type xs:anyURI, or a node (element or returned by fn:doc()). $b can point to an OASIS catalog file (.xml), a collection (path ends with '/') or a grammar document. Supported grammar documents extensions are ".dtd" ".xsd" ".rng" ".rnc" ".sch" and ".nvdl".
validation:validate-report
validation:validate-report($a as item()) node()
Validate document specified by $a. $a is of type xs:anyURI, or a node (element or returned by fn:doc()). The grammar files (DTD, XML Schema) are resolved using the global catalog file(s). A simple report is returned.
validation:validate-report($a as item(), $b as xs:anyURI) node()
Validate document specified by $a using $b. $a is of type xs:anyURI, or a node (element or returned by fn:doc()). $b can point to an OASIS catalog file (.xml), a collection (path ends with '/') or a grammar document. Supported grammar documents extensions are ".dtd" ".xsd" ".rng" ".rnc" ".sch" and ".nvdl". A simple report is returned.
Various utility extension functions (http://exist-db.org/xquery/util)
util:binary-doc
util:binary-doc($a as xs:string?) xs:base64Binary?
Retrieves the binary resource identified by $a and returns its contents as a value of type xs:base64Binary. An empty sequence is returned if the resource could not be found or $a was empty.
util:binary-doc-available
util:binary-doc-available($a as xs:string?) xs:boolean
Checks if the binary resource identified by $a is available.
util:binary-to-string
util:binary-to-string($a as xs:base64Binary?) xs:string?
Returns the contents of a binary resource as an xs:string value. The binary data is transformed into a Java string using the encoding specified in the optional second argument or UTF-8.
util:binary-to-string($a as xs:base64Binary?, $b as xs:string) xs:string?
Returns the contents of a binary resource as an xs:string value. The binary data is transformed into a Java string using the encoding specified in the optional second argument or UTF-8.
util:call
util:call($a as function, $b as item()*, ...) item()*
Invokes a first-class function reference created by util:function. The function to be called is passed as the first argument. All remaining arguments are forwarded to the called function.
util:catch
util:catch($a as xs:string+, $b as item()*, $c as item()*) item()*
This function corresponds to a try-catch statement in Java. The code block in $b will be put inside a try-catch statement. If an exception is thrown while executing $b, the function checks the name of the exception and calls $c if it matches one of the fully qualified Java class names specified in $a. A value of "*" in $a will catch all java exceptions
util:collations
util:collations() xs:string*
Returns a sequence of strings containing all collation locales that might be specified in the '?lang=' parameter of a collation URI.
util:collection-name
util:collection-name($a as item()?) xs:string?
Returns the name of the collection from a passed node or path string. If the argument is a node, the function returns the name of the collection to which the node's document belongs. If the argument is a string, it is interpreted as path to a resource and the function returns the computed parent collection path for this resource.
util:compile
util:compile($a as xs:string) xs:string
Dynamically evaluates the XPath/XQuery expression specified in $a within the current instance of the query engine.
util:declare-namespace
util:declare-namespace($a as xs:string, $b as xs:anyURI) empty()
Dynamically declares a namespace/prefix mapping for the current context. The prefix is specified in $a, the namespace URI in $b.
util:declare-option
util:declare-option($a as xs:string, $b as xs:string) empty()
Dynamically declares a serialization option as with 'declare option'.
util:deep-copy
util:deep-copy($a as item()?) item()?
Performs a Deep Clone of the Parameter $a
util:describe-function
util:describe-function($a as xs:QName) node()
Describes a built-in function. Returns an element describing the function signature.
util:disable-profiling
util:disable-profiling() empty()
Disable profiling output within the query.
util:doctype
util:doctype($a as xs:string+, ...) node()*
Returns the document nodes of the documents whose DOCTYPE is given by $a.
util:document-id
util:document-id($a as item()) xs:int?
Returns the internal integer id of a document. The argument can either be a node or a string path pointing to a resource in the database. If the resource does not exist or the node does not belong to a stored document, the empty sequence is returned.
util:document-name
util:document-name($a as item()) xs:string?
Returns the name of a document (excluding the collection path). The argument can either be a node or a string path pointing to a resource in the database. If the resource does not exist or the node does not belong to a stored document, the empty sequence is returned.
util:eXist-version
util:eXist-version() xs:string
Returns the version of eXist running this query.
util:enable-profiling
util:enable-profiling($a as xs:int) empty()
Enable profiling output within the query. The profiling starts with this function call and will end with a call to 'disable-profiling'. Argument $a specifies the verbosity. All other profiling options can be configured via the 'declare option exist:profiling ...' in the query prolog.
util:eval
util:eval($a as item()) node()*
Dynamically evaluates an XPath/XQuery expression. If the first argument is of type xs:string, the function tries to execute this string as the query. If the first argument is of type xs:anyURI, the function will try to load the query from the resource to which the URI resolves. If the URI has no scheme, it is assumed that the query is stored in the db and the URI is interpreted as a database path. This is the same as calling util:eval(xs:anyURI('xmldb:exist:///db/test/test.xq')). The query inherits the current execution context, i.e. all namespace declarations and variable declarations are visible from within the inner expression. The function returns an empty sequence if a whitespace string is passed.
util:eval($a as item(), $b as xs:boolean) node()*
Dynamically evaluates an XPath/XQuery expression. If the first argument is of type xs:string, the function tries to execute this string as the query. If the first argument is of type xs:anyURI, the function will try to load the query from the resource to which the URI resolves. If the URI has no scheme, it is assumed that the query is stored in the db and the URI is interpreted as a database path. This is the same as calling util:eval(xs:anyURI('xmldb:exist:///db/test/test.xq')). The query inherits the current execution context, i.e. all namespace declarations and variable declarations are visible from within the inner expression. The function returns an empty sequence if a whitespace string is passed. The third argument specifies if the compiled query expression should be cached. The cached query will be globally available within the db instance.
util:eval-inline
util:eval-inline($a as item()*, $b as item()) item()*
Dynamically evaluates an XPath/XQuery expression. If the first argument is of type xs:string, the function tries to execute this string as the query. If the first argument is of type xs:anyURI, the function will try to load the query from the resource to which the URI resolves. If the URI has no scheme, it is assumed that the query is stored in the db and the URI is interpreted as a database path. This is the same as calling util:eval(xs:anyURI('xmldb:exist:///db/test/test.xq')). The query inherits the first argument's context, i.e. all namespace declarations and variable declarations are visible from within the inner expression. The function returns an empty sequence if a whitespace string is passed.
util:eval-with-context
util:eval-with-context($a as item(), $b as node()?, $c as xs:boolean) node()*
Dynamically evaluates an XPath/XQuery expression. If the first argument is of type xs:string, the function tries to execute this string as the query. If the first argument is of type xs:anyURI, the function will try to load the query from the resource to which the URI resolves. If the URI has no scheme, it is assumed that the query is stored in the db and the URI is interpreted as a database path. This is the same as calling util:eval(xs:anyURI('xmldb:exist:///db/test/test.xq')). The query inherits the context described by the XML fragment in the second parameter. It should have the format: <static-context> <output-size-limit value="-1"> <unbind-namespace uri="http://exist.sourceforge.net/NS/exist"/> <current-dateTime value="dateTime"/> <implicit-timezone value="duration"/> <variable name="qname">variable value</variable> </static-context>. The third