xsl-list
[Top] [All Lists]

Re: [xsl] exercise in complex grouping

2020-05-13 10:32:10
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(_dot_)bauman(_at_)northeastern(_dot_)edu
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>