[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Section TOCs in HTML: Placing after intro text
Ah, that's correct. I was thinking toc was permitted at the end of a section, but
that's not the case here. You probably didn't want to do it manually anyway. 8^)
Here is a customization of the section template that does it automatically. Delete
the "d:" namespace prefixes if you are using the non-namespaced stylesheets.
<xsl:template match="d:section">
<xsl:variable name="depth" select="count(ancestor::d:section)+1"/>
<xsl:call-template name="id.warning"/>
<div>
<xsl:call-template name="common.html.attributes">
<xsl:with-param name="inherit" select="1"/>
</xsl:call-template>
<xsl:call-template name="section.titlepage"/>
<xsl:variable name="toc.params">
<xsl:call-template name="find.path.params">
<xsl:with-param name="table" select="normalize-space($generate.toc)"/>
</xsl:call-template>
</xsl:variable>
<xsl:apply-templates select="node()[not(self::d:section)]"/>
<xsl:if test="contains($toc.params, 'toc')
and $depth <= $generate.section.toc.level">
<xsl:call-template name="section.toc">
<xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
</xsl:call-template>
<xsl:call-template name="section.toc.separator"/>
</xsl:if>
<xsl:apply-templates select="d:section"/>
<xsl:call-template name="process.chunk.footnotes"/>
</div>
</xsl:template>
The first xsl:apply-templates processes all children except sub-sections, then the
section toc is processed, and then all section children are processed with the second
xsl:apply-templates.
If you are chunking, then be sure to set up the customization correctly with two files
as described here:
http://www.sagehill.net/docbookxsl/ChunkingCustomization.html
This customization goes in the customization file for single-page output. If you put
it in the customization of chunk.xsl, then it won't work.
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
----- Original Message -----
From: "mike 675" <m_mclaug@yahoo.co.uk>
To: <docbook-apps@lists.oasis-open.org>
Sent: Wednesday, August 24, 2011 4:21 AM
Subject: Re: [docbook-apps] Section TOCs in HTML: Placing after intro text
>
> docBook won't let me insert a <toc/> element. the following doc structure is
> invalid:
>
> <section>
> <title>Installing ABC Software</title>
> <para>
> This section describes the things you must do before
> installing ABC.
> </para>
> <para>The following topics are covered:</para>
> <toc/>
>
> <section>
> ...
> </section>
> <section>
> ...
> </section>
>
> </section>
>
>
> Bob Stayton wrote:
>>
>> Hi,
>> That one is easily supported by the stylesheets. You can put an empty
>> <toc/> element
>> where you want the mini-toc to appear.
>>
>
> --
> View this message in context:
> http://old.nabble.com/Section-TOCs-in-HTML%3A-Placing-after-intro-text-tp32317596p32325610.html
> Sent from the docbook apps mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]