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

Re: XSL stylesheet issue - part 2 (newbie)

Subject: Re: 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
Re:  XSL stylesheet issue - part 2 (newbie)
On 22/10/2024 08:41, Martin Honnen martin.honnen@xxxxxx wrote:
<!-- 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.


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
test="self::p[@class='rn_heading']">3</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

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.