Re: [xsl] Adjacent grouping?

Subject: Re: [xsl] Adjacent grouping?
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 17 Nov 2017 18:18:56 -0000
On 17.11.2017 18:43, rus tle profrustyleafiii@xxxxxxxxxxx wrote:

I am trying toB remove attributeB values in a listB based on a frequency parameter.

Is this possibleB in XSLT 2? I cannot see how to tackle theB problemB without being able to store the last attributeB value addedB to the result tree so that I can compare against it for the following attribute values? I am told that there is no way to query the result tree and so I am at a loss as to whether XSLT can actually do what I require?

To illustrate, please see the example below.

The frequencyB parameter is 30. I would like to remove all values that are "within 30" of the last value used. If the first value is 0 then I would like to remove all the following attribute values that are less than 30 plus the last value added to the result tree (in this case 0).
Such a condition can be easier formulated in XQuery 3 with a window clause

for tumbling window $w in p/Content
start $s when true()
end next $n when xs:decimal($n/@value) - xs:decimal($s/@value) ge 30
return ($w[1], subsequence($w, 2)/<Content value=""/>)

I think than in XSLT with group-adjacent.

As most people use XSLT 2 with Saxon 9 and Saxon also implements XQuery that might be an option that I think is worth mentioning.

In XSLT 3 you could even call directly into an XQuery module using above window clause if needed with

Current Thread