[XSL-LIST Mailing List Archive Home]
[xsl] positional grouping xslt2
I'm trying .. and failing, to use the xslt 2 grouping ideas
picking on a starting element and grouping using the group-starting-with
The w3c examples are too simplistic to work here.
<head1> An Example Twiki Document</head1>
<hr/>a para to show content in this level 1
<head1> This is a level 1 heading
A filler paragraph</head1>
<head2> This is a level 2 heading
A filler paragraph</head2>
<head3> And a level 3 heading. Never more than two linefeeds between
content. Othewise it shows up as a paragraph!</head3>
<p>A straightforward paragraph requires no special formatting. It can
include <b>bold</b> text, <i>italic</i> text and <literal>monotype</literal>
text. Note that
bold and italic will be converted to docbook emphasis markup.</p>
<p>Note that the star and underscore must be tight up to the marked up
as per the wiki requirment</p>
<head2> Other markup.</head2>
<p>For lists, use </p>
<bull1> Three spaces (not a tab) then the star</bull1>
<bull1> Other List items then follow</bull1>
<bull1> Third list item</bull1>
<p>For ordered (itemised) lists,</p>
<litem> ITem one</litem>
<litem> item two</litem>
<litem> and so on</litem>
<litem>Note also that you only need add the number 1, not increment it
<litem>And that if you insert spaces after the number, they will be
<p>Display lists, or definition lists, contain a term and its
explanation. Three spaces followed by the dollar symbol prefix the
term, the colon terminates the term and starts the definition. The
newline terminates the definition</p>
I.e. flat, no structure.
I want to use the positional grouping idea from xslt 2 to group under
With a root template as below, I'm stuck figuring out where the nesting is
It seems like a pull only solution is needed, since apply templates will
I'm currently getting the head1 stuff to work,
but failing with the second level.
Since the bull1 - wanted as docbook itemizedlist - also needs this
sort of grouping treatment, I'm looking for a structure which works
with this form of input.
I've added some debug to find out if its working.... and its not.
any help appreciated.
the required output is a nested suite of section tags wrapping
what are now sibling head1 head2 head3 elements.
bull1 lists should fit in with the current hierarchy.
<xsl:for-each-group select="article/*" group-starting-with="head1">
<xsl:for-each-group select="current-group()" group-starting-with="head2">
Debug: head2 children are:
<xsl:value-of select="name()"/> <xsl:text> </xsl:text>
<xsl:for-each-group select="*" group-starting-with="bull1">
<xsl:template match="p" mode="struct">
Other inline markup is similarly moded.
**** snip here *****
NOTICE: The information contained in this email and any attachments is
confidential and may be privileged. If you are not the intended
recipient you should not use, disclose, distribute or copy any of the
content of it or of any attachment; you are requested to notify the
sender immediately of your receipt of the email and then to delete it
and any attachments from your system.
RNIB endeavours to ensure that emails and any attachments generated by
its staff are free from viruses or other contaminants. However, it
cannot accept any responsibility for any such which are transmitted.
We therefore recommend you scan all attachments.
Please note that the statements and views expressed in this email and
any attachments are those of the author and do not necessarily represent
those of RNIB.
RNIB Registered Charity Number: 226227
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list