W3C home > Mailing lists > Public > spec-prod@w3.org > October to December 2004

Re: Quick TOC with XMLSpec

From: David Carlisle <davidc@nag.co.uk>
Date: Wed, 24 Nov 2004 15:05:56 GMT
Message-Id: <200411241505.PAA05023@penguin.nag.co.uk>
To: ml@graougraou.com
CC: spec-prod@w3.org

The stylesheets have a toc.level parameter

<xsl:param name="toc.level" select="5"/>

which allows you to control the depth of table of contents but
unfortunately it's global so you can't generate tables to different

(In the mathml version of the stylesheets (linked in the xml source zip
file from the mathml spec, or memeber only link of
I reworked the toc for just this reason. (We split the document up by
chapter and wanted tables of contents in each chapter in a slightly
different depth)

However in your case your quick toc is just a list of the top level div1
and inform-div1 so I would guess it's easier just to go (in your main
top level template)

<xsl:for-each select="div1|inform-div1">
<xsl:template mode="toc" match="div1">
    <xsl:apply-templates select="." mode="divnum"/>
    <a xmlns="http://www.w3.org/1999/xhtml">
      <xsl:attribute name="href">
        <xsl:call-template name="href.target">
          <xsl:with-param name="target" select="."/>
      <xsl:apply-templates select="head" mode="text"/>
    <br xmlns="http://www.w3.org/1999/xhtml"/>
    <xsl:if test="$toc.level &gt; 1">
      <xsl:apply-templates select="div2" mode="toc"/>

which is just the template for div1 in toc mode with the bit that
recursively handles subsections commented out.


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
Received on Wednesday, 24 November 2004 15:06:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:55:12 UTC