]> granicus.if.org Git - docbook-dsssl/commitdiff
Add support for qanda.in.toc to add qandaentry questions to document TOC.
authorBob Stayton <bobs@sagehill.net>
Thu, 4 Jan 2007 09:55:38 +0000 (09:55 +0000)
committerBob Stayton <bobs@sagehill.net>
Thu, 4 Jan 2007 09:55:38 +0000 (09:55 +0000)
xsl/html/autotoc.xsl
xsl/html/param.ent
xsl/html/param.xweb

index 6504ae3cce33c43bff472f8aaeb0d4358e64abc2..b390a1c2b10abdab40f7d63ae7f669b13cf7bac5 100644 (file)
@@ -32,6 +32,8 @@
   <xsl:param name="toc.title.p" select="true()"/>
   <xsl:param name="nodes" select="/NOT-AN-ELEMENT"/>
 
+  <xsl:variable name="nodes.plus" select="$nodes | qandaset"/>
+
   <xsl:variable name="toc.title">
     <xsl:if test="$toc.title.p">
       <p>
       </xsl:if>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:if test="$nodes">
-        <div class="toc">
-          <xsl:copy-of select="$toc.title"/>
-          <xsl:element name="{$toc.list.type}">
-            <xsl:apply-templates select="$nodes" mode="toc">
-              <xsl:with-param name="toc-context" select="$toc-context"/>
-            </xsl:apply-templates>
-          </xsl:element>
-        </div>
-      </xsl:if>
+      <xsl:choose>
+        <xsl:when test="$qanda.in.toc != 0">
+          <xsl:if test="$nodes.plus">
+            <div class="toc">
+              <xsl:copy-of select="$toc.title"/>
+              <xsl:element name="{$toc.list.type}">
+                <xsl:apply-templates select="$nodes.plus" mode="toc">
+                  <xsl:with-param name="toc-context" select="$toc-context"/>
+                </xsl:apply-templates>
+              </xsl:element>
+            </div>
+          </xsl:if>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:if test="$nodes">
+            <div class="toc">
+              <xsl:copy-of select="$toc.title"/>
+              <xsl:element name="{$toc.list.type}">
+                <xsl:apply-templates select="$nodes" mode="toc">
+                  <xsl:with-param name="toc-context" select="$toc-context"/>
+                </xsl:apply-templates>
+              </xsl:element>
+            </div>
+          </xsl:if>
+        </xsl:otherwise>
+      </xsl:choose>
+
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
   <xsl:param name="toc-context" select="."/>
   <xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
 
+  <xsl:variable name="nodes.plus" select="$nodes | qandaset"/>
+
   <xsl:variable name="subtoc">
     <xsl:element name="{$toc.list.type}">
-      <xsl:apply-templates mode="toc" select="$nodes">
-        <xsl:with-param name="toc-context" select="$toc-context"/>
-      </xsl:apply-templates>
+      <xsl:choose>
+        <xsl:when test="$qanda.in.toc != 0">
+          <xsl:apply-templates mode="toc" select="$nodes.plus">
+            <xsl:with-param name="toc-context" select="$toc-context"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates mode="toc" select="$nodes">
+            <xsl:with-param name="toc-context" select="$toc-context"/>
+          </xsl:apply-templates>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:element>
   </xsl:variable>
 
       <xsl:with-param name="toc-context" select="$toc-context"/>
     </xsl:call-template>
     <xsl:if test="$toc.listitem.type = 'li'
-                  and $toc.section.depth > $depth and count($nodes)&gt;0
+                  and $toc.section.depth > $depth and 
+                  ( ($qanda.in.toc = 0 and count($nodes)&gt;0) or
+                    ($qanda.in.toc != 0 and count($nodes.plus)&gt;0) )
                   and $toc.max.depth > $depth.from.context">
       <xsl:copy-of select="$subtoc.list"/>
     </xsl:if>
   </xsl:element>
   <xsl:if test="$toc.listitem.type != 'li'
-                and $toc.section.depth > $depth and count($nodes)&gt;0
+                and $toc.section.depth > $depth and 
+                ( ($qanda.in.toc = 0 and count($nodes)&gt;0) or
+                  ($qanda.in.toc != 0 and count($nodes.plus)&gt;0) )
                 and $toc.max.depth > $depth.from.context">
     <xsl:copy-of select="$subtoc.list"/>
   </xsl:if>
   </xsl:element>
 </xsl:template>
 
+<!-- Used only if qanda.in.toc parameter is non-zero -->
+<xsl:template match="qandaset" mode="toc">
+  <xsl:param name="toc-context" select="."/>
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="toc-context" select="$toc-context"/>
+    <xsl:with-param name="nodes" select="qandadiv | qandaentry"/>
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="qandadiv|qandaentry" mode="toc">
+  <xsl:apply-templates select="." mode="qandatoc.mode"/>
+</xsl:template>
+
 </xsl:stylesheet>
 
index be00c6594a95b3adfabd379fe06205d8a3338568..ff88cbe6c1ef521e3d21166c028d39fffda977c5 100644 (file)
 <!ENTITY profile.vendor SYSTEM "../params/profile.vendor.xml">
 <!ENTITY punct.honorific SYSTEM "../params/punct.honorific.xml">
 <!ENTITY qanda.defaultlabel SYSTEM "../params/qanda.defaultlabel.xml">
+<!ENTITY qanda.in.toc SYSTEM "../params/qanda.in.toc.xml">
 <!ENTITY qanda.inherit.numeration SYSTEM "../params/qanda.inherit.numeration.xml">
 <!ENTITY qanda.nested.in.toc SYSTEM "../params/qanda.nested.in.toc.xml">
 <!ENTITY qandadiv.autolabel SYSTEM "../params/qandadiv.autolabel.xml">
 <!ENTITY id.warnings SYSTEM "../params/id.warnings.xml">
 <!ENTITY index.method SYSTEM "../params/index.method.xml">
 <!ENTITY reference.autolabel SYSTEM "../params/reference.autolabel.xml">
+<!ENTITY glossary.sort SYSTEM "../params/glossary.sort.xml">
index 2b9c288e12b3d488530688b2be869da2cfe8e7c9..15de4521fee3fa35a423ef14fd000c09c3fd8afd 100644 (file)
@@ -187,6 +187,7 @@ $Id$
 <reference id="qa"><title>QAndASet</title>
 &qanda.defaultlabel;
 &qanda.inherit.numeration;
+&qanda.in.toc;
 &qanda.nested.in.toc;
 </reference>
 
@@ -239,6 +240,7 @@ $Id$
 &glossterm.auto.link;
 &firstterm.only.link;
 &glossary.collection;
+&glossary.sort;
 &glossentry.show.acronym;
 </reference>
 
@@ -521,6 +523,7 @@ around all these parameters.</para>
 <src:fragref linkend="generate.section.toc.level.frag"/>
 <src:fragref linkend="generate.toc.frag"/>
 <src:fragref linkend="glossary.collection.frag"/>
+<src:fragref linkend="glossary.sort.frag"/>
 <src:fragref linkend="glossentry.show.acronym.frag"/>
 <src:fragref linkend="glossterm.auto.link.frag"/>
 <src:fragref linkend="graphic.default.extension.frag"/>
@@ -671,6 +674,7 @@ around all these parameters.</para>
 <src:fragref linkend="punct.honorific.frag"/>
 <src:fragref linkend="qanda.defaultlabel.frag"/>
 <src:fragref linkend="qanda.inherit.numeration.frag"/>
+<src:fragref linkend="qanda.in.toc.frag"/>
 <src:fragref linkend="qanda.nested.in.toc.frag"/>
 <src:fragref linkend="qandadiv.autolabel.frag"/>
 <src:fragref linkend="refentry.generate.name.frag"/>