[Bug 4869] [FS] Enclosed expressions and namespaces

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





------- Comment #20 from mike@saxonica.com  2008-02-12 22:37 -------
In discussion on 12 Feb 2008 there was some sentiment to adopting David
Carlisle's suggestion in comment #16 that the no-preserve effect should apply
to namespace declarations in all element constructors, and not only to those in
"directly enclosed" element constructors.

This involves changing the first two bullets of 3.7.1.2 to read:

<quote>
# If the prefix of the attribute name is xmlns, then the local part of the
attribute name is interpreted as a namespace prefix and the value of the
attribute is interpreted as a namespace URI. This prefix and URI are added to
the statically known namespaces of the constructor expression (overriding any
existing binding of the given prefix). If the namespace URI is a zero-length
string and the implementation supports [XML Names 1.1], any existing namespace
binding for the given prefix is removed from statically known namespaces of the
constructor expression. If the namespace URI is a zero-length string and the
implementation does not support [XML Names 1.1], a static error is raised
[err:XQST0085]. It is implementation-defined whether an implementation supports
[XML Names] or [XML Names 1.1].

# If the name of the namespace declaration attribute is xmlns with no prefix,
the value of the attribute is interpreted as a namespace URI. This URI
specifies the default element/type namespace of the constructor expression
(overriding any existing default). If the namespace URI is a zero-length
string, the default element/type namespace of the constructor expression is set
to "none".

<aside>There really isn't any good reason why this should have a dependency on
XML Namespaces 1.1</aside>

<provisional>
Furthermore, if copy-namespaces mode specifies "preserve", and if the namespace
URI is not a zero-length string, then the namespace binding implied by the
above rules is added to the in-scope namespaces of the constructed element.
</provisional>
</quote>

Now, this doesn't say anything about namespace undeclarations like xmlns="" or
xmlns:p="". The current spec talks about these *removing* a namespace binding
from the constructed element - which is rather odd because how can they have a
binding that needs removing? The answer seems to lie in section 3.7.4, which
appears to overlap 3.7.1.2 in various ways (and is not referenced from it,
which caused me a lot of grief in writing this proposal!) So I think the answer
is to remove the text above marked <provisional>, and instead add after the
three bullets:

<para>Namespace declarations also cause in-scope namespace bindings to be added
to the constructed element node, as described in section 3.7.4.</para>

In 3.7.4, replace the first two bullets by:

* if copy-namespaces mode includes "preserve", a namespace binding is created
for each namespace declared by a namespace declaration attribute in the current
element constructor or in an enclosing direct element constructor. (A namespace
is so declared if the namespace URI is not a zero-length string, and if the
declaration is not overridden within the current element constructor or an
intermediate constructor).

Delete the Note, which is no longer true.

Finally, apply the change described in comment #12

Received on Tuesday, 12 February 2008 22:37:25 UTC