JDK-6957215 : JDK6u18 XSLT regression: xsl:copy-of failing to copy generated attributes
  • Type: Bug
  • Component: xml
  • Sub-Component: javax.xml.transform
  • Affected Version: 6u18
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-05-31
  • Updated: 2012-04-25
  • Resolved: 2012-01-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7
1.4.0Fixed 6u32 b01Fixed 7Fixed
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.
05-08-2010

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.
07-06-2010