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
depths.

(In the mathml version of the stylesheets (linked in the xml source zip
file from the mathml spec, or memeber only link of
http://www.w3.org/Math/Group/spec/style/html/mathmlspec.xsl
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:call-template>
      </xsl:attribute>
      <xsl:apply-templates select="head" mode="text"/>
    </a>
    <br xmlns="http://www.w3.org/1999/xhtml"/>
    <xsl:text>
</xsl:text>
<!--
    <xsl:if test="$toc.level &gt; 1">
      <xsl:apply-templates select="div2" mode="toc"/>
    </xsl:if>
-->
</xsl:for-each>

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

David

________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________
Received on Wednesday, 24 November 2004 15:06:13 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:19:13 GMT