> I have a web application that performs an XML transformation with an
> XSLT style sheet. It uses standard transformation classes from
[quoted text clipped - 4 lines]
> XSL (not the XML) Document is written to the StreamResult. On retry, it
> works fine. I think it has something to do with the Tomcat classloader.
Why do you think this? Is it a wild guess? Or did you run your
web-application in *another* Java-web-server too, and you did *not* get the
described strange behaviour there?
> Does anyone have other ideas on this (and possibly, a solution)?
Another reason might be a bug somewhere in your web-application (especially
in using static variables).

Signature
"Thomas:Fritsch$ops.de".replace(':', '.').replace('$', '@')
Moiristo - 21 Jun 2006 19:14 GMT
> Another reason might be a bug somewhere in your web-application (especially
> in using static variables).
I create a pipeline that first collects the data in a class called
DataManager. The XML and XSL documents are stored in a bean. After that,
I call the transform function in another class (static method, see
below). It seems to me that it's just a standard transformation. No
exception is thrown. If I assume that the Transformer does its job, what
else could it be then my wild guess?
public static void transform(ReportOutput r) throws
XSLTTransformException {
Document XMLDoc = r.getXMLDoc();
Document XSLDoc = r.getXSLTDoc();
if(XSLDoc == null ) {
r.setOutput(xmlToString(XMLDoc));
return;
}
try {
// Create a TransformerFactory
TransformerFactory tFactory =
TransformerFactory.newInstance();
// Use the DOM XML Document to define a DOMSource object.
DOMSource xmlDomSource = new DOMSource(XMLDoc);
// Use the DOM XSL Document to define a DOMSource object.
DOMSource xslDomSource = new DOMSource(XSLDoc);
//Create a StringWriter to collect the output
StringWriter sw = new StringWriter();
// Create a StreamResult from the StringWriter
StreamResult SResult = new StreamResult(sw);
// Process the stylesheet DOMSource and generate a
//Transformer.
Transformer transformer =
tFactory.newTransformer(xslDomSource);
// Perform the transformation, placing the output in the
//StreamResult.
transformer.transform(xmlDomSource, SResult);
r.setOutput(sw.getBuffer().toString());
} catch (TransformerException e) {
ModelUtils.log(e);
throw new XSLTTransformException();
}
}