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 9812 - [XSLT] Excluded namespace nodes and namespace aliases
Summary: [XSLT] Excluded namespace nodes and namespace aliases
Status: CLOSED WORKSFORME
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 2.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL: http://www.w3.org/TR/xslt20/#dt-targe...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-27 14:03 UTC by Tim Mills
Modified: 2010-07-15 09:56 UTC (History)
0 users

See Also:


Attachments

Description Tim Mills 2010-05-27 14:03:03 UTC
The XSLT 2.0 specification states:

"[Definition: The namespace URI that is to be used in the result tree as a substitute for a literal namespace URI is called the target namespace URI.]"

and later

"A namespace node whose string value is a target namespace URI is copied to the result tree, whether or not the URI identifies an excluded namespace."

Suppose we have two stylesheets:

main.xsl

<xsl:stylesheet
  version="2.0" 
  xmlns="http://www.w3.org/1999/XSL/Transform"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:x="http://www.example.org/alias"
  xmlns:y="http://www.example.org/My/Transform/Language">
	
  <xsl:import href="import.xsl" />

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

  <xsl:template match="/">
    <x:transform />
  </xsl:template>

</xsl:stylesheet>


import.xsl

<xsl:stylesheet
  version="2.0" 
  xmlns="http://www.w3.org/1999/XSL/Transform"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:x="http://www.example.org/alias"
  xmlns:y="http://www.example.org/My/Transform/Language">
	
  <xsl:namespace-alias stylesheet-prefix="x" result-prefix="#default"/>

</xsl:stylesheet>

Is "http://www.w3.org/1999/XSL/Transform" (ordinarily an excluded namespace) considered as a target namespace URI, even though the xsl:namespace-alias is overridden by a higher priority xsl:namespace-alias for the same literal namespace URI?

i.e. is the correct result:

<y:transform 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns="http://www.w3.org/1999/XSL/Transform" 
  xmlns:y="http://www.example.org/My/Transform/Language"/>

or

<y:transform xmlns:y="http://www.example.org/My/Transform/Language"/>

?

I would presume that the latter is correct, because "http://www.w3.org/1999/XSL/Transform" is not going to be used in the result tree as a substitute for a literal namespace URI due to the higher precedence xsl:namespace-alias declaration.
Comment 1 Michael Kay 2010-05-27 15:04:07 UTC
I guess that the statement "If a literal namespace URI is declared to be an alias for multiple different target namespace URIs, then the declaration with the highest import precedence is used." could be expanded with "..., and the other declarations have no effect." Would this remove any remaining doubts?
Comment 2 Tim Mills 2010-05-27 15:10:13 UTC
Yes.  Just to be clear, do you agree that

<y:transform xmlns:y="http://www.example.org/My/Transform/Language"/>

is the correct answer?
Comment 3 Michael Kay 2010-05-27 15:48:52 UTC
I've added this as test case nspc-n144.

The answer I get from Saxon is

<?xml version="1.0" encoding="UTF-8"?>
<y:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
             xmlns="http://www.w3.org/1999/XSL/Transform" 
             xmlns:y="http://www.example.org/My/Transform/Language"/>

which I believe is incorrect, for the reasons described.
Comment 4 Tim Mills 2010-05-27 16:13:13 UTC
Thanks.

We believe we have found a number of errors in the test suite.  Where should we report them?
Comment 5 Michael Kay 2010-05-27 16:18:21 UTC
Please report errors in the XSLT testsuite in the W3C "member-private" Bugzilla database, http://www.w3.org/Member/bugzilla/ - product "XSLT 2.0 CR Test Collection".
Comment 6 Michael Kay 2010-07-15 09:56:09 UTC
Closing as WORKSFORME - the spec is correct, the test case was wrong.