This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1817 - [XSLT 2.0] Incorrect example for xsl:namespace
Summary: [XSLT 2.0] Incorrect example for xsl:namespace
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Last Call drafts
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-26 13:54 UTC by Michael Kay
Modified: 2005-07-28 22:37 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2005-07-26 13:54:49 UTC
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.)
Comment 1 Michael Kay 2005-07-28 22:37:32 UTC
The proposed change has been applied. I have also changed the example to use
legal namespace URIs.