Donate Share

Saxon XSLT and XQuery Processor

Tracker: Bugs

5 Conflicting namespace names - ID: 637117
Last Update: Settings changed ( mhkay )

When an attempt is made to add a namespace node to an
element, and the namespace node uses a prefix that is
already in use for the element name, but with a
different URI, Saxon reports an error. For example,
with Saxon 7.2, the following fails:

<ns:e xmlns:ns="nsone.uri">
<xsl:namespace
name="ns">nstwo.uri</xsl:namespace>
</ns:e>

The same failure occurs in Saxon 6.5.2, if the
namespace node is created using <xsl:copy/> or
<xsl:copy-of/>.

This should not fail, because technically according to
the specification, a prefix for the element name is
only created at serialization time (or namespace fixup
time in XSLT 2.0), in other words no prefix for element
<{nsone.uri}e> should be allocated until the namespace
node has been successfully created.

The error message is "Cannot create two namespace nodes
with the same name".

Applies to 7.2, 6.5.2, and all earlier releases.

Test cases: nspc39, nspc40


Michael Kay ( mhkay ) - 2002-11-12 13:48

5

Closed

Wont Fix

Michael Kay

XSLT conformance

v6.5.2

Public


Comments ( 2 )

Date: 2002-11-18 14:18
Sender: mhkayProject Admin

Logged In: YES
user_id=251681

Fixed in 7.3


Date: 2002-11-12 14:14
Sender: mhkayProject Admin

Logged In: YES
user_id=251681

The example is incorrect, because literal result elements
are required to copy their namespace nodes. The following
example illustrates the problem with 6.5.2:

<xsl:element name="ns:e" namespace="nsone.uri">
<xsl:copy-of select="doc/namespace::ns"/>
</xsl:element>

Here the "ns" prefix in xsl:element is only a suggested
prefix, it should not be used in the result tree until it is
known that the prefix is not being used for a different purpose.

Source code fixed in 7.x branch.

A fix for 6.5.x will be more difficult and I might not
attempt it: it isn't worth risking destabilising the code
for such an obscure problem.


Attached File

No Files Currently Attached

Changes ( 3 )

Field Old Value Date By
status_id Open 2003-08-14 14:22 mhkay
resolution_id None 2003-08-14 14:22 mhkay
close_date - 2003-08-14 14:22 mhkay