This problem came from using Ant's Style task after I upgrading an existing Ant
project to use Xalan-J-2.2.0 after using
2.0.1. I isolated the problem by modifying the trax examples code (code
appended). The exceptions are sensitive to the
order and number of input documents that are trying to be transformed with a
stylesheet reuse. Also, the stylesheet
imports other stylesheets.
I'm new to this list, but I did scan the bug reports for similar problems.
Anybody have suggestions as to how to solve
this problem?
Here are the exceptions that are encountered in the "community" test case:
EXCEPTION:
javax.xml.transform.TransformerException:
java.lang.ArrayIndexOutOfBoundsException
at
org.apache.xalan.transformer.TransformerImpl.transformToRTF(TransformerImpl.java:1741)
...
---------
java.lang.ArrayIndexOutOfBoundsException
at
org.apache.xalan.transformer.ResultTreeHandler.flushElem(ResultTreeHandler.java:868)
...
---------
java.lang.ArrayIndexOutOfBoundsException
at
org.apache.xml.utils.SuballocatedIntVector.elementAt(SuballocatedIntVector.java:453)
Here's the modified Trax Examples source code:
==========================
public static void exampleTransformerReuse(Vector sources, String xslID)
throws TransformerException, TransformerConfigurationException
{
TransformerFactory tfactory = TransformerFactory.newInstance();
Transformer transformer = tfactory.newTransformer(new StreamSource(baseDir +
xslID));
for (Enumeration e=sources.elements(); e.hasMoreElements(); )
{
String sourceID = (String)e.nextElement();
System.out.println("\n=========" + sourceID + "\n");
transformer.transform( new StreamSource(baseDir + sourceID),
new StreamResult(destDir + sourceID));
}
}