Project

Profile

Help

fn:transform and post-process function: shouldn't it be applied to all result documents?

Added by Martin Honnen over 2 years ago

I have tried a rather complex setting of an XSLT stylesheet processing an XML input document first with fn:transform and a second XSLT stylesheet which splits the input into various result documents, where I hoped to provide the post-process option function to fn:transform to do further processing on the intermediary results, in this case a chain of stylesheets applied further using fold-left and fn:transform.

Unfortunately neither with SaxonCS nor SaxonJ the results are what I expected, namely getting the chain of stylesheets applied to each result document; rather, the chain of sylesheets seems to be only applied to the primary result while secondary results don't seem to have been processed by my post-process doing fold-left with fn:transform on a series of stylesheets.

I attach a zip with reduced test samples, the main stylesheet to be run with SaxonCS or Java from the command line is split-and-post-process1.xsl, the XML input sample is input-sample-25-items.xml, the code should create result files output, chunk-1.xml, 'chunk-2.xml, chunk-3.xmlwhere in each of the result files you should see the comment that the chain of stylesheetssheet1.xsl, sheet2.xsl, sheet3.xsl. sheet4.xslinserted, but the comments appear only in theoutput.xml, the chunk-x.xmlfile contents shows no sign of having been created by thepost-process` function using a chain of stylesheets.

Any advice whether the error is in my code or with Saxon appreciated.

All tested with the current releases 11.3 of SaxonCS and SaxonJ.


Replies (2)

RE: fn:transform and post-process function: shouldn't it be applied to all result documents? - Added by Martin Honnen over 2 years ago

Looking at https://saxonica.plan.io/projects/saxonmirrorhe/repository/he/revisions/he_mirror_saxon_11_3/entry/src/main/java/net/sf/saxon/functions/TransformFn.java it kind of appears as if only the primary result is subjected to the post-process function. But the spec states

A function that is used to post-process each result document of the transformation (both the principal result and secondary results)

Hmm. Kind of a bummer. Or I have to take the map result of the first fn:transform call and use map:for-each to apply my post processing chain on each item in the result map.

RE: fn:transform and post-process function: shouldn't it be applied to all result documents? - Added by Norm Tovey-Walsh over 2 years ago

Hmm. Kind of a bummer. Or I have to take the map result of the first
fn:transform call and use map:for-each to apply my post processing
chain on each item in the result map.

That looks like a bug to me, created #5566.

There’s already an action to investigate post-processing in SaxonJS
where I think the observation was that we simply don’t.

Be seeing you,
norm

--
Norm Tovey-Walsh
Saxonica

    (1-2/2)

    Please register to reply