[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Manual chunking with component level toc
Actually, this is pretty easy to customize. Let's say you want a section
TOC only for those sections that contain a processing instruction such as
this:
<section>
<?section-toc on?>
<title>etc.
You can add this template customization (from html/autotoc.xsl) to your
stylesheet. The section.toc template is called whenever the section level
is one of those to set a section toc (within the range of
$generate.section.toc.level). The context node for the template is the
section in question. You just need to have it check for your processing
instruction child before calling the make.toc template.
<xsl:param name="generate.section.toc.level" select="8"/>
<xsl:template name="section.toc">
<xsl:param name="toc-context" select="."/>
<xsl:param name="toc.title.p" select="true()"/>
<!-- Add this variable -->
<xsl:variable name="section.toc.pi">
<xsl:value-of select="processing-instruction('section-toc')"/>
</xsl:variable>
<xsl:if test="$section.toc.pi = 'on'"> <!-- Add this test -->
<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>
Now only those sections with the PI will have a TOC, and this change will
not affect any other TOCs.
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
----- Original Message -----
From: "honyk" <j.tosovsky@email.cz>
To: <docbook-apps@lists.oasis-open.org>
Sent: Monday, March 02, 2009 10:32 AM
Subject: RE: [docbook-apps] Manual chunking with component level toc
>> There is missing top-level content of chapter or section as
>> there is no corresponding xml file.
>> <book>
>> <chapter id="objects">
>> <title>Objects</title>
>> <xi:include href="objects/server.xml"
>> xmlns:xi="http://www.w3.org/2001/XInclude"/>
>> <xi:include href="objects/input.xml"
>> xmlns:xi="http://www.w3.org/2001/XInclude"/>
>> </chapter>
>> </book>
>
> Ooops. I am wrong. I am mixing several things together.
> Chapter has own file, of course. As I have switched the component toc off,
> chapter pages created as mentioned above have title only - sections are on
> the separate html pages.
> Ok, for chapter level, if I switch toc on, I'd get what needed.
> But in deeper level I'll have to switch on toc for section too. And I
> remember this is the reason why everything I have switched off. I need to
> mix section with and without toc. Toc is required for sections included
> directly in the main XML file with other included subsections. On the
> contrary, if subsections aren't included as separate file (they are
> directly
> in parent section, in the same file), toc would be disturbing in this
> place.
> I suppose there is no way to mix both behaviour so I am looking for
> method,
> how to invoke toc generation only when necessary. I think any attribute
> will
> have to be added to such element, but I don't know how to customize
> stylesheets in this case.
>
> Jan
>
>
>
> ---------------------------------------------------------------------
> 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]