[Bug 5857] [XSLT 2.0] A problem with namespace inheritance

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





--- Comment #3 from Michael Kay <mike@saxonica.com>  2009-01-30 09:26:42 ---
The WG discussed this on 2009-01-29, and asked the editor to investigate the
proposed fix further to make sure there were no unwanted side effects, for
example, by doing a trial implementation.

Meanwhile, a couple of further thoughts.

Firstly, I think the problem in the spec is actually worse than the example
suggests. If you write:

<xsl:template match="/">
  <s:complexType xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns="http://t.com/">
    <s:element ref="abcd" xmlns=""/>
  </s:complexType>
</xsl:template>

then Saxon outputs (I believe correctly):

<?xml version="1.0" encoding="UTF-8"?>
<s:complexType xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns="http://t.com/">
   <s:element ref="abcd"/>
</s:complexType>

so the xmlns="" is lost even in this simple case of a stylesheet consisting
entirely of literal result elements.

Secondly, I think the change needed to the text can be done more simply than
proposed in comment #2, by deleting the text between <delete>...</delete>
below:

<quote>
If the newly constructed node is an element node, and if namespaces are
inherited, then each namespace node of the newly constructed element (including
any produced as a result of the namespace fixup process) is copied to each
descendant element of the newly constructed element, unless that element or an
intermediate element already has a namespace node with the same name
<delete>(or
absence of a name)</delete> or <delete>that descendant element or an
intermediate element is in no namespace and</delete> the namespace node has no
name.
</quote>

The fact that the fix simplifies the rules rather than complicating them must
be encouraging. An alternative formulation is:

<quote>
If the newly constructed node is an element node, and if namespaces are
inherited, then each named (that is, non-default) namespace node of the newly
constructed element (including any produced as a result of the namespace fixup
process) is copied to each descendant element of the newly constructed element,
unless that element or an intermediate element already has a namespace node
with the same name.
</quote>

I've also looked a little bit at XQuery to see if the same problem exists
there. The answer is that it's slightly different, because of the way
copy-namespaces applies to enclosed expressions. I don't think this sheds any
useful light (in fact, it only muddies the waters), so I'll pursue the
analogous XQuery questions in a separate forum.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 30 January 2009 09:26:52 UTC