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 2613 - namespace-alias and #default
Summary: namespace-alias and #default
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Candidate Recommendation
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-12-21 16:43 UTC by Michael Kay
Modified: 2006-03-10 21:18 UTC (History)
0 users

See Also:


Attachments
A stylesheet that demonstrates the incompatibility (556 bytes, application/xml+xslt)
2006-01-27 19:48 UTC, Michael Kay
Details

Description Michael Kay 2005-12-21 16:43:45 UTC
Some time ago, I think in response to a comment from Oliver Becker during the
first last call [1], we decided that it should be an error for
xsl:namespace-alias to specify stylesheet-prefix="#default" if there is no
default namespace (that is, if the declaration xmlns="" is in force explicitly
or implicitly). The same applies to result-prefix.

I've recently got around to implementing this decision and it breaks a few XSLT
1.0 test cases. I'm not suggesting that the decision should be changed, but we
should document it as a backwards-incompatibility. 

The XSLT 1.0 spec isn't very clear about what should happen, but some processors
at least adopted the interpretation that xsl:namespace-alias should be able to
move elements from the null namespace into an actual namespace or vice versa,
and that capability no longer exists.


[1] http://lists.w3.org/Archives/Public/public-qt-comments/2003Sep/0009.html
Comment 1 Michael Kay 2006-01-27 19:48:47 UTC
Created attachment 400 [details]
A stylesheet that demonstrates the incompatibility
Comment 2 Michael Kay 2006-01-27 19:49:09 UTC
I was actioned to provide an example of a stylesheet that demonstrates this
incompatibility. An example is attached (it can be used with any source document).

Note that it's unclear in the XSLT 1.0 spec whether this should work or not, but
it does work in Saxon and may well work in other processors. Under Saxon 6.5.5
it produces the result:

<?xml version="1.0" encoding="utf-8"?>
<out xmlns="ns://www.error.com/" xmlns:err="ns://www.error.com/">
   <banana xmlns="">
      <yyy xmlns="ns://www.error.com/"/>
   </banana>
</out>

(Other processors are likely to use "err" as the namespace prefix)

Under Saxon 8.6.1 it produces:

Error at xsl:namespace-alias on line 11 of
file:/C:/MyJava/tests/testsuite/nspc/nspc99055err.xsl:
  XTSE0815: #default cannot be used: there is no default namespace
Failed to compile stylesheet. 1 error detected.
Comment 3 Michael Kay 2006-02-02 19:34:20 UTC
Looking at the behaviour of existing XSLT 1.0 processors, some of them allow
this stylesheet and others reject it. Because it would cause significant impact
on anyone who is using the facility, we decided to remove this error condition
and instead define that the value #default refers to the "null namespace" if no
explicit namespace is bound.
Comment 4 Michael Kay 2006-03-10 21:18:22 UTC
This change has been applied to the spec and the issue is now closed.