This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook-apps] Changing the ToC for only index.html?


If you want to retain the depth of the book tables of contents while
reducing the depth of the set table of contents, you will have to do a
little customization.

The template named 'make.toc' in autotoc.xsl is called at the beginning of a
table of contents, and then it applies templates in mode="toc" for each
nested level.  As it applies templates in that mode, it supplies the
'toc-context' parameter whose value is the top element containing the TOC.
You want to change how a book is processed when the toc-context is set.  So
copy the match="book" mode="toc" template from autotoc.xsl to your
customization layer and add an xsl:choose to modify the behavior:

<xsl:template match="book" mode="toc">
  <xsl:param name="toc-context" select="."/>

  <xsl:choose>
    <xsl:when test="local-name($toc-context) = 'set'">
      <xsl:call-template name="subtoc">
        <xsl:with-param name="toc-context" select="$toc-context"/>
        <xsl:with-param name="nodes" select="foo"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:call-template name="subtoc">
        <xsl:with-param name="toc-context" select="$toc-context"/>
        <xsl:with-param name="nodes" select="part|reference
                                         |preface|chapter|appendix
                                         |article
                                         |bibliography|glossary|index
                                         |refentry
                                         |bridgehead[$bridgehead.in.toc !=
0]"/>
      </xsl:call-template>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

In the xsl:when statement, if the toc-context is 'set', then call subtoc
with no nodes selected (I entered a fake element name because it won't
accept an empty select statement). The subtoc template will format the book
title, and then won't have any subnodes to process.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message ----- 
From: "Avleen Vig" <lists-docbook@silverwraith.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Monday, April 05, 2004 3:53 AM
Subject: [docbook-apps] Changing the ToC for only index.html?


> I'm trying to find a way, to alter the creating of the ToC in
> index.html.
>
> I have a single <set>, with 10 <book>s under it.
> I'm trying to get the ToC that the html stylesheets produce, to only
> list the books, not the titles of the chapters under them. I want to
> save those titles for once the user is looking at the book itself.
>
> If this even possible?
>
> -- 
> Avleen Vig
> Systems Administrator
> Personal: www.silverwraith.com
> EFnet:    irc.mindspring.com (Earthlink user access only)
>
> To unsubscribe from this list, send a post to
docbook-apps-unsubscribe@lists.oasis-open.org, or visit
http://www.oasis-open.org/mlmanage/.
>
>
>



To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org, or visit http://www.oasis-open.org/mlmanage/.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]