]> granicus.if.org Git - docbook-dsssl/commitdiff
Fix bug 3424546, no TOC for top level reference element in FO output.
authorBob Stayton <bobs@sagehill.net>
Tue, 15 Nov 2011 22:07:59 +0000 (22:07 +0000)
committerBob Stayton <bobs@sagehill.net>
Tue, 15 Nov 2011 22:07:59 +0000 (22:07 +0000)
xsl/fo/refentry.xsl

index 1e120bccfe4486ef264eb5602a559a747c3b7421..2d9ceb071e897934a7e0c20f206c32d4ac57758d 100644 (file)
@@ -17,6 +17,7 @@
 <!-- ==================================================================== -->
 
 <xsl:template match="reference">
+   <!-- If there is a partintro, it triggers the page  sequence -->
    <xsl:if test="not(partintro)">
     <xsl:variable name="id">
       <xsl:call-template name="object.id"/>
         <fo:block id="{$id}">
           <xsl:call-template name="reference.titlepage"/>
         </fo:block>
+
+        <xsl:variable name="toc.params">
+          <xsl:call-template name="find.path.params">
+            <xsl:with-param name="table" 
+                            select="normalize-space($generate.toc)"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:if test="contains($toc.params, 'toc')">
+          <xsl:call-template name="component.toc">
+            <xsl:with-param name="toc.title.p" 
+                            select="contains($toc.params, 'title')"/>
+          </xsl:call-template>
+          <xsl:call-template name="component.toc.separator"/>
+        </xsl:if>
+
         <!-- Create one page sequence if no pagebreaks needed -->
         <xsl:if test="$refentry.pagebreak = 0">
           <xsl:apply-templates select="refentry"/>
         <xsl:call-template name="partintro.titlepage"/>
       </xsl:if>
       <xsl:apply-templates/>
+
+      <!-- switch contexts to generate any toc -->
+      <xsl:for-each select="..">
+        <xsl:variable name="toc.params">
+          <xsl:call-template name="find.path.params">
+            <xsl:with-param name="table" 
+                            select="normalize-space($generate.toc)"/>
+          </xsl:call-template>
+        </xsl:variable>
+        <xsl:if test="contains($toc.params, 'toc')">
+          <xsl:call-template name="component.toc">
+            <xsl:with-param name="toc.title.p" 
+                            select="contains($toc.params, 'title')"/>
+          </xsl:call-template>
+          <xsl:call-template name="component.toc.separator"/>
+        </xsl:if>
+      </xsl:for-each>
+
       <!-- Create one page sequence if no pagebreaks needed -->
       <xsl:if test="$refentry.pagebreak = 0">
         <xsl:apply-templates select="../refentry"/>