If you use a cache to store pre-compiled XSL documents performance decrease is negligable (especially seen in the light of the typical runtime of a medium sized
JSP or
servlet, throw in some
EJB calls and you will never even notice) after the first request that adds the compiled XSL to the cache.
I've successfully used code like the following (this is a rough draft of a version I'm working for for an upcoming new project):
as the doPost method of a servlet. 'cache' is a simple HashMap that's declared static to the servlet.
Calling entities pass a Document object and the name of an XSL stylesheet (which are assumed to be stored in /WEB-INF/xsl here).
Using similar code written for an earlier version of Xalan I clocked transformation times of 2-5 milliseconds for quite complex XSL stylesheets (with compilation taking 300 or so milliseconds, illustrating the need for caching).
About half this code is actually concerned with errorchecking, using an HTML template to generate an HTML output to display errors on the fly.
[ December 01, 2003: Message edited by: Jeroen Wenting ]