RE: [xsl] Optimizing transform in java

Subject: RE: [xsl] Optimizing transform in java
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 23 Jan 2002 22:55:57 -0000
> I've got a few questions about doing XSL transformations in Java.
> I have an application which stores a JDOM object in memory
> and transforms the object to HTML for viewing.
> I'm currently using the Xalan transformer
> (org.apache.xalan.processor.TransformerFactoryImpl) for the
> transformation.
> Is this the best transformer for a JDOM object?
> It doesn't seem like it would be since it extends
> javax.xml.transform.sax.SAXTransformerFactory,
> which is a SAX transformer.

Saxon has built-in support for JDOM transformation, though (as with Xalan)
it works faster if you let it build its own native tree from SAX input.
>
> My second question is about XSL stylesheets.
> When I do a transformation I am always showing a small
> section of the XML document.
> When the XML document gets large you still see the same data,
> but the transform takes longer.
> Is there any way to speed up a transform by passing a XPath
> parameter to the stylesheet?

If you can insert a SAX filter in front of the transformation, so you avoid
building a tree for the parts of the document you aren't interested in, it
will certainly go faster. Unless, of course, you can keep the whole tree in
memory and reuse it for multiple transformations. Passing an XPath parameter
won't help, but using xsl:key to select the part of the document you need to
transform might.

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread