Available XQuery Functions

XQuery/XPath Core Library Functions (http://www.w3.org/2003/05/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 number?) number
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?
This version of the function returns the value of the base-uri property from the static context. If the base-uri property is undefined, the empty sequence is returned.
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 number?) number
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: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: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. TODO: collation as argument $c
fn:distinct-values
fn:distinct-values($a as xdt:anyAtomicType*) xdt:anyAtomicType*
Returns a sequence where duplicate values, based on value equality, 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 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: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*
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 number*) number
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: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. Deprecated. Use $x[1] instead.
fn:lang
fn:lang($a as xs:string) node*
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 eqvivalent 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 $aIf $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: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: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: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 number?) number
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 number?) number
The first signature of this function produces the same result as the second signature with $b=0.
round-half-to-even($a as number?, $b as number?) number
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.
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 subcollections of the specified collections. This function is specific to eXist and will be moved into a seperate module in the near future.
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.
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. Parameters are: username, password, group memberships, home collection.
xmldb:chmod-collection
xmldb:chmod-collection($a as xs:string, $b as xs:integer) empty()
Sets the mode of the specified Collection. Required: collection, 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. Required: collection, resource, mode (as xs:integer). PLEASE REMEMBER that 0755 is 7*64+5*8+5, NOT decimal 755.
xmldb:collection
xmldb:collection($a as xs:string, $b as xs:string, $c as xs:string) object?
Get a reference to a collection. The first argument is either a collection path like '/db/shakespeare/plays' or an XMLDB URI like 'xmldb:exist://localhost:8081//db/shakespeare/plays'. While the function accepts a string argument, this argument must conform to the xs:anyURI type specification. The second argument should specify the name of a valid user, the third is the password. The method returns a Java object type, which can then be used as argument to the create-collection or store functions.
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 item, $b as xs:string) empty()
Copy a collection. The collections can be specified either as a simple collection path, an XMLDB URI or a collection object.
xmldb:copy($a as item, $b as xs:string, $c as xs:string) empty()
Copy a resource from the collection specified in $a to collection in $b. The collections can be either specified as a simple collection path, an XMLDB URI or a collection object.
xmldb:create-collection
xmldb:create-collection($a as item, $b as xs:string) object?
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, an XMLDB URI or as a collection object (obtained from the collection function).The second argument specifies the name of the new collection.
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,home collection.
xmldb:created
xmldb:created($a as item, $b as xs:string) xs:dateTime
Returns the creation date of a resource in the collection specified by $a. The collection can be passed as a simple collection path, an XMLDB URI or a collection object (obtained from the collection function).
xmldb:created($a as item) xs:dateTime
Returns the creation date of a collection. The collection can be passed as a simple collection path, an XMLDB URI or a collection object (obtained from the collection function).
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-has-lock
xmldb:document-has-lock($a as item, $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, an XMLDB URI or a collection object (obtained from the collection function).
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 item) 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, an XMLDB URI or a collection object as returned by the xmldb:collection function.
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 item) xs:string?
Returns the owner group of a collection. The collection can be passed as a simple collection path, an XMLDB URI or a collection object (obtained from the collection function).
xmldb:get-group($a as item, $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, an XMLDB URI or a collection object (obtained from the collection function).
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, an XMLDB URI or a collection object (obtained from the collection function).
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, an XMLDB URI or a collection object (obtained from the collection function).
xmldb:get-permissions
xmldb:get-permissions($a as item) xs:int?
Returns the permissions assigned to the collection. The collection can be specified as a simple collection path, an XMLDB URI or a collection object.
xmldb:get-permissions($a as item, $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, an XMLDB URI or a collection object.
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 exists. Requires username. Does not delete the user's home collection.
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, an XMLDB URI or acollection object (obtained from the collection function).
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 item, $b as xs:string) empty()
Move a collection $a. The collection can be specified either as a simple collection path, an XMLDB URI or a collection object.
xmldb:move($a as item, $b as xs:string, $c as xs:string) empty()
Move a resource from the collection specified in $a to collection in $b. The collection can be either specified as a simple collection path, an XMLDB URI or a collection object.
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:remove
xmldb:remove($a as item) empty()
Remove a collection. The collection can be specified either as a simple collection path, an XMLDB URI or a collection object.
xmldb:remove($a as item, $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, an XMLDB URI or a collection object.
xmldb:rename
xmldb:rename($a as item, $b as xs:string) empty()
Rename a collection $a. The collection can be specified either as a simple collection path, an XMLDB URI or a collection object.
xmldb:rename($a as item, $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, an XMLDB URI or a collection object.
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, an XMLDB URI or a collection object. $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, an XMLDB URI or a collection object. $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 item, $b as xs:string) xs:long
Returns the estimated size of a resource (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, an XMLDB URI or a collection object (obtained from the collection function).
xmldb:store
xmldb:store($a as item, $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, an XMLDB URI, or a collection object as returned by the collection or create-collection functions. 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 item, $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, an XMLDB URI, or a collection object as returned by the collection or create-collection functions. 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 item, $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, an XMLDB URI, or a collection object as returned by the collection or create-collection functions. 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 item, $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, an XMLDB URI, or a collection object as returned by the collection or create-collection functions. 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 item, $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, an XMLDB URI, or a collection object as returned by the collection or create-collection functions. 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 object, $b as node) xs:integer
Process an XUpdate request on the current collection. The first argument specifies the collection object as returned by the collection or create-collection functions. The second argument specifies the XUpdate modifications to be processed. Modifications are passed in a document conforming to the XUpdate specification.
XML validation and grammars functions. (http://exist-db.org/xquery/validation)
validation:grammar-cache-clear
validation:grammar-cache-clear() empty()
Remove all cached grammers.
validation:grammar-cache-show
validation:grammar-cache-show() xs:string*
Show all cached grammars.
validation:validate
validation:validate($a as xs:string) xs:boolean
Validate document specified by $a. The grammar files are searched inside the database.
validation:validate($a as xs:string, $b as xs:string) xs:boolean
Validate document specified by $a using path $b. $b can point a grammar, a collection containing grammars (usefull for XSD) or a OASIS catalog file.
validation:validate-report
validation:validate-report($a as xs:string) xs:string*
Validate document specified by $a, return a simple report. The grammar files are searched inside the database.
validation:validate-report($a as xs:string, $b as xs:string) xs:string*
Validate document specified by $a using path $b, return a simple report. $b can point a grammar, a collection containing grammars (usefull for XSD) or a OASIS catalog file.
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-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
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 to which the passed node belongs.
util:compile
util:compile($a as xs:string) xs:string
Dynamically evaluates the XPath/XQuery expression specified in $b within the current instance of the query engine. The evaluation context is taken from argument $a.
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: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:document-id
util:document-id($a as node) xs:int?
Returns the internal id of the document to which the passed node belongs.
util:document-name
util:document-name($a as node) xs:string?
Returns the name of the document to which the passed node belongs.
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 its string argument as an XPath/XQuery expression. The query is specified via the first argument. If it is of type xs:string, util:eval tries to execute this string as the query. If the first argument is an xs:anyURI, the function will try to load the query from the resource to which the (absolute) 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('xmldb:exist:///db/test/test.xq'). The argument expression will inherit the current execution context, i.e. all namespace declarations and variable declarations are visible from within the inner expression. It will return an empty sequence if you pass a whitespace string.
util:eval($a as item, $b as xs:boolean) node*
Dynamically evaluates its string argument as an XPath/XQuery expression. The query is specified via the first argument. If it is of type xs:string, util:eval tries to execute this string as the query. If the first argument is an 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('xmldb:exist:///db/test/test.xq'). The argument expression will inherit the current execution context, i.e. all namespace declarations and variable declarations are visible from within the inner expression. It will return an empty sequence if you pass a whitespace string.
util:eval-inline
util:eval-inline($a as item*, $b as item) item*
Dynamically evaluates the XPath/XQuery expression specified in $b within the current instance of the query engine. The query is specified via the first argument. If it is of type xs:string, util:eval tries to execute this string as the query. If the first argument is an 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('xmldb:exist:///db/test/test.xq'). The evaluation context is taken from argument $a.
util:eval-inline($a as item*, $b as item, $c as xs:boolean) item*
Dynamically evaluates the XPath/XQuery expression specified in $b within the current instance of the query engine. The query is specified via the first argument. If it is of type xs:string, util:eval tries to execute this string as the query. If the first argument is an 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('xmldb:exist:///db/test/test.xq'). The evaluation context is taken from argument $a. The third argument, $c, specifies if the compiled query expression should be cached. The cached query will be globally available within the db instance.
util:eval-with-context
util:eval-with-context($a as item, $b as node?, $c as xs:boolean) node*
Dynamically evaluates its string argument as an XPath/XQuery expression. The query is specified via the first argument. If it is of type xs:string, util:eval tries to execute this string as the query. If the first argument is an 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('xmldb:exist:///db/test/test.xq'). A new execution context will be created before the expression is evaluated. Static context properties can be set via the XML fragment in the second parameter. The XML fragment should have the format: <static-context><variable name="qname">variable value</variable></static-context>.
util:exclusive-lock
util:exclusive-lock($a as node*, $b as item*) item*
Puts an exclusive lock on the owner documents of all nodes in the first argument $a. Then evaluates the expressions in the second argument $b and releases the acquired locks aftertheir completion.
util:file-read
util:file-read($a as item) xs:string?
Read content of file $a
util:file-read($a as item, $b as xs:string) xs:string?
Read content of file $a with the encoding specified in $b.
util:function
util:function($a as xs:string, $b as xs:integer) function
Creates a reference to an XQuery function which can later be called from util:call. This allows for higher-order functions to be implemented in XQuery. A higher-order function is a function that takes another function as argument. The first argument represents the name of the function, which should bea valid QName. The second argument is the arity of the function. If nofunction can be found that matches the name and arity, an error is thrown. Please note: due to the special character of util:function, the arguments to this function have to be literals or need to be resolvable at compile time at least.
util:get-module-description
util:get-module-description($a as xs:string) xs:string
Returns a short description of the module identified by the namespace URI.
util:import-module
util:import-module($a as xs:anyURI, $b as xs:string, $c as xs:anyURI) empty()
Dynamically imports an XQuery module into the current context. The namespace URI of the module is specified in argument $a, $b is the prefix that will be assigned to that namespace, $c is the location of the module. The parameters have the same meaning as in an 'import module ...' expression in the query prolog.
util:index-key-documents
util:index-key-documents($a as node*, $b as xdt:anyAtomicType) xs:integer?
Return the number of documents for an indexed value. The first argument specifies the nodes whose content is indexed. The second argument specifies the value.
util:index-key-occurrences
util:index-key-occurrences($a as node*, $b as xdt:anyAtomicType) xs:integer?
Return the number of occurrences for an indexed value. The first argument specifies the nodes whose content is indexed. The second argument specifies the value.
util:index-keys
util:index-keys($a as node*, $b as xdt:anyAtomicType, $c as function, $d as xs:int) item*
Can be used to query existing range indexes defined on a set of nodes. All index keys defined for the given node set are reported to a callback function. The node set is specified in the first argument. The second argument specifies a start value. Only index keys of the same type but being greater than $b will be reported for non-stringtypes. For string types, only keys starting with the given prefix are reported. The third arguments is a function reference as created by the util:function function. It can be an arbitrary user-defined function, but it should take exactly 2 arguments: 1) the current index key as found in the range index as an atomic value, 2) a sequence containing three int values: a) the overall frequency of the key within the node set, b) the number of distinct documents in the node set the key occurs in, c) the current position of the key in the whole list of keys returned.
util:index-type
util:index-type($a as node*) xs:string?
Returns the range index type for a set of nodes or an empty sequence if no index is defined.
util:log
util:log($a as xs:string, $b as item*) empty()
Logs the message specified in $b to the current logger. $a indicates the log priority, e.g. 'debug' or 'warn'.
util:md5
util:md5($a as item) xs:string
Generates an MD5 key from a string.
util:node-by-id
util:node-by-id($a as node, $b as xs:string) node
Retrieves a node by its internal node-id. The document is specified via the first argument. It may either be a document node or another node from the same document from which the target node will be retrieved by its id. The second argument is the internal node-id, specified as a string. Please note: the function does not check if the passed id does really point to an existing node. It just returns a pointer, which may thus be invalid.
util:node-id
util:node-id($a as node) xs:string
Returns the internal node-id of a node. The internal node-id uniquely identifies a node within its document. It is encoded as a long number.
util:qname-index-lookup
util:qname-index-lookup($a as xs:QName, $b as xdt:anyAtomicType) node*
Can be used to query existing qname indexes defined on a set of nodes. The qname is specified in the first argument. The second argument specifies a comparison value.
util:random
util:random() xs:double
Returns a random number - equivalent to calling the java function Math.random().
util:registered-functions
util:registered-functions($a as xs:string) xs:string+
Returns a sequence containing the QNames of all functions declared in the module identified by the specified namespace URI. An error is raised if no module is found for the specified URI.
util:registered-functions() xs:string+
Returns a sequence containing the QNames of all functions currently known to the system, including functions in imported and built-in modules.
util:registered-modules
util:registered-modules() xs:string+
Returns a sequence containing the namespace URIs of all modules currently known to the system, including built in and imported modules.
util:serialize
util:serialize($a as node*, $b as xs:string, $c as xs:string*) xs:boolean?
Writes the node set passed in parameter $a into a file on the file system. The full path to the file is specified in parameter $b. $c contains a sequence of zero or more serialization parameters specified as key=value pairs. The serialization options are the same as those recognized by "declare option exist:serialize". The function does NOT automatically inherit the serialization options of the XQuery it is called from. False is returned if the specified file can not be created or is not writable, true on success. The empty sequence is returned if the argument sequence is empty.
util:serialize($a as node*, $b as xs:string*) xs:string?
Returns the Serialized node set passed in parameter $a. $b contains a sequence of zero or more serialization parameters specified as key=value pairs. The serialization options are the same as those recognized by "declare option exist:serialize". The function does NOT automatically inherit the serialization options of the XQuery it is called from.
util:shared-lock
util:shared-lock($a as node*, $b as item*) item*
Puts a shared lock on the owner documents of all nodes in the first argument $a. Then evaluates the expressions in the second argument $b and releases the acquired locks aftertheir completion.
util:system-property
util:system-property($a as xs:string) xs:string?
Returns the value of a system property. Similar to the corresponding XSLT function. Predefined properties are: vendor, vendor-url, product-name, product-version, product-build, and all Java system properties.
util:system-time
util:system-time() xs:time
Returns the xs:time (with timezone) as reported by the Java method System.currentTimeMillis(). Contrary to fn:current-time, this function is not stable, i.e. the returned xs:time will change during the evaluation time of a query and can be used to measure time differences.
util:unescape-uri
util:unescape-uri($a as xs:string, $b as xs:string) xs:string
Returns an un-escaped URL escaped string identified by $a with the encoding scheme indicated by the string $b (e.g. "UTF-8"). Decodes encoded sensitive characters from a URL, for example "%2F" becomes "/", i.e. does the oposite to escape-uri()
Functions to deal with XSL transformations (http://exist-db.org/xquery/transform)
transform:stream-transform
transform:stream-transform($a as node?, $b as item, $c as node?) empty()
Applies an XSL stylesheet to the node tree passed as first argument. The parameters are the same as for the transform function. stream-transform can only be used within a servlet context. Instead of returning the transformed document fragment, it directly streams its output to the servlet's output stream. It should thus be the last statement in the XQuery.
transform:transform
transform:transform($a as node?, $b as item, $c as node?) node?
Applies an XSL stylesheet to the node tree passed as first argument. The stylesheet is specified in the second argument. This should either be an URI or a node. If it is an URI, it can either point to an external location or to an XSL stored in the db by using the 'xmldb:' scheme. Stylesheets are cached unless they were just created from an XML fragment and not from a complete document. Stylesheet parameters may be passed in the third argument using an XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
Extension functions for text searching (http://exist-db.org/xquery/text)
text:filter
text:filter($a as xs:string, $b as xs:string) xs:string*
Filter substrings that match the regular expression $b in text $a.
text:fuzzy-index-terms
text:fuzzy-index-terms($a as xs:string?) xs:string*
Fuzzy keyword search, which compares strings based on the Levenshtein distance (or edit distance). The function tries to match each of the keywords specified in the keyword string $b against the string value of each item in the sequence $a.
text:fuzzy-match-all
text:fuzzy-match-all($a as node*, $b as xs:string, ...) node*
Fuzzy keyword search, which compares strings based on the Levenshtein distance (or edit distance). The function tries to match each of the keywords specified in the keyword string $b against the string value of each item in the sequence $a.
text:fuzzy-match-any
text:fuzzy-match-any($a as node*, $b as xs:string, ...) node*
Fuzzy keyword search, which compares strings based on the Levenshtein distance (or edit distance). The function tries to match any of the keywords specified in the keyword string $b against the string value of each item in the sequence $a.
text:groups
text:groups($a as xs:string, $b as xs:string) xs:string*
Tries to match the string in $a to the regular expression in $b. Returns an empty sequence if the string does not match, or a sequence whose first item is the entire string, and whose following items are the matched groups.
text:groups($a as xs:string, $b as xs:string, $c as xs:string) xs:string*
Tries to match the string in $a to the regular expression in $b, using the flags specified in $c. Returns an empty sequence if the string does not match, or a sequence whose first item is the entire string, and whose following items are the matched groups.
text:highlight-matches
text:highlight-matches($a as text*, $b as function, $c as item*) node*
Highlight matching strings within text nodes that resulted from a fulltext search. When searching with one of the fulltext operators or functions, eXist keeps track of the fulltext matches within the text. Usually, the serializer will mark those matches by enclosing them into an 'exist:match' element. One can then use an XSLT stylesheet to replace those match elements and highlight matches to the user. However, this is not always possible, so Instead of using an XSLT to post-process the serialized output, the highlight-matches function provides direct access to the matching portions of the text within XQuery. The function takes a sequence of text nodes as first argument $a and a callback function (defined with util:function) as second parameter $b. $c may contain a sequence of additional values that will be passed to the callback functions third parameter. Text nodes without matches will be returned as they are. However, if the text contains a match marker, the matching character sequence is reported to the callback function, and the result of the function call is inserted into the resulting node set where the matching sequence occurred. For example, you can use this to mark all matching terms with a <span class="highlight">abc</span>.
text:index-terms
text:index-terms($a as node*, $b as xs:string, $c as function, $d as xs:int) item*
This function can be used to collect some information on the distribution of index terms within a set of nodes. The set of nodes is specified in the first argument $a. The function returns term frequencies for all terms in the index found in descendants of the nodes in $a. The second argument $b specifies a start string. Only terms starting with the specified character sequence are returned. $c is a function reference, which points to a callback function that will be called for every term occurrence. $d defines the maximum number of terms that should be reported. The function reference for $c can be created with the util:function function. It can be an arbitrary user-defined function, but it should take exactly 2 arguments: 1) the current term as found in the index as xs:string, 2) a sequence containing four int values: a) the overall frequency of the term within the node set, b) the number of distinct documents in the node set the term occurs in, c) the current position of the term in the whole list of terms returned, d) the rank of the current term in the whole list of terms returned.
text:kwic-display
text:kwic-display($a as text*, $b as xs:positiveInteger, $c as function, $d as item*) node*
This function takes a sequence of text nodes in $a, containing matches from a fulltext search. It highlights matching strings within those text nodes in the same way as the text:highlight-matches function. However, only a defined portion of the text surrounding the first match (and maybe following matches) is returned. If the text preceding the first match is larger than the width specified in the second argument $b, it will be truncated to fill no more than (width - keyword-length) / 2 characters. Likewise, the text following the match will be truncated in such a way that the whole string sequence fits into width characters. The third parameter $c is a callback function (defined with util:function). $d may contain an additional sequence of values that will be passed to the last parameter of the callback function. Any matching character sequence is reported to the callback function, and the result of the function call is inserted into the resulting node set where the matching sequence occurred. For example, you can use this to mark all matching terms with a <span class="highlight">abc</span>. The callback function should take 3 or 4 arguments: 1) the text sequence corresponding to the match as xs:string, 2) the text node to which this match belongs, 3) the sequence passed as last argument to kwic-display. If the callback function accepts 4 arguments, the last argument will contain additional information on the match as a sequence of 4 integers: a) the number of the match if there's more than one match in a text node - the first match will be numbered 1; b) the offset of the match into the original text node string; c) the length of the match as reported by the index.
text:kwic-display($a as text*, $b as xs:positiveInteger, $c as function, $d as function, $e as item*) node*
This function takes a sequence of text nodes in $a, containing matches from a fulltext search. It highlights matching strings within those text nodes in the same way as the text:highlight-matches function. However, only a defined portion of the text surrounding the first match (and maybe following matches) is returned. If the text preceding the first match is larger than the width specified in the second argument $b, it will be truncated to fill no more than (width - keyword-length) / 2 characters. Likewise, the text following the match will be truncated in such a way that the whole string sequence fits into width characters. The third parameter $c is a callback function (defined with util:function). $d may contain an additional sequence of values that will be passed to the last parameter of the callback function. Any matching character sequence is reported to the callback function, and the result of the function call is inserted into the resulting node set where the matching sequence occurred. For example, you can use this to mark all matching terms with a <span class="highlight">abc</span>. The callback function should take 3 or 4 arguments: 1) the text sequence corresponding to the match as xs:string, 2) the text node to which this match belongs, 3) the sequence passed as last argument to kwic-display. If the callback function accepts 4 arguments, the last argument will contain additional information on the match as a sequence of 4 integers: a) the number of the match if there's more than one match in a text node - the first match will be numbered 1; b) the offset of the match into the original text node string; c) the length of the match as reported by the index.
text:make-token
text:make-token($a as xs:string) xs:string*
split a string into a token
text:match-all
text:match-all($a as node*, $b as xs:string+) node*
Tries to match each of the regular expression strings passed in $b 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. By default, a keyword is considered to match the pattern only if the entire string matches. To change this behaviour, use the 3-argument version of the function and specify flag 's'. With 's' specified, a string matches the pattern if any substring matches, i.e. 'explain.*' will match 'unexplained'.
text:match-all($a as node*, $b as xs:string+, $c as xs:string) node*
Tries to match each of the regular expression strings passed in $b 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. By default, a keyword is considered to match the pattern only if the entire string matches. To change this behaviour, use the 3-argument version of the function and specify flag 's'. With 's' specified, a string matches the pattern if any substring matches, i.e. 'explain.*' will match 'unexplained'.
text:match-any
text:match-any($a as node*, $b as xs:string+) node*
Tries to match each of the regular expression strings passed in $b 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. By default, a keyword is considered to match the pattern only if the entire string matches. To change this behaviour, use the 3-argument version of the function and specify flag 's'. With 's' specified, a string matches the pattern if any substring matches, i.e. 'explain.*' will match 'unexplained'.
text:match-any($a as node*, $b as xs:string+, $c as xs:string) node*
Tries to match each of the regular expression strings passed in $b 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. By default, a keyword is considered to match the pattern only if the entire string matches. To change this behaviour, use the 3-argument version of the function and specify flag 's'. With 's' specified, a string matches the pattern if any substring matches, i.e. 'explain.*' will match 'unexplained'.
text:match-count
text:match-count($a as node?) xs:integer
Counts the number of fulltext matches within the nodes and subnodes in $a.
text:text-rank
text:text-rank($a as node?) xs:double
This is just a skeleton for a possible ranking function. Don't use this.
Functions to retrieve information about eXist and the system. (http://exist-db.org/xquery/system)
system:count-instances-active
system:count-instances-active() xs:integer
Returns the number of eXist instances that are active.
system:count-instances-available
system:count-instances-available() xs:integer
Returns the number of eXist instances that are available.
system:count-instances-max
system:count-instances-max() xs:integer
Returns the maximum number of eXist instances.
system:ft-index-lookup
system:ft-index-lookup($a as node*, $b as xs:string?) node*
Internal function
system:get-build
system:get-build() xs:string
Returns the build of eXist running this query.
system:get-exist-home
system:get-exist-home() xs:string
Returns the eXist home location.
system:get-memory-free
system:get-memory-free() xs:long
Returns the amount of free memory available to eXist.
system:get-memory-max
system:get-memory-max() xs:long
Returns the maximum amount of memory eXist may use.
system:get-memory-total
system:get-memory-total() xs:long
Returns the total amount of memory in use by eXist.
system:get-revision
system:get-revision() xs:string
Returns the SubVersion (SVN) revision id of eXist running this query.
system:get-version
system:get-version() xs:string
Returns the version of eXist running this query.
system:shutdown
system:shutdown($a as xs:string, $b as xs:string) empty()
Shutdown eXist. $a is the username and $b is the password.
system:shutdown($a as xs:string, $b as xs:string, $c as xs:long) empty()
Shutdown eXist. $a is the username, $b is the password and $c is the delay in milliseconds.
Functions dealing with the HTTP session (http://exist-db.org/xquery/session)
session:create
session:create() empty()
Initialize an HTTP session if not already present
session:encode-url
session:encode-url($a as xs:anyURI) xs:anyURI
Encodes the specified URL with the current HTTP session-id.
session:get-attribute
session:get-attribute($a as xs:string) xs:string*
Returns an attribute stored in the current session object or an empty sequence if the attribute cannot be found.
session:get-attribute-names
session:get-attribute-names() xs:string*
Returns a sequence containing the names of all session attributes defined within the current HTTP session.
session:get-id
session:get-id() xs:string?
Returns the ID of the current session or an empty sequence if there is no session.
session:invalidate
session:invalidate() empty()
Invalidate (remove) the current HTTP session if present
session:set-attribute
session:set-attribute($a as xs:string, $b as item*) empty()
Stores a value in the current session using the supplied attribute name.
session:set-current-user
session:set-current-user($a as xs:string, $b as xs:string) xs:boolean?
Change the user identity for the current HTTP session. Subsequent XQueries in the session will run with the new user identity.
Functions dealing with HTTP responses (http://exist-db.org/xquery/response)
response:redirect-to
response:redirect-to($a as xs:anyURI) empty()
Sends a HTTP redirect response (302) to the client. Note: this is not supported by the Cocooon generator. Use a sitemap redirect instead.
response:set-cookie
response:set-cookie($a as xs:string, $b as xs:string) empty()
Set's a HTTP Cookie on the HTTP Response. $a is the cookie name, $b is the cookie value.
response:set-header
response:set-header($a as xs:string, $b as xs:string) empty()
Set's a HTTP Header on the HTTP Response. $a is the header name, $b is the header value.
response:stream-binary
response:stream-binary($a as xs:base64Binary?, $b as xs:string, ...) empty()
Streams the binary data passed in $a to the current servlet response output stream. The ContentType HTTP header is set to the value given in $b. This function only works within a servlet context, not within Cocoon. Note: the servlet output stream will be closed afterwards and mime-type settings in the prolog will not be passed.
Functions dealing with HTTP requests (http://exist-db.org/xquery/request)
request:create-session
request:create-session() empty()
Initialize an HTTP session if not already present
request:encode-url
request:encode-url($a as xs:anyURI) xs:anyURI
Encodes the specified URL with the current HTTP session-id.
request:get-cookie-names
request:get-cookie-names() xs:string*
Returns the names of all Cookie's in the request
request:get-cookie-value
request:get-cookie-value($a as xs:string) xs:string?
Returns the value of the Cookie named in $a.
request:get-data
request:get-data() item?
Returns the content of a POST request as an XML document or a string representaion. Returns an empty sequence if there is no data.
request:get-header
request:get-header($a as xs:string) xs:string*
Returns the HTTP request header identified by $a. The list of all headers included in the HTTP request are available through the request:get-header-names function.
request:get-header-names
request:get-header-names() xs:string*
Returns a sequence containing the names of all headers passed in the current request
request:get-hostname
request:get-hostname() xs:string
Returns the hostname of the current request.
request:get-method
request:get-method() xs:string
Returns the HTTP method of the current request.
request:get-parameter
request:get-parameter($a as xs:string, $b as item*) xs:string*
Returns the HTTP request parameter identified by $a. If the parameter could not be found, the default value specified in $b is returned instead. Note: this function will not try to expand predefined entities like &amp; or &lt;, so a &amp; passed through a parameter will indeed be treated as an &amp; character.
request:get-parameter-names
request:get-parameter-names() xs:string*
Returns a sequence containing the names of all parameters passed in the current request
request:get-query-string
request:get-query-string() xs:string
Returns the full query string passed to the servlet (without the initial question mark).
request:get-request-data
request:get-request-data() item?
Returns the content of a POST request as an XML document or a string representaion. Returns an empty sequence if there is no data.
request:get-server-name
request:get-server-name() xs:string
Returns the server nodename of the current request.
request:get-server-port
request:get-server-port() xs:integer
Returns the server port of the current request.
request:get-session-attribute
request:get-session-attribute($a as xs:string) xs:string*
Returns an attribute stored in the current session object or an empty sequence if the attribute cannot be found.
request:get-session-id
request:get-session-id() xs:string?
Returns the ID of the current session or an empty sequence if there is no session.
request:get-uploaded-file
request:get-uploaded-file($a as xs:string) item?
Retrieve the Java file object where the file part of a multi-part request has been stored. Returns the empty sequence if the request is not a multi-part request or the parameter name does not point to a file part.
request:get-uploaded-file-name
request:get-uploaded-file-name($a as xs:string) item?
Retrieve the file name of an uploaded file from a multi-part request. This returns the file name of the file on the client (without path). Returns the empty sequence if the request is not a multi-part request or the parameter name does not point to a file part.
request:get-uri
request:get-uri() xs:string
Returns the URI of the current request.
request:get-url
request:get-url() xs:string
Returns the URL of the current request.
request:invalidate-session
request:invalidate-session() empty()
Invalidate (remove) the current HTTP session if present
request:parameter-names
request:parameter-names() xs:string*
Returns a sequence containing the names of all parameters passed in the current request
request:redirect-to
request:redirect-to($a as xs:anyURI) empty()
Sends a HTTP redirect response (302) to the client. Note: this is not supported by the Cocooon generator. Use a sitemap redirect instead.
request:request-hostname
request:request-hostname() xs:string
Returns the hostname of the current request.
request:request-parameter
request:request-parameter($a as xs:string, $b as item*) xs:string*
Returns the HTTP request parameter identified by $a. If the parameter could not be found, the default value specified in $b is returned instead. Note: this function will not try to expand predefined entities like &amp; or &lt;, so a &amp; passed through a parameter will indeed be treated as an &amp; character.
request:request-servername
request:request-servername() xs:string
Returns the server nodename of the current request.
request:request-serverport
request:request-serverport() xs:integer
Returns the server port of the current request.
request:request-uri
request:request-uri() xs:string
Returns the URI of the current request.
request:session-attributes
request:session-attributes() xs:string*
Returns a sequence containing the names of all session attributes defined within the current HTTP session.
request:set-current-user
request:set-current-user($a as xs:string, $b as xs:string) xs:boolean?
Change the user identity for the current HTTP session. Subsequent XQueries in the session will run with the new user identity.
request:set-session-attribute
request:set-session-attribute($a as xs:string, $b as item*) empty()
Stores a value in the current session using the supplied attribute name.
request:stream-binary
request:stream-binary($a as xs:base64Binary?, $b as xs:string, ...) empty()
Streams the binary data passed in $a to the current servlet response output stream. The ContentType HTTP header is set to the value given in $b. This function only works within a servlet context, not within Cocoon. Note: the servlet output stream will be closed afterwards and mime-type settings in the prolog will not be passed.
request:unescape-uri
request:unescape-uri($a as xs:string, $b as xs:string) xs:string
Returns an un-escaped URL escaped string identified by $a with the encoding scheme indicated by the string $b (e.g. "UTF-8"). Decodes encoded sensitive characters from a URL, for example "%2F" becomes "/", i.e. does the oposite to escape-uri()
A simple example module (http://exist-db.org/xquery/examples)
example:echo
example:echo($a as xs:string*) xs:string*
A useless example function. It just echoes the input parameters.

View source code