[xsl] Support or interest for iterate-adjacent-groups?

Subject: [xsl] Support or interest for iterate-adjacent-groups?
From: "David Rudel fwqhgads@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 Jan 2015 11:35:23 -0000
I'm interested in seeing if there is interest/support for a new
instruction in XSL: iterate-adjacent-groups

This instruction would group items use the same rules as the
@group-adjacent attribute on xsl:for-each-group but would use the
functionality of xsl:iterate with regard to process control.

It is worth noting (as Mike Kay has pointed out) that one can achieve
the same functionality using maps, but there are at least four
benefits to having a dedicated function.

1. Using maps locks up more memory.

2. The flipside of number 1 is that it is conceivable that
iterate-adjacent-groups could be streamable. Grouping by adjacent keys
is streamable, as is iteration.  Obviously, using maps to accomplish
this is never going to be streamable.

3. Related to number 2, using iterate allows early exit of the
instruction, which would save processing time.

4. A dedicated iterate-adjacent-groups commands should only require a
single pass through the data. Using maps requires two passes.

In addition to the above 4 remarks, a more complex specification of
this instruction could give it more functionality than the map-based
approach. In particular, perhaps the grouping could be influenced by
the values of the iterate parameters, thus allowing the grouping of
future items to depend on the outcome of processing previous groups.
This would allow the script to do things that can not currently be
done in any practical way with the language.

For example, imagine you had a sequence of elements, each of which had
a numbering attribute @index, where @index of the first element was 1,
@index of the second element was 2, etc.

The iterate-adjacent-groups could have group-by="@index idiv
$group.size" , where $group.size is a parameter of the iteration that
could be changed by processing of previous groups.


-David





-- 

"A false conclusion, once arrived at and widely accepted is not
dislodged easily, and the less it is understood, the more tenaciously
it is held." - Cantor's Law of Preservation of Ignorance.

Current Thread