[XSLT2.0] Aliasing the XML Namespace

Section 11.1.4 contains the note:

It is not possible to define an alias for the XML namespace
http://www.w3.org/XML/1998/namespace because there is a specific
provision in [XML Namespaces 1.0] (see erratum NE05) that disallows the
use of this namespace URI with any prefix other than xml.

This note is incorrect. The following is quite legitimate, and even
useful:

<xsl:stylesheet xmlns:axml="alias-xml"...>

<xsl:namespace-alias stylesheet-prefix="axml" result-prefix="xml">

<xsl:template match="z">
  <lre axml:space="preserve">

  </lre>
</xsl:template>

The new rules for xsl:namespace-alias make it clear that this cannot
result in a namespace node being generated that binds the prefix axml to
the XML namespace http://www.w3.org/XML/1998/namespace, therefore the
constraint quoted in this note is not violated. Under the XSLT 1.0
rules, it would work provided the implementation was careful in its
choice of prefixes.

Michael Kay

Received on Saturday, 21 February 2004 06:40:41 UTC