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] 5 Questions: from PHP tags to XIncludes


----- Original Message ----- 
From: "Frans Englich" <frans.englich@telia.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Friday, July 23, 2004 11:52 PM
Subject: [docbook-apps] 5 Questions: from PHP tags to XIncludes


> 3. Skipping TOCs in sections
>
> My project is a book, but simultaneously are the sections(sect1) shown
> independently on a website as "articles". Some of these are too small for
> having a TOC. While I need to have sections and so forth, the TOC is
> sometimes overkill. How can I specify in the sect1 to not have a TOC? (or
> some other object oriented solution, I want my driver to be generic)

For cases where you need special exceptions, a processing instruction can be
used.  If you add something like this to those sections whose TOC you want
to omit:

    <section id="c2s2">
      <?dbhtml omit-toc="1"?>
       <title>Section test</title>

And then customize the template named 'section.toc' by adding something like
this to your customization file:

<xsl:template name="section.toc">
  <xsl:param name="toc-context" select="."/>
  <xsl:param name="toc.title.p" select="true()"/>

  <xsl:param name="omit-toc">
    <xsl:call-template name="dbhtml-attribute">
      <xsl:with-param name="pis"
                      select="processing-instruction('dbhtml')"/>
      <xsl:with-param name="attribute" select="'omit-toc'"/>
    </xsl:call-template>
  </xsl:param>

  <xsl:if test="$omit-toc != '1'">
    <xsl:call-template name="make.toc">
      <xsl:with-param name="toc-context" select="$toc-context"/>
      <xsl:with-param name="toc.title.p" select="$toc.title.p"/>
      <xsl:with-param name="nodes"
                      select="section|sect1|sect2|sect3|sect4|sect5|refentry
                             |bridgehead[$bridgehead.in.toc != 0]"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template>


It first fetches any value of the PI as a child of the current section
element, then uses that value to decide if it should call 'make.toc'.

BTW, I don't know about others, but I prefer to see one question per message
with a good subject line.  When people look in the list archive, then they
can find something based on the subject lines.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net





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