On 11/14/17, 1:42 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of
Christian Grün" wrote:
> How can database updating be done inside map:for-each ?
The higher-order functions of the XQuery spec are currently restricted
to non-updating functions. You can circumvent this restriction by
enabling the MIXUPDATES option, or using traditional iterations (which
are, at least, not much slower than map:for-each):
for $key in map:keys($map)
let $val := $map($key)
return (...)
I will offer that if the question is being asked because it matches what would
be done in other languages, it’s probably a good idea to read about functional
programming, which XQuery is associated with. A purely functional program
would not directly cause side-effects within a function.
At least, some familiarity with functional programming is fundamentally
important in learning about XQuery.
Kendall