Re: [xsl] exercise in complex grouping

Subject: Re: [xsl] exercise in complex grouping
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 May 2020 15:32:00 -0000
Hey Syd,

With apologies for lateness: maybe this is now "moot" in the American
sense. But an idea.

I would try this by writing a function: it could return a Boolean
value, true() or false() depending on whether a node should be judged
to be "sticky". f:sticky(.), in other words, would be true for any
node that was either a B, or an A pointing to a B, or anything
between. Is there a B anywhere, in other words, to which this node
should stick? Or perhaps for stronger code, it would return not a
Boolean, but the value of a relevant A/xml:id. Yup: this would be
better, since it would also break out any adjacent B/A pair-groups
from one another. So, f:sticks-to-id().

In complicated cases the function might have to perform a sibling
recursion, although in your case it could perhaps simply inspect
sibling nodes, finding any Bs with their As, then use >> or <<
comparison operators against those pairs.

Given such a function, for-each-group/@group-adjacent should work.
Plus, since the core logic is in the function, it's easier to test and
repair for any edge cases.

The code to detect any Bs that have wandered away from their As should
not be too hard either, to help ensure coverage.

Cheers, Wendell

On Tue, May 12, 2020 at 11:47 AM Syd Bauman s.bauman@xxxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> To:   Geert Bormans  and  David Carlisle
> From: Syd
> Re:   complex grouping suggestions
> Gentlemen --
> Thank you so much! As you might guess, it will take me awhile to work
> through your suggestions, tweak to match the actual data, and test.
> But I'm on it, and very appreciative.

...Wendell Piez... ...wendell -at- nist -dot- gov...

Current Thread