XQuery Function Documentation

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

java:org.exist.xquery.functions.util.UtilModule

A module for various utility extension functions.

util:eval-with-context

util:eval-with-context($expression as item(), $context as node()?, $cache-flag as xs:boolean) as node()*

Dynamically evaluates an XPath/XQuery expression.

Parameters:
$expression The 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.
$context? The 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-flag The flag for whether the compiled query should be cached. The cached querywill be globally available within the db instance.
Returns:
node()* : the results of the evaluated XPath/XQuery expression

util:eval-with-context

util:eval-with-context($expression as item(), $context as node()?, $cache-flag as xs:boolean, $eval-context-item as item()?) as node()*

Dynamically evaluates an XPath/XQuery expression.

Parameters:
$expression The 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.
$context? The 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-flag The flag for whether the compiled query should be cached. The cached querywill be globally available within the db instance.
$eval-context-item? the context item against which the expression will be evaluated
Returns:
node()* : the results of the evaluated XPath/XQuery expression

util:eval-with-context

util:eval-with-context($expression as item(), $context as node()?, $cache-flag as xs:boolean, $eval-context-item as item()?, $pass as xs:boolean) as node()*

Dynamically evaluates an XPath/XQuery expression.

Parameters:
$expression The 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.
$context? The 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-flag The flag for whether the compiled query should be cached. The cached querywill be globally available within the db instance.
$eval-context-item? the context item against which the expression will be evaluated
$pass Passes on the original error info (line and column number). By default, this option is false
Returns:
node()* : the results of the evaluated XPath/XQuery expression