https://issues.apache.org/bugzilla/show_bug.cgi?id=45011
Summary: Add stronger recommendation to use XALAN with XSLT task
for Sun JDK 1.5+
Product: Ant
Version: 1.7.0
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
In the documentation for XSLT task and Library Dependencies, please word more
strongly the recommendation to use Xalan library when using Sun JDK 1.5+.
Can you also mention that out-of-the-box JDK 1.5+ will add excessive namespaces
during identity transformation? It leads to poor resulting documents
readability and in many cases failure to process these documents. I first
encountered this problem trying to transform default web.xml file that comes
with Tomcat. After this transformation the Tomcat would not start at all.
I had spent many hours before finding the real culprit:
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl shipped as
default XSLT transformer in 1.5+.
One other good thing to mention is that you need both xalan.jar and
serializer.jar from the xalan distribution. I mention it here because it was a
source of confusion in discussion of workaround for bug 43981.
My current environment:
OS : Fedora-Core linux: kernel-2.6.23.1-42.fc8
Java: Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Ant: 1.7.0
Xalan: 2.7.1
Attached are build.xml, test-style.xslt and test.xml that should be copied into
the same directory in order to reproduce this problem:
Below is the output of identity transformation example:
Here is an original test.xml document:
<?xml version = "1.0" encoding = "UTF-8" ?>
<test xmlns="urn:test">
<element1>
<with-text>text</with-text>
</element1>
<element2>
<with-text>text</with-text>
</element2>
</test>
After XSLT identity transformation:
<?xml version="1.0" encoding="UTF-8"?><ns0:test xmlns:ns0="urn:test"
xmlns="urn:test">
<ns1:element1 xmlns:ns1="urn:test">
<ns2:with-text xmlns:ns2="urn:test">text</ns2:with-text>
</ns1:element1>
<ns3:element2 xmlns:ns3="urn:test">
<ns4:with-text xmlns:ns4="urn:test">text</ns4:with-text>
</ns3:element2>
</ns0:test>
Now XSLT transformation after you add xalan.jar and serializer.jar from the
Xalan-J distribution to ${ANT_HOME}/lib
<?xml version="1.0" encoding="UTF-8"?><test xmlns="urn:test">
<element1>
<with-text>text</with-text>
</element1>
<element2>
<with-text>text</with-text>
</element2>
</test>
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.