W3C home > Mailing lists > Public > public-qt-comments@w3.org > July 2005

[Bug 1817] New: [XSLT 2.0] Incorrect example for xsl:namespace

From: <bugzilla@wiggum.w3.org>
Date: Tue, 26 Jul 2005 13:54:49 +0000
To: public-qt-comments@w3.org
Cc:
Message-Id: <E1DxPtR-0005y8-Bv@wiggum.w3.org>

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

           Summary: [XSLT 2.0] Incorrect example for xsl:namespace
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 2.0
        AssignedTo: mike@saxonica.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


In section 11.7, xsl:namespace, we find the example:

<quote>
Example: Conflicting Namespace Prefixes

Given the instruction:

<p:item xmlns:p="p.uri"><xsl:namespace name="p">q.uri</xsl:namespace></p:item>

a possible serialization of the result tree is:

<ns0:item xmlns:ns0="p.uri" xmlns:p="q.uri"/>

The processor must invent a namespace prefix for the URI p.uri; it cannot use
the prefix p because that prefix has been explicitly associated with a different
URI.
</quote>

In fact, the processor is not allowed to invent a prefix for p.uri: the rules
for literal result elements say that namespace nodes must be copied from the
stylesheet. So there is a conflict here, which should result in error XTDE0430.
Namespace prefixes can be invented only in the case of namespace nodes generated
by namespace fixup. So a better example would be:

    <xsl:element name="p:item" xmlns:p="p.uri">
       <xsl:namespace name="p">q.uri</xsl:namespace>
    </xsl:element>

Here the processor can, and must, choose a prefix for p.uri that does not
conflict with the binding of p to q.uri.

Michael Kay
(this originated in a Saxon bug report from Colin Adams, who pointed out that
Saxon was giving different results for this example than the result stated in
the spec.)
Received on Tuesday, 26 July 2005 13:55:03 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:25 UTC