>1) passes it directly to Xalan as DOMSource;
>2) traverses the DOM tree and manually fires the SAX events into Xalan
> (TransformerHandler).
> While I ran some tests on both cases, it turned out (2) is still faster
> than (1), while it's true it commands more memory.
That's somewhat surprising. Once we're into the DTM world, performance
should be more or less equivalent... and using DOM2DTM gives us the
incremental behavior automatically, which should improve performance if you
don't have to scan the whole document. The difference may just reflect the
fact that we've spent more time working on SAX2DTM than on DOM2DTM, or it
may be a result of additional work we have to do to "impedence-match"
between the DOM and DTM models.
Note that performance has to be measured against many testcases; a single
stylesheet/document may show atypical results. It would probably be worth
trying our performance benchmarks (XSLTMark etc) in this DOM-to-SAX-to-DTM
mode, to see if your results hold true more generally and (if so) to help
us analyse why.