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

Re: Auto generating a table of contents

Subject: Re: Auto generating a table of contents
From: "Juergen Hermann" <jhe@xxxxxxxxxxx>
Date: Tue, 07 Mar 2000 11:17:45
auto generate xsl
On Tue, 07 Mar 2000 08:53:57 +0000, John Morrison wrote:

>where the tag <contents/> is I wish to insert a table of contents, ie
>1. A
>1.1. B
>1.2. C
>2. D

This is what I use for a structure using s1/2/3/4, maybe you can adapt it to
your needs:

  <xsl:template match="s2|s3|s4" mode="toc">
    <font size="2" face="arial,helvetica,sanserif">
      <xsl:number format="1.1.1. " level="multiple" from="s1" count="s2|s3
|s4"/>&#160;
      <a href="#{generate-id(.)}">
        <xsl:value-of select="@title"/>
      </a>
    </font>
    <br/>
    <xsl:if test="count(child::s2|child::s3|child::s4) >= 1">
      <dir>
        <xsl:apply-templates select="s2|s3|s4" mode="toc"/>
      </dir>
    </xsl:if>

  </xsl:template>

And your call it like so:

  <dir>
    <xsl:apply-templates select="s2" mode="toc"/>
  </dir>

The important thing is to use a "toc" mode, to have it not infere with the
normal content processing.



Ciao, Jürgen

--
Jürgen Hermann (jhe@xxxxxxxxxxx)
WEB.DE AG, Amalienbadstr.41, D-76227 Karlsruhe
Tel.: 0721/94329-0, Fax: 0721/94329-22



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


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.