[Bug 4763] 1.0.3dev: K2-InScopePrefixesFunc-12

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


frans.englich@telia.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|andrew.eisenberg@us.ibm.com |frans.englich@telia.com




------- Comment #1 from frans.englich@telia.com  2007-06-27 09:20 -------
I have this problem that I forget things after I've finished it -- and that
clearly doesn't work for exotic topics like namespaces!

A reduced, free-standing test case for what we're discussing is, I believe:

declare default element namespace "http://www.example.com/";
count(in-scope-prefixes(element {QName("", "a")} {}))

My implementation and Saxon 8.9.0.3J evaluates this to 2.

The second bullet point in 3.7.1.2 Namespace Declaration Attributes seems
relevant, but contradictory. It says:

"This URI specifies the default element/type namespace of the constructor
expression (overriding any existing default), and is added (with no prefix) to
the in-scope namespaces of the constructed element (overriding any existing
namespace binding with no prefix)." and then continues to say:

"If the namespace URI is a zero-length string, the default element/type
namespace of the constructor expression is set to "none," and any no-prefix
namespace binding is removed from the in-scope namespaces of the constructed
element."

I guess it can be seen as an elaborated way of saying "if the prefix is empty
and the namespace URI is empty, any existing binding to the empty prefix is
removed"(not that I see how there's anything to remove for a newly created
node).

I'm trying to reconstruct why Mike and I implemented it the way we did. The
problem I see is how do you make sure, e.g when serializing, that a node
actually gets the empty default namespace when being attached as a child with a
non-empty namespace, without having an empty binding for the default namespace?
That is, when serializing this:

<e xmlns="http://example.com/">
    {element {QName("", "a")} {}}
</e>

how would the result be <e xmlns="http://example.com/"><a xmlns=""/></e>,
without a binding for a's empty namespace?

Received on Wednesday, 27 June 2007 09:20:18 UTC