Re: [xsl] Problems grouping nested items within a completely flat structure

Subject: Re: [xsl] Problems grouping nested items within a completely flat structure
From: "David Rudel fwqhgads@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Aug 2014 13:53:02 -0000
Frank,

Taking another look at the desired output, it looks like you first need to use

<xsl:for-each-group select="para" group-starting-with="para[@
pgftag='Chapter']">

to break the elements into Chapters, then use

<xsl:for-each-group select="current-group()" group-starting-with="para[@
pgftag=('Chapter','Body Text')]">

to cut those chapters into snippets. This latter instruction can be
replaced with the

<xsl:for-each-group select="current-group()" group-starting-with="para[@
pgftag='Body Text']">

if you are certain that every chapter begins with a Body Text element.

I'm assuming that notes only occur in list structures, in which case I
think each of these snippets is straightforward to process with
another for-each-group:

<xsl:for-each-group select="current-group()" group-starting-with="para[@
pgftag=('Bulleted text','Note')]">
Inside each of these groups, you will look for the first "Bullet sub"
element. If there is one then you know it and all the elements
following it are a sub-list.


The above should still work with the section headings as well,
assuming that section headings always stop a list, I would think you
could nest 4 for-each-groups:

<xsl:for-each-group select="para" group-starting-with="para[@
pgftag='Chapter']">

...
<xsl:for-each-group select="para"
group-starting-with="para[contains(@pgftag,'Section')']">

....

<xsl:for-each-group select="current-group()" group-starting-with="para[@
pgftag='Body Text']">


<xsl:for-each-group select="current-group()" group-starting-with="para[@
pgftag=('Bulleted text','Note')]">

(Process each of these sub-snippets here.)

-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