Changes

Jump to navigation Jump to search
173 bytes added ,  14:22, 8 March 2013
added context example
|Evaluates {{Code|$query}} as XQuery expression at runtime and returns the resulting items.<br />Variables and context items can be declared via {{Code|$bindings}}. The specified keys must be QNames or strings, the values can be arbitrary item sequences:
* variables specified as QNames will be directly interpreted as variable name.
* variables specified as xs:string may be prefixed with a dollar sign. Namespace can be specified using the [http://www.jclark.com/xml/xmlns.htm Clark Notation]. * If the specified string is empty, the value will be bound to the context item.
|-
| '''Errors'''
|
* {{Code|xquery:eval("1+3")}} returns {{Code|4}}.<br />
* You can bind the context and e.g. operate on a certain database only:<br />
<pre class='brush:xquery'>
xquery:eval("//country", map{ '' := db:open('factbook') })
</pre>
* The following expressions use strings as keys. All of them return 'XML':<br/>
<pre class='brush:xquery'>
administrator, editor
28

edits

Navigation menu