xsl-list
[Top] [All Lists]

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

2014-08-06 08:53:10
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.
--~----------------------------------------------------------------
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>