Re: [xsl] xsl:for-each-group output control

Subject: Re: [xsl] xsl:for-each-group output control
From: Andreas Peter <info@xxxxxxxxxx>
Date: Fri, 23 Nov 2007 23:06:13 +0100
Quoting "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>:

At 2007-11-23 22:11 +0100, Andreas Peter wrote:
Unfortunaltely I still have a problem with xsl:for-each-group and my
xml example.
For a better understanding the test-xml-file:

<root>
   <element>
       <h1>h1</h1>
       <h2>h2_1</h2>
       <para>para_1</para>
       <para>para_2<emp>auszeichnung</emp></para>
       <para>para_3</para>
       <para>para_4</para>
       <para>para_5</para>
       <h2>h2_2</h2>
       <para>para_6</para>
       <h3>h3_1</h3>
       <para>para_7</para>
       <h5>h5_1</h5>
       <para>para_8</para>
       <para>para_9<emp>auszeichnung</emp></para>
       <para>para_10</para>
       <h4>h4_1</h4>
       <para>para_11</para>
       <para>para_12</para>
       <h2>h2_3</h2>
       <para>para_13</para>
       <para>para_14</para>
       <para>para_15</para>
       <h3>h3_2</h3>
       <para>para_16<emp>auszeichnung</emp></para>
       <para>para_17</para>
       <para>para_18</para>
       <h4>h4_2</h4>
       <para>para_19</para>
       <para>para_20</para>
       <h5>h5_2</h5>
       <para>para_21</para>
       <para>para_22<emp>auszeichnung</emp></para>
       <para>para_23</para>
   </element>
</root>

I numbered the text nodes for a better visualization.

Yes, but could you please post a *complete* example of the output desired from the above?

For example, since 5 > 3, that would imply a <sect3> inside of a
<sect1>, but since a 4 follows the 5, would that <sect2> be a sibling?

I apologize that I am unable to decipher how the nesting is supposed to
work from the sample data supplied.  Perhaps there has been no answer
from anyone else for the same reason.

and so on. Unfortunately I cannot see the problem. IsnCB4t it possible
to grab the content out of a xsl:for-each-group as I tried it using a
separate template?

I am really sorry for that perhaps basic question but I am dispaired
about that problem.

Thanks for helping me. Perhaps one day I will be more firm to XSLT.

Many of us are anxious to help new users become seasoned users, but I have taken a chunk of my volunteer time to try and work out what you need and I am truly lost. Sorry.

. . . . . . . . . . . Ken

--
Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Hello Ken,


many thanks for taking time. I know that all of you out there are really
busy.

The desired output from the above input should look like this. I hope
this helps:

<set>
    <book>
        <bookinfo/>
        <title>h1</title>
        <chapter>
            <title>for h2</title>
            <para>para of h2</para>
            <sect1>
                <title>for h3</title>
                <para>paras of h3</para>
                <sect2>
                    <title>for h4</title>
                    <para>para of h4</para>
                    <sect3>
                        <title>for h5</title>
                        <para>para of h5</para>
                        <sect4>
                            <title>for h6</title>
                            <para>para of h6</para>
                        </sect4>
                    </sect3>
                </sect2>
            </sect1>
        </chapter>
        <chapter>
            <title>for h2</title>
            <para>para of h2</para>
            <sect1>
                <title>for h3</title>
                <para>paras of h3</para>
                <sect2>
                    <title>for h4</title>
                    <para>para of h4</para>
                    <sect3>
                        <title>for h5</title>
                        <para>para of h5</para>
                        <sect4>
                            <title>for h6</title>
                            <para>para of h6</para>
                        </sect4>
                    </sect3>
                </sect2>
            </sect1>
        </chapter>
    </book>
</set>

By the way, how can I get a good XSLT programmer? I am reading and
testing a lot, but it is so hard for me understanding this language.
Are there realy good books on the market?

Thanks so much,
Andreas

Current Thread