]> granicus.if.org Git - docbook-dsssl/commitdiff
Further changes related to handling when qanda.nested.in.toc is
authorMichael Smith <xmldoc@users.sourceforge.net>
Sat, 5 Aug 2006 17:30:39 +0000 (17:30 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Sat, 5 Aug 2006 17:30:39 +0000 (17:30 +0000)
non-zer0; deal also with answer/qandaset instances (which are
valid in DocBook 5).

xsl/html/qandaset.xsl

index c4b8552dc15fac93f9fe49d051cf4af8e6d82a3e..722358c937e4e5adf38edd4fd992a550e71b8159 100644 (file)
         and name(.) != 'qandaentry']"/>
       <!-- * handle nested answer/qandaentry instances -->
       <!-- * (bug 1509043 from Daniel Leidert) -->
-      <xsl:if test="child::qandaentry">
+      <xsl:if test="descendant::question">
         <xsl:call-template name="process.qandaset"/>
       </xsl:if>
     </td>
 <!-- ==================================================================== -->
 
 <xsl:template name="process.qanda.toc">
+  <!-- * if user wants nested qandaset and qandaentry in main Qandaset TOC, -->
+  <!-- * then don't also include the nested stuff in the sub TOCs -->
+  <xsl:if test="not($qanda.nested.in.toc = 0) and not(ancestor::answer)">
   <dl>
     <xsl:apply-templates select="qandadiv" mode="qandatoc.mode"/>
-    <xsl:apply-templates select="qandaentry" mode="qandatoc.mode"/>
+    <xsl:apply-templates select="qandaset|qandaentry" mode="qandatoc.mode"/>
   </dl>
+  </xsl:if>
 </xsl:template>
 
 <xsl:template match="qandadiv" mode="qandatoc.mode">
   </a>
 </xsl:template>
 
+<xsl:template match="qandaset" mode="qandatoc.mode">
+  <xsl:for-each select="qandaentry">
+    <xsl:apply-templates select="." mode="qandatoc.mode"/>
+  </xsl:for-each>
+</xsl:template>
+
 <xsl:template match="qandaentry" mode="qandatoc.mode">
   <xsl:apply-templates select="question" mode="qandatoc.mode"/>
 </xsl:template>
       <xsl:value-of select="$firstch"/>
     </a>
   </dt>
+  <!-- * include nested qandaset/qandaentry in TOC if user wants it -->
   <xsl:if test="not($qanda.nested.in.toc = 0)">
     <xsl:apply-templates select="following-sibling::answer" mode="qandatoc.mode"/>
   </xsl:if>
 </xsl:template>
 
 <xsl:template match="answer" mode="qandatoc.mode">
-  <xsl:if test="child::qandaentry">
+  <xsl:if test="descendant::question">
     <dd>
       <xsl:call-template name="process.qanda.toc"/>
     </dd>