[xsl] Namespace-alias using #default with no default namespace in scope

Subject: [xsl] Namespace-alias using #default with no default namespace in scope
From: "Buchcik, Kasimier" <k.buchcik@xxxxxxxxxxxx>
Date: Thu, 11 May 2006 21:54:57 +0200
Hi,

This is an XSLT 1.0 issue.

With XSLT 2.0 processors, a value of "#default" either for the
stylesheet-prefix or result-prefix of an xsl:namespace-alias
will raise a static error.

For XSLT 1.0 processors, the spec has not provided a rule (I can't
find such a rule) for not-is-scope default namespaces wrt
xsl:namespace-alias;
the results of some XSLT 1.0 processors differ.

What would be the best/intuitive/logical result for the following
scenario (run with an XSLT 1.0 processor)?

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:foo="urn:test:foo">

  <xsl:namespace-alias stylesheet-prefix="foo"
result-prefix="#default"/>

  <xsl:template match="/">
    <foo:foo xmlns="urn:test:default">
      <foo:bar/>
    </foo:foo>
  </xsl:template>

</xsl:stylesheet>

Libxslt (looks like a bug):
<?xml version="1.0"?>
<foo xmlns="urn:test:default"
xmlns:foo="urn:test:default"><foo:bar/></foo>

Xalan-J:
"java.lang.RuntimeException: java.lang.NullPointerExceptio"

Saxon 6.5.3 (isn't xmlns:foo="" allowed only for XML 1.1 ?):
<?xml version='1.0' ?>
<foo:foo xmlns:foo="" xmlns="urn:test:default"><foo:bar/></foo:foo>

MSXML .NET (this is my favorite result, although the ns-declaration is
gone):
<?xml version='1.0' encoding='utf-8' ?>
<foo><bar/></foo>

Any other ideas for a possible result?

Regards,

Kasimier

Current Thread