Subject: Re: [xsl] XSL stylesheet issue - part 2 (newbie) From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 22 Oct 2024 07:32:00 -0000 |
<!-- Template to generate the TOC --> B <xsl:template mode="step2" match="div[@id='rn_toc']"> B B B <xsl:copy> B B B B B <xsl:apply-templates select="@*"/> B B B B B <xsl:apply-templates select="h1"/>
Note that for a clean approach I should have changed all the apply-templates in templates for the mode named step2 to use e.g.
B B B B <xsl:apply-templates select="@*" mode="#current"/> B B B B B <xsl:apply-templates select="h1" mode="#current"/>
but for the simple case of two modes doing shallow copying by default it doesn't matter.
test="self::p[@class='rn_heading']">3</xsl:when>
B B B B B <!-- Insert the TOC after the <h1> element --> B B B B B <xsl:for-each select="//*[@id[starts-with(., 'tocref')]]">
B B B B B B B <xsl:variable name="level"> B B B B B B B B B <xsl:choose> B B B B B B B B B B B <xsl:when test="self::h2">1</xsl:when> B B B B B B B B B B B <xsl:when test="self::h3">2</xsl:when> B B B B B B B B B B B <xsl:when
B B B B B B B B B </xsl:choose> B B B B B B B </xsl:variable>
B B B B B B B <p class="toclev{level}"> B B B B B B B B B <a href="#{./@id}"> B B B B B B B B B B B <xsl:value-of select="."/> B B B B B B B B B </a> B B B B B B B </p>
B B B B B </xsl:for-each> B B B </xsl:copy> B </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL stylesheet issue - pa, Martin Honnen martin | Thread | [xsl] XSL stylesheet issue - part 2, Frank Dissinger fran |
Re: [xsl] XSL stylesheet issue - pa, Martin Honnen martin | Date | [xsl] XSL stylesheet issue - part 2, Frank Dissinger fran |
Month |