W3C home > Mailing lists > Public > www-ql@w3.org > January to March 2006

Re: Recursive replacement

From: Martin Probst <martin@x-hive.com>
Date: Mon, 30 Jan 2006 16:33:13 +0100
To: David Carlisle <davidc@nag.co.uk>
Cc: novak@ispras.ru, www-ql@w3.org
Message-Id: <1138635194.7862.25.camel@localhost.localdomain>

> > 2) for $p in fn:doc("test.xml")//a 
> >    do replace {$p}
> >       with element "new-node" {$p/*}
> 
> Hmm I'll leave that one for a WG member to answer.., I think that you
> should get get an error from
> http://www.w3.org/TR/xqupdate/#id-extensions-to-existing
> 
>   All the pending update lists generated by the previous step are merged
>   by successive invocations of the upd:mergeUpdates operation. If the
>   upd:mergeUpdates operation signals an incompatibility, a dynamic error
>   is raised [err:TBD].  
> 
> But I don't actually see that in the table in
> http://www.w3.org/TR/xqupdate/#id-compatibility
> which has side condition "Not compatible if t1 is t2." in some cases
> looks to me as if it should be t1 is an ancestor to t2

Well, the constructor "element new-node {$p/*}" copies the contents of
the node $p, so the outermost <a/> node is replaced with
<new-node><b><a/></b></new-node>.

There is also a rename operation for exactly this (changing a node name
without changing it's identity).

Martin
Received on Monday, 30 January 2006 15:33:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:43:44 UTC