A RESTful browser for eXist Function Modules


http://exist-db.org/versioning

versioning:revisions($doc as node()) as xs:integer*

versioning:versions($doc as node()) as element(v:version)*
Return all version docs, including the full diff, for the specified document. This is mainly for internal use.
$doca node in the document for which revisions should be retrieved.

Returns zero or more v:version elements describing the changes made in a revision.

versioning:doc($doc as node(), $rev as xs:integer?) as node()*
Restore a certain revision of a document by applying a sequence of diffs and return it as an in-memory node. If the revision argument is empty or smaller than the first actual revision of the document, the function will return the base version of the document. If the revision number is greater than the latest revision, the latest version will be returned.
$doca node in the document for which a revision should be retrieved.
$revthe revision which should be restored

Returns a sequence of nodes corresponding to the restored document (TODO: return a document node instead?)

versioning:apply-patch($doc as node(), $diffs as element(v:version)*)
Apply a given patch on a document. This function is used by v:doc internally.

versioning:diff($doc as node(), $rev as xs:integer) as element(v:version)?
For the document passed as first argument, retrieve the revision specified in the second argument. Generate a diff between both version, i.e. HEAD and the given revision. The empty sequence is returned if the given revision is invalid, i.e. v:doc returns the empty sequence.
$doca node in the document for which the diff should be generated
$reva valid revision number

versioning:annotate($doc as node(), $rev as xs:integer)
Return an XML document in which all changes between $rev and $rev - 1 are annotated.
$doca node in the document which should be annotated
$revthe revision whose changes will be annotated

versioning:find-newer-revision($doc as node(), $base as xs:integer, $key as xs:string) as element(v:version)?
Check if there are any revisions in the database which are newer than the version identified by the specified base revision and key. If versioning is active, the base revision and key are added to the document root element as attributes whenever a document is serialized. The combination of the two attributes allows eXist to determine if a newer revision of the document exists in the database, which usually means that another user/client has committed it in the meantime. If one or more newer revisions exist in the database, v:find-newer-revision will return the version document of the newest revision or an empty sequence otherwise.
$doca node in the document which should be checked
$basethe base revision as provided in the v:revision attribute of the document which was retrieved from the db.
$keythe key as provided in the v:key attribute of the document which was retrieved from the db.

Returns a v:version element or the empty sequence if there's no newer revision in the database

versioning:history($doc as node()) as element(v:history)
Returns an XML fragment showing the version history of the document to which the specified node belongs. All revisions are listed with date and user, but without the detailed diff.
$docan arbitrary node in a document

http://exist-db.org/xquery/compression
A module for compression and decompression functions

compression:gzip($data as xs:base64Binary) xs:base64Binary?
GZip's data
$dataThe data to GZip

compression:tar($sources as xs:anyType+, $use-collection-hierarchy as xs:boolean) xs:base64Binary*
Tars nodes, resources and collections.
$sourcesThe sequence of URI's and/or Entrys. If a URI points to a collection then the collection, its resources and sub-collections are zipped recursively. An Entry takes the format <entry name="filename.ext" type="collection|uri|binary|xml|text" method="deflate|store">data</entry>. The method attribute is only effective for the compression:zip function.
$use-collection-hierarchyIndicates whether the Collection hierarchy (if any) should be preserved in the zip file.

compression:tar($sources as xs:anyType+, $use-collection-hierarchy as xs:boolean, $strip-prefix as xs:string) xs:base64Binary*
Tars nodes, resources and collections.
$sourcesThe sequence of URI's and/or Entrys. If a URI points to a collection then the collection, its resources and sub-collections are zipped recursively. An Entry takes the format <entry name="filename.ext" type="collection|uri|binary|xml|text" method="deflate|store">data</entry>. The method attribute is only effective for the compression:zip function.
$use-collection-hierarchyIndicates whether the Collection hierarchy (if any) should be preserved in the zip file.
$strip-prefixThis prefix is stripped from the Entrys name

compression:ungzip($gzip-data as xs:base64Binary) xs:base64Binary?
UnGZip's data
$gzip-dataThe gzip data to uncompress.

compression:untar($tar-data as xs:base64Binary, $entry-filter as function, $entry-filter-param as xs:anyType*, $entry-data as function, $entry-data-param as xs:anyType*) item()*
UnTar all the resources/folders from the provided data by calling user defined functions to determine what and how to store the resources/folders
$tar-dataThe tar file data
$entry-filterA user defined function for filtering resources from the tar file. The function takes 3 parameters e.g. user:untar-entry-filter($path as xs:string, $data-type as xs:string, $param as item()*) as xs:boolean. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parameters, for example a list of extracted files. If the return type is true() it indicates the entry should be processed and passed to the entry-data function, else the resource is skipped.
$entry-filter-paramA sequence with an additional parameters for filtering function.
$entry-dataA user defined function for storing an extracted resource from the tar file. The function takes 4 parameters e.g. user:untar-entry-data($path as xs:string, $data-type as xs:string, $data as item()?, $param as item()*). Or a user defined function wich returns path for storing an extracted resource from the tar file. The function takes 3 parameters e.g. user:entry-path($path as xs:string, $data-type as xs:string, $param as item()*) as xs:anyURI. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parameters
$entry-data-paramA sequence with an additional parameters for storing function.

compression:unzip($zip-data as xs:base64Binary, $entry-filter as function, $entry-filter-param as xs:anyType*, $entry-data as function, $entry-data-param as xs:anyType*) item()*
UnZip all the resources/folders from the provided data by calling user defined functions to determine what and how to store the resources/folders
$zip-dataThe zip file data
$entry-filterA user defined function for filtering resources from the zip file. The function takes 3 parameters e.g. user:unzip-entry-filter($path as xs:string, $data-type as xs:string, $param as item()*) as xs:boolean. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parameters, for example a list of extracted files. If the return type is true() it indicates the entry should be processed and passed to the entry-data function, else the resource is skipped.
$entry-filter-paramA sequence with an additional parameters for filtering function.
$entry-dataA user defined function for storing an extracted resource from the zip file. The function takes 4 parameters e.g. user:unzip-entry-data($path as xs:string, $data-type as xs:string, $data as item()?, $param as item()*). Or a user defined function wich returns path for storing an extracted resource from the tar file. The function takes 3 parameters e.g. user:entry-path($path as xs:string, $data-type as xs:string, $param as item()*) as xs:anyURI. $data-type may be 'resource' or 'folder'. $param is a sequence with any additional parameters.
$entry-data-paramA sequence with an additional parameters for storing function.

compression:zip($sources as xs:anyType+, $use-collection-hierarchy as xs:boolean) xs:base64Binary*
Zips nodes, resources and collections.
$sourcesThe sequence of URI's and/or Entrys. If a URI points to a collection then the collection, its resources and sub-collections are zipped recursively. An Entry takes the format <entry name="filename.ext" type="collection|uri|binary|xml|text" method="deflate|store">data</entry>. The method attribute is only effective for the compression:zip function.
$use-collection-hierarchyIndicates whether the Collection hierarchy (if any) should be preserved in the zip file.

compression:zip($sources as xs:anyType+, $use-collection-hierarchy as xs:boolean, $strip-prefix as xs:string) xs:base64Binary*
Zips nodes, resources and collections.
$sourcesThe sequence of URI's and/or Entrys. If a URI points to a collection then the collection, its resources and sub-collections are zipped recursively. An Entry takes the format <entry name="filename.ext" type="collection|uri|binary|xml|text" method="deflate|store">data</entry>. The method attribute is only effective for the compression:zip function.
$use-collection-hierarchyIndicates whether the Collection hierarchy (if any) should be preserved in the zip file.
$strip-prefixThis prefix is stripped from the Entrys name

http://exist-db.org/xquery/counter
A module for persistent counters.

counter:create($counter-name as item()) xs:long?
Create a unique counter named $counter-name.
$counter-nameName of the counter.

Returns the value of the newly created counter.

counter:create($counter-name as item(), $init-value as xs:long) xs:long?
Create a unique counter named $counter-name and initialize it with value $init-value.
$counter-nameName of the counter.
$init-valueThe initial value of the counter.

Returns the value of the newly created counter.

counter:destroy($counter-name as item()) xs:boolean?
Destroy the counter named $counter-name.
$counter-nameName of the counter.

Returns boolean value true() if removal as successful, otherwise return value false().

counter:next-value($counter-name as item()) xs:long?
Increment the counter $counter-name and return its new value.
$counter-nameName of the counter.

Returns the new value of the specified counter, or -1 if the counter does not exist.

http://exist-db.org/xquery/datetime
A module for performing date and time operations

datetime:count-day-in-month($weekday as xs:integer, $date as xs:date) xs:integer
Returns the count of a specific weekday in a month from the given date. For example it can tell you there are 5 Fridays in February 2008.
$weekdayThe day of the week in the range of 1 to 7 where 1 = Sunday and 7 = Saturday.
$dateThe day that will identify the month to get the count of the number of occurrences of a given weekday

Returns The number of occurrences of the weekday in the selected month.

datetime:date-for($year as xs:integer, $month as xs:integer, $week as xs:integer, $weekday as xs:integer) xs:date
Returns the date for a given set of parameters.
$yearThe year of interest
$monthThe month of interest (1 = January, 12 = December)
$weekThe week in the month of interest (1 = first week, 4 or 5 = last week)
$weekdayThe day in the week of interest (1 = Sunday, 7 = Saturday)

Returns the date generated from the parameters.

datetime:date-from-dateTime($date-time as xs:dateTime) xs:date
Returns the xs:date portion of an xs:dateTime
$date-timeThe dateTime to extract the date from.

Returns the extracted date.

datetime:date-range($start-date as xs:date, $increment as xs:duration, $iterations as xs:integer) xs:date*
Generates a range of xs:date values, incremented cumulatively by a fixed duration from a start xs:date
$start-dateThe date to start at.
$incrementThe duration increment.
$iterationsThe number of increments to generate.

Returns the range(s)

datetime:datetime-range($start-date-time as xs:dateTime, $increment as xs:duration, $iterations as xs:integer) xs:dateTime*
Generates a range of xs:dateTime values, incremented cumulatively by a fixed duration from a start xs:dateTime
$start-date-timeThe dateTime to start at.
$incrementThe duration increment.
$iterationsThe number of increments to generate.

Returns the range(s)

datetime:day-in-week($date as xs:date) xs:integer
Returns the day in the week of the date. Result is in the range 1 to 7, where 1 = Sunday, 7 = Saturday.
$dateThe date to extract the day in the week from.

Returns the day in the week of the date in the range 1 to 7, where 1 = Sunday, 7 = Saturday.

datetime:days-in-month($date as xs:date) xs:integer
Returns the number of days in the month of the date.
$dateThe date for extracting the number of days in the month component.

Returns the number of days in the given month.

datetime:format-date($date as xs:date, $simple-date-format as xs:string) xs:string
Returns a xs:string of the xs:date formatted according to the SimpleDateFormat format.
$dateThe date to to be formatted.
$simple-date-formatThe format string according to the Java java.text.SimpleDateFormat class

Returns the formatted date string

datetime:format-dateTime($date-time as xs:dateTime, $simple-date-format as xs:string) xs:string
Returns a xs:string of the xs:dateTime according to the SimpleDateFormat format.
$date-timeThe dateTime to to be formatted.
$simple-date-formatThe format string according to the Java java.text.SimpleDateFormat class

Returns the formatted dateTime string

datetime:format-time($time as xs:time, $simple-date-format as xs:string) xs:string
Returns a xs:string of the xs:time formatted according to the SimpleDateFormat format.
$timeThe time to to be formatted.
$simple-date-formatThe format string according to the Java java.text.SimpleDateFormat class

Returns the formatted time string

datetime:parse-date($date-string as xs:string, $simple-date-format as xs:string) xs:date
Returns an xs:date of the xs:string parsed according to the SimpleDateFormat format.
$date-stringThe date to to be parsed.
$simple-date-formatThe format string according to the Java java.text.SimpleDateFormat class

Returns the parsed xs:date

datetime:parse-dateTime($dateTime-string as xs:string, $simple-date-format as xs:string) xs:dateTime
Returns an xs:dateTime of the xs:string parsed according to the SimpleDateFormat format.
$dateTime-stringThe date and time to to be parsed.
$simple-date-formatThe format string according to the Java java.text.SimpleDateFormat class

Returns the parsed xs:dateTime

datetime:parse-time($time-string as xs:string, $simple-date-format as xs:string) xs:time
Returns an xs:time of the xs:string parsed according to the SimpleDateFormat format.
$time-stringThe time to to be parsed.
$simple-date-formatThe format string according to the Java java.text.SimpleDateFormat class

Returns the parsed xs:time

datetime:time-from-dateTime($date-time as xs:dateTime) xs:time
Returns the xs:time portion of an xs:dateTime.
$date-timeThe dateTime to extract the time from.

Returns the time extracted from the date-time

datetime:time-range($start-time as xs:time, $increment as xs:dayTimeDuration, $iterations as xs:integer) xs:time*
Generates a range of xs:time values, incremented cumulatively by a fixed duration from a start xs:time
$start-timeThe time to start at.
$incrementThe duration increment.
$iterationsThe number of increments to generate.

Returns the range(s)

datetime:week-in-month($date as xs:date) xs:integer
Returns the week in the month of the date.
$dateThe date to extract the week in the month from.

Returns the week in the month of the date

http://exist-db.org/xquery/examples
A module for showing good examples of module usage

example:echo($text as xs:string*) xs:string*
A useless example function. It just echoes the input parameters.
$textThe text to echo

Returns the echoed text

http://exist-db.org/xquery/file
A module for performing various operations on files and directories stored in the server file system.

file:delete($filepath as item()) xs:boolean
Delete a file or directory. This method is only available to the DBA role.
$filepathThe full path to the file

Returns true if successful, false otherwise

file:directory-list($directory as xs:string, $pattern as xs:string) node()?
List all files, including their file size and modification time, found in or below a directory, $directory. Files are located in the server's file system, using filename patterns, $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 specified directory. This method is only available to the DBA role.
$directoryThe base directory path in the file system where the files are located.
$patternThe file name pattern

Returns a node fragment that shows all matching filenames, including their file size and modification time, and the subdirectory they were found in

file:exists($filepath as item()) xs:boolean
Tests if a file or directory exists. This method is only available to the DBA role.
$filepathThe full path to the file in the file system

Returns the boolean value true if the file exists, false otherwise

file:is-directory($path as item()) xs:boolean
Tests if a path is a directory. This method is only available to the DBA role.
$pathThe full path to the file or directory

Returns true if the path is a directory

file:is-readable($filepath as item()) xs:boolean
Tests if a file is readable. This method is only available to the DBA role.
$filepathThe full path to the file

Returns true if file can be read

file:is-writeable($filepath as item()) xs:boolean
Tests if a file is writeable. This method is only available to the DBA role.
$filepathThe full path to the file

Returns true if the file has write permissions

file:list($directory as xs:string) node()*
List all files and directories under the specified directory. This method is only available to the DBA role.
$directoryThe directory path in the file system.

Returns a node describing file and directory names and meta data.

file:mkdir($filepath as item()) xs:boolean
Create a directory. This method is only available to the DBA role.
$filepathThe full path to the directory

Returns true if successful, false otherwise

file:mkdirs($filepath as item()) xs:boolean
Create a directory including any necessary but nonexistent parent directories. This method is only available to the DBA role.
$filepathThe full path to the directory

Returns true if successful, false otherwise

file:move($original as item(), $destination as item()) xs:boolean
Move (rename) a file or directory. Exact operation is platform dependent. This method is only available to the DBA role.
$originalThe full path to the file
$destinationThe full path to the file

Returns true if successful, false otherwise

file:read($url as item()) xs:string?
Reads the content of file. This method is only available to the DBA role.
$urlA string representing a URL, eg file://etc.

Returns the file contents

file:read($url as item(), $encoding as xs:string) xs:string?
Reads the content of file. This method is only available to the DBA role.
$urlA string representing a URL, eg file://etc.
$encodingThe encoding type for the file

Returns the file contents

file:read-binary($url as item()) xs:base64Binary?
Reads the contents of a binary file. This method is only available to the DBA role.
$urlA string representing a URL, eg file://etc.

Returns the file contents

file:read-unicode($url as item()) xs:string?
Reads the contents of a file. Unicode BOM (Byte Order Marker) will be stripped off if found. This method is only available to the DBA role.
$urlThe URL to the file, e.g. file://etc.

Returns the contents of the file

file:read-unicode($url as item(), $encoding as xs:string) xs:string?
Reads the contents of a file. Unicode BOM (Byte Order Marker) will be stripped off if found. This method is only available to the DBA role.
$urlThe URL to the file, e.g. file://etc.
$encodingThe file is read with the encoding specified.

Returns the contents of the file

file:serialize($node-set as node()*, $filepath as xs:string, $parameters as xs:string*) xs:boolean?
Writes the node set into a file on the file system. $parameters 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. This method is only available to the DBA role.
$node-setThe contents to write to the file system.
$filepathThe full path to the file
$parametersThe serialization parameters specified as key-value pairs

Returns true on success - false if the specified file can not be created or is not writable. The empty sequence is returned if the argument sequence is empty.

file:serialize($node-set as node()*, $filepath as xs:string, $parameters as xs:string*, $append as xs:boolean) xs:boolean?
Writes the node set into a file on the file system, optionally appending to it. $parameters 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. This method is only available to the DBA role.
$node-setThe contents to write to the file system.
$filepathThe full path to the file
$parametersThe serialization parameters specified as key-value pairs
$appendShould content be appended?

Returns true on success - false if the specified file can not be created or is not writable. The empty sequence is returned if the argument sequence is empty.

file:serialize-binary($binarydata as xs:base64Binary, $filepath as xs:string) xs:boolean
Writes binary data into a file on the file system. This method is only available to the DBA role.
$binarydataThe contents to write to the file system.
$filepathThe full path to the file

Returns true on success - false if the specified file can not be created or is not writable

file:serialize-binary($binarydata as xs:base64Binary, $filepath as xs:string, $append as xs:boolean) xs:boolean
Writes binary data into a file on the file system, optionally appending the content. This method is only available to the DBA role.
$binarydataThe contents to write to the file system.
$filepathThe full path to the file
$appendShould content be appended?

Returns true on success - false if the specified file can not be created or is not writable

file:sync($collection as xs:string, $targetPath as xs:string, $dateTime as xs:dateTime?) xs:boolean
Synchronize a collection with a directory hierarchy. Compares last modified time stamps. If $dateTime is given, only resources modified after this time stamp are taken into account. This method is only available to the DBA role.
$collectionThe collection to sync.
$targetPathThe full path to the directory
$dateTimeOptional: only resources modified after the given date/time will be synchronized.

Returns true if successful, false otherwise

http://exist-db.org/xquery/httpclient
A module for performing HTTP requests as a client

httpclient:clear-all() empty()
Clears all persistent state (eg. cookies, crednetials, etc.) stored in the current session on the client.

httpclient:delete($url as xs:anyURI, $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP DELETE request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$persistIndicates if the HTTP state (eg. cookies, credentials, etc.) should persist for the life of this xquery
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:get($url as xs:anyURI, $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP GET request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$persistIndicates if the HTTP state (eg. cookies, credentials, etc.) should persist for the life of this xquery
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:get($url as xs:anyURI, $persist as xs:boolean, $request-headers as element()?, $parser-options as element()?) item()
Performs a HTTP GET request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data. When HTML is converted to XML. Features and properties of the parser may be set in the options parameter.
$urlThe URL to process
$persistIndicates if the HTTP state (eg. cookies, credentials, etc.) should persist for the life of this xquery
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>
$parser-optionsFeature and Property options to be passed to the HTML/XML parser in the form <options><feature name="" value="{true|false}"/><property name="" value=""/></options>

Returns the XML body content

httpclient:head($url as xs:anyURI, $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP HEAD request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers></httpclient:response>
$urlThe URL to process
$persistIndicates if the HTTP state (eg. cookies, credentials, etc.) should persist for the life of this xquery
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:options($url as xs:anyURI, $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP OPTIONS request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers></httpclient:response>
$urlThe URL to process
$persistIndicates if the HTTP state (eg. cookies, credentials, etc.) should persist for the life of this xquery
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:post($url as xs:anyURI, $content as item(), $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP POST request. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$contentThe XML POST payload/content. If it is an XML Node it will be serialized, any other type will be atomized into a string.
$persistIndicates if the HTTP state (eg. cookies, credentials, etc.) should persist for the life of this xquery
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:post-form($url as xs:anyURI, $content as element(), $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP POST request for a form. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$contentThe form data in the format <httpclient:fields><httpclient:field name="" value="" type="string|file"/>...</httpclient:fields>. If the field values will be suitably URLEncoded and sent with the mime type application/x-www-form-urlencoded.
$persistIndicates if the HTTP state (eg. cookies, credentials, etc.) should persist for the life of this xquery
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:put($url as xs:anyURI, $content as node(), $persist as xs:boolean, $request-headers as element()?) item()
Performs a HTTP PUT request.. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$contentThe XML PUT payload/content. If it is an XML Node it will be serialized, any other type will be atomized into a string.
$persistIndicates if the HTTP state (eg. cookies, credentials, etc.) should persist for the life of this xquery
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>

Returns the XML body content

httpclient:put($url as xs:anyURI, $content as node(), $persist as xs:boolean, $request-headers as element()?, $indentation as xs:integer) item()
Performs a HTTP PUT request.. This method returns the HTTP response encoded as an XML fragment, that looks as follows: <httpclient:response xmlns:httpclient="http://exist-db.org/xquery/httpclient" statusCode="200"><httpclient:headers><httpclient:header name="name" value="value"/>...</httpclient:headers><httpclient:body type="xml|xhtml|text|binary" mimetype="returned content mimetype">body content</httpclient:body></httpclient:response> where XML body content will be returned as a Node, HTML body content will be tidied into an XML compatible form, a body with mime-type of "text/..." will be returned as a URLEncoded string, and any other body content will be returned as xs:base64Binary encoded data.
$urlThe URL to process
$contentThe XML PUT payload/content. If it is an XML Node it will be serialized, any other type will be atomized into a string.
$persistIndicates if the HTTP state (eg. cookies, credentials, etc.) should persist for the life of this xquery
$request-headersAny HTTP Request Headers to set in the form <headers><header name="" value=""/></headers>
$indentationIndentation level. If this parameter is added, then the XML being put will be serailazed with indentation and the number is the number of characters for each level of indentation. If this parameter is not include, then the XML is serialized to one line of text.

Returns the XML body content

http://exist-db.org/xquery/image
A module for performing operations on Images stored in the eXist db

image:crop($image as xs:base64Binary, $dimension as xs:integer*, $mimeType as xs:string) xs:base64Binary?
Crop the image $image to a specified dimension. If no dimensions are specified, then the default values are 'y1 = 0', 'x1 = 0', 'x2 = 100' and 'y2 = 100'.
$imageThe image data
$dimensionThe maximum dimension of the cropd image. expressed in pixels (x1, y1, x2, y2). If empty, then the default values are are 'y1 = 0', 'x1 = 0', 'x2 = 100' and 'y2 = 100'.
$mimeTypeThe mime-type of the image

Returns the cropd image or an empty sequence if $image is invalid

image:get-height($image as xs:base64Binary) xs:integer?
Gets the Height of the image passed in, returning an integer of the images Height in pixels or an empty sequence if the image is invalid.
$imageThe image data

Returns the height in pixels

image:get-metadata($image as xs:base64Binary, $native-format as xs:boolean) node()?
Gets the metadata of the image passed in, returning the images XML metadata.
$imageThe image data
$native-formatWhen true metadata of the images native format is returned, otherwise common java ImageIO metadata is returned.

Returns the image metadata

Deprecated: Use the contentextraction module instead This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

image:get-width($image as xs:base64Binary) xs:integer?
Gets the width of the image passed in, returning an integer of the images width in pixels or an empty sequence if the image is invalid.
$imageThe image data

Returns the width in pixels

image:scale($image as xs:base64Binary, $dimension as xs:integer*, $mimeType as xs:string) xs:base64Binary?
Scale the image image to a specified dimension. If no dimensions are specified, then the default values are 'maxheight = 100' and 'maxwidth = 100'.
$imageThe image data
$dimensionThe maximum dimension of the scaled image. expressed in pixels (maxheight, maxwidth). If empty, then the default values are 'maxheight = 100' and 'maxwidth = 100'.
$mimeTypeThe mime-type of the image

Returns the scaled image or an empty sequence if $image is invalid

image:thumbnail($collection as xs:anyURI, $thumbnail-location as xs:anyURI?, $dimension as xs:integer*, $prefix as xs:string?) xs:string*
Generate thumbnails from the given database collection
$collectionThe URI to the collection
$thumbnail-locationThe location in the database where the thumbnails should be created, this can be a local path, with the prefix 'xmldb:' a absolute path within the database or with 'rel:' path relative to the given $collection. You can leave this empty then the default is 'rel:/thumbs'.
$dimensionThe dimension of the thumbnails, if empty then the default values are 'maxheight = 100' and 'maxwidth = 100', the first value is 'maxheight' and the second 'maxwidth'.
$prefixThe prefix to append to the thumbnail filenames

Returns the result

http://exist-db.org/xquery/jfreechart
A module for generating charts using the JFreeChart library.

jfreechart:render($chart-type as xs:string, $configuration as node(), $data as node()) xs:base64Binary?
Render chart using JFreechart. Check documentation on http://www.jfree.org/jfreechart/ for details about chart types, parameters and data structures.
$chart-typeThe type of chart to render. Supported chart types: LineChart, LineChart3D, MultiplePieChart, MultiplePieChart3D, PieChart, PieChart3D, RingChart, StackedAreaChart, StackedBarChart, StackedBarChart3D, WaterfallChart.
$configurationThe configuration for the chart. The configuration should be supplied as follows: <configuration><param1>Value1</param1><param2>Value2</param2>/<configuration>. Supported parameters: width height title categoryAxisLabel timeAxisLabel valueAxisLabel domainAxisLabel rangeAxisLabel pieSectionLabel pieSectionNumberFormat pieSectionPercentFormat orientation titleColor chartBackgroundColor plotBackgroundColor rangeLowerBound rangeUpperrBound categoryItemLabelGeneratorClass seriesColors sectionColors sectionColorsDelimiter categoryAxisColor valueAxisColortimeAxisColor order legend tooltips urls.
$dataThe CategoryDataset or PieDataset, supplied as JFreechart XML.

Returns the generated PNG image file

jfreechart:stream-render($chart-type as xs:string, $configuration as node(), $data as node()) empty()
Render chart using JFreechart. Check documentation on http://www.jfree.org/jfreechart/ for details about chart types, parameters and data structures. Output is directly streamed into the servlet output stream.
$chart-typeThe type of chart to render. Supported chart types: LineChart, LineChart3D, MultiplePieChart, MultiplePieChart3D, PieChart, PieChart3D, RingChart, StackedAreaChart, StackedBarChart, StackedBarChart3D, WaterfallChart.
$configurationThe configuration for the chart. The configuration should be supplied as follows: <configuration><param1>Value1</param1><param2>Value2</param2>/<configuration>. Supported parameters: width height title categoryAxisLabel timeAxisLabel valueAxisLabel domainAxisLabel rangeAxisLabel pieSectionLabel pieSectionNumberFormat pieSectionPercentFormat orientation titleColor chartBackgroundColor plotBackgroundColor rangeLowerBound rangeUpperrBound categoryItemLabelGeneratorClass seriesColors sectionColors sectionColorsDelimiter categoryAxisColor valueAxisColortimeAxisColor order legend tooltips urls.
$dataThe CategoryDataset or PieDataset, supplied as JFreechart XML.

http://exist-db.org/xquery/kwic
KWIC module: formats query results to display keywords in context (KWIC). A configurable amount of text is displayed to the left and right of a matching keyword (or phrase). The module works with all indexes that support match highlighting (matches are tagged with an <exist:match> element). This includes the old full text index, the new Lucene-based full text index, as well as the NGram index. The kwic:summarize() function represents the main entry point into the module. To have more control over the text extraction context, you can also call kwic:get-summary() instead. For example, the following snippet will only print the first match within a given set of context nodes ($ancestor):
    let $matches := kwic:get-matches($hit)
for $ancestor in $matches/ancestor::para | $matches/ancestor::title | $matches/ancestor::td
return
kwic:get-summary($ancestor, ($ancestor//exist:match)[1], $config)

kwic:get-context($root as element(), $match as element(exist:match), $mode as xs:string) as node()*
Retrieve the following and preceding text chunks for a given match.
$matchthe text node containing the match
$modethe selection mode: either "previous" or "following"

kwic:substring($node as item(), $start as xs:int, $count as xs:int) as item()?
Like fn:substring, but takes a node argument. If the node is an element, a new element is created with the same node-name as the old one and the shortened text content.

kwic:display-text($text as text()?) as node()?

kwic:callback($callback as function?, $node as node(), $mode as xs:string) as xs:string?

kwic:truncate-previous($root as node(), $node as node()?, $truncated as item()*, $max as xs:int, $chars as xs:int, $callback as function?)
Generate the left-hand context of the match. Returns a sequence of nodes and strings, whose total string length is less than or equal to $max characters. Note: this function calls itself recursively until $nodes is empty or the returned sequence has the desired total string length.

kwic:truncate-following($root as node(), $node as node()?, $truncated as item()*, $max as xs:int, $chars as xs:int, $callback as function?)
Generate the right-hand context of the match. Returns a sequence of nodes and strings, whose total string length is less than or equal to $max characters. Note: this function calls itself recursively until $nodes is empty or the returned sequence has the desired total string length.

kwic:string-length($nodes as item()*) as xs:integer
Computes the total string length of the nodes in the argument sequence

kwic:get-summary($root as node(), $node as element(exist:match), $config as element(config)) as element()

kwic:get-summary($root as node(), $node as element(exist:match), $config as element(config), $callback as function?) as element()
Print a summary of the match in $node. Output a predefined amount of text to the left and the right of the match.
$rootroot element which should be used as context for the match. It defines the boundaries for the text extraction. Text will be taken from this context.
$nodethe exist:match element to process.
$configconfiguration element which determines the behaviour of the function
$callback(optional) reference to a callback function which will be called once for every text node before it is appended to the displayed text. The function should accept 2 parameters: 1) a single text node, 2) a string indicating the current direction in which text is appended, i.e. "before" or "after". The function may return the empty sequence if the current node should be ignore (e.g. if it belongs to a "footnote" which should not be displayed). Otherwise it should return a single string.

kwic:expand($hit as element()) as element()
Expand the element in $hit. Creates an in-memory copy of the element and marks all matches with an exist:match tag, which will be used by all other functions in this module. You need to call kwic:expand before kwic:get-summary. kwic:summarize will call it automatically.

kwic:get-matches($hit as element()) as element(exist:match)*
Return all matches within the specified element, $hit. Matches are returned as exist:match elements. The returned nodes are part of a new document whose root element is a copy of the specified $hit element.
$hitan arbitrary XML element which has been selected by one of the full text operations or an ngram search.

kwic:summarize($hit as element(), $config as element(config)) as element()*

kwic:summarize($hit as element(), $config as element(config), $callback as function?) as element()*
Main function of the KWIC module: takes the passed element and returns an XHTML fragment containing a chunk of text before and after the first full text match in the node. The optional config parameter is used to configure the behaviour of the function: <config width="character width" table="yes|no" link="URL to which the match is linked"/> By default, kwic:summarize returns an XHTML fragment with the following structure: <p xmlns="http://www.w3.org/1999/xhtml"> <span class="previous">Text before match</span> <a href="passed URL if any" class="hi">The highlighted term</a> <span class="following">Text after match</span> </p> If table=yes is passed with the config element, a tr table row will be returned instead of a span (using the same class names).
$hitan arbitrary XML element which has been selected by one of the full text operations or an ngram search.
$configconfiguration element to configure the behaviour of the function

http://exist-db.org/xquery/lucene
A module for full text indexed searching based on Lucene.

ft:close() empty()
Close the current Lucene document and flush it to disk. Subsequent calls to ft:index will write to a new Lucene document.

ft:get-field($path as xs:string*, $field as xs:string) xs:string*
Retrieve the stored content of a field.
$pathURI paths of documents or collections in database. Collection URIs should end on a '/'.
$fieldquery string

Returns All documents that are match by the query

ft:index($documentPath as xs:string, $solrExression as node()) empty()
Index an arbitrary chunk of (non-XML) data with lucene. Syntax is inspired by Solar.
$documentPathURI path of document in database.
$solrExressionXML syntax expected by Solr' add expression. Element should be called 'doc', e.g.<doc> <field name="field1">data1</field> <field name="field2" boost="value">data2</field> </doc>

ft:index($documentPath as xs:string, $solrExression as node(), $close as xs:boolean) empty()
Index an arbitrary chunk of (non-XML) data with lucene. Syntax is inspired by Solar.
$documentPathURI path of document in database.
$solrExressionXML syntax expected by Solr' add expression. Element should be called 'doc', e.g.<doc> <field name="field1">data1</field> <field name="field2" boost="value">data2</field> </doc>
$closeIf true, close the Lucene document. Subsequent calls to ft:index will thus add to a new Lucene document. If false, the document remains open and is not flushed to disk. Call the ft:close function to explicitely close and flush the current document.

ft:optimize() empty()
Calls Lucene's optimize method to merge all index segments into a single one. This function should be called after adding a larger bunch of documents or if no further changes are expected for a while. The optimize will block the index for other write operations and may take some time. You need to be a user in group dba to call this function.

ft:query($nodes as node()*, $query as item()) node()*
Queries a node set using a Lucene full text index; a lucene index must already be defined on the nodes, because if no index is available on a node, nothing will be found. Indexes on descendant nodes are not used. The context of the Lucene query is determined by the given input node set. The query is specified either as a query string based on Lucene's default query syntax or as an XML fragment. See http://exist-db.org/lucene.html#N1029E for complete documentation.
$nodesThe node set to search using a Lucene full text index which is defined on those nodes
$queryThe query to search for, provided either as a string or text in Lucene's default query syntax or as an XML fragment to bypass Lucene's default query parser

Returns all nodes from the input node set matching the query. match highlighting information will be available for all returned nodes. Lucene's match score can be retrieved via the ft:score function.

ft:query($nodes as node()*, $query as item(), $options as node()?) node()*
Queries a node set using a Lucene full text index; a lucene index must already be defined on the nodes, because if no index is available on a node, nothing will be found. Indexes on descendant nodes are not used. The context of the Lucene query is determined by the given input node set. The query is specified either as a query string based on Lucene's default query syntax or as an XML fragment. See http://exist-db.org/lucene.html#N1029E for complete documentation.
$nodesThe node set to search using a Lucene full text index which is defined on those nodes
$queryThe query to search for, provided either as a string or text in Lucene's default query syntax or as an XML fragment to bypass Lucene's default query parser
$optionsAn XML fragment containing options to be passed to Lucene's query parser. The following options are supported (a description can be found in the docs): <options> <default-operator>and|or</default-operator> <phrase-slop>number</phrase-slop> <leading-wildcard>yes|no</leading-wildcard> <filter-rewrite>yes|no</filter-rewrite> </options>

Returns all nodes from the input node set matching the query. match highlighting information will be available for all returned nodes. Lucene's match score can be retrieved via the ft:score function.

ft:query-field($field as xs:string*, $query as item()) node()*
Queries a Lucene field, which has to be explicitely created in the index configuration.
$fieldThe lucene field name.
$queryThe query to search for, provided either as a string or text in Lucene's default query syntax or as an XML fragment to bypass Lucene's default query parser

Returns all nodes from the input node set matching the query. match highlighting information will be available for all returned nodes. Lucene's match score can be retrieved via the ft:score function.

ft:query-field($field as xs:string*, $query as item(), $options as node()?) node()*
Queries a Lucene field, which has to be explicitely created in the index configuration.
$fieldThe lucene field name.
$queryThe query to search for, provided either as a string or text in Lucene's default query syntax or as an XML fragment to bypass Lucene's default query parser
$optionsAn XML fragment containing options to be passed to Lucene's query parser. The following options are supported (a description can be found in the docs): <options> <default-operator>and|or</default-operator> <phrase-slop>number</phrase-slop> <leading-wildcard>yes|no</leading-wildcard> <filter-rewrite>yes|no</filter-rewrite> </options>

Returns all nodes from the input node set matching the query. match highlighting information will be available for all returned nodes. Lucene's match score can be retrieved via the ft:score function.

ft:remove-index($documentPath as xs:string) empty()
Remove any (non-XML) Lucene index associated with the document identified by the path parameter. This function will only remove indexes which were manually created by the user via the ft:index function. Indexes defined in collection.xconf will NOT be removed. They are maintained automatically by the database. Please note that non-XML indexes will also be removed automatically if the associated document is deleted.
$documentPathURI path of document in database.

ft:score($node as node()) xs:float*
Returns a computed relevance score for the given node. The score is the sum of all relevance scores provided by Lucene for the node and its descendants. In general, the score will be a number between 0.0 and 1.0 if the query had $node as context. If the query targeted multiple descendants of $node (e.g. 'title' and 'author' within a 'book'), the score will be the sum of all sub-scores and may thus be greater than 1.
$nodethe context node

Returns sum of all relevance scores provided by Lucene for all matches below the given context node

ft:search($path as xs:string*, $query as xs:string) node()
Search for (non-XML) data with lucene
$pathURI paths of documents or collections in database. Collection URIs should end on a '/'.
$queryquery string

Returns All documents that are match by the query

ft:search($query as xs:string) node()
Search for (non-XML) data with lucene
$queryquery string

Returns All documents that are match by the query

http://exist-db.org/xquery/math
A module containing functions for common mathematical operations.

math:abs($x as xs:double) xs:double
Calculates the absolute value (distance from zero) of a value or expression
$xThe value to return the absolute value of

Returns the absolute value (distance from zero) of a value or expression

math:acos($x as xs:double) xs:double
Returns the arc cosine of an angle, in the range of 0.0 through pi.
$xThe input number

Returns the result

math:asin($x as xs:double) xs:double
Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
$xThe input number

Returns result

math:atan($x as xs:double) xs:double
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
$xThe input number

Returns the result

math:atan2($y as xs:double, $x as xs:double) xs:double
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).
$yThe y coordinate
$xThe x coordinate

Returns the theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates.

math:ceil($x as xs:double) xs:double
Returns the smallest (closest to negative infinity) value that is not less than the argument and is equal to a mathematical integer.
$xThe input number

Returns result

math:cos($x as xs:double) xs:double
Returns the trigonometric cosine of an angle.
$xThe input number

Returns the cosine

math:degrees($radians as xs:double) xs:double
Converts angle in radians to degrees.
$radiansThe radians

Returns the degrees

math:e() xs:double
Returns base of the natural logarithms, e.

Returns the value of e

math:exp($x as xs:double) xs:double
Calculates e (the Euler Constant) raised to the power of a value or expression
$xThe input number

Returns e (the Euler Constant) raised to the power of a value or expression

math:floor($x as xs:double) xs:double
Returns the largest (closest to positive infinity) value that is not greater than the argument and is equal to a mathematical integer.
$xThe input number

Returns the floor value

math:log($x as xs:double) xs:double
Returns the natural logarithm (base e) of a number.
$xThe input number

Returns the log

math:pi() xs:double
Returns the value of pi.

Returns the value of pi

math:power($value as xs:double, $power as xs:double) xs:double
Returns the value of $value raised to the power of $power.
$valueThe value
$powerThe power to raise the value to

Returns the result

math:radians($degrees as xs:double) xs:double
Converts angle in degrees to radians.
$degreesThe degrees

Returns the radians

math:random() xs:double
Returns a value greater than or equal to 0.0 and less than 1.0.

Returns a random value

math:round($x as xs:double) xs:double
Returns the double value that is closest to a integer.
$xThe input number

Returns the rounded value

math:sin($x as xs:double) xs:double
Returns the trigonometric sine of an angle.
$xThe input number

Returns the sine

math:sqrt($x as xs:double) xs:double
Returns the correctly rounded positive square root of a number.
$xThe input number

Returns the square root of $x

math:tan($radians as xs:double) xs:double
Returns the tangent of the number passed as an argument in radians.
$radiansThe radians

Returns the tangent

http://exist-db.org/xquery/ngram
A module for NGram-based indexed searching.

ngram:add-match($node-set as node()?) node()*
For each of the nodes in the argument sequence, mark the entire first text descendant as a text match, just as if it had been found through a search operation. At serialization time, the text node will be enclosed in an &lt;exist:match&gt; tag, which facilitates further processing by the kwic module or match highlighting. The function is not directly related to the NGram indexand works without an index; it just uses the NGram module's match processor.
$node-setThe node set

Returns a node set containing nodes that do not have descendent nodes.

ngram:contains($nodes as node()*, $queryString as xs:string?) node()*
Similar to the standard XQuery fn:contains function, but based on the NGram index. Searches the given $queryString in the index defined on the input node set $nodes. String comparison is case insensitive. Nodes need to have an ngram index to be searched.The string may appear at any position within the node content.
$nodesThe input node set to search
$queryStringThe exact string to search for

Returns a set of nodes from the input node set $nodes containing the query string or the empty sequence

ngram:ends-with($nodes as node()*, $queryString as xs:string?) node()*
Similar to the standard XQuery fn:ends-with function, but based on the NGram index. Searches the given $queryString in the index defined on the input node set $nodes. String comparison is case insensitive. Nodes need to have an ngram index to be searched.The string has to appear at the end of the node's content.
$nodesThe input node set to search
$queryStringThe exact string to search for

Returns a set of nodes from the input node set $nodes ending with the query string or the empty sequence

ngram:filter-matches($nodes as node()*, $function-reference as function) node()*
Highlight matching strings within text nodes that resulted from a ngram search. The function takes a sequence of nodes as first argument $nodes and a callback function (defined with util:function) as second parameter $function-reference. Each node in $nodes will be copied into a new document fragment. For each ngram match found while copying a node, the callback function in $function-reference will be called once. The callback function should take 2 arguments: 1) the matching text string as xs:string, 2) the node to which this text string belongs. The callback function should return zero or more nodes, which will be inserted into the resulting node set at the place where the matching text sequence occurred. Note: a ngram match on mixed content may span multiple nodes. In this case, the callback function is called once for every text node which is part of the matching text sequence.
$nodesThe sequence of nodes
$function-referenceThe callback function

Returns a resulting node set

ngram:starts-with($nodes as node()*, $queryString as xs:string?) node()*
Similar to the standard XQuery fn:starts-with function, but based on the NGram index. Searches the given $queryString in the index defined on the input node set $nodes. String comparison is case insensitive. Nodes need to have an ngram index to be searched.The string has to appear at the start of the node's content.
$nodesThe input node set to search
$queryStringThe exact string to search for

Returns a set of nodes from the input node set $nodes starting with the query string or the empty sequence

ngram:wildcard-contains($nodes as node()*, $queryString as xs:string?) node()*
Similar to the standard XQuery fn:matches function, but based on the NGram index and allowing wildcards in the query string. Searches the given $queryString in the index defined on the input node set $nodes. String comparison is case insensitive. Nodes need to have an ngram index to be searched.The string has to match the whole node's content.
$nodesThe input node set to search
$queryStringThe string to search for.A full stop, '.', (not between brackets), without any qualifiers: Matches a single arbitrary character.A full stop, '.', (not between brackets), immediately followed by a single question mark, '?': Matches either no characters or one character.A full stop, '.', (not between brackets), immediately followed by a single asterisk, '*': Matches zero or more characters.A full stop, '.', (not between brackets), immediately followed by a single plus sign, '+': Matches one or more characters.A full stop, '.', immediately followed by a sequence of characters that matches the regular expression {[0-9]+,[0-9]+}: Matches a number of characters, where the number is no less than the number represented by the series of digits before the comma, and no greater than the number represented by the series of digits following the comma.An expression "[…]" matches a single character, namely any of the charactersenclosed by the brackets. The string enclosed by the brackets cannot be empty; therefore ']' can be allowed between the brackets, provided that it is the first character.(Thus, "[][?]" matches the three characters '[', ']' and '?'.)A circumflex accent, '^', at the start of the search string matches the start of the element content.A dollar sign, '$', at the end of the search string matches the end of the element content.One can remove the special meaning of any character mentioned above by preceding them by a backslash.Between brackets these characters stand for themselves. Thus, "[[?*\]" matchesthe four characters '[', '?', '*' and '\'.'?', '*', '+' and character sequences matching the regular expression {[0-9]+,[0-9]+} not immediately preceeded by an unescaped period, '.', stand for themselves.'^' and '$' not at the very beginning or end of the search string, respectively, stand for themselves.

Returns a set of nodes from the input node set $nodes matching the query string or the empty sequence

http://exist-db.org/xquery/repo
A module for working with expath repository manager

repo:deploy($pkgName as xs:string) element()
Deploy an application package. Installs package contents to the specified target collection, using the permissions defined by the &lt;permissions&gt; element in repo.xml. Pre- and post-install XQuery scripts can be specified via the &lt;prepare&gt; and &lt;finish&gt; elements.
$pkgNamepackage name

Returns <status result="ok"/> if deployment was ok. Throws an error otherwise.

repo:deploy($pkgName as xs:string, $targetCollection as xs:string) element()
Deploy an application package. Installs package contents to the specified target collection, using the permissions defined by the &lt;permissions&gt; element in repo.xml. Pre- and post-install XQuery scripts can be specified via the &lt;prepare&gt; and &lt;finish&gt; elements.
$pkgNamepackage name
$targetCollectionthe target collection into which the package will be stored

Returns <status result="ok"/> if deployment was ok. Throws an error otherwise.

repo:get-resource($pkgName as xs:string, $resource as xs:string) xs:base64Binary?
Retrieves the specified resource from an installed expath application package.
$pkgNamepackage name
$resourceresource path

Returns <status result="ok"/> if deployment was ok. Throws an error otherwise.

repo:install($text as xs:string*) xs:boolean
Install package from repository.
$textpackage name

Returns true if successful, false otherwise

repo:list() xs:string*
List repository packages.

Returns sequence of strings

repo:remove($text as xs:string*) xs:boolean
Remove package from repository.
$textpackage name

Returns true if successful, false otherwise

repo:undeploy($pkgName as xs:string) element()
Deploy an application package. Installs package contents to the specified target collection, using the permissions defined by the &lt;permissions&gt; element in repo.xml. Pre- and post-install XQuery scripts can be specified via the &lt;prepare&gt; and &lt;finish&gt; elements.
$pkgNamepackage name

Returns <status result="ok"/> if deployment was ok. Throws an error otherwise.

http://exist-db.org/xquery/request
A module for dealing with HTTP requests.

request:attribute-names() xs:string*
Returns the names of all request attributes in the current request.

Returns the names of all attributes attached to the current request

request:exists() xs:boolean
Returns whether a request object exists.

Returns true if the request object exists

request:get-attribute($attribute-name as xs:string) item()*
Returns the string value of the request attribute specified in the argument or the empty sequence if no such attribute exists. The attribute value should be a string.
$attribute-nameThe name of the attribute

Returns the string value of the requested attribute

request:get-context-path() xs:string
Returns the context path of the current request, i.e. the portion of the request URI that indicates the context of the request.

Returns the context path of the current request

request:get-cookie-names() xs:string*
Returns the names of all Cookies in the request

Returns a sequence of the names of all Cookies in the request

request:get-cookie-value($cookie-name as xs:string) xs:string?
Returns the value of a named Cookie.
$cookie-nameThe name of the cookie to retrieve the value from.

Returns the value of the named Cookie

request:get-data() item()?
Returns the content of a POST request. If the HTTP Content-Type header in the request identifies it as a binary document, then xs:base64Binary is returned. If its not a binary document, we attempt to parse it as XML and return a document-node(). If its not a binary or XML document, any other data type is returned as an xs:string representation or an empty sequence if there is no data to be read.

Returns the content of a POST request

request:get-effective-uri() xs:anyURI
Returns the URI of the current request. If the request was forwarded via URL rewriting, the function returns the effective, rewritten URI, not the original URI which was received from the client.

Returns the URI of the request

request:get-header($header-name as xs:string) xs:string?
Returns the HTTP request header identified by $header-name. The list of all headers included in the HTTP request are available through the request:get-header-names function.
$header-nameThe HTTP request header name

Returns the HTTP request header value

request:get-header-names() xs:string*
Returns a sequence containing the names of all headers passed in the current request

Returns a sequence containing the names of all headers passed in the current request

request:get-hostname() xs:string
Returns the hostname of the current request.

Returns the hostname of the current request

request:get-method() xs:string
Returns the HTTP method of the current request.

Returns the HTTP method of the current request

request:get-parameter($name as xs:string, $default-value as item()*) xs:string*
Returns the HTTP request parameter identified by $name. If the parameter could not be found, the default value 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.
$nameThe parameter name
$default-valueThe default value if the parameter does not exist

Returns a sequence of parameter values

request:get-parameter($name as xs:string, $default-value as item()*, $failonerror as xs:boolean*) xs:string*
Returns the HTTP request parameter identified by $name. If the parameter could not be found, the default value 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.
$nameThe parameter name
$default-valueThe default value if the parameter does not exist
$failonerrorThe fail on error flag. If the value is set to false, then the function will not fail if there is no request in scope.

Returns a sequence of parameter values

request:get-parameter-names() xs:string*
Returns a sequence containing the names of all parameters passed in the current request

Returns the sequence containing the names of all parameters

request:get-path-info() xs:string
Returns any extra path information associated with the URL the client sent when it made this request. For example an xquery GET or POST to /some/path/myfile.xq/extra/path will return /extra/path when myfile.xq is executed.

Returns the request path information

request:get-query-string() xs:string?
Returns the full query string passed to the servlet (without the initial question mark).

Returns the query string

request:get-remote-addr() xs:string
Returns the IP address of the client machine that made the current request, as a string.

Returns the IP address

request:get-remote-host() xs:string
Returns the fully qualified name of the client or the last proxy that sent the current request.

Returns the host name

request:get-remote-port() xs:integer
Returns the Internet Protocol (IP) source port of the client or last proxy that sent the current request.

Returns the IP port number

request:get-scheme() xs:string
Returns the name of the scheme used in the current request, for example, http, https, or ftp.

Returns the scheme of the current request

request:get-server-name() xs:string
Returns the server nodename of the current request.

Returns the server nodename of the current request

request:get-server-port() xs:integer
Returns the server port of the current request.

Returns the server port of the current request

request:get-servlet-path() xs:string
Returns the servlet path of the current request, i.e. the portion of the request URI that points to the servlet which is handling the request. For example an xquery GET or POST to /some/path/myfile.xq/extra/path will return /some/path/myfile.xq when myfile.xq is executed.

Returns the servlet path of the current request

request:get-uploaded-file-data($upload-param-name as xs:string) xs:base64Binary?
Retrieve the base64 encoded data 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.
$upload-param-nameThe parameter name

Returns the base64 encoded data from the uploaded file

request:get-uploaded-file-name($upload-param-name as xs:string) xs:string?
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.
$upload-param-nameThe parameter name

Returns the file name of the uploaded file

request:get-uploaded-file-size($upload-param-name as xs:string) xs:double?
Retrieve the size of an uploaded file from a multi-part request. This returns the size of the file in bytes. Returns the empty sequence if the request is not a multi-part request or the parameter name does not point to a file part.
$upload-param-nameThe parameter name

Returns the size of the uploaded file

request:get-uri() xs:anyURI
Returns the URI of the current request. This will be the original URI as received from the client. Possible modifications done by the URL rewriter will not be visible.

Returns the URI of the request

request:get-url() xs:string
Returns the URL of the current request.

Returns the URL of the current request

request:is-multipart-content() xs:boolean
Determine if the request contains multipart/form-data

Returns true is the request is a multipart/form-data request else false.

request:set-attribute($name as xs:string, $value as item()*) empty()
Stores a value in the current request using the supplied attribute name.
$nameThe attribute name
$valueThe attribute value

http://exist-db.org/xquery/response
A module for dealing with HTTP responses.

response:exists() xs:boolean
Returns whether a response object exists.

Returns true if the response object exists

response:redirect-to($uri 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.
$uriThe URI to redirect the client to

response:set-cookie($name as xs:string, $value as xs:string) empty()
Sets a HTTP Cookie on the HTTP Response.
$nameThe cookie name
$valueThe cookie value

response:set-cookie($name as xs:string, $value as xs:string, $max-age as xs:duration, $secure-flag as xs:boolean?) empty()
Sets a HTTP Cookie on the HTTP Response.
$nameThe cookie name
$valueThe cookie value
$max-ageThe xs:duration of the cookie
$secure-flagThe flag on whether the cookie is to be secure (eg. only transferred using HTTPS)

response:set-cookie($name as xs:string, $value as xs:string, $max-age as xs:duration, $secure-flag as xs:boolean?, $domain as xs:string?, $path as xs:string?) empty()
Sets a HTTP Cookie on the HTTP Response.
$nameThe cookie name
$valueThe cookie value
$max-ageThe xs:duration of the cookie
$secure-flagThe flag on whether the cookie is to be secure (eg. only transferred using HTTPS)
$domainThe flag on whether the cookie is to be secure (eg. only transferred using HTTPS)
$pathThe flag on whether the cookie is to be secure (eg. only transferred using HTTPS)

response:set-date-header($name as xs:string, $value as xs:string) empty()
Sets a HTTP Header on the HTTP Response.
$nameThe header name
$valueThe header value

response:set-header($name as xs:string, $value as xs:string) empty()
Sets a HTTP Header on the HTTP Response.
$nameThe header name
$valueThe header value

response:set-status-code($code as xs:integer) empty()
Sets a HTTP server status code on the HTTP Response.
$codeThe status code

response:stream($content as item()*, $serialization-options as xs:string) empty()
Stream can only be used within a servlet context. Itt directly streams its input to the servlet's output stream. It should thus be the last statement in the XQuery.
$contentThe source sequence
$serialization-optionsThe serialization options

response:stream-binary($binary-data as xs:base64Binary, $content-type as xs:string, $filename as xs:string?, ...) empty()
Streams the binary data to the current servlet response output stream. The ContentType HTTP header is set to the value given in $content-type.Note: the servlet output stream will be closed afterwards and mime-type settings in the prolog will not be passed.
$binary-dataThe binary data to stream
$content-typeThe ContentType HTTP header value
$filenameThe filename. If no filename is given, then the current request name is used

http://exist-db.org/xquery/securitymanager
Module for interacting with the Security Manager

sm:add-group-ace($path as xs:anyURI, $group-name as xs:string, $allowed as xs:boolean, $mode as xs:string) empty()
Adds a Group ACE to the ACL of a resource or collection.
$pathThe path to the resource or collection whoose ACL you wish to add the ACE to.
$group-nameThe name of the group to create an ACE for.
$allowedtrue() if the ACE is allowing the permission mode, or false() if we are denying the permission mode
$modeThe mode to set on the ACE e.g. 'rwx'

sm:add-user-ace($path as xs:anyURI, $user-name as xs:string, $allowed as xs:boolean, $mode as xs:string) empty()
Adds a User ACE to the ACL of a resource or collection.
$pathThe path to the resource or collection whoose ACL you wish to add the ACE to.
$user-nameThe name of the user to create an ACE for.
$allowedtrue() if the ACE is allowing the permission mode, or false() if we are denying the permission mode
$modeThe mode to set on the ACE e.g. 'rwx'

sm:chgrp($path as xs:anyURI, $group-name as xs:string) empty()
Changes the group owner of a resource or collection.
$pathThe path to the resource or collection whoose group owner you wish to set
$group-nameThe name of the user group owner to set on the resource or collection e.g. 'guest'

sm:chmod($path as xs:anyURI, $mode as xs:string) empty()
Changes the mode of a resource or collection.
$pathThe path to the resource or collection whoose mode you wish to set
$modeThe mode to set on the resource or collection e.g. 'rwxrwxrwx'

sm:chown($path as xs:anyURI, $user-name as xs:string) empty()
Changes the owner of a resource or collection.
$pathThe path to the resource or collection whoose owner you wish to set
$user-nameThe name of the user owner to set on the resource or collection e.g. 'guest'

sm:clear-acl($path as xs:anyURI) empty()
Removes all ACEs from the ACL of a resource or collection.
$pathThe path to the resource or collection whoose ACL you wish to clear.

sm:delete-group($group-id as xs:string) empty()
Deletes an existing group identified by $group-id. Any resources owned by the group will be moved to the 'guest' group.
$group-idThe group-id to delete

sm:delete-group($group-id as xs:string, $successor-group-id as xs:string) empty()
Deletes an existing group identified by $group-id, any resources owned by the group will be moved to the group indicated by $successor-group-id.
$group-idThe group-id to delete
$successor-group-idThe group-id that should take over ownership of any resources

sm:find-groups-by-groupname($starts-with as xs:string) xs:string*
Finds groups whoose group name starts with a matching string
$starts-withThe starting string against which to match group names

Returns The list of matching group names

sm:find-groups-where-groupname-contains($fragment as xs:string) xs:string*
Finds groups whoose group name contains the string fragment
$fragmentThe fragment against which to match group names

Returns The list of matching group names

sm:find-users-by-name($starts-with as xs:string) xs:string*
Finds users whoose personal name starts with a matching string
$starts-withThe starting string against which to match a personal name

Returns The list of matching usernames

sm:find-users-by-name-part($starts-with as xs:string) xs:string*
Finds users whoose first name or last name starts with a matching string
$starts-withThe starting string against which to match a first or last name

Returns The list of matching usernames

sm:find-users-by-username($starts-with as xs:string) xs:string*
Finds users whoose username starts with a matching string
$starts-withThe starting string against which to match usernames

Returns The list of matching usernames

sm:get-account-metadata($username as xs:string, $attribute as xs:anyURI) xs:string?
Gets a metadata attribute value for an account
$usernameThe username of the account to retrieve metadata from.
$attributeThe metadata attribute namespace as defined by axschema.org

Returns The metadata value (if any).

sm:get-account-metadata-keys($username as xs:string) xs:anyURI*
Gets a sequence of the metadata attribute namespaces present for an account
$usernameThe username of the account to retrieve metadata from.

Returns The metadata attribute namespaces if any

sm:get-group-managers($group as xs:string) xs:string+
Gets a list of the group managers. Can only be called by a group manager.
$groupThe group name to retrieve the list of managers for.

Returns The list of group managers for the group $group

sm:get-group-members($group as xs:string) xs:string+
Gets a list of the group members.
$groupThe group name to retrieve the list of members for.

Returns The list of group members for the group $group

sm:get-groups() xs:string*
Gets all groups

Returns The list of groups

sm:get-permissions($path as xs:anyURI) document-node()
Gets the permissions of a resource or collection.
$pathThe path to the resource or collection to get permissions of.

Returns The permissions of the resource or collection

sm:has-access($path as xs:anyURI, $mode as xs:string) xs:boolean
Checks whether the current user has access to the resource or collection.
$pathThe path to the resource or collection whoose acess of which you wish to check
$modeThe partial mode to check against the resource or collection e.g. 'rwx'

sm:insert-group-ace($path as xs:anyURI, $index as xs:int, $group-name as xs:string, $allowed as xs:boolean, $mode as xs:string) empty()
Inserts a Group ACE into the ACL of a resource or collection.
$pathThe path to the resource or collection whoose ACL you wish to add the ACE to.
$indexThe index in the ACL to insert the ACE before, subsequent entries will be renumbered
$group-nameThe name of the group to create an ACE for.
$allowedtrue() if the ACE is allowing the permission mode, or false() if we are denying the permission mode
$modeThe mode to set on the ACE e.g. 'rwx'

sm:insert-user-ace($path as xs:anyURI, $index as xs:int, $user-name as xs:string, $allowed as xs:boolean, $mode as xs:string) empty()
Inserts a User ACE into the ACL of a resource or collection.
$pathThe path to the resource or collection whoose ACL you wish to add the ACE to.
$indexThe index in the ACL to insert the ACE before, subsequent entries will be renumbered
$user-nameThe name of the user to create an ACE for.
$allowedtrue() if the ACE is allowing the permission mode, or false() if we are denying the permission mode
$modeThe mode to set on the ACE e.g. 'rwx'

sm:is-externally-authenticated() xs:boolean
Returns the true() if current account is authenticated by external user, false() otherwise.

Returns true() if user from the xquery context is authenticated, false() otherwise

sm:modify-ace($path as xs:anyURI, $index as xs:int, $allowed as xs:boolean, $mode as xs:string) empty()
Modified an ACE of an ACL of a resource or collection.
$pathThe path to the resource or collection whoose ACL you wish to modify the ACE of.
$indexThe index of the ACE in the ACL to modify
$allowedtrue() if the ACE is allowing the permission mode, or false() if we are denying the permission mode
$modeThe mode to set on the ACE e.g. 'rwx'

sm:remove-ace($path as xs:anyURI, $index as xs:int) empty()
Removes an ACE from the ACL of a resource or collection.
$pathThe path to the resource or collection whoose ACL you wish to remove the ACE from.
$indexThe index of the ACE in the ACL to remove, subsequent entries will be renumbered

http://exist-db.org/xquery/sequences
Basic XQuery equivalents of map, fold, and filter functions adapted from the standard library of the Scheme programming language. Demonstrates the use of higher-order functions in eXist.

sequences:map($func as function, $seqA as item()*, $seqB as item()*) as item()*
Applies $func to the items of two sequences and returns the results as a new sequence. Both input sequences should have the same length.

sequences:fold($func as function, $seq as item()*, $start as item())
Calls $func for all items in the sequence. For example, if the sequence is (1, 2, 3), $func will be called with arguments (1, 2) and (3, 3).

sequences:filter($func as function, $seq as item()*) as item()*
Filters the passed sequence by calling $func for every item. All items for which $func returns true are copied to the output sequence, items for which it returns false are skipped.

http://exist-db.org/xquery/session
A module for dealing with the HTTP session.

session:clear() empty()
Removes all attributes from the current HTTP session. Does NOT invalidate the session.

session:create() empty()
Initialize an HTTP session if not already present

session:encode-url($url as xs:anyURI) xs:anyURI
Encodes the specified URL with the current HTTP session-id.
$urlThe URL to encode

Returns the encoded URL

session:exists() xs:boolean
Returns whether a session object exists.

Returns true if the session object exists

session:get-attribute($name as xs:string) xs:string*
Returns an attribute stored in the current session object or an empty sequence if the attribute cannot be found.
$nameThe session attribute name

Returns the attribute value

session:get-attribute-names() xs:string*
Returns a sequence containing the names of all session attributes defined within the current HTTP session.

Returns the list of attribute names

session:get-creation-time() xs:dateTime
Returns the time when this session was created. If a session does not exist, a new one is created. If the session is already invalidated, it returns January 1, 1970 GMT

Returns the date-time when the session was created

session:get-id() xs:string?
Returns the ID of the current session or an empty sequence if there is no session.

Returns the session ID

session:get-last-accessed-time() xs:dateTime
Returns the last time the client sent a request associated with this session. If a session does not exist, a new one is created. Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time. If the session is already invalidated, it returns January 1, 1970 GMT

Returns the date-time when the session was last accessed

session:get-max-inactive-interval() xs:int
Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with the session:set-max-inactive-interval function. A negative time indicates the session should never timeout.

Returns the maximum time interval, in seconds

session:invalidate() empty()
Invalidate (remove) the current HTTP session if present

session:remove-attribute($name as xs:string) empty()
Removes the attribute with the supplied name from the current session
$nameThe attribute name

session:set-attribute($name as xs:string, $value as item()*) empty()
Stores a value in the current session using the supplied attribute name. If no session exists, then one will be created.
$nameThe attribute name
$valueThe value to be stored in the session by the attribute name

session:set-current-user($user-name as xs:string, $password 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.
$user-nameThe user name
$passwordThe password

Returns true if the user name and password represent a valid user

session:set-max-inactive-interval($interval as xs:int) empty()
Sets the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. A negative time indicates the session should never timeout.
$intervalThe maximum inactive interval (in seconds) before closing the session

http://exist-db.org/xquery/sort
Creates and manages pre-ordered indexes for use with an 'order by' expression.

sort:create-index($id as xs:string, $nodes as node()*, $values as xs:anyAtomicType*, $options as element()?) item()*
Create a sort index to be used within an 'order by' expression.
$idThe id by which the index will be known and distinguished from other indexes on the same nodes.
$nodesThe node set to be indexed.
$valuesThe values to be indexed. There should be one value for each node in $nodes. $values thus needs to contain as many items as $nodes. If not, a dynamic error is triggered.
$options<options order='ascending|descending' empty='least|greatest'/>

sort:create-index-callback($id as xs:string, $nodes as node()*, $callback as function, $options as element()?) item()*
Create a sort index to be used within an 'order by' expression.
$idThe id by which the index will be known and distinguished from other indexes on the same nodes.
$nodesThe node set to be indexed.
$callbackA callback function which will be called for every node in the $nodes input set. The function receives the current node as single argument and should return an atomic value by which the node will be sorted.
$options<options order='ascending|descending' empty='least|greatest'/>

sort:has-index($id as xs:string) xs:boolean
Check if the sort index, $id, exists.
$idThe name of the index.

Returns true() if the sort index, $id, exists, false() otherwise.

sort:index($id as xs:string, $node as node()?) xs:long?
Look up a node in the sort index and return a number (&gt; 0) corresponding to the position of that node in the ordered set which was created by a previous call to the sort:create-index function. The function returns the empty sequence if the node cannot be found in the index.
$idThe name of the index.
$nodeThe node to look up.

Returns A number &gt; 0 or the empty sequence if the $node argument was empty or the node could not be found in the index.

sort:remove-index($id as xs:string) item()*
Remove a sort index identified by its name.
$idThe name of the index to be removed.

sort:remove-index($id as xs:string, $document-node as node()) item()*
Remove all sort index entries for the given document.
$idThe name of the index to be removed.
$document-nodeA node from the document for which entries should be removed.

http://exist-db.org/xquery/spatial
A module for spatial operations on GML 2D geometries.

spatial:boundary($geometry as node()?) node()?
Returns the GML representation of the boundary of geometry $geometry.
$geometryThe geometry

Returns the GML representation of the boundary of geometry $geometry.

spatial:buffer($geometry as node()?, $width as xs:double) xs:string?
Returns the GML representation of a buffer around geometry $geometry having width $width in its CRS. Curves will be represented by 8 segments per circle quadrant.
$geometryThe geometry
$widthThe width

Returns the GML representation of a buffer around geometry $geometry having width $width in its CRS.

spatial:buffer($geometry as node()?, $width as xs:double, $segments as xs:integer) xs:string?
Returns the GML representation of a buffer around geometry $geometry having width $width in its CRS. Curves will be represented by $segments segments per circle quadrant.
$geometryThe geometry
$widthThe width
$segmentsThe segments

Returns the GML representation of a buffer around geometry $geometry having width $width in its CRS.

spatial:buffer($geometry as node()?, $width as xs:double, $segments as xs:integer, $line-end-style as xs:integer) xs:string?
Returns the GML representation of a buffer around geometry $geometry having width $width in its CRS. Curves will be represented by $segments segments per circle quadrant. The fourth argument denotes the line end style (round, butt or square) as an integer constant.
$geometryThe geometry
$widthThe width
$segmentsThe segments
$line-end-styleThe line-end-style

Returns the GML representation of a buffer around geometry $geometry having width $width in its CRS.

spatial:contains($nodes as node()*, $geometry as node()?) node()*
Returns the nodes in $nodes that contain a geometry which contains geometry $geometry
$nodesThe nodes
$geometryThe geometry

Returns the nodes in $nodes that contain a geometry which contains geometry $geometry

spatial:convexHull($geometry as node()?) node()?
Returns the GML representation of the convex hull of geometry $geometry.
$geometryThe geometry

Returns the GML representation of the convex hull of geometry $geometry.

spatial:crosses($nodes as node()*, $geometry as node()?) node()*
Returns the nodes in $nodes that contain a geometry which crosses geometry $geometry
$nodesThe nodes
$geometryThe geometry

Returns the nodes in $nodes that contain a geometry which touches geometry $geometry

spatial:difference($geometry-a as node()?, $geometry-b as node()?) node()?
Returns the GML representation of the difference of geometry $geometry-a and geometry $geometry-b in the SRS of $geometry-a.
$geometry-aThe geometry-a
$geometry-bThe geometry-b

Returns the GML representation of the difference of geometry $geometry-a and geometry $geometry-b in the SRS of $geometry-a.

spatial:disjoint($nodes as node()*, $geometry as node()?) node()*
Returns the nodes in $nodes that contain a geometry which is disjoint with geometry $geometry
$nodesThe nodes
$geometryThe geometry

Returns the nodes in $nodes that contain a geometry which is disjoint with geometry $geometry

spatial:equals($nodes as node()*, $geometry as node()?) node()*
Returns the nodes in $nodes that contain a geometry which is equal to geometry $geometry
$nodesThe nodes
$geometryThe geometry

Returns the nodes in $nodes that contain a geometry which is equal to geometry $geometry

spatial:getArea($geometry as node()?) xs:double?
Returns the area of geometry $geometry
$geometryThe geometry

Returns the area of geometry $geometry

spatial:getBbox($geometry as node()?) node()?
Returns the GML representation of the bounding box of geometry $geometry.
$geometryThe geometry

Returns the GML representation of the bounding box of geometry $geometry.

spatial:getCentroidX($geometry as node()?) xs:double?
Returns the X of centroid of geometry $geometry
$geometryThe geometry

Returns the X of centroid of geometry $geometry

spatial:getCentroidY($geometry as node()?) xs:double?
Returns the Y of centroid of geometry $geometry
$geometryThe geometry

Returns the Y of centroid of geometry $geometry

spatial:getEPSG4326Area($geometry as node()?) xs:double?
Returns the area of geometry $geometry in the EPSG:4326 SRS
$geometryThe geometry

Returns the area of geometry $geometry in the EPSG:4326 SRS

spatial:getEPSG4326CentroidX($geometry as node()?) xs:double?
Returns the X of centroid of geometry $geometry in the EPSG:4326 SRS
$geometryThe geometry

Returns the X of centroid of geometry $geometry in the EPSG:4326 SRS

spatial:getEPSG4326CentroidY($geometry as node()?) xs:double?
Returns the Y of centroid of geometry $geometry in the EPSG:4326 SRS
$geometryThe geometry

Returns the Y of centroid of geometry $geometry in the EPSG:4326 SRS

spatial:getEPSG4326MaxX($geometry as node()?) xs:double?
Returns the maximal X of geometry $geometry in the EPSG:4326 SRS
$geometryThe geometry

Returns the maximal X of geometry $geometry in the EPSG:4326 SRS

spatial:getEPSG4326MaxY($geometry as node()?) xs:double?
Returns the maximal Y of geometry $geometry in the EPSG:4326 SRS
$geometryThe geometry

Returns the maximal Y of geometry $geometry in the EPSG:4326 SRS

spatial:getEPSG4326MinX($geometry as node()?) xs:double?
Returns the minimal X of geometry $geometry in the EPSG:4326 SRS
$geometryThe geometry

Returns the minimal X of geometry $geometry in the EPSG:4326 SRS

spatial:getEPSG4326MinY($geometry as node()?) xs:double?
Returns the minimal Y of geometry $geometry in the EPSG:4326 SRS
$geometryThe geometry

Returns the minimal Y of geometry $geometry in the EPSG:4326 SRS

spatial:getEPSG4326WKB($geometry as node()?) xs:base64Binary?
Returns the WKB representation of geometry $geometry in the EPSG:4326 SRS
$geometryThe geometry

Returns the WKB representation of geometry $geometry in the EPSG:4326 SRS

spatial:getEPSG4326WKT($geometry as node()?) xs:string?
Returns the WKT representation of geometry $geometry in the EPSG:4326 SRS
$geometryThe geometry

Returns the WKT representation of geometry $geometry in the EPSG:4326 SRS

spatial:getGeometryType($geometry as node()?) xs:string?
Returns the type of geometry $geometry
$geometryThe geometry

Returns the type of geometry $geometry

spatial:getMaxX($geometry as node()?) xs:double?
Returns the maximal X of geometry $geometry
$geometryThe geometry

Returns the maxmal X of geometry $geometry

spatial:getMaxY($geometry as node()?) xs:double?
Returns the maximal Y of geometry $geometry
$geometryThe geometry

Returns the maximal Y of geometry $geometry

spatial:getMinX($geometry as node()?) xs:double?
Returns the minimal X of geometry $geometry
$geometryThe geometry

Returns the minimal X of geometry $geometry

spatial:getMinY($geometry as node()?) xs:double?
Returns the minimal Y of geometry $geometry
$geometryThe geometry

Returns the minimal Y of geometry $geometry

spatial:getSRS($geometry as node()?) xs:string?
Returns the spatial reference system of geometry $geometry
$geometryThe geometry

Returns the spatial reference system of geometry $geometry

spatial:getSRS($geometry as node()?) xs:string?
Returns the spatial reference system of geometry $geometry
$geometryThe geometry

Returns the spatial reference system of geometry $geometry

spatial:getWKB($geometry as node()?) xs:base64Binary?
Returns the WKB representation of geometry $geometry
$geometryThe geometry

Returns the WKB representation of geometry $geometry

spatial:getWKT($geometry as node()?) xs:string?
Returns the WKT representation of geometry $geometry
$geometryThe geometry

Returns the WKT representation of geometry $geometry

spatial:intersection($geometry-a as node()?, $geometry-b as node()?) node()?
Returns the GML representation of the intersection of geometry $geometry-a and geometry $geometry-b in the SRS of $geometry-a.
$geometry-aThe geometry-a
$geometry-bThe geometry-b

Returns the GML representation of the intersection of geometry $geometry-a and geometry $geometry-b in the SRS of $geometry-a.

spatial:intersects($nodes as node()*, $geometry as node()?) node()*
Returns the nodes in $nodes that contain a geometry which instersects with geometry $geometry
$nodesThe nodes
$geometryThe geometry

Returns the nodes in $nodes that contain a geometry which instersects with geometry $geometry

spatial:isClosed($geometry as node()?) xs:boolean?
Returns true() if geometry $geometry is closed, otherwise false()
$geometryThe geometry

Returns true() if geometry $geometry is closed, otherwise false()

spatial:isSimple($geometry as node()?) xs:boolean?
Returns true() if geometry $geometry is simple, otherwise false()
$geometryThe geometry

Returns true() if geometry $geometry is simple, otherwise false()

spatial:isValid($geometry as node()?) xs:boolean?
Returns true() if geometry $geometry is valid, otherwise false()
$geometryThe geometry

Returns true() if geometry $geometry is valid, otherwise false()

spatial:overlaps($nodes as node()*, $geometry as node()?) node()*
Returns the nodes in $nodes that contain a geometry which overlaps geometry $geometry
$nodesThe nodes
$geometryThe geometry

Returns the nodes in $nodes that contain a geometry which overlaps geometry $geometry

spatial:symetricDifference($geometry-a as node()?, $geometry-b as node()?) node()?
Returns the GML representation of the symetric difference of geometry $geometry-a and geometry $geometry-b in the SRS of $geometry-a.
$geometry-aThe geometry-a
$geometry-bThe geometry-b

Returns the GML representation of the symetric difference of geometry $geometry-a and geometry $geometry-b in the SRS of $geometry-a.

spatial:touches($nodes as node()*, $geometry as node()?) node()*
Returns the nodes in $nodes that contain a geometry which touches geometry $geometry
$nodesThe nodes
$geometryThe geometry

Returns the nodes in $nodes that contain a geometry which touches geometry $geometry

spatial:transform($geometry as node()?, $srs as xs:string) node()?
Returns the GML representation of geometry $geometry with the SRS $srs
$geometryThe geometry
$srsThe srs

Returns the GML representation of geometry $geometry with the SRS $srs

spatial:union($geometry-a as node()?, $geometry-b as node()?) node()?
Returns the GML representation of the union of geometry $geometry-a and geometry $geometry-b in the SRS of $geometry-a.
$geometry-aThe geometry-a
$geometry-bThe geometry-b

Returns the GML representation of the union of geometry $geometry-a and geometry $geometry-b in the SRS of $geometry-a.

spatial:within($nodes as node()*, $geometry as node()?) node()*
Returns the nodes in $nodes that contain a geometry which is within geometry $geometry
$nodesThe nodes
$geometryThe geometry

Returns the nodes in $nodes that contain a geometry which is within geometry $geometry

spatial:WKTtoGML($wkt as xs:string?, $srs as xs:string) node()?
Returns the GML representation of WKT $wkt with the SRS $srs
$wktThe wkt
$srsThe srs

Returns the GML representation of WKT $wkt with the SRS $srs

http://exist-db.org/xquery/system
A module for retrieving information about eXist and the system.

system:as-user($username as xs:string, $password as xs:string?, $code-block as item()*) item()*
A pseudo-function to execute a limited block of code as a different user. The first argument is the name of the user, the second is the password. If the user can be authenticated, the function will execute the code block given in the third argument with the permissions of that user andreturns the result of the execution. Before the function completes, it switches the current user back to the old user.
$usernameThe username of the user to run the code against
$passwordThe password of the user to run the code against
$code-blockThe code block to run as the identified user

Returns the results of the code block executed

system:clear-trace() empty()
Clear the global trace log.

system:count-instances-active() xs:integer
Returns the number of eXist instances that are active.

Returns the count

system:count-instances-available() xs:integer
Returns the number of eXist instances that are available.

Returns the count

system:count-instances-max() xs:integer
Returns the maximum number of eXist instances.

Returns the count

system:enable-tracing($enable as xs:boolean) empty()
Enable function tracing on the database instance.
$enableThe boolean flag to enable/disable function tracing

system:enable-tracing($enable as xs:boolean, $tracelog as xs:boolean) empty()
Enable function tracing on the database instance.
$enableThe enable boolean flag to enable/disable function tracing
$tracelogThe tracelog boolean flag: if set to true, entering/exiting a function will be logged to the logger 'xquery.profiling'

system:ft-index-lookup($nodes as node()*, $string-filter as xs:string?) node()*
Internal function doing old full-text index lookup filtering. Intended to support the query optimizer by allowing restrictive filtering early on.
$nodesThe nodes
$string-filterThe string-filter

Returns the nodes matching the string-filter

system:function-available($function-name as xs:QName, $arity as xs:integer) xs:boolean
Returns whether a function is available.
$function-nameThe fully qualified name of the function
$arityThe arity of the function

Returns true() if the function exists, false() otherwise.

system:get-build() xs:string
Returns the build of eXist running this query.

Returns the build number

system:get-exist-home() xs:string
Returns the eXist home location.

Returns the path to the eXist home

system:get-index-statistics() node()?
Internal function

Returns the resource containing the index statistics

system:get-memory-free() xs:long
Returns the amount of free memory available to eXist.

Returns the size of memory

system:get-memory-max() xs:long
Returns the maximum amount of memory eXist may use.

Returns the size of memory

system:get-memory-total() xs:long
Returns the total amount of memory in use by eXist.

Returns the size of memory

system:get-module-load-path() xs:string
Returns the module load path from the current query context. The module load path corresponds to the location on the file system from where modules are loaded into an XQuery. This is usually the directory from which the main XQuery was compiled, or - when executing a stored XQuery - the collection in which the main query resides. The module load path is also used to resolve relative XInclude paths.

Returns the load path

system:get-revision() xs:string
Returns the SubVersion (SVN) revision ID of eXist running this query.

Returns the revision ID.

system:get-running-jobs() item()
Get a list of running jobs (dba role only).

Returns the list of running jobs

system:get-running-xqueries() item()
Get a list of running XQueries (dba role only).

Returns a node containing the list of running XQueries

system:get-scheduled-jobs() item()
Get a list of scheduled jobs (dba role only).

Returns a node containing the list of scheduled jobs

system:get-uptime() xs:dayTimeDuration
Returns the time since eXist-db was started. The value is stable over the lifetime of a query.

Returns the duration since eXist-db was started

system:get-version() xs:string
Returns the version of eXist running this query.

Returns the version string

system:kill-running-xquery($xquery-id as xs:integer) empty()
Kill a running XQuey (dba role only).
$xquery-idThe XQuery ID obtained from get-running-xqueries()

system:kill-running-xquery($xquery-id as xs:integer, $wait-time as xs:long) empty()
Kill a running XQuey (dba role only).
$xquery-idThe XQuery ID obtained from get-running-xqueries()
$wait-timeThe wait time in milliseconds before terminating the XQuery

system:restore($dir-or-file as xs:string, $admin-pass as xs:string?, $new-admin-pass as xs:string?) node()
Restore the database or a section of the database (admin user only).
$dir-or-fileThis is either a backup directory with the backup descriptor (__contents__.xml) or a backup ZIP file.
$admin-passThe password for the admin user
$new-admin-passSet the admin password to this new password.

Returns the restore results

system:shutdown($delay as xs:long) empty()
Shutdown eXist. This method is only available to the DBA role.
$delayThe delay in milliseconds before eXist starts to shutdown.

system:shutdown() empty()
Shutdown eXist immediately. This method is only available to the DBA role.

system:trace() node()
Returns function call statistics gathered by the trace log.

Returns the call statistics gathered by the trace

system:tracing-enabled() xs:boolean
Returns true if function tracing is currently enabled on the database instance.

Returns true is tracing is enabled.

system:trigger-system-task($java-classname as xs:string, $task-parameters as node()?) empty()
Trigger a system task.
$java-classnameThe full name of the Java class to execute. It must implement org.exist.storage.SystemTask
$task-parametersThe XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>

system:update-statistics() empty()
This function is part of the unfinished index statistics module, which is not yet usable in a normal eXist setup. update-statistics rebuilds index statistics for the entire database.

http://exist-db.org/xquery/testing

test:setup-action($action)

test:store($action as element(store))

test:store-files($action as element(store-files))

test:setup($setup as element(setup))

test:tearDown($tearDown as element(tearDown)?)

test:declare-variable($var as element(variable)) as item()?

test:init-prolog($test as element(test))

test($result as item()*)

test:run-test($test as element(test), $count as xs:integer)

test:normalize($nodes as node()*)

test:normalize-node($node as node())

test:xpath($output as item()*, $xpath as element())

test:run-testSet($set as element(TestSet))

test:format-testResult($result)

http://exist-db.org/xquery/text
A module for text searching extension functions.

text:filter($text as xs:string, $regularexpression as xs:string) xs:string*
Filter substrings that match the regular expression in the text.
$textThe text to filter
$regularexpressionThe regular expression to perform against the text

Returns the substrings

text:filter-nested($node-set as node()*) node()*
Filters out all nodes in the node set, which do have descendant nodes in the same node set. This is useful if you do a combined query like //(a|b)[. &= $terms] and some 'b' nodes are nested within 'a' nodes, but you only want to see the innermost matches, i.e. the 'b' nodes, not the 'a' nodes containing 'b' nodes.
$node-setThe node set

Returns a node set containing nodes that do not have descendent nodes.

text:fuzzy-index-terms($term as xs:string?) xs:string*
Compares the specified argument against the contents of the fulltext index. Returns a sequence of strings which are similar to the argument. Similarity is based on Levenshtein distance. This function may not be useful in its current form and is subject to change.
$termThe term

Returns a sequence of strings which are similar to the argument $term

text:fuzzy-match-all($source as node()*, $keyword 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 against the string value of each item in the sequence $source.
$sourceThe source
$keywordThe keyword string

Returns the sequence of nodes that match the keywords

text:fuzzy-match-any($source as node()*, $keyword 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 against the string value of each item in the sequence $source.
$sourceThe source
$keywordThe keyword string

Returns the sequence of nodes that match the keywords

text:groups($text as xs:string, $regularexpression as xs:string) xs:string*
Tries to match the string in $text to the regular expression. 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.
$textThe text to filter
$regularexpressionThe regular expression to perform against the text

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($text as xs:string, $regularexpression as xs:string, $flags as xs:string) xs:string*
Tries to match the string in $text to the regular expression, using the flags specified. 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.
$textThe text to filter
$regularexpressionThe regular expression to perform against the text
$flagsThe flags

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-regex($text as xs:string, $regularexpression as xs:string) xs:string*
Tries to match the string in $text to the regular expression. 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. Note: The groups-regex() variants of the groups() functions are identical except that they avoid the translation of the specified regular expression from XPath2 to Java syntax. That is, the regular expression is evaluated as is, and must be valid according to Java regular expression syntax, rather than the more restrictive XPath2 syntax.
$textThe text to filter
$regularexpressionThe regular expression to perform against the text

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-regex($text as xs:string, $regularexpression as xs:string, $flags as xs:string) xs:string*
Tries to match the string in $text to the regular expression, using the flags specified. 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. Note: The groups-regex() variants of the groups() functions are identical except that they avoid the translation of the specified regular expression from XPath2 to Java syntax. That is, the regular expression is evaluated as is, and must be valid according to Java regular expression syntax, rather than the more restrictive XPath2 syntax.
$textThe text to filter
$regularexpressionThe regular expression to perform against the text
$flagsThe flags

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($source as text()*, $callback-function-ref as function, $parameters 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 $source and a callback function (defined with util:function) as second parameter. $parameters 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>.
$sourceThe sequence of text nodes
$callback-function-refThe callback function (defined with util:function)
$parametersThe sequence of additional values that will be passed to the callback functions third parameter.

Returns the source with the added highlights

text:index-terms($nodes as node()*, $qnames as xs:QName+, $start as xs:string?, $function as function, $returnMax as xs:int) item()*
This version of the index-terms function is to be used with indexes that were defined on a specific element or attribute QName. The second argument lists the QNames or elements or attributes for which occurrences should bereturned. Otherwise, the function behaves like the 4-argument version.
$nodesThe set of nodes in which the returned tokens occur
$qnamesOne or more element or attribute names for which index terms are returned
$startThe optional start string
$functionThe callback function reference
$returnMaxThe maximum number of terms to report

Returns the results from the evaluation of the function reference

text:index-terms($nodes as node()*, $start as xs:string?, $function as function, $returnMax 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 $nodes. The function returns term frequencies for all terms in the index found in descendants of the nodes in $nodes. The second argument $start specifies a start string. Only terms starting with the specified character sequence are returned. If $nodes is the empty sequence, all terms in the index will be selected. $function is a function reference, which points to a callback function that will be called for every term occurrence. $returnMax defines the maximum number of terms that should be reported. The function reference for $function 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.
$nodesThe set of nodes in which the returned tokens occur
$startThe optional start string
$functionThe callback function reference
$returnMaxThe maximum number of terms to report

Returns the results from the evaluation of the function reference

text:kwic-display($text as text()*, $width as xs:positiveInteger, $callback-function as function, $parameters as item()*) node()*
Deprecated: kwic functionality is now provided by an XQuery module, see http://exist-org/kwic.html.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.
$textThe text nodes
$widthThe width
$callback-functionThe callback function
$parametersThe parameters passed into the last argument of the callback function

Returns the results

Deprecated: Improved kwic functionality is now provided by a separate XQuery module, see http://exist-db.org/kwic.html. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

text:kwic-display($text as text()*, $width as xs:positiveInteger, $callback-function as function, $result-callback as function, $parameters 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.
$textThe text nodes
$widthThe width
$callback-functionThe callback function
$result-callbackThe result callback function
$parametersThe parameters passed into the last argument of the callback function

Returns the results

Deprecated: Improved kwic functionality is now provided by a separate XQuery module, see http://exist-db.org/kwic.html. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

text:make-token($text as xs:string) xs:string*
Split a string into tokens
$textThe string to tokenize

Returns a sequence of tokens

text:match-all($source as node()*, $regular-expression as xs:string+) node()*
Tries to match each of the regular expression strings against the keywords contained in the fulltext index. The keywords found are then compared to the node set in $source. Every node containing ALL of the keywords is copied to the result sequence. By default, a keyword is considered to match the pattern if any substring of the keyword matches. To change this behaviour, use the 3-argument version of the function and specify flag 'w'. With 'w' specified, the regular expression is matched against the entire keyword, i.e. 'explain.*' will match 'explained' , but not 'unexplained'.
$sourceThe node set that is to be searched for the keyword set
$regular-expressionThe regular expressions to be matched against the fulltext index

Returns the sequence of all of the matching nodes

text:match-all($source as node()*, $regular-expression as xs:string+, $flag as xs:string) node()*
Tries to match each of the regular expression strings against the keywords contained in the fulltext index. The keywords found are then compared to the node set in $source. Every node containing ALL of the keywords is copied to the result sequence. By default, a keyword is considered to match the pattern if any substring of the keyword matches. To change this behaviour, use the 3-argument version of the function and specify flag 'w'. With 'w' specified, the regular expression is matched against the entire keyword, i.e. 'explain.*' will match 'explained' , but not 'unexplained'.
$sourceThe node set that is to be searched for the keyword set
$regular-expressionThe regular expressions to be matched against the fulltext index
$flagWith 'w' specified, the regular expression is matched against the entire keyword, i.e. 'explain.*' will match 'explained' , but not 'unexplained'.

Returns the sequence of all of the matching nodes

text:match-any($source as node()*, $regular-expression as xs:string+) node()*
Tries to match each of the regular expression strings against the keywords contained in the fulltext index. The keywords found are then compared to the node set in $source. Every node containing ANY of the keywords is copied to the result sequence. By default, a keyword is considered to match the pattern if any substring of the keyword matches. To change this behaviour, use the 3-argument version of the function and specify flag 'w'. With 'w' specified, the regular expression is matched against the entire keyword, i.e. 'explain.*' will match 'explained' , but not 'unexplained'.
$sourceThe node set that is to be searched for the keyword set
$regular-expressionThe regular expressions to be matched against the fulltext index

Returns the sequence of all of the matching nodes

text:match-any($source as node()*, $regular-expression as xs:string+, $flag as xs:string) node()*
Tries to match each of the regular expression strings against the keywords contained in the fulltext index. The keywords found are then compared to the node set in $source. Every node containing ANY of the keywords is copied to the result sequence. By default, a keyword is considered to match the pattern if any substring of the keyword matches. To change this behaviour, use the 3-argument version of the function and specify flag 'w'. With 'w' specified, the regular expression is matched against the entire keyword, i.e. 'explain.*' will match 'explained' , but not 'unexplained'.
$sourceThe node set that is to be searched for the keyword set
$regular-expressionThe regular expressions to be matched against the fulltext index
$flagWith 'w' specified, the regular expression is matched against the entire keyword, i.e. 'explain.*' will match 'explained' , but not 'unexplained'.

Returns the sequence of all of the matching nodes

text:match-count($source as node()?) xs:integer
Counts the number of fulltext matches within the nodes and subnodes in $source.
$sourceThe node and subnodes to do the fulltext match on

Returns the count

text:matches-regex($input as xs:string*, $pattern as xs:string) xs:boolean
The function returns true if $input matches the regular expression supplied as $pattern, if present; otherwise, it returns false. If $input is the empty sequence, it is interpreted as the zero-length string. Note: The text:matches-regex() variants of the fn:matches() functions are identical except that they avoid the translation of the specified regular expression from XPath2 to Java syntax. That is, the regular expression is evaluated as is, and must be valid according to Java regular expression syntax, rather than the more restrictive XPath2 syntax.
$inputThe input string
$patternThe pattern

Returns true if the pattern is a match, false otherwise

text:matches-regex($input as xs:string*, $pattern as xs:string, $flags as xs:string) xs:boolean
The function returns true if $input matches the regular expression supplied as $pattern as influenced by the value of $flags, if present; otherwise, it returns false. The effect of calling this version of the function with the $flags argument set to a zero-length string is the same as using the other two argument version. Flags are defined in 7.6.1.1 Flags. If $input is the empty sequence, it is interpreted as the zero-length string. Note: The text:matches-regex() variants of the fn:matches() functions are identical except that they avoid the translation of the specified regular expression from XPath2 to Java syntax. That is, the regular expression is evaluated as is, and must be valid according to Java regular expression syntax, rather than the more restrictive XPath2 syntax.An error is raised [err:FORX0001] if the value of $flags is invalid according to the rules described in section 7.6.1 Regular Expression Syntax.
$inputThe input string
$patternThe pattern
$flagsThe flags

Returns true if the pattern is a match, false otherwise

text:text-rank($text as node()?) xs:double
This is just a skeleton for a possible ranking function. Don't use this.
$textThe text to rank

Returns the ranking of the text

http://exist-db.org/xquery/transform
A module for dealing with XSL transformations.

transform:stream-transform($node-tree as node()*, $stylesheet as item(), $parameters 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.
$node-treeThe source-document (node tree)
$stylesheetThe XSL stylesheet
$parametersThe transformer parameters

transform:stream-transform($node-tree as node()*, $stylesheet as item(), $parameters as node()?, $serialization-options as xs:string) 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.
$node-treeThe source-document (node tree)
$stylesheetThe XSL stylesheet
$parametersThe transformer parameters
$serialization-optionsThe serialization options

transform:transform($node-tree as node()*, $stylesheet as item(), $parameters 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>. There are two special parameters named "exist:stop-on-warn" and "exist:stop-on-error". If set to value "yes", eXist will generate an XQuery error if the XSL processor reports a warning or error.
$node-treeThe source-document (node tree)
$stylesheetThe XSL stylesheet
$parametersThe transformer parameters

Returns the transformed result (node tree)

transform:transform($node-tree as node()*, $stylesheet as item(), $parameters as node()?, $serialization-options as xs:string) 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>. There are two special parameters named "exist:stop-on-warn" and "exist:stop-on-error". If set to value "yes", eXist will generate an XQuery error if the XSL processor reports a warning or error. The fourth argument specifies serialization options in the same way as if they were passed to "declare option exist:serialize" expression. An additional serialization option, xinclude-path, is supported, which specifies a base path against which xincludes will be expanded (if there are xincludes in the document). A relative path will be relative to the current module load path.
$node-treeThe source-document (node tree)
$stylesheetThe XSL stylesheet
$parametersThe transformer parameters
$serialization-optionsThe serialization options

Returns the transformed result (node tree)

http://exist-db.org/xquery/util
A module for various utility extension functions.

util:base-to-integer($number as item(), $base as xs:integer) xs:integer
Converts the number $number from base $base to xs:integer.
$numberThe number to convert
$baseThe base of $number

Returns the xs:integer representation of $number in base $base

util:base64-decode($string as xs:string?) xs:string?
Decode the given Base64 encoded string back to clear text
$stringThe Base64 string to be decoded

Returns the decoded output

util:base64-encode($string as xs:string?) xs:string?
Encodes the given string as Base64
$stringThe string to be Base64 encoded

Returns the Base64 encoded output, with trailing newlines trimmed

util:base64-encode($string as xs:string?, $trim as xs:boolean) xs:string?
Encodes the given string as Base64
$stringThe string to be Base64 encoded
$trimTrim trailing newlines?

Returns the Base64 encoded output

util:binary-doc($binary-resource as xs:string?) xs:base64Binary?
Retrieves the binary resource and returns its contents as a value of type xs:base64Binary. An empty sequence is returned if the resource could not be found or $binary-resource was empty.
$binary-resourceThe path to the binary resource

Returns the binary document

util:binary-doc-available($binary-resource as xs:string?) xs:boolean
Checks if the binary resource identified by $binary-resource is available.
$binary-resourceThe path to the binary resource

Returns true if the binary document is available

util:binary-to-string($binary-resource 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 the default of UTF-8.
$binary-resourceThe binary resource

Returns the string containing the encoded binary resource

util:binary-to-string($binary-resource as xs:base64Binary?, $encoding 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 the default of UTF-8.
$binary-resourceThe binary resource
$encodingThe encoding type. i.e. 'UTF-8'

Returns the string containing the encoded binary resource

util:call($function-reference as function, $parameters 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.
$function-referenceThe function to ba called
$parametersThe parameters to be passed into the function

Returns the results from the function called

util:catch($java-classnames as xs:string+, $try-code-blocks as item()*, $catch-code-blocks as item()*) item()*
This function corresponds to a try-catch statement in Java. The code block in $try-code-blocks will be put inside a try-catch statement. If an exception is thrown while executing $try-code-blocks, the function checks the name of the exception and calls $catch-code-blocks if it matches one of the fully qualified Java class names specified in $java-classnames. A value of "*" in $java-classnames will catch all java exceptions. Inside the catch code block, the variable $util:exception will be bound to the java class name of the exception, and $util:exception-message will be bound to the message produced by the exception.
$java-classnamesThe list of one or more fully qualified Java class names. An entry of '*' will catch all java exceptions.
$try-code-blocksThe code blocks that will be put inside of a the try part of the try-catch statement.
$catch-code-blocksThe code blocks that will be will called if the catch matches one of the $java-classnames

Returns the results from the try-catch

Deprecated: Use the XQuery 3.0 try/catch expression in stead. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

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.

Returns the sequence of strings containing all collation locales that might be specified in the '?lang=' parameter of a collation URI.

util:collection-name($node-or-path-string 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.
$node-or-path-stringThe document node or a path string.

Returns the name of the collection.

util:compile($expression as xs:string) xs:string
Compiles the XQuery expression given in parameter $expression. Returns an empty string if no errors were found, a description of the error otherwise.
$expressionThe XPath/XQuery expression.

Returns the results of the expression

util:compile($expression as xs:string, $module-load-path as xs:string) xs:string
Compiles the XQuery expression given in parameter $expression. Returns an empty string if no errors were found, a description of the error otherwise.
$expressionThe XPath/XQuery expression.
$module-load-pathThe module load path. Imports will be resolved relative to this. Use xmldb:exist:///db if your modules are stored in db.

Returns the results of the expression

util:compile-query($expression as xs:string, $module-load-path as xs:string?) element()
Compiles the XQuery expression given in parameter $expression. Returns an XML fragment which describes any errors found. If the query could be compiled successfully, a fragment <info result="pass"/> is returned. Otherwise, an error description is returned as follows: <info result="fail"><error code="errcode" line="line" column="column">error description</error></info>.
$expressionThe XPath/XQuery expression.
$module-load-pathThe module load path. Imports will be resolved relative to this. Use xmldb:exist:///db if your modules are stored in db.

Returns the results of the expression

util:declare-namespace($prefix as xs:string, $namespace-uri as xs:anyURI) empty()
Dynamically declares a namespace/prefix mapping for the current context.
$prefixThe prefix to be assigned to the namespace
$namespace-uriThe namespace URI

util:declare-option($name as xs:string, $option as xs:string) empty()
Dynamically declares a serialization option as with 'declare option'.
$nameThe serialization option name
$optionThe serialization option value

util:declared-variables($namespace-uri 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.
$namespace-uriThe namespace URI of the function module

Returns the sequence of function names

util:deep-copy($item as item()?) item()?
Performs a Deep Clone of the passed in item.
$itemThe item to be cloned

Returns the item clone

util:describe-function($function-name as xs:QName) node()
Describes a built-in function. Returns an element describing the function signature.
$function-nameThe name of the function to get the signature of

Returns the signature of the function

util:disable-profiling() empty()
Disable profiling output within the query.

util:doctype($doctype as xs:string+, ...) node()*
Returns the document nodes of the documents with the given DOCTYPE(s).
$doctypeThe DOCTYPE of the documents to find

Returns the document nodes

util:document-id($node-or-path 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.
$node-or-pathThe node or a string path pointing to a resource in the database.

Returns the ID of the document

util:document-name($node-or-path 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.
$node-or-pathThe node or a string path pointing to a resource in the database.

Returns the name of the document

util:enable-profiling($verbosity 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 $verbosity specifies the verbosity. All other profiling options can be configured via the 'declare option exist:profiling ...' in the query prolog.
$verbosityThe verbosity of the profiling

util:eval($expression as item()) node()*
Dynamically evaluates an XPath/XQuery expression.
$expressionThe expression to be evaluated. If it 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.

Returns the results of the evaluated XPath/XQuery expression

util:eval($expression as item(), $cache-flag as xs:boolean) node()*
Dynamically evaluates an XPath/XQuery expression.
$expressionThe expression to be evaluated. If it 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.
$cache-flagThe flag for whether the compiled query should be cached. The cached query will be globally available within the db instance.

Returns the results of the evaluated XPath/XQuery expression

util:eval($expression as item(), $cache-flag as xs:boolean, $external-variable as xs:anyType*) node()*
Dynamically evaluates an XPath/XQuery expression.
$expressionThe expression to be evaluated. If it 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.
$cache-flagThe flag for whether the compiled query should be cached. The cached query will be globally available within the db instance.
$external-variableExternal variables to be bound for the query that is being evaluated. Should be alternating variable QName and value.

Returns the results of the evaluated XPath/XQuery expression

util:eval-async($expression as item()) node()*
Dynamically evaluates an XPath/XQuery expression asynchronously. The ID of the executing thread is returned.
$expressionThe expression to be evaluated. If it 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.

Returns the results of the evaluated XPath/XQuery expression

util:eval-inline($inline-context as item()*, $expression as item()) item()*
Dynamically evaluates an XPath/XQuery expression.
$inline-contextThe inline context
$expressionThe expression to be evaluated. If it 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.

Returns the results of the evaluated XPath/XQuery expression

util:eval-inline($inline-context as item()*, $expression as item(), $cache-flag as xs:boolean) item()*
Dynamically evaluates an XPath/XQuery expression.
$inline-contextThe inline context
$expressionThe expression to be evaluated. If it 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.
$cache-flagThe flag for whether the compiled query should be cached. The cached query will be globally available within the db instance.

Returns the results of the evaluated XPath/XQuery expression

util:eval-with-context($expression as item(), $context as node()?, $cache-flag as xs:boolean) node()*
Dynamically evaluates an XPath/XQuery expression.
$expressionThe expression to be evaluated. If it 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.
$contextThe query inherits the context described by the XML fragment in this 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> <default-context>explicitly provide default context here</default-context> <mapModule namespace="uri" uri="uri_to_module"/> </static-context>.
$cache-flagThe flag for whether the compiled query should be cached. The cached query will be globally available within the db instance.

Returns the results of the evaluated XPath/XQuery expression

util:eval-with-context($expression as item(), $context as node()?, $cache-flag as xs:boolean, $eval-context-item as item()?) node()*
Dynamically evaluates an XPath/XQuery expression.
$expressionThe expression to be evaluated. If it 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.
$contextThe query inherits the context described by the XML fragment in this 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> <default-context>explicitly provide default context here</default-context> <mapModule namespace="uri" uri="uri_to_module"/> </static-context>.
$cache-flagThe flag for whether the compiled query should be cached. The cached query will be globally available within the db instance.
$eval-context-itemthe context item against which the expression will be evaluated

Returns the results of the evaluated XPath/XQuery expression

util:exclusive-lock($nodes as node()*, $expression as item()*) item()*
Puts an exclusive lock on the owner documents of all nodes in the first argument $nodes. Then evaluates the expressions in the second argument $expression and releases the acquired locks after their completion.
$nodesThe nodes whose owning documents will have exclusive locks set.
$expressionThe expression(s) that are to be evaluated before the acquired locks are released.

Returns the results of the evaluated expression(s)

util:expand($node as node()*) node()*
Creates an in-memory copy of the passed node set, using the specified serialization options. By default, full-text match terms will be tagged with &lt;exist:match&gt; and XIncludes will be expanded.
$nodeThe node(s) to create in-memory copies of.

Returns the results

util:expand($node as node()*, $serialization-parameters as xs:string) node()*
Creates an in-memory copy of the passed node set, using the specified serialization options. By default, full-text match terms will be tagged with &lt;exist:match&gt; and XIncludes will be expanded. Serialization parameters can be set in the second argument, which accepts the same parameters as the exist:serialize option.
$nodeThe node(s) to create in-memory copies of.
$serialization-parametersThe serialization parameters

Returns the results

util:extract-docs($uri as xs:string) node()?
Returns an XML document which describes the functions available in a given module. The module is identified through its module namespace URI, which is passed as an argument. The function returns a module documentation in XQDoc format.
$uriThe namespace URI of the function module

Returns the xqdocs for the function module

util:function($name as xs:QName, $arity 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 (number of parameters) of the function. If no function can be found that matches the name and arity, an error is thrown. Please note: the arguments to this function have to be literals or need to be resolvable at compile time at least.
$nameThe name of the function
$arityThe arity of the function

Returns the reference to the XQuery function

util:get-fragment-between($beginning-node as node()?, $ending-node as node()?, $make-fragment as xs:boolean?) xs:string
Returns an xml fragment or a sequence of nodes between two elements (normally milestone elements). The $beginning-node represents the first node/milestone element, $ending-node, the second one. The third argument, $make-fragment, is a boolean value for the path completion. If it is set to true() the result sequence is wrapped into a parent element node. Example call of the function for getting the fragment between two TEI page break element nodes: let $fragment := util:get-fragment-between(//pb[1], //pb[2], true())
$beginning-nodeThe first node/milestone element
$ending-nodeThe second node/milestone element
$make-fragmentThe flag make a fragment.

Returns the string containing the fragments between the two node/milestone elements.

util:get-module-description($namespace-uri as xs:string) xs:string
Returns a short description of the module identified by the namespace URI.
$namespace-uriThe namespace URI of the module

Returns the description of the active function module identified by the namespace URI

util:get-module-info($namespace-uri as xs:string) element()
Returns an XML fragment providing additional information about the module identified by the namespace URI.
$namespace-uriThe namespace URI of the module

Returns the description of the active function module identified by the namespace URI

util:get-module-info() element()
Returns an XML fragment providing additional information about the module identified by the namespace URI.

Returns the description of the active function module identified by the namespace URI

util:get-option($name as xs:string) xs:string?
Gets the value of a serialization option as set with 'declare option'.
$nameThe serialization option name

util:get-sequence-type($sequence-type as xs:anyType*) xs:string
Returns the string representation of the type of sequence.
$sequence-typeThe type of sequence

Returns the string representation of the type of sequence

util:hash($message as item(), $algorithm as xs:string) xs:string
Calculates a hashcode from a string based on a specified algorithm.
$messageThe string to generate the hashcode from
$algorithmThe algorithm used to generate the hashcode

Returns the hashcode

util:hash($message as item(), $algorithm as xs:string, $base64flag as xs:boolean) xs:string
Calculates a hashcode from a string based on a specified algorithm.
$messageThe string to generate the hashcode from
$algorithmThe algorithm used to generate the hashcode
$base64flagThe flag that specifies whether to return the result as Base64 encoded

Returns the hashcode

util:import-module($module-uri as xs:anyURI, $prefix as xs:string, $location as xs:anyURI) empty()
Dynamically imports an XQuery module into the current context. The parameters have the same meaning as in an 'import module ...' expression in the query prolog.
$module-uriThe namespace URI of the module
$prefixThe prefix to be assigned to the namespace
$locationThe location of the module

util:index-key-documents($nodes as node()*, $value as xs:anyAtomicType) xs:integer?
Return the number of documents for an indexed value.
$nodesThe nodes whose content is indexed
$valueThe indexed value to search for

Returns the number of documents for the indexed value

util:index-key-documents($nodes as node()*, $value as xs:anyAtomicType, $index as xs:string) xs:integer?
Return the number of documents for an indexed value.
$nodesThe nodes whose content is indexed
$valueThe indexed value to search for
$indexThe index in which the search is made

Returns the number of documents for the indexed value

util:index-key-occurrences($nodes as node()*, $value as xs:anyAtomicType) xs:integer?
Return the number of occurrences for an indexed value.
$nodesThe nodes whose content is indexed
$valueThe indexed value to search for

Returns the number of occurrences for the indexed value

util:index-key-occurrences($nodes as node()*, $value as xs:anyAtomicType, $index as xs:string) xs:integer?
Return the number of occurrences for an indexed value.
$nodesThe nodes whose content is indexed
$valueThe indexed value to search for
$indexThe index in which the search is made

Returns the number of occurrences for the indexed value

util:index-keys($node-set as node()*, $start-value as xs:anyAtomicType?, $function-reference as function, $max-number-returned 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 function will check for indexes defined on path as well as indexes defined by QName.
$node-setThe node set
$start-valueOnly index keys of the same type but being greater than $start-value will be reported for non-string types. For string types, only keys starting with the given prefix are reported.
$function-referenceThe 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.
$max-number-returnedThe maximum number of returned keys

Returns the results of the eval of the $function-reference

util:index-keys($node-set as node()*, $start-value as xs:anyAtomicType?, $function-reference as function, $max-number-returned as xs:int?, $index as xs:string) 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 function will check for indexes defined on path as well as indexes defined by QName.
$node-setThe node set
$start-valueOnly index keys of the same type but being greater than $start-value will be reported for non-string types. For string types, only keys starting with the given prefix are reported.
$function-referenceThe 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.
$max-number-returnedThe maximum number of returned keys
$indexThe index in which the search is made

Returns the results of the eval of the $function-reference

util:index-keys-by-qname($qname as xs:QName*, $start-value as xs:anyAtomicType?, $function-reference as function, $max-number-returned as xs:int?, $index as xs:string) 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 function will check for indexes defined on path as well as indexes defined by QName.
$qnameThe node set
$start-valueOnly index keys of the same type but being greater than $start-value will be reported for non-string types. For string types, only keys starting with the given prefix are reported.
$function-referenceThe 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.
$max-number-returnedThe maximum number of returned keys
$indexThe index in which the search is made

Returns the results of the eval of the $function-reference

util:index-type($set-of-nodes as node()*) xs:string?
Returns the range index type for a set of nodes or an empty sequence if no index is defined.
$set-of-nodesThe set of nodes

Returns the range index type

util:integer-to-base($number as xs:integer, $base as xs:integer) xs:string
Converts the xs:integer $number (unsigned) into base $base as xs:string. Bases 2, 8, and 16 are supported.
$numberThe number to convert
$baseThe base of $number

Returns the xs:string representation of $number in base $base

util:is-binary-doc($binary-resource as xs:string?) xs:boolean
Checks if the resource identified by $binary-resource is a binary resource.
$binary-resourceThe path to the binary resource

Returns true if the resource is a binary document

util:is-module-mapped($namespace-uri as xs:string) xs:boolean
Returns a Boolean value if the module statically mapped to a source location in the configuration file.
$namespace-uriThe namespace URI of the module

Returns true if the namespace URI is mapped as an active function module

util:is-module-registered($namespace-uri as xs:string) xs:boolean
Returns a Boolean value if the module identified by the namespace URI is registered.
$namespace-uriThe namespace URI of the module

Returns true if the namespace URI is registered as an active function module

util:log($priority as xs:string, $message as item()*) empty()
Logs the message to the current logger.
$priorityThe logging priority: 'error', 'warn', 'debug', 'info', 'trace'
$messageThe message to log

util:log-app($priority as xs:string, $logger-name as xs:string, $message as item()*) empty()
Logs the message to the named logger
$priorityThe logging priority: 'error', 'warn', 'debug', 'info', 'trace'
$logger-nameThe name of the logger, eg: my.app.log
$messageThe message to log

util:log-system-err($message as item()*) empty()
Logs the message to System.err.
$messageThe message to log

util:log-system-out($message as item()*) empty()
Logs the message to System.out.
$messageThe message to log

util:map-module($namespace-uri as xs:string, $location-uri as xs:string) empty()
Map the module to a source location. This function is only available to the DBA role.
$namespace-uriThe namespace URI of the module
$location-uriThe location URI of the module

Returns Returns an empty sequence

util:mapped-modules() xs:string+
Returns a sequence containing the namespace URIs of all XQuery modules which are statically mapped to a source location in the configuration file. This does not include any built in modules.

Returns the sequence of all of the active function modules namespace URIs

util:node-by-id($document as node(), $node-id 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.
$documentThe document whose node is to be retrieved by its id
$node-idThe internal node id

Returns the node

util:node-id($node 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.
$nodeThe node to get the internal node-id from

Returns the internal node-id

util:node-xpath($node as node()) xs:string?
Returns the XPath for a Node.
$nodeThe node to retrieve the XPath to

Returns the XPath expression of the node

util:parse($to-be-parsed as xs:string?) document-node()?
Parses the passed string value into an XML fragment. The string has to be well-formed XML. An empty sequence is returned if the argument is an empty string or sequence. If the XML is not well-formed, the function throws an error (EXXQDY0002). An XML-formatted description of the error is contained in the error value and can be accessed using XQuery 3.0 try-catch statement.
$to-be-parsedThe string to be parsed

Returns the XML fragment parsed from the string

util:parse-html($to-be-parsed as xs:string?) document-node()?
Parses the passed string value into an XML fragment. The HTML string may not be well-formed XML. It will be passed through the Neko HTML parser to make it well-formed. An empty sequence is returned if the argument is an empty string or sequence.
$to-be-parsedThe string to be parsed

Returns the XML fragment parsed from the string

util:qname-index-lookup($qname as xs:QName, $comparison-value as xs:anyAtomicType) node()*
Can be used to query existing qname indexes defined on a set of nodes.
$qnameThe QName
$comparison-valueThe comparison value

Returns the result

util:random($max as xs:integer) xs:integer
Returns a random number between 0 (inclusive) and $max (exclusive), that is, a number greater than or equal to 0 but less than $max
$maxA number to be used as the exclusive maximum value for the random number; the return value will be less than this number.

Returns a random number between 0 and $max

util:random() xs:double
Returns a random number between 0.0 and 1.0

Returns a random number between 0.0 and 1.0

util:random-ulong() xs:unsignedLong
Returns a random number between 0 and the maximum xs:unsignedLong

Returns a random number between 0 and the maximum xs:unsignedLong

util:registered-functions($namespace-uri 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.
$namespace-uriThe namespace URI of the function module

Returns the sequence of function names

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.

Returns the sequence of function names

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.

Returns the sequence of all of the active function modules namespace URIs

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.

Deprecated: Use the file:serialize() function in the file extension module instead! This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

util:serialize($node-set as node()*, $parameters as xs:string*) xs:string?
Returns the Serialized node set passed in parameter $node-set. $parameters 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.
$node-setThe node set to serialize
$parametersThe serialization parameters

Returns the string containing the serialized node set.

util:shared-lock($nodes as node()*, $expression as item()*) item()*
Puts a shared lock on the owner documents of all nodes in the first argument $nodes. Then evaluates the expressions in the second argument $expression and releases the acquired locks aftertheir completion.
$nodesThe nodes that the shared lock will be placed on their owning documents.
$expressionThe expression to be evaluated before the acquired locks are released.

Returns the results of the evaluation of the expression(s)

util:string-to-binary($encoded-string as xs:string?) xs:base64Binary?
Returns the contents of a string as an base64binary value. The string data is transformed into a binary using the encoding specified in the optional second argument or the default of UTF-8.
$encoded-stringThe string containing the encoded binary resource

Returns the binary resource

util:string-to-binary($encoded-string as xs:string?, $encoding as xs:string) xs:base64Binary?
Returns the contents of a string as a base64binary value. The string data is transformed into a binary using the encoding specified in the optional second argument or the default of UTF-8.
$encoded-stringThe string containing the encoded binary resource
$encodingthe encoding type. i.e. 'UTF-8'

Returns the binary resource

util:system-date() xs:date
Returns the current xs:date (with timezone) as reported by the Java method System.currentTimeMillis(). Contrary to fn:current-date, this function is not stable, i.e. the returned xs:date will change during the evaluation time of a query and can be used to measure time differences.

Returns the current xs:date (with timezone)

util:system-dateTime() xs:dateTime
Returns the current xs:dateTime (with timezone) as reported by the Java method System.currentTimeMillis(). Contrary to fn:current-dateTime, this function is not stable, i.e. the returned xs:dateTime will change during the evaluation time of a query and can be used to measure time differences.

Returns the current xs:dateTime (with timezone)

util:system-property($property-name 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.
$property-nameThe name of the system property to retrieve the value of.

Returns the value of the named system property

util:system-time() xs:time
Returns the current 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.

Returns the current xs:time (with timezone)

util:unescape-uri($escaped-string as xs:string, $encoding as xs:string) xs:string
Returns an un-escaped URL escaped string with the encoding scheme (e.g. "UTF-8"). Decodes encoded sensitive characters from a URL, for example "%2F" becomes "/", i.e. does the oposite to escape-uri()
$escaped-stringThe escaped string to be un-escaped
$encodingThe encoding scheme to use in the un-escaping of the string

Returns the un-escaped string

util:unmap-module($namespace-uri as xs:string) empty()
Remove relation between module namespace and source location. This function is only available to the DBA role.
$namespace-uriThe namespace URI of the module

Returns Returns an empty sequence

util:uuid($name as item()) xs:string
Generate a version 3 universally unique identifier (UUID) string, e.g. 154ad200-9c79-44f3-8cff-9780d91552a6
$nameThe input value for UUID calculation.

Returns a generated UUID string

util:uuid() xs:string
Generate a version 4 (random) universally unique identifier (UUID) string, e.g. 154ad200-9c79-44f3-8cff-9780d91552a6

Returns a generated UUID string

util:wait($interval as xs:integer) empty()
Wait for the specified number of milliseconds
$intervalNumber of milliseconds to wait.

Returns Returns an empty sequence

http://exist-db.org/xquery/validation
A module for XML validation and grammars functions.

validation:clear-grammar-cache() xs:integer
Remove all cached grammers.

Returns the number of deleted grammars.

validation:jaxp($instance as item(), $cache-grammars as xs:boolean) xs:boolean
Validate document by parsing $instance. Optionally grammar caching can be enabled. Supported grammars types are '.xsd' and '.dtd'.
$instanceThe document referenced as xs:anyURI, a node (element or result of fn:doc()) or as a Java file object.
$cache-grammarsSet the flag to true() to enable grammar caching.

Returns true() if the document is valid and no single problem occured, false() for all other conditions. For detailed validation information use the corresponding -report() function.

validation:jaxp($instance as item(), $cache-grammars as xs:boolean, $catalogs as item()*) xs:boolean
Validate document by parsing $instance. Optionally grammar caching can be enabled and an XML catalog can be specified. Supported grammars types are '.xsd' and '.dtd'.
$instanceThe document referenced as xs:anyURI, a node (element or result of fn:doc()) or as a Java file object.
$cache-grammarsSet the flag to true() to enable grammar caching.
$catalogsThe catalogs referenced as xs:anyURI's.

Returns true() if the document is valid and no single problem occured, false() for all other conditions. For detailed validation information use the corresponding -report() function.

validation:jaxp-parse($instance as item(), $enable-grammar-cache as xs:boolean, $catalogs as item()*) node()
Parse document in validating mode, all defaults are filled in according to the grammar (xsd).
$instanceThe document referenced as xs:anyURI, a node (element or result of fn:doc()) or as a Java file object.
$enable-grammar-cacheSet the flag to true() to enable grammar caching.
$catalogsThe catalogs referenced as xs:anyURI's.

Returns the parsed document.

validation:jaxp-report($instance as item(), $enable-grammar-cache as xs:boolean) node()
Validate document by parsing $instance. Optionally grammar caching can be enabled. Supported grammars types are '.xsd' and '.dtd'. An XML report is returned.
$instanceThe document referenced as xs:anyURI, a node (element or result of fn:doc()) or as a Java file object.
$enable-grammar-cacheSet the flag to true() to enable grammar caching.

Returns a validation report.

validation:jaxp-report($instance as item(), $enable-grammar-cache as xs:boolean, $catalogs as item()*) node()
Validate document by parsing $instance. Optionally grammar caching can be enabled and an XML catalog can be specified. Supported grammars types are '.xsd' and '.dtd'. An XML report is returned.
$instanceThe document referenced as xs:anyURI, a node (element or result of fn:doc()) or as a Java file object.
$enable-grammar-cacheSet the flag to true() to enable grammar caching.
$catalogsThe catalogs referenced as xs:anyURI's.

Returns a validation report.

validation:jaxv($instance as item(), $grammars as item()+) xs:boolean
Validate document specified by $instance using the schemas in $grammars. Based on functionality provided by 'javax.xml.validation.Validator'. Only '.xsd' grammars are supported.
$instanceThe document referenced as xs:anyURI, a node (element or returned by fn:doc()) or as a Java file object.
$grammarsOne of more XML Schema documents (.xsd), referenced as xs:anyURI, a node (element or returned by fn:doc()) or as Java file objects.

Returns true() if the document is valid and no single problem occured, false() for all other conditions. For detailed validation information use the corresponding -report() function.

validation:jaxv-report($instance as item(), $grammars as item()+) node()
Validate document specified by $instance using the schemas in $grammars. Based on functionality provided by 'javax.xml.validation.Validator'. Only '.xsd' grammars are supported. An XML report is returned.
$instanceThe document referenced as xs:anyURI, a node (element or returned by fn:doc()) or as a Java file object.
$grammarsOne of more XML Schema documents (.xsd), referenced as xs:anyURI, a node (element or returned by fn:doc()) or as Java file objects.

Returns a validation report.

validation:jing($instance as item(), $grammar as item()) xs:boolean
Validate document using 'Jing'. Supported grammar documents extensions are ".xsd" ".rng" ".rnc" ".sch" and ".nvdl". Based on functionality provided by 'com.thaiopensource.validate.ValidationDriver'.
$instanceThe document referenced as xs:anyURI, a node (element or returned by fn:doc()) or as a Java file object.
$grammarThe grammar document as node (element of returned by fn:doc()), xs:anyURI, returned by util:binary-doc() or as a Java file object.

Returns true() if the document is valid and no single problem occured, false() for all other conditions. For detailed validation information use the corresponding -report() function.

validation:jing-report($instance as item(), $grammar as item()) node()
Validate document using 'Jing'. Supported grammar documents extensions are ".xsd" ".rng" ".rnc" ".sch" and ".nvdl". Based on functionality provided by 'com.thaiopensource.validate.ValidationDriver'. An XML report is returned.
$instanceThe document referenced as xs:anyURI, a node (element or returned by fn:doc()) or as a Java file object.
$grammarThe grammar document as node (element of returned by fn:doc()), xs:anyURI, returned by util:binary-doc() or as a Java file object.

Returns a validation report.

validation:pre-parse-grammar($grammar as xs:anyURI*) xs:string*
Pre parse grammars and add to grammar cache. Only XML schemas (.xsd) are supported.
$grammarReference to grammar.

Returns sequence of namespaces of preparsed grammars.

validation:show-grammar-cache() node()
Show all cached grammars.

Returns an XML document containing details on all cached grammars.

validation:validate($instance as item()) xs:boolean
Validate xml. The grammar files (DTD, XML Schema) are resolved using the global catalog file(s).
$instanceThe document referenced as xs:anyURI or a node (element or returned by fn:doc())

Returns true() if the document is valid and no single problem occured, false() for all other conditions. For detailed validation information use the corresponding -report() function.

Deprecated: Use the validation:jaxp-parse(), validation:jaxv() or validation:jing() functions. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

validation:validate($instance as item(), $grammar as xs:anyURI) node()
Validate document by using a specific grammar.
$instanceThe document referenced as xs:anyURI or a node (element or returned by fn:doc())
$grammarThe reference 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".

Returns true() if the document is valid and no single problem occured, false() for all other conditions. For detailed validation information use the corresponding -report() function.

Deprecated: Use the validation:jaxp-parse(), validation:jaxv() or validation:jing() functions. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

validation:validate-report($instance as item()) node()
Validate xml. The grammar files (DTD, XML Schema) are resolved using the global catalog file(s). An xml report is returned.
$instanceThe document referenced as xs:anyURI or a node (element or returned by fn:doc())

Returns a validation report.

Deprecated: Use the validation:jaxp-parse-report(), validation:jaxv-report() or validation:jing-report() functions. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

validation:validate-report($instance as item(), $grammar as xs:anyURI) node()
Validate document by using a specific grammar. An xml report is returned.
$instanceThe document referenced as xs:anyURI or a node (element or returned by fn:doc())
$grammarThe reference 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".

Returns a validation report.

Deprecated: Use the validation:jaxp-parse-report(), validation:jaxv-report() or validation:jing-report() functions. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

http://exist-db.org/xquery/versioning/svn
A module for interaction with subversion (svn) repositories.

subversion:add($database-path as xs:string) empty()
Puts directories and files under version control scheduling them for addition to a repository.
$database-pathA database URI.

subversion:checkout($repository-uri as xs:string, $database-path as xs:string) xs:long
Checks out a working copy from a repository. Like 'svn checkout URL[@REV] PATH (-r..)' command.
$repository-uriThe subversion repository URI.
$database-pathA database URI.

Returns value of the revision actually checked out from the repository

subversion:checkout($repository-uri as xs:string, $database-path as xs:string, $login as xs:string, $password as xs:string) xs:long
Checks out a working copy from a repository. Like 'svn checkout URL[@REV] PATH (-r..)' command.
$repository-uriThe subversion repository URI.
$database-pathA database URI.
$loginLogin to authenticate on svn server.
$passwordPassord to authenticate on svn server.

Returns value of the revision actually checked out from the repository

subversion:clean-up($database-path as xs:string) empty()
Recursively cleans up the working copy, removing locks and resuming unfinished operations.
$database-pathA database URI.

subversion:commit($database-path as xs:string, $message as xs:string?, $login as xs:string, $password as xs:string) xs:long
Commits files or directories into repository.
$database-pathA database URI.
$messageThe message.
$loginLogin to authenticate on svn server.
$passwordPassord to authenticate on svn server.

Returns the revision number the repository was committed to

subversion:get-latest-revision-number($repository-uri as xs:string, $login as xs:string, $password as xs:string) xs:long
Returns the number of the latest revision of the subversion repository.
$repository-uriThe subversion repository URI.
$loginLogin to authenticate on svn server.
$passwordPassord to authenticate on svn server.

Returns The latest revision number of the repository

subversion:info($database-path as xs:string) element()
Collects information on local path(s). Like 'svn info (-R)' command.
$database-pathA database URI.

subversion:list($repository-uri as xs:string) element()
Reports the directory entry, and possibly children, for url at revision.
$repository-uriThe subversion repository URI.

Returns a sequence containing the list entries

subversion:lock($database-path as xs:string, $message as xs:string?) empty()
Locks a resource to a subversion repository.
$database-pathA database URI.
$messageThe message.

subversion:log($repository-uri as xs:string, $login as xs:string, $password as xs:string, $start-revision as xs:integer?, $end-revision as xs:integer?) element()
Retrieves the log entries from a subversion repository. The return is formatted as follows: <log uri="" start=""> <entry rev="" author="" date=""> <message></message> <paths> <path revtype="M"></path> </paths> </entry> </log> Revtype values are 'A' (item added), 'D' (item deleted), 'M' (item modified), or 'R' (item replaced).
$repository-uriThe subversion repository URI.
$loginLogin to authenticate on svn server.
$passwordPassord to authenticate on svn server.
$start-revisionThe subversion revision to start from. If empty, then start from the beginning.
$end-revisionThe subversion revision to end with. If empty, then end with the HEAD revision

Returns a sequence containing the log entries

subversion:revert($database-path as xs:string) empty()
Restores the pristine version of working copy path, effectively undoing any local mods.
$database-pathA database URI.

subversion:status($database-path as xs:string) element()
Status information on Working Copy items.
$database-pathA database URI.

subversion:unlock($database-path as xs:string) empty()
Unlocks a resource in a subversion repository.
$database-pathA database URI.

subversion:update($database-path as xs:string, $login as xs:string, $password as xs:string) xs:long
Updates a working copy (brings changes from the repository into the working copy). Like 'svn update PATH' command.
$database-pathA database URI.
$loginLogin to authenticate on svn server.
$passwordPassord to authenticate on svn server.

Returns revision to which revision was resolved

http://exist-db.org/xquery/xmldb
A module for database manipulation functions.

xmldb:add-user-to-group($user as xs:string, $group as xs:string) xs:boolean
Add a user to a group. $user is the username. $group is the group nameThe XQuery owner must have appropriate privileges to do this, e.g. having DBA role.
$userThe user name
$groupThe group name

Returns true() or false() indicating the outcome of the operation

xmldb:authenticate($collection-uri as xs:string, $user-id as xs:string?, $password as xs:string?) xs:boolean
Check if the user, $user-id, can authenticate against the database collection $collection-uri. The function simply tries to read the collection $collection-uri, using the credentials $user-id and $password. Collection URIs can be specified either as a simple collection path or an XMLDB URI. It returns true if the authentication succeeds, false otherwise.
$collection-uriThe collection URI
$user-idThe user-id
$passwordThe password

Returns true() on successful authentication, false() otherwise

xmldb:change-user($user-id as xs:string, $password as xs:string?, $groups as xs:string*, $home-collection as xs:string?) empty()
Change properties of an existing database user. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role. $user-id is the username, $password is the password, $groups is the sequence of group memberships, $home-collection is the home collection. The username, $user-id, is mandatory. Non-empty values for the other parameters are optional, where if empty the existing value is used.
$user-idThe user-id
$passwordThe password
$groupsThe groups the user is member of
$home-collectionThe user's home collection

xmldb:chmod-collection($collection as xs:string, $mode as xs:integer) empty()
Sets the mode of collection $collection. $mode is the mode as xs:integer. PLEASE REMEMBER that octal number 0755 is 7*64+5*8+5 i.e. 493 in decimal NOT 755. You can use util:base-to-integer(0755, 8) as argument for convenience.
$collectionThe collection path
$modeThe mode as xs:integer

xmldb:chmod-resource($collection as xs:string, $resource as xs:string, $mode as xs:integer) empty()
Sets the mode of the resource $resource in collection $collection, $mode is the mode as xs:integer. PLEASE REMEMBER that octal number 0755 is 7*64+5*8+5 i.e. 493 in decimal NOT 755. You can use util:base-to-integer(0755, 8) as argument for convenience.
$collectionThe collection
$resourceThe resource
$modeThe mode as xs:integer

xmldb:collection-available($collection-uri as xs:string) xs:boolean
Returns true() if the collection $collection-uri exists and is available, otherwise false(). Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI

Returns true() if the collection exists and is available, false() otherwise

xmldb:copy($source-collection-uri as xs:string, $target-collection-uri as xs:string) empty()
Copy the collection $source-collection-uri to the collection $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$source-collection-uriThe source collection URI
$target-collection-uriThe target collection URI

xmldb:copy($source-collection-uri as xs:string, $target-collection-uri as xs:string, $resource as xs:string) empty()
Copy the resource $resource in $source-collection-uri to collection $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$source-collection-uriThe source collection URI
$target-collection-urithe target collection URI
$resourcethe resource to copy

xmldb:create-collection($target-collection-uri as xs:string, $new-collection as xs:string) xs:string?
Create a new collection with name $new-collection as a child of $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.Returns the path to the new collection if successfully created, otherwise the empty sequence.
$target-collection-uriThe target collection URI
$new-collectionThe name of the new collection to create

Returns the path to the new collection if successfully created, otherwise the empty sequence

xmldb:create-group($group as xs:string) xs:boolean
Create a new user group. $group is the group name. The current user will be the groups manager.
$groupThe group name

Returns true() or false() indicating the outcome of the operation

Deprecated: Use xmldb:create-group($group, $group-manager-username) instead. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

xmldb:create-group($group as xs:string, $group-manager-username as xs:string+) xs:boolean
Create a new user group, with an initial member. $group is the group name, $group-manager-username are the groups managers in addition to the current user.
$groupThe group name
$group-manager-usernameThe name of the user(s) who will be the groups manager

Returns true() or false() indicating the outcome of the operation

xmldb:create-user($user-id as xs:string, $password as xs:string, $groups as xs:string+, $home-collection-uri as xs:string?) empty()
Create a new user, $user-id, in the database. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role. $user-id is the username, $password is the password, $groups is the sequence of group memberships. The first group in the sequence is the primary group.$home-collection-uri is the home collection URI.Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$user-idThe user-id
$passwordThe password
$groupsThe group memberships
$home-collection-uriThe home collection URI

xmldb:created($collection-uri as xs:string) xs:dateTime
Returns the creation date of the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI

Returns the creation date

xmldb:created($collection-uri as xs:string, $resource as xs:string) xs:dateTime
Returns the creation date of the resource $resource in $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI
$resourceThe resource

Returns the creation date

xmldb:decode($string as xs:string) xs:string
Decodes the string $string such that any percent encoded octets will be translated to their decoded UTF-8 representation.
$stringThe input string

Returns the decoded string

xmldb:decode-uri($uri as xs:anyURI) xs:string
Decodes the URI $uri such that any percent encoded octets will be translated to their decoded UTF-8 representation.
$uriThe URI

Returns the decoded $uri as xs:string

xmldb:defragment($nodes as node()+) empty()
Start a defragmentation run on each document which has a node in $nodes. Fragmentation may occur if nodes are inserted into a document using XQuery update extensions. Please note that defragmenting a document changes its internal structure, so any references to this document will become invalid, in particular, variables pointing to some nodes in the document.
$nodesThe sequence of nodes from the documents to defragment

xmldb:defragment($nodes as node()+, $integer as xs:integer) empty()
Start a defragmentation run on each document which has a node in $nodes. Fragmentation may occur if nodes are inserted into a document using XQuery update extensions. The second argument specifies the minimum number of fragmented pages which should be in a document before it is considered for defragmentation. Please note that defragmenting a document changes its internal structure, so any references to this document will become invalid, in particular, variables pointing to some nodes in the document.
$nodesThe sequence of nodes from the documents to defragment
$integerThe minimum number of fragmented pages required before defragmenting

xmldb:delete-user($user-id as xs:string) empty()
Deletes an existing user, $user-id, in the database. This does not delete the user's home collection. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role, and not being the owner of the currently running XQuery. You cannot delete the owner of the currently running XQuery.
$user-idThe user-id to delete

xmldb:document($document-uris as xs:string+, ...) node()*
Returns the documents $document-uris in the input sequence. Collection URIs can be specified either as a simple collection path or an XMLDB URI.If the input sequence is empty, the function will load all documents in the database.
$document-urisThe document URIs

Returns the documents

Deprecated: See the standard fn:doc() function This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

xmldb:document-has-lock($collection-uri as xs:string, $resource as xs:string) xs:string?
Returns the user-id of the user that holds a write lock on the resource $resource in the collection $collection-uri. If no lock is in place, the empty sequence is returned. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI
$resourceThe resource

Returns the user id of the lock owner, otherwise if not locked the empty sequence

xmldb:encode($string as xs:string) xs:string
Encodes the string $string such that it will be a valid collection or resource path. Provides similar functionality to java's URLEncoder.encode() function, with some enhancements.
$stringThe input string

Returns the URL encoded string

xmldb:encode-uri($string as xs:string) xs:anyURI
Encodes the string $string 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
$stringThe input string

Returns the XmldbURI encoded from $string

xmldb:exists-user($user-id as xs:string) xs:boolean
Returns true if the user $user-id exists.
$user-idThe user-id

Returns true() if the user exists, false() otherwise

xmldb:find-last-modified-since($node-set as node()*, $since as xs:dateTime) node()?
Filters the given node set to only include nodes from resources which were modified since the specified date time.
$node-setA node set
$sinceDate

Returns the mime-type if available, otherwise the empty sequence

xmldb:get-child-collections($collection-uri as xs:string) xs:string*
Returns the names of the child collections in the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI

Returns the sequence of child collection names

xmldb:get-child-resources($collection-uri as item()) xs:string*
Returns the names of the child resources in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI

Returns the sequence of resource names

xmldb:get-current-user() xs:string
Returns the user-id of the current user from the xquery context.

Returns the user-id of the current user

xmldb:get-current-user-attribute($name as xs:string) xs:string?
Returns the user-id of the current user from the xquery context.
$nameThe name of the user attribute

Returns the attribute value of the current user

Deprecated: Use securitymanager:get-account-metadata() instead! This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

xmldb:get-current-user-attribute-names() xs:string*
Returns the names of the attributes of the current user from the xquery context.

Returns the attribute names of the current user

Deprecated: Use securitymanager:get-account-metadata-keys() instead! This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

xmldb:get-group($collection-uri as xs:string) xs:string?
Returns the owner group of the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI

Returns the owner group

xmldb:get-group($collection-uri as xs:string, $resource as xs:string) xs:string?
Returns the owner group of the resource $resource in the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI
$resourceThe resource

Returns the owner group

xmldb:get-mime-type($resource-uri as xs:anyURI) xs:string?
Returns the MIME type if available of the resource $resource-uri, otherwise the empty sequence. Resource URIs can be specified either as a simple collection path, an XMLDB URI or any URI.
$resource-uriThe resource URI

Returns the mime-type if available, otherwise the empty sequence

xmldb:get-owner($collection-uri as item()) xs:string?
Returns the owner user-id of the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI

Returns the user-id

xmldb:get-owner($collection-uri as item(), $resource as xs:string) xs:string?
Returns the owner user-id of the resource $resource in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI
$resourceThe resource

Returns the user-id

xmldb:get-permissions($collection-uri as xs:string) xs:int?
Returns the permissions assigned to the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection-uri

Returns the collection permissions

xmldb:get-permissions($collection-uri as xs:string, $resource as xs:string) xs:int?
Returns the permissions assigned to the resource $resource in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection-uri
$resourceThe resource

Returns the resource permissions

xmldb:get-user-groups($user-id as xs:string) xs:string+
Returns the sequence of groups the user $user-id is a member of.
$user-idThe user-id

Returns the group memberships

xmldb:get-user-home($user-id as xs:string) xs:anyURI?
Returns the user's home collection URI or the empty sequence if no home collection is assigned to the user $user-id.
$user-idThe user-id

Returns the home collection URI of user $user-id if one is assigned, otherwise the empty sequence

xmldb:get-user-primary-group($user-id as xs:string) xs:string
Returns the user's primary group.
$user-idThe user-id

Returns The Primary Group of the User

xmldb:get-users($group-name as xs:string) xs:string*
Returns the list of users in the group
$group-nameThe group-name

Returns The list of users in the group identified by $group-name

xmldb:group-exists($group as xs:string) xs:boolean
Determines whether a group exists. $group is the group name, The current user must have permission to access the group, i.e. be a member of the group or DBA
$groupThe group name

Returns true() or false() indicating the outcome of the operation

xmldb:is-admin-user($user-id as xs:string) xs:boolean?
Returns true() if user $user-id has DBA role, false() otherwise.
$user-idThe user-id

Returns true() if user has DBA role, false() otherwise

xmldb:is-authenticated() xs:boolean
Returns the true() if current user from the xquery context is authenticated, false() otherwise.

Returns true() if user from the xquery context is authenticated, false() otherwise

Deprecated: Use sm.is-externally-authenticated() function. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

xmldb:last-modified($collection-uri as item(), $resource as xs:string) xs:dateTime?
Returns the last-modification date of resource $resource in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI
$resourceThe resource

Returns the last modification date

xmldb:login($collection-uri as xs:string, $user-id as xs:string?, $password as xs:string?) xs:boolean
Login the user, $user-id, and set it as the owner of the currently executing XQuery. Collection URIs can be specified either as a simple collection path or an XMLDB URI. It returns true if the authentication succeeds, false otherwise. If called from a HTTP context the login is cached for the lifetime of the HTTP session and may be used for any XQuery run in that session. If an HTTP session does not already exist, none will be created.
$collection-uriThe collection URI
$user-idThe user-id
$passwordThe password

Returns true() on successful authentication and owner elevation, false() otherwise

xmldb:login($collection-uri as xs:string, $user-id as xs:string?, $password as xs:string?, $create-session as xs:boolean?) xs:boolean
Login the user, $user-id, and set it as the owner of the currently executing XQuery. Collection URIs can be specified either as a simple collection path or an XMLDB URI. It returns true() if the authentication succeeds, false() otherwise. If called from a HTTP context the login is cached for the lifetime of the HTTP session and may be used for any XQueryrun in that session. $create-session specifies whether to create an HTTP session on successful authentication or not. If $create-session is false() or the empty sequence no session will be created if one does not already exist.
$collection-uriThe collection URI
$user-idThe user-id
$passwordThe password
$create-sessionwhether to create the session or not on successful authentication, default false()

Returns true() on successful authentication and owner elevation, false() otherwise

xmldb:match-collection($regexp as xs:string) xs:string*
Looks for collection names in the collection index that match the provided regexp
$regexpThe expression to use for matching collection names

Returns The names of the collections that match the expression

xmldb:move($source-collection-uri as xs:string, $target-collection-uri as xs:string) empty()
Moves the collection $source-collection-uri into the collection $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$source-collection-uriThe source collection URI
$target-collection-uriThe target collection URI

xmldb:move($source-collection-uri as xs:string, $target-collection-uri as xs:string, $resource as xs:string) empty()
Moves the resource $resource from the collection $source-collection-uri into collection $target-collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$source-collection-uriThe source collection URI
$target-collection-uriThe target collection URI
$resourceThe resource

xmldb:permissions-to-string($permissions as xs:integer) xs:string?
Formats the resource or collection permissions, $permissions, passed as an integer value into a string. The returned string shows the permissions following the Unix conventions, i.e. all permissions set is returned as rwurwurwu, where the first three chars are for user permissions, followed by group and other users. 'r' denotes read, 'w' write and 'u' update permissions.
$permissionsThe permissions in xs:integer format

Returns the permissions as string 'rwu' for, user, group and other

xmldb:register-database($driver as xs:string, $create-db as xs:boolean) xs:boolean
Registers 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.
$driverThe DB driver
$create-dbThe flag to create the db if it does not exist

Returns true() if successfully registered, false() otherwise

xmldb:reindex($collection-uri as xs:string) xs:boolean
Reindex collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI. The XQuery owner must have appropriate privileges to do this, e.g. having DBA role.
$collection-uriThe collection URI

Returns true() if successfully reindexed, false() otherwise

xmldb:remove($collection-uri as xs:string) empty()
Removes the collection $collection-uri and its contents from the database. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI

xmldb:remove($collection-uri as xs:string, $resource as xs:string) empty()
Removes the resource $resource from the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI
$resourceThe resource

xmldb:remove-user-from-group($user as xs:string, $group as xs:string) xs:boolean
Remove a user from a group. $user is the username. $group is the group nameThe XQuery owner must have appropriate privileges to do this, e.g. having DBA role.
$userThe user name
$groupThe group name

Returns true() or false() indicating the outcome of the operation

xmldb:rename($collection-uri as xs:string, $resource as xs:string, $new-resource-name as xs:string) empty()
Renames the resource $resource in collection $collection-uri with new name $new-resource-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI
$resourceThe resource
$new-resource-nameThe new resource name

xmldb:rename($source-collection-uri as xs:string, $new-collection-name as xs:string) empty()
Renames the collection $source-collection-uri with new name $new-collection-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$source-collection-uriThe source collection URI
$new-collection-nameThe new collection name

xmldb:set-collection-permissions($collection-uri as xs:string, $user-id as xs:string, $group-id as xs:string, $permissions as xs:integer) empty()
Sets the permissions of the collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI. $user-id specifies the user which will become the owner of the resource, $group-id the group, and $permissons the permissions as an xs:integer value. PLEASE REMEMBER that octal number 0755 is 7*64+5*8+5 i.e. 493 in decimal NOT 755. You can use util:base-to-integer(0755, 8) as argument for convenience.
$collection-uriThe collection URI
$user-idThe user-id
$group-idThe group-id
$permissionsThe permissions

xmldb:set-resource-permissions($collection-uri as xs:string, $resource as xs:string, $user-id as xs:string, $group-id as xs:string, $permissions as xs:integer) empty()
Sets the permissions of the resource $resource in collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI. $user-id specifies the user which will become the owner of the resource, $group-id the group, and $permissions the permissions as an xs:integer value. PLEASE REMEMBER that octal number 0755 is 7*64+5*8+5 i.e. 493 in decimal NOT 755. You can use util:base-to-integer(0755, 8) as argument for convenience.
$collection-uriThe collection URI
$resourceThe resource
$user-idThe user-id
$group-idThe group-id
$permissionsThe permissions

xmldb:size($collection-uri as xs:string, $resource as xs:string) xs:long
Returns the estimated size of the resource $resource (in bytes) in the collection $collection-uri. The estimation is based on the number of pages occupied by the resource. If the document is serialized back to a string, its size may be different, since parts of the structural information are stored in compressed form. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-uriThe collection URI
$resourceThe resource

Returns the size of the pages, occupied by the resource, in bytes

xmldb:store($collection-uri as xs:string, $resource-name as xs:string?, $contents as item()) xs:string?
Stores a new resource into the database. The resource is stored in the collection $collection-uri with the name $resource-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI. The contents $contents, 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 $contents is of type xs:anyURI, the resource is loaded from that URI. Returns the path to the new document if successfully stored, otherwise an XPathException is thrown.
$collection-uriThe collection URI
$resource-nameThe resource name
$contentsThe contents

Returns the path to new resource if sucessfully stored, otherwise the emtpty sequence

xmldb:store($collection-uri as xs:string, $resource-name as xs:string?, $contents as item(), $mime-type as xs:string) xs:string?
Stores a new resource into the database. The resource is stored in the collection $collection-uri with the name $resource-name. Collection URIs can be specified either as a simple collection path or an XMLDB URI. The contents $contents, 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 $contents is of type xs:anyURI, the resource is loaded from that URI. The final argument $mime-type is used to specify a mime type. If the mime-type is not a xml based type, the resource will be stored as a binary resource.Returns the path to the new document if successfully stored, otherwise an XPathException is thrown.
$collection-uriThe collection URI
$resource-nameThe resource name
$contentsThe contents
$mime-typeThe mime type

Returns the path to new resource if sucessfully stored, otherwise the emtpty sequence

xmldb:store-files-from-pattern($collection-uri as xs:string, $directory as xs:string, $pattern as xs:string+) xs:string*
Stores new resources into the database. Resources are read from the server's file system, using file patterns. 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(s).
$collection-uriThe collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$directoryThe directory in the file system from where the files are read.
$patternThe file matching pattern. 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

Returns the sequence of document paths

xmldb:store-files-from-pattern($collection-uri as xs:string, $directory as xs:string, $pattern as xs:string+, $mime-type as xs:string?) xs:string*
Stores new resources into the database. Resources are read from the server's file system, using file patterns. 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(s).
$collection-uriThe collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$directoryThe directory in the file system from where the files are read.
$patternThe file matching pattern. 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
$mime-typeIf the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource.

Returns the sequence of document paths

xmldb:store-files-from-pattern($collection-uri as xs:string, $directory as xs:string, $pattern as xs:string+, $mime-type as xs:string?, $preserve-structure as xs:boolean) xs:string*
Stores new resources into the database. Resources are read from the server's file system, using file patterns. 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(s).
$collection-uriThe collection-uri where resources should be stored. Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$directoryThe directory in the file system from where the files are read.
$patternThe file matching pattern. 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
$mime-typeIf the mime-type is something other than 'text/xml' or 'application/xml', the resource will be stored as a binary resource.
$preserve-structureIf preserve-structure is true(), the filesystem directory structure will be mirrored 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.

Returns the sequence of document paths

xmldb:string-to-permissions($permissions-string as xs:string) xs:integer
Converts the resource or collection permissions, $permissions-string, into an integer representation suitable for use with set-permissions functions. The permissions string should be in the format 'rwurwurwu' where r is read, w is write and u is update.
$permissions-stringThe permissions string

Returns The permissions integer

xmldb:update($collection-uri as xs:string, $modifications as node()) xs:integer
Processes an XUpdate request, $modifications, against a collection $collection-uri. Collection URIs can be specified either as a simple collection path or an XMLDB URI.The modifications are passed in a document conforming to the XUpdate specification. http://rx4rdf.liminalzone.org/xupdate-wd.html#N1a32e0The function returns the number of modifications caused by the XUpdate.
$collection-uriThe collection URI
$modificationsThe XUpdate modifications to be processed

Returns the number of modifications, as xs:integer, caused by the XUpdate

xmldb:xcollection($collection-uris as xs:string+) node()*
Returns the document nodes in the collections $collection-uris non-recursively, i.e. does not include document nodes found in sub-collections. C.f. fn:collection(). Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-urisThe collection URIs

Returns the document nodes from the specified collections excluding sub-collections

http://exist-db.org/xquery/xmldiff
A module for determining differences in XML documents.

xmldiff:compare($node-set-1 as node()*, $node-set-2 as node()*) xs:boolean?
Returns true() if the two node sets $node-set-1 and $node-set-2 are equal, otherwise false()
$node-set-1the first node set
$node-set-2the second node set

Returns true() if the two node sets $node-set-1 and $node-set-2 are equal, otherwise false()

http://exist-db.org/xquery/xqdoc
XQDoc integration module.

xqdm:scan($data as xs:base64Binary, $name as xs:string) node()*
Scan and extract function documentation from an external XQuery function module according to the XQDoc specification. The two parameter version of the function expects to get the source code of the module in the first argument and a name for the module in the second.
$dataThe base64 encoded source data of the module
$nameThe name of the module

Returns the function docs.

xqdm:scan($uri as xs:anyURI) node()*
Scan and extract function documentation from an external XQuery function module according to theXQDoc specification. The single argument URI may either point to an XQuery module stored in the db (URI starts with xmldb:exist:...) or a module in the file system. A file system module is searched in the same way as if it were loaded through an "import module" statement. Static mappings defined in conf.xml are searched first.
$uriThe URI from which to load the function module

Returns the function docs.

http://exist-db.org/xquery/xslfo
A module for performing XSL-FO transformations

xslfo:render($document as node(), $mime-type as xs:string, $parameters as node()?) xs:base64Binary?
Renders a given FO document. Returns an xs:base64binary of the result. Parameters are specified with the structure: <parameters><param name="param-name1" value="param-value1"/></parameters>. Recognised rendering parameters are: author, title, keywords and dpi.
$documentFO document
$parametersparameters for the transform

Returns result

xslfo:render($document as node(), $mime-type as xs:string, $parameters as node()?, $config-file as node()?) xs:base64Binary?
Renders a given FO document. Returns an xs:base64binary of the result. Parameters are specified with the structure: <parameters><param name="param-name1" value="param-value1"/></parameters>. Recognised rendering parameters are: author, title, keywords and dpi.
$documentFO document
$parametersparameters for the transform
$config-fileFOP Processor Configuration file

Returns result

http://expath.org/ns/http-client
EXPath HTTP Client http://expath.org/spec/http-client

http:send-request($request as element()?) item()+
Sends a HTTP request to a server and returns the response.
$requestrequest contains the various parameters of the request, for instance the HTTP method to use or the HTTP headers. Among other things, it can also contain the other param's values: the URI and the bodies. If they are not set as parameter to the function, their value in $request, if any, is used instead. See the following section (http://www.expath.org/spec/http-client#d2e183) for the detailed definition of the http:request element. If the parameter does not follow the grammar defined in this spec, this is an error [err:HC005].

Returns A sequence representing the response from the server. This sequence has an http:response element as first item, which is followed by an additional item for each body or body part in the response. Further detail can be found here - http://www.expath.org/spec/http-client#d2e483

http:send-request($request as element()?, $href as xs:string?) item()+
Sends a HTTP request to a server and returns the response.
$requestrequest contains the various parameters of the request, for instance the HTTP method to use or the HTTP headers. Among other things, it can also contain the other param's values: the URI and the bodies. If they are not set as parameter to the function, their value in $request, if any, is used instead. See the following section (http://www.expath.org/spec/http-client#d2e183) for the detailed definition of the http:request element. If the parameter does not follow the grammar defined in this spec, this is an error [err:HC005].
$href$href is the HTTP or HTTPS URI to send the request to. It is an xs:anyURI, but is declared as a string to be able to pass literal strings (without requiring to explicitly cast it to an xs:anyURI)

Returns A sequence representing the response from the server. This sequence has an http:response element as first item, which is followed by an additional item for each body or body part in the response. Further detail can be found here - http://www.expath.org/spec/http-client#d2e483

http:send-request($request as element()?, $href as xs:string?, $bodies as item()*) item()+
Sends a HTTP request to a server and returns the response.
$requestrequest contains the various parameters of the request, for instance the HTTP method to use or the HTTP headers. Among other things, it can also contain the other param's values: the URI and the bodies. If they are not set as parameter to the function, their value in $request, if any, is used instead. See the following section (http://www.expath.org/spec/http-client#d2e183) for the detailed definition of the http:request element. If the parameter does not follow the grammar defined in this spec, this is an error [err:HC005].
$href$href is the HTTP or HTTPS URI to send the request to. It is an xs:anyURI, but is declared as a string to be able to pass literal strings (without requiring to explicitly cast it to an xs:anyURI)
$bodies$bodies is the request body content, for HTTP methods that can contain a body in the request (e.g. POST). This is an error if this param is not the empty sequence for methods that must be empty (e.g. DELETE). The details of the methods are defined in their respective specs (e.g. [RFC 2616] or [RFC 4918]). In case of a multipart request, it can be a sequence of several items, each one is the body of the corresponding body descriptor in $request.

Returns A sequence representing the response from the server. This sequence has an http:response element as first item, which is followed by an additional item for each body or body part in the response. Further detail can be found here - http://www.expath.org/spec/http-client#d2e483

http://expath.org/ns/zip
EXPath HTTP Client http://expath.org/spec/http-client

zip:binary-entry($href as xs:anyURI, $entry as xs:string) xs:base64Binary
Extracts the binary stream from the file positioned at $entry within the ZIP file identified by $href and returns it as a Base64 item.
$hrefThe URI for locating the Zip file
$entryThe entry within the Zip file to address

Returns The binary representation of the entry from the Zip file.

zip:html-entry($href as xs:anyURI, $entry as xs:string) document-node()
Extracts the html file positioned at $entry within the ZIP file identified by $href, and returns a document node. Because an HTML document is not necessarily a well-formed XML document, an implementation may use a specific parser in order to produce an XDM document node, like [TagSoup] or [HTML Tidy]; the details of this process are implementation-defined.
$hrefThe URI for locating the Zip file
$entryThe entry within the Zip file to address

Returns The document-node of the entry from the Zip file.

zip:text-entry($href as xs:anyURI, $entry as xs:string) xs:string
Extracts the contents of the text file positioned at entry within the ZIP file identified by $href and returns it as a string.
$hrefThe URI for locating the Zip file
$entryThe entry within the Zip file to address

Returns The string value of the entry from the Zip file.

zip:xml-entry($href as xs:anyURI, $entry as xs:string) document-node()
Extracts the content from the XML file positioned at $entry within the ZIP file identified by $href and returns it as a document-node.
$hrefThe URI for locating the Zip file
$entryThe entry within the Zip file to address

Returns The document-node of the entry from the Zip file.

http://www.json.org
Transform XML fragments into JSON. The target of this module is to create a straight-forward Javasript representation of data-centric XML. It does not try to handle mixed content nodes (with a mix of elements and text).

Special rules

The root element will be absorbed, i.e. <root>text</root> becomes "text".

Child elements with the same name are added to an array.

If an element has attribute and text content, the text content becomes a property, e.g. '#text': 'my text'.

In mixed content nodes, text nodes will be dropped.

An empty element becomes 'null', i.e. <e/> becomes {"e": null}.

An element with a single text child becomes a property with the value of the text child, i.e. <e>text</e> becomes {"e": "text"}

If the attribute json:literal="true" is present on an element, then its text value is considered literal and not quoted as a string. Useful for boolean and numberic values!


json:element-helper($attribs as attribute()*, $children as node()*)
Helper function: output element content for elements with more than one child node or attribute. Special cases:

json:contents-to-json($node as node())
Helper function: output the contents of a node or attribute. Special cases:

json:node-to-json($node as node()+)
Helper function: convert a node into JSON.

json:xml-to-json($node as node())
Main entry point of the module. Convert a single node into JSON. The root element will be absorbed.

http://www.jsonp.org

jsonp:element-helper($attribs as attribute()*, $children as node()*)
Helper function: output element content for elements with more than one child node or attribute. Special cases:

jsonp:contents-to-jsonp($node as node())
Helper function: output the contents of a node or attribute. Special cases:

jsonp:node-to-jsonp($node as node()+)
Helper function: convert a node into JSON.

jsonp:node-to-jsonp-entry($node as node()+)

jsonp:xml-to-jsonp($node as node()+, $call-back as xs:string?)
Main entry point of the module. Convert node into JSONP.

http://www.w3.org/1999/XSL/Transform
XSLT Module

xsl:current() item()
The function, used within an XPath expression, returns the item that was the context item at the point where the expression was invoked from the XSLT stylesheet.

xsl:document($a as node()*) node()*
The function allows access to XML documents identified by a URI.

xsl:document($a as node()*, $b as node()) node()*
The function allows access to XML documents identified by a URI.

xsl:format-date($date as xs:date?, $picture as xs:string) xs:string?
The functions formats a date as a string using the picture string.
$dateThe date value
$pictureThe picture string

Returns The formatted string

xsl:format-date($date as xs:date?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $country as xs:string?) xs:string?
The functions formats a date as a string using the picture string.
$dateThe date value
$pictureThe picture string
$languageThe language parameter
$calendarThe calendar parameter
$countryThe country parameter

Returns The formatted string

xsl:format-dateTime($date-TIME as xs:dateTime?, $picture as xs:string) xs:string?
The functions formats a dateTime as a string using the picture string.
$date-TIMEThe date-time value
$pictureThe picture string

Returns The formatted string

xsl:format-dateTime($date-TIME as xs:dateTime?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $country as xs:string?) xs:string?
The functions formats a dateTime as a string using the picture string.
$date-TIMEThe date-time value
$pictureThe picture string
$languageThe language parameter
$calendarThe calendar parameter
$countryThe country parameter

Returns The formatted string

xsl:format-number($number as numeric?, $format as xs:string) xs:string
The format-number function converts its first argument to a string using the format pattern string specified by the second argument and the decimal-format named by the third argument, or the default decimal-format, if there is no third argument. The format pattern string is in the syntax specified by the JDK 1.1 DecimalFormat class. The format pattern string is in a localized notation: the decimal-format determines what characters have a special meaning in the pattern (with the exception of the quote character, which is not localized). The format pattern must not contain the currency sign (#x00A4); support for this feature was added after the initial release of JDK 1.1. The decimal-format name must be a QName, which is expanded as described in [2.4 Qualified Names]. It is an error if the stylesheet does not contain a declaration of the decimal-format with the specified expanded-name.
$numberThe number to format
$formatThe format pattern string. Please see the JavaDoc for java.text.DecimalFormat to get the specifics of this format string.

Returns the formatted string

xsl:format-number($number as numeric?, $format as xs:string, $decimalformat as xs:string) xs:string
The format-number function converts its first argument to a string using the format pattern string specified by the second argument and the decimal-format named by the third argument, or the default decimal-format, if there is no third argument. The format pattern string is in the syntax specified by the JDK 1.1 DecimalFormat class. The format pattern string is in a localized notation: the decimal-format determines what characters have a special meaning in the pattern (with the exception of the quote character, which is not localized). The format pattern must not contain the currency sign (#x00A4); support for this feature was added after the initial release of JDK 1.1. The decimal-format name must be a QName, which is expanded as described in [2.4 Qualified Names]. It is an error if the stylesheet does not contain a declaration of the decimal-format with the specified expanded-name. NOTE: The decimalformat parameter is currently not implemented and is ignored.
$numberThe number to format
$formatThe format pattern string. Please see the JavaDoc for java.text.DecimalFormat to get the specifics of this format string.
$decimalformatThe decimal-format name must be a QName, which is expanded as described in [2.4 Qualified Names]. It is an error if the stylesheet does not contain a declaration of the decimal-format with the specified expanded-name.

Returns the formatted string

xsl:format-time($time as xs:time?, $picture as xs:string) xs:string?
The functions formats a time as a string using the picture string.
$timeThe time value
$pictureThe picture string

Returns The formatted string

xsl:format-time($time as xs:time?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $country as xs:string?) xs:string?
The functions formats a time as a string using the picture string.
$timeThe time value
$pictureThe picture string
$languageThe language parameter
$calendarThe calendar parameter
$countryThe country parameter

Returns The formatted string

xsl:generate-id($a as node()?) item()
The function returns a string that uniquely identifies a given node.

xsl:generate-id() item()
The function returns a string that uniquely identifies a given node.

xsl:generate-id() item()
The function returns a string that uniquely identifies a given node.

xsl:key($a as xs:string, $b as xs:anyAtomicType*) node()*
The function does for keys what the id FO function does for IDs

xsl:key($a as xs:string, $b as xs:anyAtomicType*, $c as node()) node()?
The function does for keys what the id FO function does for IDs

xsl:system-property($a as xs:string) xs:string
The function returns a string representing the value of the system property identified by the name.

xsl:unparsed-entity-public-id($a as xs:string) xs:string
The function returns the public identifier of the unparsed entity whose name is given by the value of the $entity-name argument, in the document containing the context node.

xsl:unparsed-entity-uri($a as xs:string) xs:anyURI
The function returns the URI of the unparsed entity whose name is given by the value of the $entity-name argument, in the document containing the context node.

xsl:unparsed-text($a as xs:string?) xs:string?
The function reads an external resource (for example, a file) and returns its contents as a string.

xsl:unparsed-text($a as xs:string?, $b as xs:string) xs:string?
The function reads an external resource (for example, a file) and returns its contents as a string.

xsl:unparsed-text-available($a as xs:string?) xs:boolean
The function determines whether a call on the unparsed-text function with identical arguments would return a string.

xsl:unparsed-text-available($a as xs:string?, $b as xs:string?) xs:boolean
The function determines whether a call on the unparsed-text function with identical arguments would return a string.

http://www.w3.org/2005/xpath-functions
A module with the XQuery/XPath Core Library Functions

abs($number as numeric?) numeric
Returns the absolute value of the argument $number. If the argument is negative returns -$number otherwise returns $number.
$numberThe number

Returns the absolute value of the argument

adjust-date-to-timezone($date as xs:date?) xs:date?
Adjusts the xs:date value $date to the implicit timezone of the current locale.
$dateThe date

Returns the adjusted date

adjust-date-to-timezone($date as xs:date?, $duration as xs:dayTimeDuration?) xs:date?
Adjusts the xs:date value $date to a specific timezone, or to no timezone at all. If $duration is the empty sequence, returns an xs:date without a timezone.
$dateThe date
$durationThe duration

Returns the adjusted date

adjust-dateTime-to-timezone($date-time as xs:dateTime?) xs:dateTime?
Adjusts the xs:dateTime value $date-time to the implicit timezone of the current locale.
$date-timeThe date-time

Returns the adjusted date-time

adjust-dateTime-to-timezone($date-time as xs:dateTime?, $duration as xs:dayTimeDuration?) xs:dateTime?
Adjusts the xs:dateTime value $date-time to a specific timezone, or to no timezone at all. If $duration is the empty sequence, returns an xs:dateTime without a timezone.
$date-timeThe date-time
$durationThe duration

Returns the adjusted date-time

adjust-time-to-timezone($time as xs:time?) xs:time?
Adjusts the xs:time value $time to the implicit timezone of the current locale.
$timeThe time

Returns the adjusted time

adjust-time-to-timezone($time as xs:time?, $duration as xs:dayTimeDuration?) xs:time?
Adjusts the xs:time value $time to a specific timezone, or to no timezone at all. If $duration is the empty sequence, returns an xs:time without a timezone.
$timeThe time
$durationThe duration

Returns the adjusted time

analyze-string($input as xs:string?, $pattern as xs:string) element()
Analyzes a string using a regular expression, returning an XML structure that identifies which parts of the input string matched or failed to match the regular expression, and in the case of matched substrings, which substrings matched each capturing group in the regular expression.
$inputThe input string
$patternThe pattern

Returns The result of the analyisis

analyze-string($input as xs:string?, $pattern as xs:string, $flags as xs:string) element()
Analyzes a string using a regular expression, returning an XML structure that identifies which parts of the input string matched or failed to match the regular expression, and in the case of matched substrings, which substrings matched each capturing group in the regular expression.
$inputThe input string
$patternThe pattern
$flagsFlags

Returns The result of the analyisis

avg($values as xs:anyAtomicType*) xs:anyAtomicType?
Returns the average of the values in the input sequence $values, that is, the sum of the values divided by the number of values.
$valuesThe values

Returns the average of the values in the input sequence

base-uri($uri as node()?) xs:anyURI?
Returns the value of the base URI property for $uri. If $uri is the empty sequence, the empty sequence is returned.
$uriThe URI

Returns the base URI from $uri

base-uri() xs:anyURI?
Returns the value of the base URI property for the context item.

Returns the base URI from the context item

boolean($items as item()*) xs:boolean
Computes the xs:boolean value of the sequence $items.
$itemsThe items

Returns the boolean value, ebv, of the items

ceiling($number 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, $number.
$numberThe number

Returns the non-fractional number not less than $number

codepoint-equal($string-1 as xs:string?, $string-2 as xs:string?) xs:boolean?
Returns true or false depending on whether the value of $string-1 is equal to the value of $string-2, according to the Unicode code point collation.
$string-1The first string
$string-2The second string

Returns true() if the codepoints are equal, false() otherwise

codepoints-to-string($codepoints as xs:integer*) xs:string
Creates an xs:string from a sequence of code points. Returns the zero-length string if $codepoints is the empty sequence. If any of the code points in $codepoints is not a legal XML character, an error is raised
$codepointsThe codepoints as a sequence of xs:integer values

Returns the string constructed from the codepoints if valid

collection($collection-uris as xs:string*, ...) node()*
Returns the documents contained in the collections specified in the input sequence. Collection URIs can be specified either as a simple collection path or an XMLDB URI. Documents contained in subcollections are also included.
$collection-urisThe collection-uris for which to include the documents

Returns the document nodes contained in or under the given collections

compare($string-1 as xs:string?, $string-2 as xs:string?) xs:integer?
Returns the collatable comparison between $string-1 and $string-2, -1 if $string-1 is inferior to $string-2, 0 if $string-1 is equal to $string-2, 1 if $string-1 is superior to $string-2. If either comparand is the empty sequence, the empty sequence is returned. Please remember to specify the collation in the context or use the three argument version if you don't want the system default.
$string-1The first string
$string-2The second string

Returns -1 if $string-1 is inferior to $string-2, 0 if $string-1 is equal to $string-2, 1 if $string-1 is superior to $string-2. If either comparand is the empty sequence, the empty sequence is returned.

compare($string-1 as xs:string?, $string-2 as xs:string?, $collation-uri as xs:string) xs:integer?
Returns the collatable comparison using $collation-uri between $string-1 and $string-2, -1 if $string-1 is inferior to $string-2, 0 if $string-1 is equal to $string-2, 1 if $string-1 is superior to $string-2. If either comparand is the empty sequence, the empty sequence is returned. The third argument $collation-uri is relative so you only need to specify the last part of a valid full collation-uri, e.g. '?lang=sv-SE', 'lang=sv-SE;strength=primary;decomposition=standard' or 'swedish'.
$string-1The first string
$string-2The second string
$collation-uriThe relative collation URI

Returns -1 if $string-1 is inferior to $string-2, 0 if $string-1 is equal to $string-2, 1 if $string-1 is superior to $string-2. If either comparand is the empty sequence, the empty sequence is returned.

concat($atomizable-values as xs:anyAtomicType?, ...) xs:string?
Accepts two or more xdt:anyAtomicType arguments, $atomizable-values, and converts them to xs:string. Returns the xs:string that is the concatenation of the values of its arguments after conversion. If any of the arguments is the empty sequence, the argument is treated as the zero-length string.
$atomizable-valuesThe atomizable values

Returns the concatenated values

contains($source-string as xs:string?, $substring as xs:string?) xs:boolean
Returns an xs:boolean indicating whether or not the value of $source-string contains (at the beginning, at the end, or anywhere within) at least one sequence of collation units that provides a minimal match to the collation units in the value of $substring, according to the default collation.
$source-stringThe source-string
$substringThe substring

Returns true() if $source-string contains $substring, false() otherwise

contains($source-string as xs:string?, $substring as xs:string?, $collation-uri as xs:string) xs:boolean
Returns an xs:boolean indicating whether or not the value of $source-string contains (at the beginning, at the end, or anywhere within) at least one sequence of collation units that provides a minimal match to the collation units in the value of $substring, according to the collation that is specified in $collation-uri.The third argument $collation-uri is relative so you only need to specify the last part of a valid full collation-uri, e.g. '?lang=sv-SE', 'lang=sv-SE;strength=primary;decomposition=standard' or 'swedish'.
$source-stringThe source-string
$substringThe substring
$collation-uriThe collation URI

Returns true() if $source-string contains $substring, false() otherwise

count($items as item()*) xs:integer
Returns the number of items in the argument sequence, $items.
$itemsThe items

Returns the number of items in the argument sequence

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.

Returns the date current within the query execution time span

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.

Returns the date-time current within query execution time span

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.

Returns the time current within query execution time span

data($items as item()*) xs:anyAtomicType*
Returns the sequence of atomic values from the items in $items.
$itemsThe items

Returns the atomic values of the items in $items

dateTime($date as xs:date?, $time as xs:time?) xs:dateTime?
Creates an xs:dateTime from an xs:date, $date, and an xs:time, $time.
$dateThe date as xs:date
$timeThe time as xs:time

Returns the combined date and time as xs:dateTime

day-from-date($date as xs:date?) xs:integer?
Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $date.
$dateThe date as xs:date

Returns the day component from $date

day-from-dateTime($date-time as xs:dateTime?) xs:integer?
Returns an xs:integer between 1 and 31, both inclusive, representing the day component in the localized value of $date-time.
$date-timeThe date-time as xs:dateTime

Returns the day component from $date-time

days-from-duration($duration as xs:dayTimeDuration?) xs:integer?
Returns an xs:integer representing the days component in the canonical lexical representation of the value of $duration. The result may be negative.
$durationThe duration as xs:dayTimeDuration

Returns the days component of $duration

deep-equal($items-1 as item()*, $items-2 as item()*) xs:boolean
Returns true iff every item in $items-1 is deep-equal to the item at the same position in $items-2, false otherwise. If both $items-1 and $items-2 are the empty sequence, returns true().
$items-1The first item sequence
$items-2The second item sequence

Returns true() if the sequences are deep-equal, false() otherwise

deep-equal($items-1 as item()*, $items-2 as item()*, $collation-uri as xs:string) xs:boolean
Returns true iff every item in $items-1 is deep-equal to the item at the same position in $items-2, false otherwise. If both $items-1 and $items-2 are the empty sequence, returns true(). Comparison collation is specified by $collation-uri. The third argument $collation-uri is relative so you only need to specify the last part of a valid full collation-uri, e.g. '?lang=sv-SE', 'lang=sv-SE;strength=primary;decomposition=standard' or 'swedish'.
$items-1The first item sequence
$items-2The second item sequence
$collation-uriThe collation URI

Returns true() if the sequences are deep-equal, false() otherwise

default-collation() xs:string
Returns the context's default collation. E.g. http://www.w3.org/2005/xpath-functions/collation/codepoint.

Returns the default collation from the context

distinct-values($atomic-values as xs:anyAtomicType*) xs:anyAtomicType*
Returns a sequence where duplicate values of $atomic-values, based on value equality, have been deleted.
$atomic-valuesThe atomic values

Returns the distinct values sequence

distinct-values($atomic-values as xs:anyAtomicType*, $collation-uri as xs:string) xs:anyAtomicType*
Returns a sequence where duplicate values of $atomic-values, based on value equality specified by collation $collation-uri, have been deleted.
$atomic-valuesThe atomic values
$collation-uriThe collation URI

Returns the distinct values sequence

doc($document-uri as xs:string?) node()?
Returns the document node of $document-uri. Resource URIs can be specified either as a simple collection path, an XMLDB URI or any URI.
$document-uriThe document URI

Returns the document node of $document-uri

doc-available($document-uri as xs:string?) xs:boolean
Returns whether or not the document, $document-uri, specified in the input sequence is available. Resource URIs can be specified either as a simple collection path, an XMLDB URI or any URI.
$document-uriThe document URI

Returns true() if the document is available, false() otherwise

doctype($doctype as xs:string+) node()*
Returns the document nodes of the documents based on the DOCTYPE.
$doctypeone or more DOCTYPE names

Returns the document nodes matching the DOCTYPE names

Deprecated: This function is eXist-specific and deprecated. It should not be in the standard functions namespace. Please use util:doctype() instead. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

document-uri($document-node as node()?) xs:anyURI?
Returns the absolute URI of the resource from which the document node $document-node was constructed, if none such URI exists returns the empty sequence. If $document-node is the empty sequence, returns the empty sequence.
$document-nodeThe document node

Returns the document URI of $document-node

empty($items as item()*) xs:boolean
Returns true() if the value of $items is the empty sequence, false() otherwise.
$itemsThe item sequence

Returns true() if the empty sequence, false() otherwise

encode-for-uri($uri-part as xs:string?) xs:string
Escapes reserved characters in $uri-part by replacing it with its percent-encoded form as described in [RFC 3986]. If $uri-part is the empty sequence, returns the zero-length string.
$uri-partThe URI part to encode

Returns the URI part with reserved characters percent encoded

ends-with($source-string as xs:string?, $suffix as xs:string?) xs:boolean
Returns true if the string value of $suffix is a suffix of the string value of $source-string, false otherwise. If either $source-string or $suffix is the empty sequence, the empty sequence is returned.
$source-stringThe source-string
$suffixThe suffix

Returns true() if $suffix is suffix of $source-string, false() otherwise

ends-with($source-string as xs:string?, $suffix as xs:string?, $collation-uri as xs:string) xs:boolean?
Returns true if the string value of $suffix is a suffix of the string value of $source-string using collation $collation-uri, false otherwise. If either $source-string or $suffix is the empty sequence, the empty sequence is returned. The third argument $collation-uri is relative so you only need to specify the last part of a valid full collation-uri, e.g. '?lang=sv-SE', 'lang=sv-SE;strength=primary;decomposition=standard' or 'swedish'.
$source-stringThe source-string
$suffixThe suffix
$collation-uriThe collation URI

Returns true() if $suffix is suffix of $source-string, false() otherwise

equals($source-string as xs:string?, $substring as xs:string?) xs:boolean
Returns an xs:boolean indicating whether or not the value of $source-string equals the collation units in the value of $substring, according to the default collation. This function is similar to the '=' expression, except that it uses the default collation for comparisons.
$source-stringThe source-string
$substringThe substring

Returns true() if $source-string equals $substring, false() otherwise

equals($source-string as xs:string?, $substring as xs:string?, $collation-uri as xs:string) xs:boolean
Returns an xs:boolean indicating whether or not the value of $source-string cequals the collation units in the value of $substring, according to the collation that is specified in $collation-uri. This function is similar to the '=' expression, except that it uses the specified collation for comparisons.The third argument $collation-uri is relative so you only need to specify the last part of a valid full collation-uri, e.g. '?lang=sv-SE', 'lang=sv-SE;strength=primary;decomposition=standard' or 'swedish'.
$source-stringThe source-string
$substringThe substring
$collation-uriThe collation URI

Returns true() if $source-string equals $substring, false() otherwise

error($qname as xs:QName) empty()
Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception using $qname and the default message, 'An error has been raised by the query'.
$qnameThe qname

error($qname as xs:QName?, $message as xs:string) empty()
Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception using $qname and $message.
$qnameThe qname
$messageThe message

error($qname as xs:QName?, $message as xs:string, $error-object as item()*) empty()
Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception using $qname and $message with $error-object appended.
$qnameThe qname
$messageThe message
$error-objectThe error object

error() empty()
Indicates that an irrecoverable error has occurred. The script will terminate immediately with an exception using the default qname, 'http://www.w3.org/2004/07/xqt-errors#err:FOER0000', and the default error message, 'An error has been raised by the query'.

escape-html-uri($html-uri as xs:string?) xs:string
Replaces all nonprintable ASCII characters in the string value of $html-uri by an escape sequence represented as a hexadecimal octet in the form %XX. If $html-uri is the empty sequence, returns the zero-length string.
$html-uriThe html URI

Returns all nonprintable ASCII characters in $html-uri encoded by escape sequences

escape-uri($uri as xs:string?, $escape-reserved 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 $uri, which typically represents all or part of a URI. The effect of the function is to escape a set of identified characters in the string. Each such character is replaced in the string by an escape sequence, which is formed by encoding the character as a sequence of octets in UTF-8, and then representing each of these octets in the form %HH, where HH is the hexadecimal representation of the octet. $escape-reserved indicates whether to escape reserved characters.
$uriThe URI
$escape-reservedThe escaped-reserved

Returns the identified characters in $uri encoded with escape sequences

exactly-one($items as item()*) item()
Returns the argument sequence, $items, if it contains exactly one item. Otherwise, raises an error.
$itemsThe item sequence

Returns the sole item in $items if it contains exactly one item. Otherwise, an error is raised.

exists($items as item()*) xs:boolean
Returns true if the argument $items is not the empty sequence, false otherwise.
$itemsThe item sequence

Returns true() if not the empty-sequence, false() otherwise

false() xs:boolean
Always returns the boolean value false

Returns false

floor($number as numeric*) numeric
Returns the largets number not greater than the value of $number. If $number is the empty sequence, returns the empty sequence.
$numberThe number

Returns the largets number without fraction part not greater than the value of $number

hours-from-dateTime($date-time 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 $date-time.
$date-timeThe date-time as xs:dateTime

Returns the hours component from $date-time

hours-from-duration($duration as xs:dayTimeDuration?) xs:integer?
Returns an xs:integer representing the hours component in the canonical lexical representation of the value of $duration. The result may be negative.
$durationThe duration as xs:dayTimeDuration

Returns the hours component of $duration

hours-from-time($time 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 $time.
$timeThe time as xs:time

Returns the hours component from $time

id($idrefs 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 $idrefs. If none is matching or $idrefs is the empty sequence, returns the empty sequence.
$idrefsThe IDREF sequence

Returns the elements with IDs matching IDREFs from $idref-sequence

id($idrefs as xs:string*, $node-in-document 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 $idrefs and is in the same document as $node-in-document. If none is matching or $idrefs is the empty sequence, returns the empty sequence.
$idrefsThe IDREF sequence
$node-in-documentThe node in document

Returns the elements with IDs matching IDREFs from $idrefs in the same document as $node-in-document

idref($ids 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 $ids. If none is matching or $ids is the empty sequence, returns the empty sequence.
$idsThe ID sequence

Returns the elements with matching IDREF values from IDs in $ids

idref($ids as xs:string*, $node-in-document 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 $ids. If none is matching or $ids is the empty sequence, returns the empty sequence.
$idsThe ID sequence
$node-in-documentThe node in document

Returns the elements with matching IDREF values from IDs in $ids in the same document as $node-in-document

implicit-timezone() xs:dayTimeDuration
Returns the value of the implicit timezone property from the dynamic context.

Returns the implicit timezone daytime-duration from the dynamic context

in-scope-prefixes($element as element()) xs:string*
Returns the prefixes of the in-scope namespaces for $element. For namespaces that have a prefix, it returns the prefix as an xs:NCName. For the default namespace, which has no prefix, it returns the zero-length string.
$elementThe element

Returns the prefixes

index-of($source as xs:anyAtomicType*, $search as xs:anyAtomicType) xs:integer?
Returns a sequence of positive integers giving the positions within the sequence of atomic values $source that are equal to $search. The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. The collation is used when string comparison is required. The items in the sequence $source are compared with $search under the rules for the 'eq' operator. Values of type xs:untypedAtomic are compared as if they were of type xs:string. Values that cannot be compared, i.e. the 'eq' operator is not defined for their types, are considered to be distinct. If an item compares equal, then the position of that item in the sequence $source is included in the result. If the value of $source is the empty sequence, or if no item in $source matches $search, then the empty sequence is returned. The first item in a sequence is at position 1, not position 0. The result sequence is in ascending numeric order.
$sourceThe source sequence
$searchThe search component

Returns the sequence of positive integers giving the positions within the sequence

index-of($source as xs:anyAtomicType*, $search as xs:anyAtomicType, $collation-uri as xs:string) xs:integer?
Returns a sequence of positive integers giving the positions within the sequence of atomic values $source that are equal to $search. The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. The collation is used when string comparison is required. The items in the sequence $source are compared with $search under the rules for the 'eq' operator. Values of type xs:untypedAtomic are compared as if they were of type xs:string. Values that cannot be compared, i.e. the 'eq' operator is not defined for their types, are considered to be distinct. If an item compares equal, then the position of that item in the sequence $source is included in the result. If the value of $source is the empty sequence, or if no item in $source matches $search, then the empty sequence is returned. The first item in a sequence is at position 1, not position 0. The result sequence is in ascending numeric order. The third argument $collation-uri is relative so you only need to specify the last part of a valid full collation-uri, e.g. '?lang=sv-SE', 'lang=sv-SE;strength=primary;decomposition=standard' or 'swedish'.
$sourceThe source sequence
$searchThe search component
$collation-uriThe collation URI

Returns the sequence of positive integers giving the positions within the sequence

insert-before($target as item()*, $position as xs:integer, $inserts as item()*) item()*
Returns a new sequence constructed from the value of $target with the value of $inserts inserted at the position specified by the value of $position. (The value of $target is not affected by the sequence construction.) If $target is the empty sequence, $inserts is returned. If $inserts is the empty sequence, $target is returned. The value returned by the function consists of all items of $target whose index is less than $position, followed by all items of $inserts, followed by the remaining elements of $target, in that sequence. If $position is less than one (1), the first position, the effective value of $position is one (1). If $position is greater than the number of items in $target, then the effective value of $position is equal to the number of items in $target plus 1.
$targetThe target
$positionThe position to insert before
$insertsThe data to insert

Returns the new sequence

iri-to-uri($iri as xs:string?) xs:string
This function converts an xs:string containing an IRI into a URI according to the rules spelled out in Section 3.1 of [RFC 3987]. It is idempotent but not invertible. If $iri contains a character that is invalid in an IRI, such as the space character (see note below), the invalid character is replaced by its percent-encoded form as described in [RFC 3986] before the conversion is performed. If $iri is the empty sequence, returns the zero-length string. Since [RFC 3986] recommends that, for consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent-encodings, this function must always generate hexadecimal values using the upper-case letters A-F. Notes: This function does not check whether $iri is a legal IRI. It treats it as an xs:string and operates on the characters in the xs:string. The following printable ASCII characters are invalid in an IRI: "<", ">", " " " (double quote), space, "{", "}", "|", "\", "^", and "`". Since these characters should not appear in an IRI, if they do appear in $iri they will be percent-encoded. In addition, characters outside the range x20-x126 will be percent-encoded because they are invalid in a URI. Since this function does not escape the PERCENT SIGN "%" and this character is not allowed in data within a URI, users wishing to convert character strings, such as file names, that include "%" to a URI should manually escape "%" by replacing it with "%25".
$iriThe IRI

Returns the URI

item-at($source as item()*, $index as xs:integer) item()?
Returns the item in $source that is located at the position specified by $index.
$sourceThe source sequence
$indexThe index of the item in the source sequence to return

Returns the item

Deprecated: This function is eXist-specific and deprecated. It should not be in the standard functions namespace. Use e.g. $x[1] instead. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

lang($lang as xs:string?) xs:boolean
Tests whether the language of the context item as specified by xml:lang attributes is the same as, or is a sublanguage of, the language specified by $lang. The behavior of the function if the second argument is omitted is exactly the same as if the context item (.) had been passed as the second argument. The language of the argument node, or the context item if the second argument is omitted, is determined by the value of the xml:lang attribute on the node, or, if the node has no such attribute, by the value of the xml:lang attribute on the nearest ancestor of the node that has an xml:lang attribute. If there is no such ancestor, then the function returns false(). The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP. If $lang is the empty sequence it is interpreted as the zero-length string.
$langThe language code

Returns true if the language code matches, false otherwise

lang($lang as xs:string?, $node as node()) xs:boolean
Tests whether the language of $node as specified by xml:lang attributes is the same as, or is a sublanguage of, the language specified by $lang. The behavior of the function if the second argument is omitted is exactly the same as if the context item (.) had been passed as the second argument. The language of the argument node, or the context item if the second argument is omitted, is determined by the value of the xml:lang attribute on the node, or, if the node has no such attribute, by the value of the xml:lang attribute on the nearest ancestor of the node that has an xml:lang attribute. If there is no such ancestor, then the function returns false(). The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP. If $lang is the empty sequence it is interpreted as the zero-length string.
$langThe language code
$nodeThe node

Returns true if the language code matches, false otherwise

last() xs:integer?
Returns the context size from the dynamic context. If the context item is undefined, an error is raised.

Returns the context size from the dynamic context

local-name($arg as node()?) xs:string
Returns the local part of the name of $arg as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName. If the argument is omitted, it defaults to the context item (.). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP. If the argument is supplied and is the empty sequence, the function returns the zero-length string. If the target node has no name (that is, if it is a document node, a comment, or a text node), the function returns the zero-length string. Otherwise, the value returned will be the local part of the expanded-QName of the target node (as determined by the dm:node-name accessor in Section 5.11 node-name AccessorDM. This will be an xs:string whose lexical form is an xs:NCName.
$argThe node to retrieve the local name from

Returns the local name

local-name() xs:string
Returns the local part of the name of $arg as an xs:string that will either be the zero-length string or will have the lexical form of an xs:NCName. If the argument is omitted, it defaults to the context item (.). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP. If the argument is supplied and is the empty sequence, the function returns the zero-length string. If the target node has no name (that is, if it is a document node, a comment, or a text node), the function returns the zero-length string. Otherwise, the value returned will be the local part of the expanded-QName of the target node (as determined by the dm:node-name accessor in Section 5.11 node-name AccessorDM. This will be an xs:string whose lexical form is an xs:NCName.

Returns the local name

local-name-from-QName($arg as xs:QName?) xs:NCName?
Returns an xs:NCName representing the local part of $arg. If $arg is the empty sequence, returns the empty sequence.
$argThe QName

Returns the local name

lower-case($arg as xs:string?) xs:string
Returns the value of $arg after translating every character to its lower-case correspondent as defined in the appropriate case mappings section in the Unicode standard. For versions of Unicode beginning with the 2.1.8 update, only locale-insensitive case mappings should be applied. Beginning with version 3.2.0 (and likely future versions) of Unicode, precise mappings are described in default case operations, which are full case mappings in the absence of tailoring for particular languages and environments. Every upper-case character that does not have a lower-case correspondent, as well as every lower-case character, is included in the returned value in its original form.
$argThe text to be converted to all lower-case characters

Returns the resulting lower-case text

match-all($nodes as node()*, $regular-expression as xs:string+, ...) node()*
Tries to match each of the regular expression strings passed in $regular-expression and all following parameters against the keywords contained in the old fulltext index. The keywords found are then compared to the node set in $nodes. Every node containing all of the keywords is copied to the result sequence.
$nodesThe node set that is to be searched for the keyword set
$regular-expressionThe regular expressions to be matched against the fulltext index

Returns the sequence of all of the matching nodes

Deprecated: This function is eXist-specific and should not be in the standard functions namespace. Please use text:match-all() instead. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

match-any($nodes as node()*, $regular-expression as xs:string+, ...) node()*
Tries to match each of the regular expression strings passed in $regular-expression and all following parameters against the keywords contained in the old fulltext index. The keywords found are then compared to the node set in $nodes. Every node containing any of the keywords is copied to the result sequence.
$nodesThe node set that is to be searched for the keyword set
$regular-expressionThe regular expressions to be matched against the fulltext index

Returns the sequence of all of the matching nodes

Deprecated: This function is eXist-specific and should not be in the standard functions namespace. Please use text:match-any() instead. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

matches($input as xs:string*, $pattern as xs:string) xs:boolean
The function returns true if $input matches the regular expression supplied as $pattern, if present; otherwise, it returns false. If $input is the empty sequence, it is interpreted as the zero-length string. Unless the metacharacters ^ and $ are used as anchors, the string is considered to match the pattern if any substring matches the pattern. But if anchors are used, the anchors must match the start/end of the string (in string mode), or the start/end of a line (in multiline mode). Note: This is different from the behavior of patterns in [XML Schema Part 2: Datatypes Second Edition], where regular expressions are implicitly anchored. Please note that - in contrast - with the specification - this method allows zero or more items for the string argument. An error is raised [err:FORX0002] if the value of $pattern is invalid according to the rules described in section 7.6.1 Regular Expression Syntax.
$inputThe input string
$patternThe pattern

Returns true if the pattern is a match, false otherwise

matches($input as xs:string*, $pattern as xs:string, $flags as xs:string) xs:boolean
The function returns true if $input matches the regular expression supplied as $pattern as influenced by the value of $flags, if present; otherwise, it returns false. The effect of calling this version of the function with the $flags argument set to a zero-length string is the same as using the other two argument version. Flags are defined in 7.6.1.1 Flags. If $input is the empty sequence, it is interpreted as the zero-length string. Unless the metacharacters ^ and $ are used as anchors, the string is considered to match the pattern if any substring matches the pattern. But if anchors are used, the anchors must match the start/end of the string (in string mode), or the start/end of a line (in multiline mode). Note: This is different from the behavior of patterns in [XML Schema Part 2: Datatypes Second Edition], where regular expressions are implicitly anchored. Please note that - in contrast - with the specification - this method allows zero or more items for the string argument. An error is raised [err:FORX0002] if the value of $pattern is invalid according to the rules described in section 7.6.1 Regular Expression Syntax. An error is raised [err:FORX0001] if the value of $flags is invalid according to the rules described in section 7.6.1 Regular Expression Syntax.
$inputThe input string
$patternThe pattern
$flagsThe flags

Returns true if the pattern is a match, false otherwise

max($arg as xs:anyAtomicType*) xs:anyAtomicType?
Selects an item from the input sequence $arg whose value is greater than or equal to the value of every other item in the input sequence. If there are two or more such items, then the specific item whose value is returned is implementation dependent. The following rules are applied to the input sequence: - Values of type xs:untypedAtomic in $arg are cast to xs:double. - Numeric and xs:anyURI values are converted to the least common type that supports the 'ge' operator by a combination of type promotion and subtype substitution. See Section B.1 Type PromotionXP and Section B.2 Operator MappingXP. The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. This function returns an item from the converted sequence rather than the input sequence. If the converted sequence is empty, the empty sequence is returned. All items in $arg must be numeric or derived from a single base type for which the 'ge' operator is defined. In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for purposes of comparison. Duration values must either all be xs:yearMonthDuration values or must all be xs:dayTimeDuration values. If any of these conditions is not met, then a type error is raised [err:FORG0006]. If the converted sequence contains the value NaN, the value NaN is returned. If the items in the value of $arg are of type xs:string or types derived by restriction from xs:string, then the determination of the item with the largest value is made according to the collation that is used.The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations.
$argThe input sequence

Returns the max value

max($arg as xs:anyAtomicType*, $collation-uri as xs:string) xs:anyAtomicType?
Selects an item from the input sequence $arg whose value is greater than or equal to the value of every other item in the input sequence. If there are two or more such items, then the specific item whose value is returned is implementation dependent. The following rules are applied to the input sequence: - Values of type xs:untypedAtomic in $arg are cast to xs:double. - Numeric and xs:anyURI values are converted to the least common type that supports the 'ge' operator by a combination of type promotion and subtype substitution. See Section B.1 Type PromotionXP and Section B.2 Operator MappingXP. The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. This function returns an item from the converted sequence rather than the input sequence. If the converted sequence is empty, the empty sequence is returned. All items in $arg must be numeric or derived from a single base type for which the 'ge' operator is defined. In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for purposes of comparison. Duration values must either all be xs:yearMonthDuration values or must all be xs:dayTimeDuration values. If any of these conditions is not met, then a type error is raised [err:FORG0006]. If the converted sequence contains the value NaN, the value NaN is returned. If the items in the value of $arg are of type xs:string or types derived by restriction from xs:string, then the determination of the item with the largest value is made according to the collation that is used.If the type of the items in $arg is not xs:string and $collation-uri is specified, the collation is ignored. The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations.
$argThe input sequence
$collation-uriThe collation URI

Returns the max value

min($arg as xs:anyAtomicType*) xs:anyAtomicType?
Selects an item from the input sequence $arg whose value is less than or equal to the value of every other item in the input sequence. If there are two or more such items, then the specific item whose value is returned is implementation dependent. The following rules are applied to the input sequence: - Values of type xs:untypedAtomic in $arg are cast to xs:double. - Numeric and xs:anyURI values are converted to the least common type that supports the 'le' operator by a combination of type promotion and subtype substitution. See Section B.1 Type PromotionXP and Section B.2 Operator MappingXP. The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. This function returns an item from the converted sequence rather than the input sequence. If the converted sequence is empty, the empty sequence is returned. All items in $arg must be numeric or derived from a single base type for which the 'le' operator is defined. In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for the purpose of comparison. Duration values must either all be xs:yearMonthDuration values or must all be xs:dayTimeDuration values. If any of these conditions is not met, a type error is raised [err:FORG0006]. If the converted sequence contains the value NaN, the value NaN is returned. If the items in the value of $arg are of type xs:string or types derived by restriction from xs:string, then the determination of the item with the smallest value is made according to the collation that is used. The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations.
$argThe input sequence

Returns the minimum value

min($arg as xs:anyAtomicType*, $collation-uri as xs:string) xs:anyAtomicType?
Selects an item from the input sequence $arg whose value is less than or equal to the value of every other item in the input sequence. If there are two or more such items, then the specific item whose value is returned is implementation dependent. The following rules are applied to the input sequence: - Values of type xs:untypedAtomic in $arg are cast to xs:double. - Numeric and xs:anyURI values are converted to the least common type that supports the 'le' operator by a combination of type promotion and subtype substitution. See Section B.1 Type PromotionXP and Section B.2 Operator MappingXP. The items in the resulting sequence may be reordered in an arbitrary order. The resulting sequence is referred to below as the converted sequence. This function returns an item from the converted sequence rather than the input sequence. If the converted sequence is empty, the empty sequence is returned. All items in $arg must be numeric or derived from a single base type for which the 'le' operator is defined. In addition, the values in the sequence must have a total order. If date/time values do not have a timezone, they are considered to have the implicit timezone provided by the dynamic context for the purpose of comparison. Duration values must either all be xs:yearMonthDuration values or must all be xs:dayTimeDuration values. If any of these conditions is not met, a type error is raised [err:FORG0006]. If the converted sequence contains the value NaN, the value NaN is returned. If the items in the value of $arg are of type xs:string or types derived by restriction from xs:string, then the determination of the item with the smallest value is made according to the collation that is used. If the type of the items in $arg is not xs:string and $collation is specified, the collation is ignored. The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations.
$argThe input sequence
$collation-uriThe collation URI

Returns the minimum value

minutes-from-dateTime($date-time 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 $date-time.
$date-timeThe date-time as xs:dateTime

Returns the minutes component from $date-time

minutes-from-duration($duration as xs:dayTimeDuration?) xs:integer?
Returns an xs:integer representing the minutes component in the canonical lexical representation of the value of $duration. The result may be negative.
$durationThe duration as xs:dayTimeDuration

Returns the minutes component of $duration

minutes-from-time($time 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 $time.
$timeThe time as xs:time

Returns the minutes component from $time

month-from-date($date as xs:date?) xs:integer?
Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $date.
$dateThe date as xs:date

Returns the month component from $date

month-from-dateTime($date-time as xs:dateTime?) xs:integer?
Returns an xs:integer between 1 and 12, both inclusive, representing the month component in the localized value of $date-time.
$date-timeThe date-time as xs:dateTime

Returns the month component from $date-time

months-from-duration($duration as xs:yearMonthDuration?) xs:integer?
Returns an xs:integer representing the months component in the canonical lexical representation of the value of $duration. The result may be negative.
$durationThe duration as xs:yearMonthDuration

Returns the months component of $duration

name($arg as node()?) xs:string?
Returns the name of $arg as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName. If the argument is omitted, it defaults to the context item (.). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP. If the argument is supplied and is the empty sequence, the function returns the zero-length string. If the target node has no name (that is, if it is a document node, a comment, a text node, or a namespace binding having no name), the function returns the zero-length string. Otherwise, the value returned is fn:string(fn:node-name($arg)).
$argThe input node

Returns the name

name() xs:string?
Returns the name of the context item as an xs:string that is either the zero-length string, or has the lexical form of an xs:QName. The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP. If the argument is supplied and is the empty sequence, the function returns the zero-length string. If the target node has no name (that is, if it is a document node, a comment, a text node, or a namespace binding having no name), the function returns the zero-length string. Otherwise, the value returned is fn:string(fn:node-name($arg)).

Returns the name

namespace-uri($arg as node()?) xs:anyURI
Returns the namespace URI of the xs:QName of $arg. If the argument is omitted, it defaults to the context node (.). The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP. If $arg is neither an element nor an attribute node, or if it is an element or attribute node whose expanded-QName (as determined by the dm:node-name accessor in the Section 5.11 node-name AccessorDM) is in no namespace, then the function returns the xs:anyURI corresponding to the zero-length string.
$argThe input node

Returns the namespace URI

namespace-uri() xs:anyURI
Returns the namespace URI of the xs:QName of the context item. The behavior of the function if the argument is omitted is exactly the same as if the context item had been passed as the argument. The following errors may be raised: if the context item is undefined [err:XPDY0002]XP; if the context item is not a node [err:XPTY0004]XP. If $arg is neither an element nor an attribute node, or if it is an element or attribute node whose expanded-QName (as determined by the dm:node-name accessor in the Section 5.11 node-name AccessorDM) is in no namespace, then the function returns the xs:anyURI corresponding to the zero-length string.

Returns the namespace URI

namespace-uri-for-prefix($prefix as xs:string?, $element as element()) xs:anyURI?
Returns the namespace URI of one of the in-scope namespaces for $element, identified by its namespace prefix. If $element has an in-scope namespace whose namespace prefix is equal to $prefix, it returns the namespace URI of that namespace. If $prefix is the zero-length string or the empty sequence, it returns the namespace URI of the default (unnamed) namespace. Otherwise, it returns the empty sequence. Prefixes are equal only if their Unicode code points match exactly.
$prefixThe namespace prefix
$elementThe element

Returns the namespace URI

namespace-uri-from-QName($arg as xs:QName?) xs:anyURI?
Returns the namespace URI for $arg. If $arg is the empty sequence, returns the empty sequence.
$argThe QName

Returns the namespace URI

nilled($arg as node()?) xs:boolean?
Returns an xs:boolean indicating whether the argument node is "nilled". If the argument is not an element node, returns the empty sequence. If the argument is the empty sequence, returns the empty sequence.
$argThe input node

Returns true if the argument node is "nilled"

node-name($arg 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 $arg is the empty sequence, the empty sequence is returned.
$argThe input node

Returns the expanded QName

normalize-space($arg as xs:string?) xs:string
Returns the value of $arg with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of one or more than one whitespace character with a single space, #x20. The whitespace characters are defined in the metasymbol S (Production 3) of [Extensible Markup Language (XML) 1.0 Recommendation (Third Edition)]. Note: The definition of the metasymbol S (Production 3), is unchanged in [Extensible Markup Language (XML) 1.1 Recommendation]. If the value of $arg is the empty sequence, returns the zero-length string. If no argument is supplied, $arg defaults to the string value (calculated using fn:string()) of the context item (.). If no argument is supplied or if the argument is the context item and the context item is undefined an error is raised: [err:XPDY0002].
$argThe string to normalize

Returns the normalized text

normalize-space() xs:string
Returns the calculated string value of the context item with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of one or more than one whitespace character with a single space, #x20. The whitespace characters are defined in the metasymbol S (Production 3) of [Extensible Markup Language (XML) 1.0 Recommendation (Third Edition)]. Note: The definition of the metasymbol S (Production 3), is unchanged in [Extensible Markup Language (XML) 1.1 Recommendation]. If no argument is supplied, $arg defaults to the string value (calculated using fn:string()) of the context item (.). If no argument is supplied or if the argument is the context item and the context item is undefined an error is raised: [err:XPDY0002].

Returns the normalized text

normalize-unicode($arg as xs:string?) xs:string
Returns the value of the context item normalized according to the nomalization form "NFC"
$argThe unicode string to normalize

Returns the normalized text

normalize-unicode($arg as xs:string?, $normalization-form as xs:string) xs:string
Returns the value of $arg normalized according to the normalization criteria for a normalization form identified by the value of $normalization-form. The effective value of the $normalization-form is computed by removing leading and trailing blanks, if present, and converting to upper case. If the value of $arg is the empty sequence, returns the zero-length string. See [Character Model for the World Wide Web 1.0: Normalization] for a description of the normalization forms. - If the effective value of $normalization-form is "NFC", then the value returned by the function is the value of $arg in Unicode Normalization Form C (NFC). - If the effective value of $normalization-form is "NFD", then the value returned by the function is the value of $arg in Unicode Normalization Form D (NFD). - If the effective value of $normalization-form is "NFKC", then the value returned by the function is the value of $arg in Unicode Normalization Form KC (NFKC). - If the effective value of $normalization-form is "NFKD", then the value returned by the function is the value of $arg in Unicode Normalization Form KD (NFKD). - If the effective value of $normalization-form is "FULLY-NORMALIZED", then the value returned by the function is the value of $arg in the fully normalized form. - If the effective value of $normalization-form is the zero-length string, no normalization is performed and $arg is returned. Conforming implementations must support normalization form "NFC" and may support normalization forms "NFD", "NFKC", "NFKD", "FULLY-NORMALIZED". They may also support other normalization forms with implementation-defined semantics. If the effective value of the $normalization-form is other than one of the values supported by the implementation, then an error is raised [err:FOCH0003].
$argThe unicode string to normalize
$normalization-formThe normalization form

Returns the normalized text

not($arg as item()*) xs:boolean
Returns true if the effective boolean value is false, and false if the effective boolean value is true. $arg is reduced to an effective boolean value by applying the fn:boolean() function.
$argThe input items

Returns the negated effective boolean value (ebv) of $arg

number($arg as xs:anyAtomicType?) xs:double
Returns the value indicated by $arg or, if $arg is not specified, the context item after atomization, converted to an xs:double. Calling the zero-argument version of the function is defined to give the same result as calling the single-argument version with the context item (.). That is, fn:number() is equivalent to fn:number(.). If $arg is the empty sequence or if $arg or the context item cannot be converted to an xs:double, the xs:double value NaN is returned. If the context item is undefined an error is raised: [err:XPDY0002]XP. If $arg is the empty sequence, NaN is returned. Otherwise, $arg, or the context item after atomization, is converted to an xs:double following the rules of 17.1.3.2 Casting to xs:double. If the conversion to xs:double fails, the xs:double value NaN is returned.
$argThe input item

Returns the numerical value

number() xs:double
Returns the value of the context item after atomization, converted to an xs:double. If the context item cannot be converted to an xs:double, the xs:double value NaN is returned. If the context item is undefined an error is raised: [err:XPDY0002]XP.

Returns the numerical value

one-or-more($arg as item()*) item()+
Returns $arg if it contains one or more items. Otherwise, raises an error.
$argThe input sequence

Returns the sequence passed in by $arg if it contains one or more items.

position() xs:integer?
Returns the context position from the dynamic context. If the context item is undefined, raises an error.

Returns the context position

prefix-from-QName($arg as xs:QName?) xs:NCName?
Returns an xs:NCName representing the prefix of $arg. If $arg is the empty sequence, returns the empty sequence.
$argThe QName

Returns the prefix

QName($uri as xs:string?, $qname as xs:string) xs:QName
Returns an xs:QName with the namespace URI given in $uri. If $uri is the zero-length string or the empty sequence, it represents "no namespace"; in this case, if the value of $qname contains a colon (:), an error is raised [err:FOCA0002]. The prefix (or absence of a prefix) in $qname is retained in the returned xs:QName value. The local name in the result is taken from the local part of $qname. If $qname does not have the correct lexical form for xs:QName an error is raised [err:FOCA0002]. Note that unlike xs:QName this function does not require a xs:string literal as the argument.
$uriThe namespace URI
$qnameThe prefix

Returns the xs:QName with the namespace URI given in $uri

remove($target as item()*, $position as xs:integer) item()*
Returns a new sequence constructed from the value of $target with the item at $position removed. If $position is less than 1 or greater than the number of items in $target, $target is returned. Otherwise, the value returned by the function consists of all items of $target whose index is less than $position, followed by all items of $target whose index is greater than $position. If $target is the empty sequence, the empty sequence is returned.
$targetThe input sequence
$positionThe position of the value to be removed

Returns the new sequence with the item at the position specified by the value of $position removed.

replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string) xs:string?
The function returns the xs:string that is obtained by replacing each non-overlapping substring of $input that matches the given $pattern with an occurrence of the $replacement string. If $input is the empty sequence, it is interpreted as the zero-length string. If two overlapping substrings of $input both match the $pattern, then only the first one (that is, the one whose first character comes first in the $input string) is replaced. Within the $replacement string, a variable $N may be used to refer to the substring captured by the Nth parenthesized sub-expression in the regular expression. For each match of the pattern, these variables are assigned the value of the content matched by the relevant sub-expression, and the modified replacement string is then substituted for the characters in $input that matched the pattern. $0 refers to the substring captured by the regular expression as a whole. More specifically, the rules are as follows, where S is the number of parenthesized sub-expressions in the regular expression, and N is the decimal number formed by taking all the digits that consecutively follow the $ character: 1. If N=0, then the variable is replaced by the substring matched by the regular expression as a whole. 2. If 1<=N<=S, then the variable is replaced by the substring captured by the Nth parenthesized sub-expression. If the Nth parenthesized sub-expression was not matched, then the variable is replaced by the zero-length string. 3. If S<N<=9, then the variable is replaced by the zero-length string. 4. Otherwise (if N>S and N>9), the last digit of N is taken to be a literal character to be included "as is" in the replacement string, and the rules are reapplied using the number N formed by stripping off this last digit.
$inputThe input string
$patternThe pattern to match
$replacementThe string to replace the pattern with

Returns the altered string

replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) xs:string?
The function returns the xs:string that is obtained by replacing each non-overlapping substring of $input that matches the given $pattern with an occurrence of the $replacement string. The $flags argument is interpreted in the same manner as for the fn:matches() function. Calling the four argument version with the $flags argument set to a zero-length string gives the same effect as using the three argument version. If $input is the empty sequence, it is interpreted as the zero-length string. If two overlapping substrings of $input both match the $pattern, then only the first one (that is, the one whose first character comes first in the $input string) is replaced. Within the $replacement string, a variable $N may be used to refer to the substring captured by the Nth parenthesized sub-expression in the regular expression. For each match of the pattern, these variables are assigned the value of the content matched by the relevant sub-expression, and the modified replacement string is then substituted for the characters in $input that matched the pattern. $0 refers to the substring captured by the regular expression as a whole. More specifically, the rules are as follows, where S is the number of parenthesized sub-expressions in the regular expression, and N is the decimal number formed by taking all the digits that consecutively follow the $ character: 1. If N=0, then the variable is replaced by the substring matched by the regular expression as a whole. 2. If 1<=N<=S, then the variable is replaced by the substring captured by the Nth parenthesized sub-expression. If the Nth parenthesized sub-expression was not matched, then the variable is replaced by the zero-length string. 3. If S<N<=9, then the variable is replaced by the zero-length string. 4. Otherwise (if N>S and N>9), the last digit of N is taken to be a literal character to be included "as is" in the replacement string, and the rules are reapplied using the number N formed by stripping off this last digit.
$inputThe input string
$patternThe pattern to match
$replacementThe string to replace the pattern with
$flagsThe flags

Returns the altered string

resolve-QName($qname as xs:string?, $element 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. If $qname does not have the correct lexical form for xs:QName an error is raised [err:FOCA0002]. If $qname is the empty sequence, returns the empty sequence. More specifically, the function searches the namespace bindings of $element for a binding whose name matches the prefix of $qname, or the zero-length string if it has no prefix, and constructs an expanded-QName whose local name is taken from the supplied $qname, and whose namespace URI is taken from the string value of the namespace binding. If the $qname has a prefix and if there is no namespace binding for $element that matches this prefix, then an error is raised [err:FONS0004]. If the $qname has no prefix, and there is no namespace binding for $element corresponding to the default (unnamed) namespace, then the resulting expanded-QName has no namespace part. The prefix (or absence of a prefix) in the supplied $qname argument is retained in the returned expanded-QName.
$qnameThe QName name
$elementThe element

Returns the QName of $element with lexical form $qname

resolve-uri($relative as xs:string?) xs:anyURI?
Resolves $relative against the value of the base-uri property from the static context using an algorithm such as the ones described in [RFC 2396] or [RFC 3986], and the resulting absolute URI reference is returned. An error may be raised [err:FORG0009] in the resolution process. If $relative is an absolute URI reference, it is returned unchanged. If $relative or $base is not a valid xs:anyURI an error is raised [err:FORG0002]. If $relative is the empty sequence, the empty sequence is returned.
$relativeThe relative URI

Returns the absolute URI

resolve-uri($relative as xs:string?, $base as xs:string) xs:anyURI?
Resolves $relative against $base using an algorithm such as the ones described in [RFC 2396] or [RFC 3986], and the resulting absolute URI reference is returned. An error may be raised [err:FORG0009] in the resolution process. If $relative is an absolute URI reference, it is returned unchanged. If $relative or $base is not a valid xs:anyURI an error is raised [err:FORG0002]. If $relative is the empty sequence, the empty sequence is returned.
$relativeThe relative URI
$baseThe base URI

Returns the absolute URI

reverse($arg as item()*) item()*
Reverses the order of items in a sequence. If the argument is an emptysequence, the empty sequence is returned.
$argThe sequence to reverse

Returns the reverse order sequence

root($arg as node()?) node()?
Returns the root of the tree to which $arg belongs. This will usually, but not necessarily, be a document node. If $arg is the empty sequence, the empty sequence is returned. If $arg is a document node, $arg is returned. The behavior of the zero argument version of the function is exactly the same as if the context item had been passed in $arg.
$argThe input node

Returns the root node of the tree to which $arg belongs

root() node()
Returns the root of the tree to which the context item belongs.

Returns the root node of the tree to which the context node belongs

round($arg as numeric?) numeric
Returns the number with no fractional part that is closest to the argument $arg. If there are two such numbers, then the one that is closest to positive infinity is returned. If type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the type of $arg. If the type of $arg is a type derived from one of the numeric types, the result is an instance of the base numeric type. For xs:float and xs:double arguments, if the argument is positive infinity, then positive infinity is returned. If the argument is negative infinity, then negative infinity is returned. If the argument is positive zero, then positive zero is returned. If the argument is negative zero, then negative zero is returned. If the argument is less than zero, but greater than or equal to -0.5, then negative zero is returned. In the cases where positive zero or negative zero is returned, negative zero or positive zero may be returned as [XML Schema Part 2: Datatypes Second Edition] does not distinguish between the values positive zero and negative zero.
$argThe input number

Returns the rounded value

round-half-to-even($arg as numeric?) numeric
The value returned is the nearest (that is, numerically closest) value to $arg that is a multiple of ten to the power of minus 0. If two such values are equally near (e.g. if the fractional part in $arg is exactly .500...), the function returns the one whose least significant digit is even. If the type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the type of $arg. If the type of $arg is a type derived from one of the numeric types, the result is an instance of the base numeric type. The three argument version of the function with $precision = 0 produces the same result as the two argument version. For arguments of type xs:float and xs:double, if the argument is NaN, positive or negative zero, or positive or negative infinity, then the result is the same as the argument. In all other cases, the argument is cast to xs:decimal, the function is applied to this xs:decimal value, and the resulting xs:decimal is cast back to xs:float or xs:double as appropriate to form the function result. If the resulting xs:decimal value is zero, then positive or negative zero is returned according to the sign of the original argument. Note that the process of casting to xs:decimal may result in an error [err:FOCA0001]. If $arg is of type xs:float or xs:double, rounding occurs on the value of the mantissa computed with exponent = 0.
$argThe input number

Returns the rounded value

round-half-to-even($arg as numeric?, $precision as numeric?) numeric
The value returned is the nearest (that is, numerically closest) value to $arg that is a multiple of ten to the power of minus $precision. If two such values are equally near (e.g. if the fractional part in $arg is exactly .500...), the function returns the one whose least significant digit is even. If the type of $arg is one of the four numeric types xs:float, xs:double, xs:decimal or xs:integer the type of the result is the same as the type of $arg. If the type of $arg is a type derived from one of the numeric types, the result is an instance of the base numeric type. The three argument version of the function with $precision = 0 produces the same result as the two argument version. For arguments of type xs:float and xs:double, if the argument is NaN, positive or negative zero, or positive or negative infinity, then the result is the same as the argument. In all other cases, the argument is cast to xs:decimal, the function is applied to this xs:decimal value, and the resulting xs:decimal is cast back to xs:float or xs:double as appropriate to form the function result. If the resulting xs:decimal value is zero, then positive or negative zero is returned according to the sign of the original argument. Note that the process of casting to xs:decimal may result in an error [err:FOCA0001]. If $arg is of type xs:float or xs:double, rounding occurs on the value of the mantissa computed with exponent = 0.
$argThe input number
$precisionThe precision factor

Returns the rounded value

seconds-from-dateTime($date-time 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 $date-time. Note that the value can be greater than 60 seconds to accommodate occasional leap seconds used to keep human time synchronized with the rotation of the planet.
$date-timeThe date-time as xs:dateTime

Returns the seconds component from $date-time

seconds-from-duration($duration as xs:dayTimeDuration?) xs:decimal?
Returns an xs:decimal representing the seconds component in the canonical lexical representation of the value of $duration. The result may be negative
$durationThe duration as xs:dayTimeDuration

Returns the seconds component of $duration

seconds-from-time($time 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 $date. Note that the value can be greater than 60 seconds to accommodate occasional leap seconds used to keep human time synchronized with the rotation of the planet.
$timeThe time as xs:time

Returns the seconds component from $time

starts-with($source as xs:string?, $prefix as xs:string?) xs:boolean?
Returns an xs:boolean indicating whether or not the value of $source starts with a sequence of collation units that provides a minimal match to the collation units of $prefix according to the collation that is used. Note: "Minimal match" is defined in [Unicode Collation Algorithm]. If the value of $source or $prefix is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string. If the value of $prefix is the zero-length string, then the function returns true. If the value of $source is the zero-length string and the value of $prefix is not the zero-length string, then the function returns false. The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. If the specified collation does not support collation units an error may be raised [err:FOCH0004].
$sourceThe source string
$prefixThe string to determine if is a prefix of $source

Returns true if $prefix is a prefix of the string $source

starts-with($source as xs:string?, $prefix as xs:string?, $collation-uri as xs:string) xs:boolean?
Returns an xs:boolean indicating whether or not the value of $source starts with a sequence of collation units that provides a minimal match to the collation units of $prefix according to the collation that is used. Note: "Minimal match" is defined in [Unicode Collation Algorithm]. If the value of $source or $prefix is the empty sequence, or contains only ignorable collation units, it is interpreted as the zero-length string. If the value of $prefix is the zero-length string, then the function returns true. If the value of $source is the zero-length string and the value of $prefix is not the zero-length string, then the function returns false. The collation used by the invocation of this function is determined according to the rules in 7.3.1 Collations. If the specified collation does not support collation units an error may be raised [err:FOCH0004]. The third argument $collation-uri is relative so you only need to specify the last part of a valid full collation-uri, e.g. '?lang=sv-SE', 'lang=sv-SE;strength=primary;decomposition=standard' or 'swedish'.
$sourceThe source string
$prefixThe string to determine if is a prefix of $source
$collation-uriThe collation URI

Returns true if $prefix is a prefix of the string $source

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.

Returns the base URI from the static context

string($arg as item()?) xs:string
Returns the value of $arg as xs:string. If the value of $arg is the empty sequence, the zero-length string is returned. If the context item of $arg is undefined, an error is raised.
$argThe sequence to get the vaule of as an xs:string

Returns the value of $arg as an xs:string

string() xs:string
Returns the value of the context item as xs:string. If the context item is undefined, an error is raised.

Returns the value of the context item as an xs:string

string-join($arg as xs:string*, $separator as xs:string) xs:string
Returns a xs:string created by concatenating the members of the $arg sequence using $separator as a separator. If the value of the separator is the zero-length string, then the members of the sequence are concatenated without a separator.
$argThe sequence to be joined to form the string. If it is empty, a zero-length string is returned.
$separatorThe separator to be placed in the string between the items of $arg

Returns the joined string

string-length($arg as xs:string?) xs:integer?
Returns an xs:integer equal to the length in characters of the value of $arg. If the value of $arg is the empty sequence, the xs:integer 0 is returned. If no argument is supplied, $arg defaults to the string value (calculated using fn:string()) of the context item (.). If no argument is supplied or if the argument is the context item and the context item is undefined an error is raised
$argThe input string

Returns the length in characters

string-length() xs:integer?
Returns an xs:integer equal to the length in characters of the value of the context item. If the context item is undefined an error is raised.

Returns the length in characters

string-pad($arg as xs:string?, $count as xs:integer) xs:string?
Returns an xs:string consisting of a number copies of $arg concatenated together without any separators. The number of copies is specified by $count.
$argThe string to be duplicated
$countThe number of copies of $arg to be returned

Returns the duplicated string

Deprecated: fn:string-pad(...) is not part of the W3C specification. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

string-to-codepoints($arg as xs:string?) xs:integer*
Returns the sequence of unicode code points that constitute an xs:string. If $arg is a zero-length string or the empty sequence, the empty sequence is returned.
$argThe input string

Returns the sequence of code points

subsequence($source as item()*, $starting-at as xs:double) item()*
Returns a subsequence of the items in $source-sequence, items starting at the position, $starting-at, up to the end of the sequence are included.
$sourceThe source sequence
$starting-atThe starting position in the $source

Returns the subsequence

subsequence($source as item()*, $starting-at as xs:double, $length as xs:double) item()*
Returns a subsequence of the items in $source, starting at the position, $starting-at, including the number of items indicated by $length.
$sourceThe source sequence
$starting-atThe starting position in the $source
$lengthThe length of the subsequence

Returns the subsequence

substring($source as xs:string?, $starting-at as xs:double) xs:string?
Returns the portion of the value of $source beginning at the position indicated by the value of $starting-at and continuing to the end of $source. The characters returned do not extend beyond the end of $source. If $starting-at is zero or negative, only those characters in positions greater than zero are returned.If the value of $source is the empty sequence, the zero-length string is returned.
$sourceThe source string
$starting-atThe starting position

Returns the substring

substring($source as xs:string?, $starting-at as xs:double, $length as xs:double) xs:string?
Returns the portion of the value of $source beginning at the position indicated by the value of $starting-at and continuing for the number of characters indicated by the value of $length. The characters returned do not extend beyond the end of $source. If $starting-at is zero or negative, only those characters in positions greater than zero are returned. If the value of $source is the empty sequence, the zero-length string is returned.
$sourceThe source string
$starting-atThe starting position
$lengthThe number of characters in the substring

Returns the substring

substring-after($source as xs:string?, $search as xs:string?) xs:string?
Returns the substring of the value of $source that follows the first occurrence of a sequence of the value of $search. If the value of $source or $search is the empty sequence it is interpreted as the zero-length string. If the value of $search is the zero-length string, the zero-length string is returned. If the value of $source does not contain a string that is equal to the value of $search, the zero-length string is returned.
$sourceThe input string
$searchThe search string

Returns the substring after $search

substring-after($source as xs:string?, $search as xs:string?, $collation-uri as xs:string) xs:string?
Returns the substring of the value of $source that follows the first occurrence of a sequence of the value of $search in the collation $collation-uri. If the value of $source or $search is the empty sequence it is interpreted as the zero-length string. If the value of $search is the zero-length string, the zero-length string is returned. If the value of $source does not contain a string that is equal to the value of $search, the zero-length string is returned. The third argument $collation-uri is relative so you only need to specify the last part of a valid full collation-uri, e.g. '?lang=sv-SE', 'lang=sv-SE;strength=primary;decomposition=standard' or 'swedish'.
$sourceThe input string
$searchThe search string
$collation-uriThe collation URI

Returns the substring after $search

substring-before($source as xs:string?, $search as xs:string?) xs:string?
Returns the substring of the value of $source that precedes the first occurrence of a sequence of the value of $search. If the value of $source or $search is the empty sequence it is interpreted as the zero-length string. If the value of $search is the zero-length string, the zero-length string is returned. If the value of $source does not contain a string that is equal to the value of $search, the zero-length string is returned.
$sourceThe input string
$searchThe search string

Returns the substring before $search

substring-before($source as xs:string?, $search as xs:string?, $collation-uri as xs:string) xs:string?
Returns the substring of the value of $source that precedes the first occurrence of a sequence of the value of $search in the collation $collation-uri. If the value of $source or $search is the empty sequence it is interpreted as the zero-length string. If the value of $search is the zero-length string, the zero-length string is returned. If the value of $source does not contain a string that is equal to the value of $search, the zero-length string is returned. The third argument $collation-uri is relative so you only need to specify the last part of a valid full collation-uri, e.g. '?lang=sv-SE', 'lang=sv-SE;strength=primary;decomposition=standard' or 'swedish'.
$sourceThe input string
$searchThe search string
$collation-uriThe collation URI

Returns the substring before $search

sum($arg as xs:anyAtomicType*) xs:anyAtomicType
Returns a value obtained by adding together the values in $arg. If $arg is the the empty sequence the xs:double value 0.0e0 is returned.
$argThe sequence of numbers to be summed up

Returns the sum of all numbers in $arg

sum($arg as xs:anyAtomicType*, $default as xs:anyAtomicType?) xs:anyAtomicType
Returns a value obtained by adding together the values in $arg. If $arg is the the empty sequence then $default is returned.
$argThe sequence of numbers to be summed up
$defaultThe default value if $arg computes to the empty sequence

Returns the sum of all numbers in $arg

timezone-from-date($date as xs:date?) xs:dayTimeDuration?
Returns the timezone component of $date if any. If $date has a timezone component, then the result is an xs:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. Otherwise, the result is the empty sequence.If $date is the empty sequence, returns the empty sequence.
$dateThe date as xs:date

Returns the timezone component from $date

timezone-from-dateTime($date-time as xs:dateTime?) xs:dayTimeDuration?
Returns the timezone component of $date-time if any. If $date-time has a timezone component, then the result is an xdt:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. Otherwise, the result is the empty sequence.
$date-timeThe date-time as xs:dateTime

Returns the timezone component from $date-time

timezone-from-time($time as xs:time?) xs:dayTimeDuration?
Returns the timezone component of $time if any. If $time has a timezone component, then the result is an xdt:dayTimeDuration that indicates deviation from UTC; its value may range from +14:00 to -14:00 hours, both inclusive. Otherwise, the result is the empty sequence.
$timeThe time as xs:time

Returns the timezone component from $time

tokenize($input as xs:string?, $pattern as xs:string) xs:string+
Breaks the input string $input into a sequence of strings, treating any substring that matches pattern $pattern as a separator. The separators themselves are not returned.
$inputThe input string
$patternThe tokenization pattern

Returns the token sequence

tokenize($input as xs:string?, $pattern as xs:string, $flags as xs:string) xs:string+
Breaks the input string $input into a sequence of strings, treating any substring that matches pattern $pattern as a separator using $flags, see http://www.w3.org/TR/xpath-functions/#flags. The separators themselves are not returned.
$inputThe input string
$patternThe tokenization pattern
$flagsThe flags

Returns the token sequence

trace($value as item()*, $label as xs:string) item()*
This function is intended to be used in debugging queries by providing a trace of their execution. The input $value is returned, unchanged, as the result of the function. In addition, the inputs $value, converted to an xs:string, and $label is directed to a trace data set in the eXist log files.
$valueThe value
$labelThe label in the log file

Returns the labelled $value in the log

translate($arg as xs:string?, $map as xs:string, $trans as xs:string) xs:string
Returns the value of $arg modified so that every character in the value of $arg that occurs at some position N in the value of $map has been replaced by the character that occurs at position N in the value of $trans. If the value of $arg is the empty sequence, the zero-length string is returned. Every character in the value of $arg that does not appear in the value of $map is unchanged. Every character in the value of $arg that appears at some position M in the value of $map, where the value of $trans is less than M characters in length, is omitted from the returned value. If $map is the zero-length string $arg is returned. If a character occurs more than once in $map, then the first occurrence determines the replacement character. If $trans is longer than $map, the excess characters are ignored. i.e. fn:translate("bar","abc","ABC") returns "BAr"
$argThe string to be translated
$mapThe map string
$transThe translation string

Returns the translated string

true() xs:boolean
Always returns the boolean value true

Returns true

unordered($arg as item()*) item()*
Takes a sequence $arg as input and returns an arbitrary implementation dependent permutation of it. Currently, this has no effect in eXist, but it might be used for future optimizations.
$argThe input sequence

Returns the input sequence in an arbitrary implementation dependent permutation

upper-case($arg as xs:string?) xs:string
Returns the value of $arg after translating every character to its upper-case correspondent as defined in the appropriate case mappings section in the Unicode standard. For versions of Unicode beginning with the 2.1.8 update, only locale-insensitive case mappings should be applied. Beginning with version 3.2.0 (and likely future versions) of Unicode, precise mappings are described in default case operations, which are full case mappings in the absence of tailoring for particular languages and environments. Every lower-case character that does not have an upper-case correspondent, as well as every upper-case character, is included in the returned value in its original form.
$argThe text to be converted to all upper-case characters

Returns the resulting upper-case text

xcollection($collection-uris as xs:string+, ...) node()*
Returns the document nodes in the collections $collection-uris non-recursively, i.e. does not include document nodes found in sub-collections. C.f. fn:collection(). Collection URIs can be specified either as a simple collection path or an XMLDB URI.
$collection-urisThe collection URIs

Returns the document nodes from the specified collections excluding sub-collections

Deprecated: This function is eXist-specific and deprecated. It should not be in the standard functions namespace. Please use http://exist-db.org/xquery/xmldb:xcollection() instead. This function could be removed at anytime during the 1.5 development and will be removed in the 1.6 release.

year-from-date($date as xs:date?) xs:integer?
Returns an xs:integer representing the year in the localized value of $date. The value may be negative.
$dateThe date as xs:date

Returns the year component from $date

year-from-dateTime($date-time as xs:dateTime?) xs:integer?
Returns an xs:integer representing the year in the localized value of $date-time. The value may be negative.
$date-timeThe date-time as xs:dateTime

Returns the year component from $date-time

years-from-duration($duration as xs:yearMonthDuration?) xs:integer?
Returns an xs:integer representing the years component in the canonical lexical representation of the value of $duration. The result may be negative.
$durationThe duration as xs:yearMonthDuration

Returns the years component of $duration

zero-or-one($arg as item()*) item()?
Returns the argument sequence $arg if it contains zero or one items. Otherwise, raises an error.
$argThe sequence to be tested for cardinality

Returns the input sequence if it contains zero or one items.

http://xproc.net/xproc

xproc:declare-step($primary,$secondary,$options,$currentstep,$outputs)

xproc:for-each($primary,$secondary,$options,$currentstep,$outputs)

xproc:replace-matching-elements($element as element(),$select,$defaultname,$currentstep,$outputs) as element()

xproc:viewport($primary,$secondary,$options,$currentstep,$outputs)

xproc:library($primary,$secondary,$options,$step)

xproc:pipeline($primary,$secondary,$options,$step)

xproc:variable($primary,$secondary,$options,$step)

xproc:group($primary,$secondary,$options,$currentstep,$outputs)

xproc:try($primary,$secondary,$options,$currentstep,$outputs)

xproc:catch($primary,$secondary,$options,$currentstep,$outputs)

xproc:choose($primary,$secondary,$options,$currentstep,$outputs)

xproc:run-step($primary,$secondary,$options,$step,$outputs)

xproc:get-step($stepname as xs:string,$declarestep)

xproc:type($stepname as xs:string,$is_declare-step) as xs:string

xproc:generate-explicit-input($step,$count,$xproc,$unique_before,$unique_id,$allstep)

xproc:generate-explicit-output($step)

xproc:generate-explicit-options($step)

xproc:generate-step-binding($step,$xproc,$count,$stepname,$is_declare-step,$unique_id,$unique_before,$allstep)

xproc:generate-component-binding($step,$xproc,$count,$stepname,$is_declare-step,$unique_id,$unique_before,$compstep)

xproc:generate-declare-step-binding($step,$is_declare-step)

xproc:explicitbindings($xproc,$unique_id)

xproc:resolve-empty-binding()

xproc:resolve-inline-binding($child)

xproc:resolve-document-binding($child)

xproc:resolve-data-binding($child)

xproc:resolve-stdin-binding($result,$current-step-name)

xproc:resolve-primary-input-binding($result,$pipeline-name)

xproc:resolve-non-primary-input-binding($result,$child,$pipeline-name)

xproc:resolve-pipe-binding($result,$child)

xproc:resolve-port-binding($child,$result,$pipeline,$currentstep)

xproc:eval-primary($pipeline,$step,$currentstep,$primaryinput,$result)

xproc:eval-secondary($pipeline,$step,$currentstep,$primaryinput,$result)

xproc:eval-options($pipeline,$step)

xproc:eval-outputs($pipeline,$step)

xproc:evalstep ($step,$namespaces,$primaryinput,$pipeline,$outputs)

xproc:genstepnames($steps) as xs:string*

xproc:parse_and_eval($pipeline,$namespaces,$stdin,$bindings)

xproc:parse_and_eval($pipeline,$namespaces,$stdin,$bindings,$outputs)

xproc:enum-namespaces($pipeline)

xproc:resolve-external-bindings($bindings,$pipelinename)

xproc:output($result,$dflag)

xproc:run($pipeline,$stdin)

xproc:run($pipeline,$stdin,$debug)

xproc:run($pipeline,$stdin,$debug,$bindings,$options)

xproc:run($pipeline,$stdin,$dflag,$tflag,$bindings,$options)

xproc:run($pipeline,$stdin,$dflag,$tflag,$bindings,$options,$outputs)
Return to list of all modules