[xsl] RE:adding hierarchy

Subject: [xsl] RE:adding hierarchy
From: Jim_Albright@xxxxxxxxxxxx
Date: Sun, 12 Oct 2003 23:07:33 -0400
<!-- lineGroups add stanza  -->
<xsl:template match="blankLine">
        <xsl:choose>
                <xsl:when test="following-sibling::*[1]/self::lineGroup">
                        <!-- add stanza-->
                        <xsl:element name="lineGroup">
                                <xsl:attribute name="type">
                                        <xsl:text>stanza</xsl:text>
                                </xsl:attribute>
                                <!-- process all lineGroups using tail recurrsion -->
                                <xsl:if test="following-sibling::*[1]/self::lineGroup">
                                        <xsl:apply-templates select="following-sibling::*[1]" mode="stanza"/>
                                </xsl:if>
                        </xsl:element>
                </xsl:when>
        <xsl:otherwise>
                        <!-- toss out-->
        </xsl:otherwise>
        </xsl:choose>
</xsl:template>

<xsl:template match="lineGroup" name="lineGroup" mode="stanza">
        <xsl:copy-of select="."/>
                <!-- tail recurrsion -->
                <xsl:if test="following-sibling::*[1]/self::lineGroup">
                                        <xsl:apply-templates select="following-sibling::*[1]" mode="stanza"/>
        </xsl:if>
</xsl:template>

This puts the wrapper on but I will need to process lineGroups that are 
not preceded with a blankLine (which is legal to have).
Also I will need to skip processing lineGroups immediately preceded by a 
blankLine.

I am wondering if there isn't a more elegant 2.0 solution to this problem.

Jim Albright
704 843-0582
Wycliffe Bible Translators



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread