United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6957215 : JDK6u18 XSLT regression: xsl:copy-of failing to copy generated attributes

Details
Type:
Bug
Submit Date:
2010-05-31
Status:
Closed
Updated Date:
2012-04-25
Project Name:
JDK
Resolved Date:
2012-01-31
Component:
xml
OS:
generic
Sub-Component:
javax.xml.transform
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u18
Fixed Versions:
6u32 (b01)

Related Reports
Backport:
Backport:

Sub Tasks

Description
The upgrade of JAXP in JDK6u18 has introduced an XSLT regression which prevents us from building our project (OpenDS). I have managed to narrow down the problem to a simple test case which shows that in some circumstances the xsl:copy-of instruction does not fully copy the content of a variable containing attributes created using xsl:attribute instructions.

To reproduce:

Compile the attached Java program, BasicXsl.java, which I ripped from CR 6940416.

Run it as follows:

java -cp <classpath> BasicXsl test.xml output.xml test.xsl

The application should generate two identical elements as follows:

<?xml version="1.0" encoding="UTF-8"?>
<aaa name="aaa-name" package="aaa-package">
<bbb name="bbb-name">
<aaa-ref name="aaa-name" package="aaa-package"/>
</bbb>
</aaa>
<aaa name="aaa-name" package="aaa-package">
<bbb name="bbb-name">
<aaa-ref name="aaa-name" package="aaa-package"/>
</bbb>
</aaa>

This is the case for JDK6u17, Xalan-J 2.7.1, and GNOME libxslt (via xsltproc).

However with JDK6u18 and above (I have been using JDK6u20 and JDK7) the following is output:

<?xml version="1.0" encoding="UTF-8"?>
<aaa name="aaa-name" package="aaa-package">
<bbb name="bbb-name">
<aaa-ref/>
</bbb>
</aaa>
<aaa name="aaa-name" package="aaa-package">
<bbb name="bbb-name">
<aaa-ref name="aaa-name" package="aaa-package"/>
</bbb>
</aaa>

Note that the attributes are missing from the first aaa-ref element. They do not seem to be copied via the xsl:copy-of instruction.

                                    

Comments
EVALUATION

see parent cr.
                                     
2010-08-05
PUBLIC COMMENTS

Problem also encountered in Open Source community (see issue 4564) and prevents compilation:

https://opends.dev.java.net/issues/show_bug.cgi?id=4564

A temporary workaround is to drop Xalan-J 2.7.1 into Ant's classpath when building components.
                                     
2010-06-07



Hardware and Software, Engineered to Work Together