]> granicus.if.org Git - docbook-dsssl/commitdiff
First tentative stab at getting ToCs and LoTs into separate chunks--does not work
authorNorman Walsh <ndw@nwalsh.com>
Sun, 7 Jul 2002 13:38:14 +0000 (13:38 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sun, 7 Jul 2002 13:38:14 +0000 (13:38 +0000)
xsl/html/chunk-common.xsl
xsl/html/chunk.xsl

index d45183315f20f272cecfec862539504bdb50b2ef..2e59858415d2132e67024a4b935b2e464294b7eb 100644 (file)
 <!-- ==================================================================== -->
 
 <xsl:template name="chunk-element-content">
-  <xsl:param name="prev"></xsl:param>
-  <xsl:param name="next"></xsl:param>
+  <xsl:param name="prev"/>
+  <xsl:param name="next"/>
+  <xsl:param name="content"/>
 
   <html>
     <xsl:call-template name="html.head">
 
       <xsl:call-template name="user.header.content"/>
 
-      <xsl:apply-imports/>
+      <xsl:choose>
+        <xsl:when test="$content">
+          <xsl:copy-of select="$content"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-imports/>
+        </xsl:otherwise>
+      </xsl:choose>
 
       <xsl:call-template name="user.footer.content"/>
 
index 23079d3062588a56dafe02e3465a1eaf873d6ad6..31b94ee5de7f487bb71b4660c2adb6ad48b3bc26 100644 (file)
@@ -10,6 +10,9 @@
 <xsl:param name="onechunk" select="0"/>
 <xsl:param name="refentry.separator" select="0"/>
 
+<!-- this doesn't work and I have misgivings about ever getting it to work -->
+<xsl:param name="chunk.tocs.and.lots" select="0"/>
+
 <!-- ==================================================================== -->
 
 <xsl:template name="process-chunk-element">
 
 <!-- ==================================================================== -->
 
+<xsl:template name="division.toc">
+  <xsl:param name="toc-context" select="."/>
+
+  <xsl:variable name="toc.title">
+    <p>
+      <b>
+        <xsl:call-template name="gentext">
+          <xsl:with-param name="key">TableofContents</xsl:with-param>
+        </xsl:call-template>
+      </b>
+    </p>
+  </xsl:variable>
+
+  <xsl:variable name="toc">
+    <xsl:choose>
+      <xsl:when test="$manual.toc != ''">
+        <xsl:variable name="id">
+          <xsl:call-template name="object.id"/>
+        </xsl:variable>
+        <xsl:variable name="toc" select="document($manual.toc, .)"/>
+        <xsl:variable name="tocentry" select="$toc//tocentry[@linkend=$id]"/>
+        <xsl:if test="$tocentry and $tocentry/*">
+          <div class="toc">
+            <xsl:copy-of select="$toc.title"/>
+            <xsl:element name="{$toc.list.type}">
+              <xsl:call-template name="manual-toc">
+                <xsl:with-param name="tocentry" select="$tocentry/*[1]"/>
+              </xsl:call-template>
+            </xsl:element>
+          </div>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="nodes" select="part|reference
+                                           |preface|chapter|appendix
+                                           |article
+                                           |bibliography|glossary|index
+                                           |refentry
+                                           |bridgehead"/>
+        <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:variable>
+
+  <xsl:choose>
+    <xsl:when test="$chunk.tocs.and.lots != 0">
+      <xsl:call-template name="write.chunk">
+        <xsl:with-param name="filename">
+          <xsl:apply-templates select="." mode="chunk-filename"/>
+          <xsl:text>-toc.html</xsl:text>
+        </xsl:with-param>
+        <xsl:with-param name="content">
+          <xsl:call-template name="chunk-element-content">
+            <xsl:with-param name="prev" select="/foo"/>
+            <xsl:with-param name="next" select="/foo"/>
+            <xsl:with-param name="content">
+              <xsl:copy-of select="$toc"/>
+            </xsl:with-param>
+          </xsl:call-template>
+        </xsl:with-param>
+        <xsl:with-param name="quiet" select="$chunk.quietly"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$toc"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
 <xsl:template name="in.other.chunk">
   <xsl:param name="chunk" select="."/>
   <xsl:param name="node" select="."/>