Re: [xsl] Question on XSLT streaming and accumulation of values

Subject: Re: [xsl] Question on XSLT streaming and accumulation of values
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 16 Oct 2017 11:06:17 -0000
> On 16 Oct 2017, at 06:54, Felix Sasaki felix@xxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Thank you very much for your feedback, Michael and Martin.
>
> I have two other questions. First, does it matter wheter
accumulator-before() or accumulator-after()? I assume not because the metadata
values do not change before or after processing a given loop2 element.

If the value doesn't change then it doesn't really matter. Use
accumulator-before() in preference, because the rules are a bit more liberal
about exactly where it can be used.
>
> Second, I have an additional requirement to process metadata that appears at
the end of the document:
>
>>
>> For each loop2, I want to copy not the values but the whole XML tree of
document-end-metadata. Currently I am achieving this by doing two streams. a)
go through the document and gather the document-end-metadata subtree to be put
into a variable b) process the loop2 elements and add a copy of the variable
into the loop2 specific output.
>>
>> Since this requirement means copying a sub tree and not values, I assume
there is no way to achieve this with accumulators or xsl:iterate, or other
approaches?
>>

Yes, I think a two-pass approach is the only way around that.

Michael Kay
Saxonica

Current Thread