The following comment has been added to this issue:
Author: Brian Minchau
Created: Wed, 20 Oct 2004 9:51 AM
Body:
Section 7.1.1 says that the created node in the result tree will have the attribute
nodes that were present on the element node in the stylesheet, other than attributes
with names in the XSLT namespace.
After that initial statement it would seem to me that things can be added to that
created node in the result tree, in particular more namespace nodes can be added with
copy-of.
Section 11.3 (copy-of) says that when the result of evaluating the select expression
is a node-set (which it is here, a set of namespace nodes), that the nodes are copied
to the result tree.
I don't see any caveat in 11.3 about the URI "http://www.w3.org/1999/XSL/Transform".
So it would seem that although with the initial creation that the XSLT namespace is
not copied into the result tree, the copy-of should copy the namespace node declaring
the XSLT namespace with the given prefix.
-------------------------------------------------
After some experimentation (thanks to Henry Zongaro's input) here is another
stylesheet to consider:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:abc="ABC">
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<test1>
<xsl:copy-of select="document('')/xsl:stylesheet/namespace::*"/>
</test1>
<test2>
<xsl:copy-of select="document('')/xsl:stylesheet/namespace::abc"/>
</test2>
<xsl:element name="test3">
<xsl:copy-of select="document('')/xsl:stylesheet/namespace::*"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
-----------------------------------------
Xalan-J interpretive produces this output:
<test1 xmlns:abc="ABC"/>
<test2 xmlns:abc="ABC"/>
<test3/>
Not only is <test1> missing xsl, and <test3> is missing both xsl and abc.
-----------------------------------------
XSLTC produces different, and what I think is the correct output:
<test1 xmlns:abc="ABC" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<test2 xmlns:abc="ABC"/>
<test3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:abc="ABC"/>
--------------------------------------------
Modifying the stylesheet to this (and extra <doc> around the test elements):
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:abc="ABC">
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<doc>
<test1>
<xsl:copy-of select="document('')/xsl:stylesheet/namespace::*"/>
</test1>
<test2>
<xsl:copy-of select="document('')/xsl:stylesheet/namespace::abc"/>
</test2>
<xsl:element name="test3">
<xsl:copy-of select="document('')/xsl:stylesheet/namespace::*"/>
</xsl:element>
</doc>
</xsl:template>
</xsl:stylesheet>
-------------------------------------
With the extra <doc> Xalan-J produces:
<doc xmlns:abc="ABC">
<test1/>
<test2/>
<test3/>
</doc>
So namespace nodes for abc exist on all of test1, test2, test3 (inherited from the
parent <doc>), but xsl is missing from test1 and test3.
------------------------------------
XSLTC produces:
<doc xmlns:abc="ABC">
<test1 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
<test2/>
<test3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>
</doc>
Since test1, test2 and test3 inherit namespace mappings from their ancestors (only abc
here)in the output XML document, test1, test2, and test3 do have all the appropriate
namespace nodes.
-------------------------------------
---------------------------------------------------------------------
View this comment:
http://issues.apache.org/jira/browse/XALANJ-1959?page=comments#action_54399
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/XALANJ-1959
Here is an overview of the issue:
---------------------------------------------------------------------
Key: XALANJ-1959
Summary: Failure to copy namespace nodes
Type: Bug
Status: Unassigned
Priority: Major
Project: XalanJ2
Components:
Xalan-interpretive
parse-or-compile
Versions:
2.6
Assignee:
Reporter: elharo
Created: Mon, 20 Sep 2004 12:33 PM
Updated: Wed, 20 Oct 2004 9:51 AM
Description:
Another OASIS test suite discrepancy. This time libxslt agrres with Xalan, but on
reflection I think the test case is correct and Xalan and libxslt are wrong.
The test case is:
xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Purpose: Test case for bug 70935 -->
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<test><xsl:copy-of select="document('')/xsl:stylesheet/namespace::xsl"/></test>
</xsl:template>
</xsl:stylesheet>
The expected output is:
<test xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
</test>
The actual output is
<test>
</test>
The namespace node has not been copied.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]