]> granicus.if.org Git - docbook-dsssl/commitdiff
Add support for qanda.in.toc to fo TOC.
authorBob Stayton <bobs@sagehill.net>
Mon, 2 Apr 2007 08:54:24 +0000 (08:54 +0000)
committerBob Stayton <bobs@sagehill.net>
Mon, 2 Apr 2007 08:54:24 +0000 (08:54 +0000)
xsl/fo/autotoc.xsl
xsl/fo/param.ent
xsl/fo/param.xweb

index e2bae9b1f3abaf20bec0ae7d321cbf06752ea81e..4736a59e9272a27a36069902d7f391f5dce8c1e1 100644 (file)
 
   <xsl:variable name="nodes" select="section|sect1|refentry
                                      |article|bibliography|glossary
+                                     |qandaset[$qanda.in.toc != 0]
                                      |appendix|index"/>
   <xsl:if test="$nodes">
     <fo:block id="toc...{$id}"
 
   <xsl:variable name="nodes"
                 select="section|sect1|sect2|sect3|sect4|sect5|refentry
+                        |qandaset[$qanda.in.toc != 0]
                         |bridgehead[$bridgehead.in.toc != 0]"/>
 
   <xsl:variable name="level">
   </xsl:call-template>
 
   <xsl:variable name="nodes" select="section|sect1
+                                     |qandaset[$qanda.in.toc != 0]
                                      |simplesect[$simplesect.in.toc != 0]
                                      |refentry|appendix"/>
 
         <xsl:call-template name="set.toc.indent"/>
       </xsl:attribute>
               
-      <xsl:apply-templates select="sect2" mode="toc">
+      <xsl:apply-templates select="sect2|qandaset[$qanda.in.toc != 0]" 
+                           mode="toc">
         <xsl:with-param name="toc-context" select="$toc-context"/>
       </xsl:apply-templates>
     </fo:block>
         </xsl:call-template>
       </xsl:attribute>
               
-      <xsl:apply-templates select="sect3" mode="toc">
+      <xsl:apply-templates select="sect3|qandaset[$qanda.in.toc != 0]" 
+                           mode="toc">
         <xsl:with-param name="toc-context" select="$toc-context"/>
       </xsl:apply-templates>
     </fo:block>
         </xsl:call-template>
       </xsl:attribute>
               
-      <xsl:apply-templates select="sect4" mode="toc">
+      <xsl:apply-templates select="sect4|qandaset[$qanda.in.toc != 0]" 
+                           mode="toc">
         <xsl:with-param name="toc-context" select="$toc-context"/>
       </xsl:apply-templates>
     </fo:block>
         </xsl:call-template>
       </xsl:attribute>
               
-      <xsl:apply-templates select="sect5" mode="toc">
+      <xsl:apply-templates select="sect5|qandaset[$qanda.in.toc != 0]" 
+                           mode="toc">
         <xsl:with-param name="toc-context" select="$toc-context"/>
       </xsl:apply-templates>
     </fo:block>
           </xsl:call-template>
         </xsl:attribute>
                 
-        <xsl:apply-templates select="section" mode="toc">
+        <xsl:apply-templates select="section|qandaset[$qanda.in.toc != 0]" 
+                           mode="toc">
           <xsl:with-param name="toc-context" select="$toc-context"/>
         </xsl:apply-templates>
       </fo:block>
 
 <!-- ==================================================================== -->
 
+<!-- qandaset handled like a section when qanda.in.toc is set -->
+<xsl:template match="qandaset" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="cid">
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="$toc-context"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="depth" select="count(ancestor::section) + 1"/>
+  <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:with-param name="toc-context" select="$toc-context"/>
+    </xsl:call-template>
+
+    <xsl:if test="$toc.section.depth > $depth 
+                  and $toc.max.depth > $depth.from.context
+                  and (child::qandadiv or child::qandaentry)">
+      <fo:block id="toc.{$cid}.{$id}">
+        <xsl:attribute name="margin-left">
+          <xsl:call-template name="set.toc.indent">
+            <xsl:with-param name="reldepth" select="$reldepth"/>
+          </xsl:call-template>
+        </xsl:attribute>
+                
+        <xsl:apply-templates select="qandadiv|qandaentry" mode="toc">
+          <xsl:with-param name="toc-context" select="$toc-context"/>
+        </xsl:apply-templates>
+      </fo:block>
+    </xsl:if>
+  </xsl:if>
+</xsl:template>
+
 </xsl:stylesheet>
 
index 7edfe8be76a92f1f8b62506e6642434ce23cf705..18621a79f1dfaec98d919b9d16ca7aa8b9b3ff10 100644 (file)
 <!ENTITY profile.value SYSTEM "../params/profile.value.xml">
 <!ENTITY profile.vendor SYSTEM "../params/profile.vendor.xml">
 <!ENTITY punct.honorific SYSTEM "../params/punct.honorific.xml">
+<!ENTITY qanda.in.toc SYSTEM "../params/qanda.in.toc.xml">
+<!ENTITY qanda.nested.in.toc SYSTEM "../params/qanda.nested.in.toc.xml">
 <!ENTITY qanda.inherit.numeration SYSTEM "../params/qanda.inherit.numeration.xml">
 <!ENTITY qandadiv.autolabel SYSTEM "../params/qandadiv.autolabel.xml">
 <!ENTITY refentry.generate.name SYSTEM "../params/refentry.generate.name.xml">
index 8a8d8a433aa15afaadea3817d4e82b678359003d..f37651b7384dd715558ea86e7c05349a6c34ddf2 100644 (file)
@@ -207,6 +207,8 @@ generate.section.toc.level;
 &qandadiv.autolabel;
 &qanda.inherit.numeration;
 &qanda.defaultlabel;
+&qanda.in.toc;
+&qanda.nested.in.toc;
 </reference>
 
 <reference id="biblio"><title>Bibliography</title>
@@ -766,6 +768,8 @@ around all these parameters.</para>
 <src:fragref linkend="profile.vendor.frag"/>
 <src:fragref linkend="punct.honorific.frag"/>
 <src:fragref linkend="qanda.defaultlabel.frag"/>
+<src:fragref linkend="qanda.in.toc.frag"/>
+<src:fragref linkend="qanda.nested.in.toc.frag"/>
 <src:fragref linkend="qanda.inherit.numeration.frag"/>
 <src:fragref linkend="qandadiv.autolabel.frag"/>
 <src:fragref linkend="qanda.title.level1.properties.frag"/>