[xquery-talk] XQuery Update: replacing element content with a
sequence of nodes
Jonathan Robie
jonathan.robie at redhat.com
Thu Apr 14 10:59:03 PDT 2011
On 04/14/2011 08:17 AM, Florent Georges wrote:
> Andrew Welch wrote:
>
>> how about replacing the parent node itself instead:
>
>> replace node parent with <parent><one/><two/></parent>
>
> Yes, that's the conclusion I reached too. But I thought replacing
> all the content of an element was a general-enough use case, so I
> thought I missed something.
Andrew's solution works unless your system relies on the identity of the
parent element. If you have external references to a node, e.g. in some
API, then replacing it in this way may not be visible via the external
reference.
I could imagine a future version of XQuery Update that supports this use
case directly, e.g.
replace content of node parent
with (<one/><two/>)
I'm not married to this syntax, but it's analogous to the existing
"replace value of node".
Jonathan
More information about the talk
mailing list