[Bug 1272] 3.7.4 In-scope Namespaces of a Constructed Element looks buggy

http://www.w3.org/Bugs/Public/show_bug.cgi?id=1272





------- Additional Comments From jonathan.robie@datadirect.com  2005-04-26 15:26 -------
Let me check my understanding with a few queries.

Example 1:

<e1 xmlns:p="abc">{<e2/>}</e1>//e2

When <e2/> is constructed, the rules of 3.7.4 apply, so <e2/> does
indeed inherit the namespaces of the enclosing element
constructors. When <e2/> is copied into <e1/>, the rules of 3.7.1.3
apply, so these namespaces are preserved. So the result of the above
query is:

<e2 xmls:p="abc"/>


Example 2:

declare copy-namespaces preserve,no-inherit;
let $e := <e/>
return <ee xmlns:p="abc"><e/>{$e, <e/>}</ee>//*

In the let clause, there is no enclosing element constructor, so the
element does not inherit the xmlns:p binding. The other two do. So the
result is:

<e xmlns:p="abc"/>
<e/>
<e xmlns:p="abc"/>

Does that match your understanding?

Namespaces are way too complicated in XQuery - this is mostly a
problem for the implementor, rather than the user, but it definitely
makes the language more complex...

Jonathan

Received on Tuesday, 26 April 2005 15:26:54 UTC