On 21 September 2015 at 11:49, Andrew
andrew(_dot_)hallam(_at_)hotmail(_dot_)co(_dot_)uk <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Hi all.
I’m looking for advice on paginating the output of a transformation.
Some of the XML documents we pass through our transformations produce very
large HTML output. We would like to paginate this output.
We cannot split the source XML into manageable ‘chunks’ and process them
individually. It has to be transformed as a whole (// matches etc).
Currently the transformation produces a valid block of HTML - not the
whole HTML page. This is then poked into the main page via Ajax.
Not clear from the above quite which approach to suggest, so I'll suggest
two...
Plan A, chunk base on output size (I think you are asking for this, but
plan B might give more sensible splits if it is appropriate)
Here (logically at least) you apply a second transformation to the output
xhtml just splitting based on size.
Although you may (or may not) wish to interleave the chunking with the main
transformation.
XSLT isn't especially brilliant at doing this (I note you put xalan in the
header, does that mean you are restricted to XSLT 1?) as tracking the
"output so far" isn't xslt's natural functional style. Basically you need
to do a recursive application "one element at a time" and decide at each
level whether to stop or to process into the current chunk. (Probably
easier in perl)
Plan B is to chunk based on some criterion in the input (even if you need
to process the entire input for each chunk) if there is for example a
notion of "chapter" that makes sense it might be better to chunk on those
boundaries even if that means small chapters make small chunks, rather than
just chunking every 10Mb (or whatever) and having chapters split over
arbitrary chunks.
Sorry no helpful code supplied, just musing on the possibilities...
David
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--