You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Verachten Bruno <Br...@atosorigin.com> on 2002/12/11 16:23:32 UTC
How to chain transformations with XSLT?
Hi,
I managed to chain transformations with Xalan, and I wanted to do the same
with XSLTC.
I wanted to use the same method as in Xalan, but I can't figure how :-(
Here's the code:
for (int i = 0; i < translets.length; i++) {
TransformerHandler tempHandler = null;
try {
tempHandler =
saxTFactory.newTransformerHandler(compiledTranslets [i]);
} catch (javax.xml.transform.TransformerConfigurationException
tce) {
tce.printStackTrace();
return;
}
transformer = tempHandler.getTransformer();
handlers [i] = tempHandler;
if (i > 0) {
handlers [i - 1].setResult(new SAXResult(tempHandler));
}
// Create an XMLReader.
try {
reader = XMLReaderFactory.createXMLReader();
reader.setContentHandler(handlers [0]);
} catch ( org.xml.sax.SAXNotRecognizedException snre) {
snre.printStackTrace();
} catch (org.xml.sax.SAXException sae) {
sae.printStackTrace();
}
}
It could have worked if only the objects found in the "compiledTranslets"
array
had been "Templates".
But they are translets; I logically have a ClassCastException when writing
the cast:
compiledTranslets [i] = (Templates) retval;
What is the missing link between a template and a translet?
Am I really going the wrong way to chain transformations?
Thanks in advance.
Bruno Verachten.