]> granicus.if.org Git - docbook-dsssl/commitdiff
SR #431040, added generate.section.toc.level parameter to control depth of sections...
authorNorman Walsh <ndw@nwalsh.com>
Thu, 5 Jul 2001 09:53:25 +0000 (09:53 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Thu, 5 Jul 2001 09:53:25 +0000 (09:53 +0000)
xsl/html/param.xsl
xsl/html/sections.xsl

index 6da9ae5566b77897113cec73cf18e89a65d779d9..5abf9be7a746642cfb68b6c5d36dd66f8f96dee8 100644 (file)
@@ -932,13 +932,35 @@ in the CALS table.
 </doc:param>
 
 <!-- ==================================================================== -->
-<xsl:param name="generate.section.toc" select='0' doc:type='boolean'/>
+<xsl:param name="generate.section.toc" select='1' doc:type='boolean'/>
 
 <doc:param name="generate.section.toc" xmlns="">
-<refpurpose>FIXME:</refpurpose>
+<refpurpose>Generate TOCs inside Sections?</refpurpose>
 <refdescription>
-<para>FIXME:
+<para>If non-zero, a Table of Contents will be generated inside section
+elements. If <parameter>generate.section.toc.level</parameter> is non-zero,
+it may suppress some section TOCs.
+</para>
+</refdescription>
+</doc:param>
+
+<!-- ==================================================================== -->
+<xsl:param name="generate.section.toc.level" select='3' doc:type='integer'/>
+
+<doc:param name="generate.section.toc.level" xmlns="">
+<refpurpose>Control depth of TOC generation in sections</refpurpose>
+<refdescription>
+<para>If non-zero, <parameter>generate.section.toc.level</parameter> controls
+the depth of section in which TOCs will be generated. Note that this is
+related to, but not the same as <parameter>toc.section.depth</parameter>,
+which controls the depth to which TOC entries will be generated in a given
+TOC.</para>
+<para>If, for example, <parameter>generate.section.toc.level</parameter>
+is <literal>3</literal>, TOCs will be generated in first, second, and third
+level sections, but not in fourth level sections.
 </para>
+<para>If <parameter>generate.section.toc.level</parameter> is zero, it has
+no effect.</para>
 </refdescription>
 </doc:param>
 
index 608ef8457ff31f8e8e2ae284a5e6db5752d2e603..2c89eebd928facd8d03985a751f1b8f20b980406 100644 (file)
 <!-- ==================================================================== -->
 
 <xsl:template match="section">
-  <xsl:variable name="id">
-    <xsl:call-template name="object.id"/>
-  </xsl:variable>
+  <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+  <xsl:variable name="depth" select="count(ancestor::section)+1"/>
 
   <div class="{name(.)}">
     <a name="{$id}"/>
     <xsl:call-template name="section.titlepage"/>
-    <xsl:if test="$generate.section.toc != '0'
+    <xsl:if test="($generate.section.toc != '0'
+                   and ($generate.section.toc.level = 0
+                        or $depth &lt;= $generate.section.toc.level))
                   or refentry">
       <xsl:call-template name="section.toc"/>
     </xsl:if>
@@ -68,7 +69,9 @@
   <div class="{name(.)}">
     <a name="{$id}"/>
     <xsl:call-template name="sect1.titlepage"/>
-    <xsl:if test="$generate.section.toc != '0'
+    <xsl:if test="($generate.section.toc != '0'
+                   and ($generate.section.toc.level = 0
+                        or $generate.section.toc.level &gt;= 1))
                   or refentry">
       <xsl:call-template name="section.toc"/>
     </xsl:if>
@@ -89,7 +92,9 @@
   <div class="{name(.)}">
     <a name="{$id}"/>
     <xsl:call-template name="sect2.titlepage"/>
-    <xsl:if test="$generate.section.toc != '0'
+    <xsl:if test="($generate.section.toc != '0'
+                   and ($generate.section.toc.level = 0
+                        or $generate.section.toc.level &gt;= 2))
                   or refentry">
       <xsl:call-template name="section.toc"/>
     </xsl:if>
   <div class="{name(.)}">
     <a name="{$id}"/>
     <xsl:call-template name="sect3.titlepage"/>
-
-    <xsl:if test="$generate.section.toc != '0'
+    <xsl:if test="($generate.section.toc != '0'
+                   and ($generate.section.toc.level = 0
+                        or $generate.section.toc.level &gt;= 3))
                   or refentry">
       <xsl:call-template name="section.toc"/>
     </xsl:if>
   <div class="{name(.)}">
     <a name="{$id}"/>
     <xsl:call-template name="sect4.titlepage"/>
-    <xsl:if test="$generate.section.toc != '0'
+    <xsl:if test="($generate.section.toc != '0'
+                   and ($generate.section.toc.level = 0
+                        or $generate.section.toc.level &gt;= 4))
                   or refentry">
       <xsl:call-template name="section.toc"/>
     </xsl:if>
   <div class="{name(.)}">
     <a name="{$id}"/>
     <xsl:call-template name="sect5.titlepage"/>
-    <xsl:if test="$generate.section.toc != '0'
+    <xsl:if test="($generate.section.toc != '0'
+                   and ($generate.section.toc.level = 0
+                        or $generate.section.toc.level &gt;= 5))
                   or refentry">
       <xsl:call-template name="section.toc"/>
     </xsl:if>