|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Auto generating a table of contents
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"/> 
<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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








