There is a bug opened for a very similar problem. 
http://issues.apache.org/jira/browse/XALANJ-1959. You can open a new bug 
report, attach your test case and refer to XALANJ-1959.

Thanks,

Christine Li
XML Transformation
IBM Toronto Lab
Tel: (905)413-2601
Email: [EMAIL PROTECTED]



"Łukasz Budnik" <[EMAIL PROTECTED]> 
11/02/2008 06:53 AM

To
xalan-j-users@xml.apache.org
cc

Subject
copy-of namespace::* - copies namespaces to child nodes






Hi All!

Recently I have switched to Xalan 2.7.0 (I needed the xalan:evaluate 
behaviour).

But there is something strange with this instruction:

<xsl:copy-of select="namespace::*" />

I have a root node <root /> and I want to extend its namespaces.
I did it this way:

<!-- override root node -->
<lns:root
                 xmlns:new_ns_1="address1"
                 xmlns:new_ns_2="address2"
>
                 <xsl:copy-of select="namespace::*" />
                 <xsl:copy-of select="@*" />

                 <!-- contiune with child nodes -->
                 <xsl:apply-templates select="node()" />

</lns:root>

Given input:

<lns:root xmlns:lns="qwqw" xmlns:ns1="sdfsf" param1="aaa" param2="122">
<lns:a />
<lns:b />
</lns:root>

the result is:

<lns:root xmlns:new_ns_1="address1" xmlns:new_ns_2="address2"
param1="aaa" param2="122">
<lns:a xmlns:lns="qwqw" xmlns:ns1="sdfsf"  />
<lns:b xmlns:lns="qwqw" xmlns:ns1="sdfsf" />
</lns:root>

expected:

<lns:root xmlns:new_ns_1="address1" xmlns:new_ns_2="address2"
xmlns:lns="qwqw" xmlns:ns1="sdfsf" param1="aaa" param2="122">
<lns:a />
<lns:b />
</lns:root>

root's existing namespaces are copied to child nodes

previously I was using default XSLT shipped with Sun JDK - it was
working as expected.
new namespaces were appended to (and only to) <root /> element.

any ideas what is going on?

best regards
Łukasz

Reply via email to