Search archives of this mailing list for the keywords "streaming" and 
"pruning". The simple answer is that, no, Xalan does not currently have 
the ability to trim away parts of the data model it no longer requires.

If you're reading from a text stream or file, make sure you use a 
StreamSource. That will let us use our internal DTM data model, which is 
far more efficient than most DOMs. (If you already have this whole 
monstrosity loaded into a DOM... ouch... theoretically a DOMSource may be 
slightly more efficient at adapting that data into our tool, but you're 
still going to wind up with a fair amount of overhead and you'd probably 
be better off flushing the DOM out of memory to a file and then reading it 
back in, so you're back in the DTM domain.)

If you haven't already done so, you should also try adjusting your JVM's 
memory usage parameters to increase its permitted stack and heap sizes. 
Those are usually in the -X family of JVM switches.

But, yes, it is possible to flat-out run out of memory, exceeding the 
maximum your particular JVM permits. The best suggestion I can give you in 
that case is to resort to hand-coded streaming SAX-based processing... or 
at least to use that to break the document up into managable chunks, run 
those through the stylesheet, and then go through SAX processing again to 
recombine the processed chunks.


Full streaming XSLT processing is theoretically possible, but is something 
of a "holy grail" optimization -- it's extremely hard to do for the full 
XSLT language. Subset implementations have been attempted; I believe IBM's 
Datapower "XML appliance" box can do streaming processing of some of the 
simpler XSLT cases, falling back to other approaches when the stylesheet 
exceeds those limits. There have been some interesting research attempts 
to come up with a more general solution, but I don't think any of them has 
gotten past the academic-paper stage.

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
http://www.ovff.org/pegasus/songs/threes-rev-11.html)

Reply via email to