]> granicus.if.org Git - docbook-dsssl/commitdiff
Added support for toc.max.depth parametet into FO stylesheet.
authorJirka Kosek <jirka@kosek.cz>
Mon, 14 Feb 2005 13:22:48 +0000 (13:22 +0000)
committerJirka Kosek <jirka@kosek.cz>
Mon, 14 Feb 2005 13:22:48 +0000 (13:22 +0000)
xsl/fo/autotoc.xsl
xsl/fo/param.ent
xsl/fo/param.xweb

index 2b8ec9a7468c694a7631ea31ba032113e830f2ed..b6d3afab5f88eef858a0d3473345b4f215d7994f 100644 (file)
   <xsl:variable name="nodes" select="glossary|bibliography|preface|chapter
                                      |reference|part|article|appendix|index"/>
 
-  <xsl:if test="$toc.section.depth &gt; 0 and $nodes">
+  <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+  <xsl:if test="$toc.section.depth > 0 
+                and $toc.max.depth > $depth.from.context
+                and $nodes">
     <fo:block id="toc.{$cid}.{$id}"
               start-indent="{count(ancestor::*)*$toc.indent.width}pt">
       <xsl:apply-templates select="$nodes" mode="toc">
                                      refentry|article|index|glossary|
                                     bibliography"/>
 
-  <xsl:if test="$toc.section.depth &gt; 0 and $nodes">
+  <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+  <xsl:if test="$toc.section.depth > 0 
+                and $toc.max.depth > $depth.from.context
+                and $nodes">
     <fo:block id="toc.{$cid}.{$id}"
               start-indent="{count(ancestor::*)*$toc.indent.width}pt">
       <xsl:apply-templates select="$nodes" mode="toc">
     </xsl:call-template>
   </xsl:variable>
 
+  <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
   <xsl:call-template name="toc.line"/>
 
-  <xsl:if test="$toc.section.depth &gt; 0 and refentry">
+  <xsl:if test="$toc.section.depth > 0
+                and $toc.max.depth > $depth.from.context
+                and refentry">
     <fo:block id="toc.{$cid}.{$id}"
               start-indent="{count(ancestor::*)*$toc.indent.width}pt">
       <xsl:apply-templates select="refentry" mode="toc">
                                     |simplesect[$simplesect.in.toc != 0]
                                     |refentry"/>
 
-  <xsl:if test="$toc.section.depth &gt; 0 and $nodes">
+  <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+  <xsl:if test="$toc.section.depth > 0 
+                and $toc.max.depth > $depth.from.context
+                and $nodes">
     <fo:block id="toc.{$cid}.{$id}"
               start-indent="{count(ancestor::*)*$toc.indent.width}pt">
       <xsl:apply-templates select="$nodes" mode="toc">
 
   <xsl:call-template name="toc.line"/>
 
-  <xsl:if test="$toc.section.depth &gt; 1 and sect2">
+  <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+  <xsl:if test="$toc.section.depth > 1 
+                and $toc.max.depth > $depth.from.context
+                and sect2">
     <fo:block id="toc.{$cid}.{$id}"
               start-indent="{count(ancestor::*)*$toc.indent.width}pt">
       <xsl:apply-templates select="sect2" mode="toc">
   <xsl:variable name="reldepth"
                 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
 
-  <xsl:if test="$toc.section.depth &gt; 2 and sect3">
+  <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+  <xsl:if test="$toc.section.depth > 2 
+                and $toc.max.depth > $depth.from.context
+                and sect3">
     <fo:block id="toc.{$cid}.{$id}"
               start-indent="{$reldepth*$toc.indent.width}pt">
       <xsl:apply-templates select="sect3" mode="toc">
   <xsl:variable name="reldepth"
                 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
 
-  <xsl:if test="$toc.section.depth &gt; 3 and sect4">
+  <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+  <xsl:if test="$toc.section.depth > 3 
+                and $toc.max.depth > $depth.from.context
+                and sect4">
     <fo:block id="toc.{$cid}.{$id}"
               start-indent="{$reldepth*$toc.indent.width}pt">
       <xsl:apply-templates select="sect4" mode="toc">
   <xsl:variable name="reldepth"
                 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
 
-  <xsl:if test="$toc.section.depth &gt; 4 and sect5">
+  <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+  <xsl:if test="$toc.section.depth > 4 
+                and $toc.max.depth > $depth.from.context
+                and sect5">
     <fo:block id="toc.{$cid}.{$id}"
               start-indent="{$reldepth*$toc.indent.width}pt">
       <xsl:apply-templates select="sect5" mode="toc">
   <xsl:variable name="reldepth"
                 select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
 
+  <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
   <xsl:if test="$toc.section.depth &gt;= $depth">
     <xsl:call-template name="toc.line"/>
 
-    <xsl:if test="$toc.section.depth &gt; $depth and section">
+    <xsl:if test="$toc.section.depth > $depth 
+                  and $toc.max.depth > $depth.from.context
+                  and section">
       <fo:block id="toc.{$cid}.{$id}"
                 start-indent="{$reldepth*$toc.indent.width}pt">
         <xsl:apply-templates select="section" mode="toc">
index 0e68b5f27c9e56dbc9e54e226ceba09513d04795..d9754e33aff98ca42c897e2e8e235a133a68be7e 100644 (file)
 <!ENTITY title.margin.left SYSTEM "../params/title.margin.left.xml">
 <!ENTITY toc.indent.width SYSTEM "../params/toc.indent.width.xml">
 <!ENTITY toc.margin.properties SYSTEM "../params/toc.margin.properties.xml">
+<!ENTITY toc.max.depth SYSTEM "../params/toc.max.depth.xml">
 <!ENTITY toc.section.depth SYSTEM "../params/toc.section.depth.xml">
 <!ENTITY ulink.footnotes SYSTEM "../params/ulink.footnotes.xml">
 <!ENTITY ulink.hyphenate SYSTEM "../params/ulink.hyphenate.xml">
index e619c9ba967ccb4ec1381d953035556cf53ad69d..b5cb8119391a3f0717513f62d22e7983a59d290a 100644 (file)
@@ -98,6 +98,7 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 &index.div.title.properties;
 &xep.index.item.properties;
 &toc.section.depth;
+&toc.max.depth;
 &toc.indent.width;
 &toc.margin.properties;
 &bridgehead.in.toc;
@@ -773,6 +774,7 @@ around all these parameters.</para>
 <src:fragref linkend="title.margin.left.frag"/>
 <src:fragref linkend="toc.indent.width.frag"/>
 <src:fragref linkend="toc.margin.properties.frag"/>
+<src:fragref linkend="toc.max.depth.frag"/>
 <src:fragref linkend="toc.section.depth.frag"/>
 <src:fragref linkend="ulink.footnotes.frag"/>
 <src:fragref linkend="ulink.hyphenate.frag"/>