Changes

Jump to navigation Jump to search
186 bytes removed ,  04:43, 4 January 2016
===User-Defined Functions===
 
To use updating expressions within a user-defined or anonymous function, the {{Code|%updating}} annotation has to be added before the {{Code|function}} keyword. A correct declaration of a function that contains updating expressions (or one that calls updating functions) looks like this:
 
<pre class="brush:xquery">
declare %updating function { ... }
</pre>
If an updating function item is called, the function call must be prefixed with the keyword {{Code|updating}}. This ensures that the query compiler can statically detect if an invoked function item will perform updates or not:
let $node := <node>TO-BE-DELETED</node>
let $delete-text := %updating function($node) {
delete node $node//text()
}
return $node update (
)
</pre>
 
As shown in the example, user-defined and anonymous functions can additionally be annotated as {{Code|%updating}} (with {{Version|8.4}}, the annotation has become optional).
=Concepts=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu