And I need to output some of these records, but not all of
them. The rules upon which I decide to output are complex,
and I won't bore you with the details.
Also, after every 5th record has been output, I need to write
some kind of marker in the output stream.
The discussion has been interesting. It sounds from your later description
as if the first paragraph above was a gross simplification: that is, the
output records don't correspond one-to-one with a subset of the input
records, which means that the first technique I suggested isn't applicable.
In this situation I would lean strongly towards a two-pass approach. It's
interesting that your code appears already to be suffering from being too
complex and monolithic; a multi-pass approach is the best way of avoiding
this creeping complexity, and you certainly don't want it to get any worse.
Your concern about the two-pass approach seems primarily to be memory usage.
This is a technology issue rather than a language issue. The fact that you
are using XSLT 1.0 presumably means you are constrained in your choice of
technology - I don't recall seeing you say what these constraints are. With
XSLT 2.0 there is a much better chance, I think, that the second phase
(interpolating the marker elements) could be done in pure streaming mode
with no additional memory requirements. It might also allow a substantial
simplification (and speed-up) of your existing code.
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--