[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Nested for-each-group and current-group()

Subject: Re: Nested for-each-group and current-group()
From: "Rick Quatro rick@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 May 2020 15:43:23 -0000
Re:  Nested for-each-group and current-group()
Hi Martin,

That was the issue. Thank you very much. I had to modify things to get the
list nesting correct as well. Here is the finished template:

<xsl:template match="/root">
        <root>
            <xsl:for-each-group select="*" group-adjacent="if(self::topic)
then 1 else 0">
                <xsl:choose>
                    <xsl:when test="current-grouping-key()=1">
                        <ol>
                            <xsl:for-each select="current-group()">
                                <li>
                                    <xsl:for-each-group select="*"
group-adjacent="if(self::subtopic) then 1 else 0">
                                        <xsl:choose>
                                            <xsl:when
test="current-grouping-key()=1">
                                                <ul>
                                                    <xsl:for-each
select="current-group()">
                                                        <li>
 
<xsl:apply-templates/>
                                                        </li>
                                                    </xsl:for-each>
                                                </ul>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <xsl:apply-templates
select="current-group()"/>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:for-each-group>
                                </li>
                            </xsl:for-each>
                        </ol>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:apply-templates select="current-group()"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each-group> 
        </root>
    </xsl:template>

Rick

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.