RE: Recursive replacement

Martin Probst <[email protected]> Mon, 30 Jan 2006 19:37:59 +0100
Newsgroups gmane.comp.web.query-languages
Organization X-Hive Corporation
Message-ID <[email protected]>
> document: <root><a/><b><c/></b></root>
> 
> 1) 
> query insert doc("test.xml)//c into doc("test.xml)//a
> 
> result: <root><a><c/></a><b/></root>
> 
> 2)
> query for $i in doc("test.xml)//root/* do insert doc("test.xml)//c into $i
> 
> result: implementation-dependent
> 
> Am I right?

I don't think inserting a node that is currently in the tree moves it
away. The spec refers to the way it's done within element constructors.
Why should "insert" move something around anyways?

In both cases each of the target elements gets a <c/> inserted, but
those are always copies of the original nodes.

Martin