All my experience of Xalan is Windows-based, but I think the following
comments can be applied to Xalan on Linux as well.
First, the later Java run-time environments use a JIT (just in time)
compiler, so when you start executing Xalan, the run-time is compiling and
optimizing the code as it executes. Xalan also loads Xerces, so there are a
*lot* of classes being loaded, compiled and optimized.
Xalan is also loading and compiling your XSL file into its own internal
If you use the supplied command line processor to run Xalan, you only run
against one XML and one XSL file at a time.
The way to improve performance is to write your own command line processor
in Java, using the Xalan API to load and compile the XSL stylesheet once,
and then transform a whole load of XML files one after the other. Or if you
are transforming XML files on demand, say for a Web server, then you want a
Java process which the web server starts once to load Xalan, load the
stylesheet, and then run individual transforms against XML files as
If you adopt this approach you can expect a 10-fold or more performance
increase out of Xalan.
The core of any such Java code is only a few lines long:
// Set up processor & stylesheet - this code only needs to be
XSLTProcessor xsltProc = XSLTProcessorFactory.getProcessor() ;
// Set the output type parameter in the stylesheet.
StylesheetRoot xslStylesheet =
// Xalan is now set up and "stylesheet.xsl" is loaded and compiled
// Each time you want to transform an XML file:
// where xmlIn and xmlOut are String objects with the names of the input
// and output files.
DISCLAIMER! This is code I've been running against Xalan 1.0.0 - check the
documentation for your version to make sure that this is correct.
+44 (0) 1635 565362
From: Janning Vygen [mailto:[log in to unmask]]
Sent: Wednesday, April 18, 2001 9:34 AM
To: [log in to unmask]
Subject: Xalan Performance
i am using xalan XSLT processor (xalan-j_2_0_1 java on linux OS).
It takes 10 seconds to do a very simple transformation (1:1) with a very
small XML File (4 KB). Only thing to do is to parse entities and include
about 30 files. all xslt is just a 1:1 copy.
It takes 10 seconds on a AMD Athlon 700 with 128 MB and just a few other
Is this a good performance for a XSLT processor?
If the xml file grows in size, will it take longer or are the 10 seconds
an overhead for the startup process?
Planwerk 6 /websolutions