W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2003

RE: [XSLT2] 11.1.4 ns alias: implementation-dependent prefixes

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Tue, 2 Sep 2003 12:30:23 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DD0CA@daemsg02.software-ag.de>
To: Oliver Becker <obecker@informatik.hu-berlin.de>, public-qt-comments@w3.org
> Section 11.1.4 (Namespace Aliasing) of the XSLT 2.0 WD states 
> that "The namespace prefix that will be used in the 
> serialized output document 
> is implementation-dependent."
> I think the specification should either provide a way to let 
> the user choose the serialized prefix, or define unambigously 
> which prefix will be used.

I have some sympathy with the idea that we should try to make this more
interoperable, however, I think we need to retain the principle that
prefixes are not held in element and attribute nodes, only in namespace
nodes, and this constrains the solution.

In fact, I think the example we have added to XSLT 2.0 is inconsistent with
what the specification says. Suppose you write:


<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>

<xsl:template match="/">
  <axsl:template match="xsl:template"/>


Then the axsl:template element in the stylesheet has a namespace node
(axsl=file://namespace.alias), and the effect of the rules as written is
that the result tree must therefore have a namespace node
(axsl=http://www.w3.org/1999/XSL/Transform). Therefore, the namespace
declaration xmlns:axsl="http://www.w3.org/1999/XSL/Transform" must appear in
the serialized result. Contrariwise, there is nothing that obliges the
processor to include the namespace declaration
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" in the result, though the
rules for namespace fixup allow this, I think, as an additional namespace.

> I have two use cases in mind:
> 1. The prefix (within a QName) appears within the data of the 
> resulting XML. For example, a stylesheet that generates a 
> stylesheet which in turn processes as stylesheet. 
> <xsl:template match="...">
>    <axsl:template match="xsl:template"> <!-- or 
> match="axsl:template" ? -->
>       ...
>    </axsl:template>
> </xsl:template>
> Saxon 7.6.5 chooses to use the xsl prefix, so only the 
> version above works. Xalan 2.5.1 uses the axsl prefix, so 
> only the other version would work. (Saxon 6.5.3 declares both 
> prefixes in the result, so this might be a solution.)

If my analysis above is correct, it is safe to write match="axsl:template",
and Saxon 7.6.5 is getting it wrong.

> 2. The result uses the xml namespace 
> http://www.w3.org/XML/1998/namespace.
> <xsl:namespace-alias 
> stylesheet-prefix="axml" result-prefix="xml" />  
> <xsl:template match="...">
>    <result axml:space="preserve">
>       <xsl:apply-templates />
>    </result>
> </xsl:template>
> According to XML Namespaces 1.1 (Section 3; Namespace constraints), 
> no other than the xml prefix may be bound to the namespace 
> http://www.w3.org/XML/1998/namespace.
> That means in this case the result shouldn't use the axml 
> prefix for the serialized output.

Correct. As it happens, I have already added a note to the current internal
draft that points this out.

Michael Kay
Received on Tuesday, 2 September 2003 06:30:38 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:49 UTC