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 "Carter, Will" <WC...@envestnetpmc.com> on 2002/09/17 20:07:48 UTC

transformation slow in a servlet but not at command line?

Hi,

I have an xml document that I transform at the command line using xalan like this:
java org.apache.xalan.xslt.Process -in source.xml -xsl style.xsl -out output.html
it takes a few seconds to transform.

when I move this process to a servlet, it takes almost 30 seconds. Is there anyway to discover what this delay is from?  is there a way to debug what is happening in the transformation?  Here is my servlet (snippets):

----snippet-----
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
----snippet-----

----snippet-----
File xmlFile = new File("source.xml");
File xsltFile = new File("style.xsl");

Source xmlSource = new StreamSource(xmlFile);
Source xsltSource = new StreamSource(xsltFile);

TransformerFactory transFact = TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer(xsltSource);
	        
PrintWriter pw = new PrintWriter(new FileOutputStream("output2.html"));

trans.transform(xmlSource, new StreamResult(pw));
pw.close();
----snippet-----