RE: Recursive replacement

David
Surely, you're right- I've forgotten about this.
Just another pair of questions (I'm sorry for my tiresomeness):

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?
Regards, Leonid Novak






> -----Original Message-----
> From: www-ql-request@w3.org [mailto:www-ql-request@w3.org] On Behalf Of
> David Carlisle
> Sent: Monday, January 30, 2006 7:08 PM
> To: novak@ispras.ru
> Cc: martin@x-hive.com; www-ql@w3.org
> Subject: Re: Recursive replacement
> 
> 
> 
> > Thus they preserve their identity (am I right?).
> 
> I don't think so, The semantics of  "element new-node {$p/*}"
> (in Xquery, without the update extensions) are that the expression
> inside the {} is evaluated to get a sequence, and then that sequence is
> _copied_ to form child nodes of the newly created element node.
> So the <a/> that's below the <newnode> has a new identity.
> 
> 
> http://www.w3.org/TR/xquery/#id-computedElements
> says
> 
>    The content expression of a computed element constructor (if present)
> is
>    processed in exactly the same way as an enclosed expression in the
>    content of a direct element constructor,
> 
> 
> and that says
> 
> http://www.w3.org/TR/xquery/#dt-direct-elem-const
> 
> 
>    The result of an element constructor is a new element node, with its
>    own node identity. All the attribute and descendant nodes of the new
>    element node are also new nodes with their own identities, even if they
>    are copies of existing nodes.
> 
> David
> 
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________

Received on Monday, 30 January 2006 16:45:03 UTC