Re: [xsl] Xalan: Pagination of transformation output

Subject: Re: [xsl] Xalan: Pagination of transformation output
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Sep 2015 11:05:25 -0000
On 21 September 2015 at 11:49, Andrew andrew.hallam@xxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Hi all.
>
> Ibm 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 bchunksb 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

Current Thread