xsl-list
[Top] [All Lists]

Re: current-group () function trouble

2005-03-09 10:56:05
Kessler, Marcy wrote:


Hello All -

I don't think I understand how the current-group () function works
exactly.  What I want to do is add "FourHead" and "FiveHead" to the

<pedantic>all current-group() does is return the contents of the 'current group' defined/selected by xsl:for-each-group</pedantic>

following code.  I've attempted to modify this code to accomplish this
and finally got it to be both well-formed in XMLSpy and not have any
errors when processing (using Saxon 8.3).  However, with my changes, I
lose data in the output xml files.

The following is the original code.  Can any of you help me with
understanding how I need to change this to add these elements?

Thank you,
Marcy (still a newbie, but learning)
ok first thing is that the following snippet isnt even well formed (closing tags </section>, </generic>...).

the first select statement for me using current-group() is hard to grok without the hindsight of the rest of your xslt and example xml.

<xsl:apply-templates select="current-group()[self::OneHead]" />
          <xsl:for-each-group select="current-group() except ."
group-starting-with="TwoHead">
            <xsl:choose>
              <xsl:when test="self::TwoHead">
                <section>
                  <xsl:call-template name="addId"/>
                  <xsl:apply-templates
select="current-group()[self::TwoHead]"/>
                  <xsl:for-each-group select="current-group() except ."
                                      group-starting-with="ThreeHead">
                  <xsl:choose>
                    <xsl:when test="self::ThreeHead">
                      <section>
                        <xsl:call-template name="addId"/>
                        <xsl:apply-templates
select="current-group()[self::*]"/>
                      </section>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:apply-templates
select="current-group()[self::*]"/>
                    </xsl:otherwise>
                  </xsl:choose>
                  </xsl:for-each-group>
                </section>
</xsl:when> <xsl:otherwise>
                <xsl:for-each-group select="current-group()"
                                    group-starting-with="ThreeHead">
                <xsl:choose>
                  <xsl:when test="self::ThreeHead">
                    <section>
                      <xsl:call-template name="addId"/>
                      <xsl:apply-templates
select="current-group()[self::*]"/>
                    </section>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:apply-templates
select="current-group()[self::*]"/>
                  </xsl:otherwise>
                </xsl:choose>
                </xsl:for-each-group>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:for-each-group>
whats going on here ?

        </section>
        </generic>
    </c_support_doc>
</xsl:result-document> </xsl:for-each-group>
 </xsl:template>


anyway of providing a simplified yet whole xslt and ex xml ?

gl, Jim Fuller

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--