Hi Britney,
last one (before I’m on leave):
Description : In a replace expression, a target is replaced more than once. Examples : let $a := <x>x</x>/node() return (replace node $a with <a/>, replace node $a with <b/>)
The W3 XQuery Update Facility does not allow you to replace the same some multiple times. In practice, this turns out to be a very helpful restriction, because it helps you to find bugs in your code (it never makes sense to replace the same node multiple times, because only one replacement would be visible in the result anyway).
Is there a BaseX option to allow multiple "replace" in one query on the same document ?
As long as you don’t try to replace the same node, that’s absolutely possible. An example:
copy $xml := <xml><a/><b/></xml> modify ( replace node $xml/a with <abc/>, replace node $xml/b with <def/> ) return $xml
I’m not 100% sure which result you would have expected in your original example. Maybe the following query matches your requirements?
let $a := <x>x</x>/node() return ( replace node $a with (<b/>, <c/>) )
Fore more details on the semantics of XQuery Update, feel free to check out our documentation [1] or Xavier Franc’s nice introduction [2].
Cheers, C.
[1] http://docs.basex.org/wiki/XQuery_Update [2] http://www.xmlmind.com/tutorials/XQueryUpdate/