]> granicus.if.org Git - docbook-dsssl/commitdiff
Added experimental manual TOC processing for chunking and TOC generation
authorNorman Walsh <ndw@nwalsh.com>
Thu, 7 Feb 2002 18:01:42 +0000 (18:01 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Thu, 7 Feb 2002 18:01:42 +0000 (18:01 +0000)
xsl/html/autotoc.xsl
xsl/html/chunk-common.xsl [new file with mode: 0644]
xsl/html/chunk.xsl
xsl/html/chunktoc.xsl [new file with mode: 0644]
xsl/html/maketoc.xsl [new file with mode: 0644]
xsl/html/param.ent
xsl/html/param.xweb
xsl/params/chunk.toc.xml [new file with mode: 0644]
xsl/params/manual.toc.xml [new file with mode: 0644]

index 57540c97a3b4f49c9c736f91771183b2b7c29127..d05b0d8f616b67a2b576f2bf83f565494ef5d58f 100644 (file)
 </xsl:variable>
 
 <xsl:template name="set.toc">
-  <xsl:variable name="nodes" select="book|setindex"/>
-  <xsl:if test="$nodes">
-    <div class="toc">
+  <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: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="book|setindex"/>
+
+      <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:element>
+        </div>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template name="division.toc">
+  <xsl:if test="$generate.division.toc != 0">
+    <xsl:variable name="toc.title">
       <p>
         <b>
           <xsl:call-template name="gentext">
           </xsl:call-template>
         </b>
       </p>
-      <xsl:element name="{$toc.list.type}">
-        <xsl:apply-templates select="$nodes" mode="toc"/>
-      </xsl:element>
-    </div>
-  </xsl:if>
-</xsl:template>
+    </xsl:variable>
 
-<xsl:template name="division.toc">
-  <xsl:if test="$generate.division.toc != 0">
-    <xsl:variable name="nodes" select="part|reference
-                                       |preface|chapter|appendix
-                                       |article
-                                       |bibliography|glossary|index
-                                       |refentry
-                                       |bridgehead"/>
-    <xsl:if test="$nodes">
-      <div class="toc">
-        <p>
-          <b>
-           <xsl:call-template name="gentext">
-             <xsl:with-param name="key">TableofContents</xsl:with-param>
-           </xsl:call-template>
-          </b>
-        </p>
-        <xsl:element name="{$toc.list.type}">
-          <xsl:apply-templates select="$nodes" mode="toc"/>
-        </xsl:element>
-      </div>
-    </xsl:if>
+    <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:element>
+          </div>
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:if>
 </xsl:template>
 
 <xsl:template name="component.toc">
   <xsl:if test="$generate.component.toc != 0">
-    <xsl:variable name="nodes" select="section|sect1|refentry
-                                       |article|bibliography|glossary
-                                       |appendix|bridgehead[not(@renderas)]
-                                       |.//bridgehead[@renderas='sect1']"/>
-    <xsl:if test="$nodes">
-      <div class="toc">
-        <p>
-          <b>
-           <xsl:call-template name="gentext">
-             <xsl:with-param name="key">TableofContents</xsl:with-param>
-           </xsl:call-template>
-          </b>
-        </p>
-        <xsl:element name="{$toc.list.type}">
-          <xsl:apply-templates select="$nodes" mode="toc"/>
-        </xsl:element>
-      </div>
-    </xsl:if>
-  </xsl:if>
-</xsl:template>
-
-<xsl:template name="section.toc">
-  <xsl:variable name="nodes"
-                select="section|sect1|sect2|sect3|sect4|sect5|refentry
-                        |bridgehead"/>
-  <xsl:if test="$nodes">
-    <div class="toc">
+    <xsl:variable name="toc.title">
       <p>
         <b>
           <xsl:call-template name="gentext">
           </xsl:call-template>
         </b>
       </p>
-      <xsl:element name="{$toc.list.type}">
-        <xsl:apply-templates select="$nodes" mode="toc"/>
-      </xsl:element>
-    </div>
-  </xsl:if>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="book|setindex" mode="toc">
-  <xsl:variable name="nodes" select="part|reference
-                                     |preface|chapter|appendix
-                                     |article
-                                     |bibliography|glossary|index
-                                     |refentry
-                                     |bridgehead"/>
-
-  <xsl:variable name="subtoc">
-    <xsl:element name="{$toc.list.type}">
-      <xsl:apply-templates mode="toc" select="$nodes"/>
-    </xsl:element>
-  </xsl:variable>
+    </xsl:variable>
 
-  <xsl:variable name="subtoc.list">
     <xsl:choose>
-      <xsl:when test="$toc.dd.type = ''">
-        <xsl:copy-of select="$subtoc"/>
+      <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:element name="{$toc.dd.type}">
-          <xsl:copy-of select="$subtoc"/>
-        </xsl:element>
+        <xsl:variable name="nodes" select="section|sect1|refentry
+                                           |article|bibliography|glossary
+                                           |appendix|bridgehead[not(@renderas)]
+                                           |.//bridgehead[@renderas='sect1']"/>
+        <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:element>
+          </div>
+        </xsl:if>
       </xsl:otherwise>
     </xsl:choose>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="section.toc">
+  <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:element name="{$toc.listitem.type}">
-    <xsl:variable name="label">
-      <xsl:apply-templates select="." mode="label.markup"/>
-    </xsl:variable>
-    <xsl:copy-of select="$label"/>
-    <xsl:if test="$label != ''">
-      <xsl:value-of select="$autotoc.label.separator"/>
-    </xsl:if>
-    <a>
-      <xsl:attribute name="href">
-        <xsl:call-template name="href.target"/>
-      </xsl:attribute>
-      <xsl:apply-templates select="." mode="title.markup"/>
-    </a>
-    <xsl:if test="$toc.listitem.type = 'li'
-                  and $toc.section.depth>0 and count($nodes)&gt;0">
-      <xsl:copy-of select="$subtoc.list"/>
-    </xsl:if>
-  </xsl:element>
-  <xsl:if test="$toc.listitem.type != 'li'
-                and $toc.section.depth>0 and count($nodes)&gt;0">
-    <xsl:copy-of select="$subtoc.list"/>
-  </xsl:if>
+  <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="section|sect1|sect2|sect3|sect4|sect5|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:element>
+        </div>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
-<xsl:template match="part|reference" mode="toc">
-  <xsl:variable name="nodes" select="appendix|chapter|article
-                                     |index|glossary|bibliography
-                                     |preface|reference|refentry
-                                     |bridgehead"/>
+<!-- ==================================================================== -->
+
+<xsl:template name="subtoc">
+  <xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
 
   <xsl:variable name="subtoc">
     <xsl:element name="{$toc.list.type}">
-      <xsl:apply-templates select="$nodes" mode="toc"/>
+      <xsl:apply-templates mode="toc" select="$nodes"/>
     </xsl:element>
   </xsl:variable>
 
       <xsl:apply-templates select="." mode="title.markup"/>
     </a>
     <xsl:if test="$toc.listitem.type = 'li'
-                  and $toc.section.depth>0 and count($nodes) &gt; 0">
+                  and $toc.section.depth>0 and count($nodes)&gt;0">
       <xsl:copy-of select="$subtoc.list"/>
     </xsl:if>
   </xsl:element>
   <xsl:if test="$toc.listitem.type != 'li'
-                and $toc.section.depth>0 and count($nodes) &gt; 0">
+                and $toc.section.depth>0 and count($nodes)&gt;0">
     <xsl:copy-of select="$subtoc.list"/>
   </xsl:if>
 </xsl:template>
 
-<xsl:template match="preface|chapter|appendix|article" mode="toc">
-  <xsl:variable name="subtoc">
-    <xsl:element name="{$toc.list.type}">
-      <xsl:apply-templates select="section|sect1|bridgehead" mode="toc"/>
-    </xsl:element>
-  </xsl:variable>
+<xsl:template match="book|setindex" mode="toc">
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="nodes" select="part|reference
+                                         |preface|chapter|appendix
+                                         |article
+                                         |bibliography|glossary|index
+                                         |refentry
+                                         |bridgehead"/>
+  </xsl:call-template>
+</xsl:template>
 
-  <xsl:variable name="subtoc.list">
-    <xsl:choose>
-      <xsl:when test="$toc.dd.type = ''">
-        <xsl:copy-of select="$subtoc"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:element name="{$toc.dd.type}">
-          <xsl:copy-of select="$subtoc"/>
-        </xsl:element>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
+<xsl:template match="part|reference" mode="toc">
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="nodes" select="appendix|chapter|article
+                                         |index|glossary|bibliography
+                                         |preface|reference|refentry
+                                         |bridgehead"/>
+  </xsl:call-template>
+</xsl:template>
 
-  <xsl:element name="{$toc.listitem.type}">
-    <xsl:variable name="label">
-      <xsl:apply-templates select="." mode="label.markup"/>
-    </xsl:variable>
-    <xsl:copy-of select="$label"/>
-    <xsl:if test="$label != ''">
-      <xsl:value-of select="$autotoc.label.separator"/>
-    </xsl:if>
-    <a>
-      <xsl:attribute name="href">
-        <xsl:call-template name="href.target"/>
-      </xsl:attribute>
-      <xsl:apply-templates select="." mode="title.markup"/>
-    </a>
-    <xsl:if test="$toc.listitem.type = 'li'
-                  and $toc.section.depth>0 and section|sect1">
-      <xsl:copy-of select="$subtoc.list"/>
-    </xsl:if>
-  </xsl:element>
-  <xsl:if test="$toc.listitem.type != 'li'
-                and $toc.section.depth>0 and section|sect1">
-    <xsl:copy-of select="$subtoc.list"/>
-  </xsl:if>
+<xsl:template match="preface|chapter|appendix|article" mode="toc">
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="nodes" select="section|sect1|bridgehead"/>
+  </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="sect1" mode="toc">
-  <xsl:variable name="subtoc">
-    <xsl:element name="{$toc.list.type}">
-      <xsl:apply-templates select="sect2|bridgehead" mode="toc"/>
-    </xsl:element>
-  </xsl:variable>
-
-  <xsl:variable name="subtoc.list">
-    <xsl:choose>
-      <xsl:when test="$toc.dd.type = ''">
-        <xsl:copy-of select="$subtoc"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:element name="{$toc.dd.type}">
-          <xsl:copy-of select="$subtoc"/>
-        </xsl:element>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:element name="{$toc.listitem.type}">
-    <xsl:variable name="label">
-      <xsl:apply-templates select="." mode="label.markup"/>
-    </xsl:variable>
-    <xsl:copy-of select="$label"/>
-    <xsl:if test="$label != ''">
-      <xsl:value-of select="$autotoc.label.separator"/>
-    </xsl:if>
-    <a>
-      <xsl:attribute name="href">
-        <xsl:call-template name="href.target"/>
-      </xsl:attribute>
-      <xsl:apply-templates select="." mode="title.markup"/>
-    </a>
-    <xsl:if test="$toc.listitem.type = 'li'
-                  and $toc.section.depth>1 and sect2">
-      <xsl:copy-of select="$subtoc.list"/>
-    </xsl:if>
-  </xsl:element>
-  <xsl:if test="$toc.listitem.type != 'li'
-                and $toc.section.depth>1 and sect2">
-    <xsl:copy-of select="$subtoc.list"/>
-  </xsl:if>
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="nodes" select="sect2|bridgehead"/>
+  </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="sect2" mode="toc">
-  <xsl:variable name="subtoc">
-    <xsl:element name="{$toc.list.type}">
-      <xsl:apply-templates select="sect3|bridgehead" mode="toc"/>
-    </xsl:element>
-  </xsl:variable>
-
-  <xsl:variable name="subtoc.list">
-    <xsl:choose>
-      <xsl:when test="$toc.dd.type = ''">
-        <xsl:copy-of select="$subtoc"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:element name="{$toc.dd.type}">
-          <xsl:copy-of select="$subtoc"/>
-        </xsl:element>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:element name="{$toc.listitem.type}">
-    <xsl:variable name="label">
-      <xsl:apply-templates select="." mode="label.markup"/>
-    </xsl:variable>
-    <xsl:copy-of select="$label"/>
-    <xsl:if test="$label != ''">
-      <xsl:value-of select="$autotoc.label.separator"/>
-    </xsl:if>
-    <a>
-      <xsl:attribute name="href">
-        <xsl:call-template name="href.target"/>
-      </xsl:attribute>
-      <xsl:apply-templates select="." mode="title.markup"/>
-    </a>
-    <xsl:if test="$toc.listitem.type = 'li'
-                  and $toc.section.depth>2 and sect3">
-      <xsl:copy-of select="$subtoc.list"/>
-    </xsl:if>
-  </xsl:element>
-  <xsl:if test="$toc.listitem.type != 'li'
-                and $toc.section.depth>2 and sect3">
-    <xsl:copy-of select="$subtoc.list"/>
-  </xsl:if>
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="nodes" select="sect3|bridgehead"/>
+  </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="sect3" mode="toc">
-  <xsl:variable name="subtoc">
-    <xsl:element name="{$toc.list.type}">
-      <xsl:apply-templates select="sect4|bridgehead" mode="toc"/>
-    </xsl:element>
-  </xsl:variable>
-
-  <xsl:variable name="subtoc.list">
-    <xsl:choose>
-      <xsl:when test="$toc.dd.type = ''">
-        <xsl:copy-of select="$subtoc"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:element name="{$toc.dd.type}">
-          <xsl:copy-of select="$subtoc"/>
-        </xsl:element>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:element name="{$toc.listitem.type}">
-    <xsl:variable name="label">
-      <xsl:apply-templates select="." mode="label.markup"/>
-    </xsl:variable>
-    <xsl:copy-of select="$label"/>
-    <xsl:if test="$label != ''">
-      <xsl:value-of select="$autotoc.label.separator"/>
-    </xsl:if>
-    <a>
-      <xsl:attribute name="href">
-        <xsl:call-template name="href.target"/>
-      </xsl:attribute>
-      <xsl:apply-templates select="." mode="title.markup"/>
-    </a>
-    <xsl:if test="$toc.listitem.type = 'li'
-                  and $toc.section.depth>3 and sect4">
-      <xsl:copy-of select="$subtoc.list"/>
-    </xsl:if>
-  </xsl:element>
-  <xsl:if test="$toc.listitem.type != 'li'
-                and $toc.section.depth>3 and sect4">
-    <xsl:copy-of select="$subtoc.list"/>
-  </xsl:if>
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="nodes" select="sect4|bridgehead"/>
+  </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="sect4" mode="toc">
-  <xsl:variable name="subtoc">
-    <xsl:element name="{$toc.list.type}">
-      <xsl:apply-templates select="sect5|bridgehead" mode="toc"/>
-    </xsl:element>
-  </xsl:variable>
-
-  <xsl:variable name="subtoc.list">
-    <xsl:choose>
-      <xsl:when test="$toc.dd.type = ''">
-        <xsl:copy-of select="$subtoc"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:element name="{$toc.dd.type}">
-          <xsl:copy-of select="$subtoc"/>
-        </xsl:element>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:element name="{$toc.listitem.type}">
-    <xsl:variable name="label">
-      <xsl:apply-templates select="." mode="label.markup"/>
-    </xsl:variable>
-    <xsl:copy-of select="$label"/>
-    <xsl:if test="$label != ''">
-      <xsl:value-of select="$autotoc.label.separator"/>
-    </xsl:if>
-    <a>
-      <xsl:attribute name="href">
-        <xsl:call-template name="href.target"/>
-      </xsl:attribute>
-      <xsl:apply-templates select="." mode="title.markup"/>
-    </a>
-    <xsl:if test="$toc.listitem.type = 'li'
-                  and $toc.section.depth>4 and sect5">
-      <xsl:copy-of select="$subtoc.list"/>
-    </xsl:if>
-  </xsl:element>
-  <xsl:if test="$toc.listitem.type != 'li'
-                and $toc.section.depth>4 and sect5">
-    <xsl:copy-of select="$subtoc.list"/>
-  </xsl:if>
+  <xsl:call-template name="subtoc">
+    <xsl:with-param name="nodes" select="sect5|bridgehead"/>
+  </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="sect5" mode="toc">
-  <xsl:element name="{$toc.listitem.type}">
-    <xsl:variable name="label">
-      <xsl:apply-templates select="." mode="label.markup"/>
-    </xsl:variable>
-    <xsl:copy-of select="$label"/>
-    <xsl:if test="$label != ''">
-      <xsl:value-of select="$autotoc.label.separator"/>
-    </xsl:if>
-    <a>
-      <xsl:attribute name="href">
-        <xsl:call-template name="href.target"/>
-      </xsl:attribute>
-      <xsl:apply-templates select="." mode="title.markup"/>
-    </a>
-  </xsl:element>
+  <xsl:call-template name="subtoc"/>
 </xsl:template>
 
 <xsl:template match="section" mode="toc">
-  <xsl:variable name="subtoc">
-    <xsl:element name="{$toc.list.type}">
-      <xsl:apply-templates select="section|bridgehead" mode="toc"/>
-    </xsl:element>
-  </xsl:variable>
-
-  <xsl:variable name="subtoc.list">
-    <xsl:choose>
-      <xsl:when test="$toc.dd.type = ''">
-        <xsl:copy-of select="$subtoc"/>
-      </xsl:when>
-      <xsl:otherwise>
-        <xsl:element name="{$toc.dd.type}">
-          <xsl:copy-of select="$subtoc"/>
-        </xsl:element>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
   <xsl:variable name="toodeep">
     <xsl:choose>
       <!-- if the depth is less than 2, we're already deep enough -->
     </xsl:choose>
   </xsl:variable>
 
-  <xsl:element name="{$toc.listitem.type}">
-    <xsl:variable name="label">
-      <xsl:apply-templates select="." mode="label.markup"/>
-    </xsl:variable>
-    <xsl:copy-of select="$label"/>
-    <xsl:if test="$label != ''">
-      <xsl:value-of select="$autotoc.label.separator"/>
-    </xsl:if>
-    <a>
-      <xsl:attribute name="href">
-        <xsl:call-template name="href.target"/>
-      </xsl:attribute>
-      <xsl:apply-templates select="." mode="title.markup"/>
-    </a>
-    <xsl:if test="$toc.listitem.type = 'li'
-                  and $toodeep='no' and section">
-      <xsl:copy-of select="$subtoc.list"/>
-    </xsl:if>
-  </xsl:element>
-  <xsl:if test="$toc.listitem.type != 'li'
-                and $toodeep='no' and section">
-    <xsl:copy-of select="$subtoc.list"/>
-  </xsl:if>
+  <xsl:choose>
+    <xsl:when test="$toodeep = 'no'">
+      <xsl:call-template name="subtoc"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:call-template name="subtoc">
+        <xsl:with-param name="nodes" select="section|bridgehead"/>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <xsl:template match="bridgehead" mode="toc">
   <xsl:if test="$bridgehead.in.toc != 0">
-    <xsl:element name="{$toc.listitem.type}">
-      <xsl:variable name="label">
-        <xsl:apply-templates select="." mode="label.markup"/>
-      </xsl:variable>
-      <xsl:copy-of select="$label"/>
-      <xsl:if test="$label != ''">
-        <xsl:value-of select="$autotoc.label.separator"/>
-      </xsl:if>
-      <a>
-        <xsl:attribute name="href">
-          <xsl:call-template name="href.target"/>
-        </xsl:attribute>
-        <xsl:apply-templates/>
-      </a>
-    </xsl:element>
+    <xsl:call-template name="subtoc"/>
   </xsl:if>
 </xsl:template>
 
 <xsl:template match="bibliography|glossary" mode="toc">
-  <xsl:element name="{$toc.listitem.type}">
-    <a>
-      <xsl:attribute name="href">
-        <xsl:call-template name="href.target"/>
-      </xsl:attribute>
-      <xsl:apply-templates select="." mode="title.markup"/>
-    </a>
-  </xsl:element>
+  <xsl:call-template name="subtoc"/>
 </xsl:template>
 
 <xsl:template match="index" mode="toc">
   <!-- If the index tag is empty, don't point at it from the TOC -->
   <xsl:if test="* or $generate.index">
-    <xsl:element name="{$toc.listitem.type}">
-      <a>
-        <xsl:attribute name="href">
-          <xsl:call-template name="href.target"/>
-        </xsl:attribute>
-        <xsl:apply-templates select="." mode="title.markup"/>
-      </a>
-    </xsl:element>
+    <xsl:call-template name="subtoc"/>
   </xsl:if>
 </xsl:template>
 
   </a>
 </xsl:template>
 
+<xsl:template name="manual-toc">
+  <xsl:param name="tocentry"/>
+
+  <!-- be careful, we don't want to change the current document to the other tree! -->
+
+  <xsl:if test="$tocentry">
+    <xsl:variable name="node" select="key('id', $tocentry/@linkend)"/>
+
+    <xsl:element name="{$toc.listitem.type}">
+      <xsl:variable name="label">
+        <xsl:apply-templates select="$node" mode="label.markup"/>
+      </xsl:variable>
+      <xsl:copy-of select="$label"/>
+      <xsl:if test="$label != ''">
+        <xsl:value-of select="$autotoc.label.separator"/>
+      </xsl:if>
+      <a>
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$node"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:apply-templates select="$node" mode="title.markup"/>
+      </a>
+    </xsl:element>
+
+    <xsl:if test="$tocentry/*">
+      <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>
+    </xsl:if>
+
+    <xsl:if test="$tocentry/following-sibling::*">
+      <xsl:call-template name="manual-toc">
+        <xsl:with-param name="tocentry" select="$tocentry/following-sibling::*[1]"/>
+      </xsl:call-template>
+    </xsl:if>
+  </xsl:if>
+</xsl:template>
+
 </xsl:stylesheet>
 
diff --git a/xsl/html/chunk-common.xsl b/xsl/html/chunk-common.xsl
new file mode 100644 (file)
index 0000000..0d9eaca
--- /dev/null
@@ -0,0 +1,738 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0">
+
+<xsl:template name="chunk">
+  <xsl:param name="node" select="."/>
+  <!-- returns 1 if $node is a chunk -->
+
+  <!-- ==================================================================== -->
+  <!-- What's a chunk?
+
+       The root element
+       appendix
+       article
+       bibliography  in article or book
+       book
+       chapter
+       colophon
+       glossary      in article or book
+       index         in article or book
+       part
+       preface
+       refentry
+       reference
+       sect{1,2,3,4,5}  if position()>1 && depth < chunk.section.depth
+       section          if position()>1 && depth < chunk.section.depth
+       set
+       setindex
+                                                                            -->
+  <!-- ==================================================================== -->
+
+<!--
+  <xsl:message>
+    <xsl:text>chunk: </xsl:text>
+    <xsl:value-of select="name($node)"/>
+    <xsl:text>(</xsl:text>
+    <xsl:value-of select="$node/@id"/>
+    <xsl:text>)</xsl:text>
+    <xsl:text> csd: </xsl:text>
+    <xsl:value-of select="$chunk.section.depth"/>
+    <xsl:text> cfs: </xsl:text>
+    <xsl:value-of select="$chunk.first.sections"/>
+    <xsl:text> ps: </xsl:text>
+    <xsl:value-of select="count($node/parent::section)"/>
+    <xsl:text> prs: </xsl:text>
+    <xsl:value-of select="count($node/preceding-sibling::section)"/>
+  </xsl:message>
+-->
+
+  <xsl:choose>
+    <xsl:when test="not($node/parent::*)">1</xsl:when>
+
+    <xsl:when test="local-name($node) = 'sect1'
+                    and $chunk.section.depth &gt;= 1
+                    and ($chunk.first.sections != 0
+                         or count($node/preceding-sibling::sect1) &gt; 0)">
+      <xsl:text>1</xsl:text>
+    </xsl:when>
+    <xsl:when test="local-name($node) = 'sect2'
+                    and $chunk.section.depth &gt;= 2
+                    and ($chunk.first.sections != 0
+                         or count($node/preceding-sibling::sect2) &gt; 0)">
+      <xsl:call-template name="chunk">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="local-name($node) = 'sect3'
+                    and $chunk.section.depth &gt;= 3
+                    and ($chunk.first.sections != 0
+                         or count($node/preceding-sibling::sect3) &gt; 0)">
+      <xsl:call-template name="chunk">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="local-name($node) = 'sect4'
+                    and $chunk.section.depth &gt;= 4
+                    and ($chunk.first.sections != 0
+                         or count($node/preceding-sibling::sect4) &gt; 0)">
+      <xsl:call-template name="chunk">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="local-name($node) = 'sect5'
+                    and $chunk.section.depth &gt;= 5
+                    and ($chunk.first.sections != 0
+                         or count($node/preceding-sibling::sect5) &gt; 0)">
+      <xsl:call-template name="chunk">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="local-name($node) = 'section'
+                    and $chunk.section.depth &gt;= count(ancestor::section)+1
+                    and ($chunk.first.sections != 0
+                         or count($node/preceding-sibling::section) &gt; 0)">
+      <xsl:call-template name="chunk">
+        <xsl:with-param name="node" select="$node/parent::*"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <xsl:when test="name($node)='preface'">1</xsl:when>
+    <xsl:when test="name($node)='chapter'">1</xsl:when>
+    <xsl:when test="name($node)='appendix'">1</xsl:when>
+    <xsl:when test="name($node)='article'">1</xsl:when>
+    <xsl:when test="name($node)='part'">1</xsl:when>
+    <xsl:when test="name($node)='reference'">1</xsl:when>
+    <xsl:when test="name($node)='refentry'">1</xsl:when>
+    <xsl:when test="name($node)='index'
+                    and (name($node/parent::*) = 'article'
+                         or name($node/parent::*) = 'book')">1</xsl:when>
+    <xsl:when test="name($node)='bibliography'
+                    and (name($node/parent::*) = 'article'
+                         or name($node/parent::*) = 'book')">1</xsl:when>
+    <xsl:when test="name($node)='glossary'
+                    and (name($node/parent::*) = 'article'
+                         or name($node/parent::*) = 'book')">1</xsl:when>
+    <xsl:when test="name($node)='colophon'">1</xsl:when>
+    <xsl:when test="name($node)='book'">1</xsl:when>
+    <xsl:when test="name($node)='set'">1</xsl:when>
+    <xsl:when test="name($node)='setindex'">1</xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="chunk-filename">
+  <xsl:param name="recursive" select="false()"/>
+
+  <!-- returns the filename of a chunk -->
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+<!--
+  <xsl:message>
+    <xsl:value-of select="local-name(.)"/>
+    <xsl:if test="@id">
+      <xsl:text> [</xsl:text>
+      <xsl:value-of select="@id"/>
+      <xsl:text>]</xsl:text>
+    </xsl:if>
+    <xsl:text>, </xsl:text>
+    <xsl:value-of select="$ischunk"/>
+  </xsl:message>
+-->
+
+  <xsl:variable name="dbhtml-filename">
+    <xsl:call-template name="dbhtml-filename"/>
+  </xsl:variable>
+
+  <xsl:variable name="filename">
+    <xsl:choose>
+      <xsl:when test="$dbhtml-filename != ''">
+        <xsl:value-of select="$dbhtml-filename"/>
+      </xsl:when>
+      <!-- if this is the root element, use the root.filename -->
+      <xsl:when test="not(parent::*) and $root.filename != ''">
+        <xsl:value-of select="$root.filename"/>
+        <xsl:value-of select="$html.ext"/>
+      </xsl:when>
+      <!-- if there's no dbhtml filename, and if we're to use IDs as -->
+      <!-- filenames, then use the ID to generate the filename. -->
+      <xsl:when test="@id and $use.id.as.filename != 0">
+        <xsl:value-of select="@id"/>
+        <xsl:value-of select="$html.ext"/>
+      </xsl:when>
+      <xsl:otherwise></xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="dir">
+    <xsl:call-template name="dbhtml-dir"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$ischunk='0'">
+      <!-- if called on something that isn't a chunk, walk up... -->
+      <xsl:choose>
+        <xsl:when test="count(parent::*)>0">
+          <xsl:apply-templates mode="chunk-filename" select="parent::*">
+            <xsl:with-param name="recursive" select="$recursive"/>
+          </xsl:apply-templates>
+        </xsl:when>
+        <!-- unless there is no up, in which case return "" -->
+        <xsl:otherwise></xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+
+    <xsl:when test="not($recursive) and $filename != ''">
+      <!-- if this chunk has an explicit name, use it -->
+      <xsl:if test="$dir != ''">
+        <xsl:value-of select="$dir"/>
+        <xsl:text>/</xsl:text>
+      </xsl:if>
+      <xsl:value-of select="$filename"/>
+    </xsl:when>
+
+    <xsl:when test="name(.)='set'">
+      <xsl:value-of select="$root.filename"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='book'">
+      <xsl:text>bk</xsl:text>
+      <xsl:number level="any" format="01"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='article'">
+      <xsl:if test="/set">
+        <!-- in a set, make sure we inherit the right book info... -->
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>ar</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='preface'">
+      <xsl:if test="/set">
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>pr</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='chapter'">
+      <xsl:if test="/set">
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>ch</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='appendix'">
+      <xsl:if test="/set">
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>ap</xsl:text>
+      <xsl:number level="any" format="a" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='part'">
+      <xsl:if test="/set">
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>pt</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='reference'">
+      <xsl:if test="/set">
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>rn</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='refentry'">
+      <xsl:if test="parent::reference">
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>re</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='colophon'">
+      <xsl:if test="/set">
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>co</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="local-name(.) = 'sect1'
+                    or local-name(.) = 'sect2'
+                    or local-name(.) = 'sect3'
+                    or local-name(.) = 'sect4'
+                    or local-name(.) = 'sect5'
+                    or local-name(.) = 'section'">
+      <xsl:apply-templates mode="chunk-filename" select="parent::*">
+        <xsl:with-param name="recursive" select="true()"/>
+      </xsl:apply-templates>
+      <xsl:text>s</xsl:text>
+      <xsl:number format="01"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='sect1' or name(.)='section'">
+      <xsl:apply-templates mode="chunk-filename" select="parent::*">
+        <xsl:with-param name="recursive" select="true()"/>
+      </xsl:apply-templates>
+      <xsl:text>s</xsl:text>
+      <xsl:number level="any" format="01" from="preface|chapter|appendix"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='bibliography'">
+      <xsl:if test="/set">
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>bi</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='glossary'">
+      <xsl:if test="/set">
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>go</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='index'">
+      <xsl:if test="/set">
+        <xsl:apply-templates mode="chunk-filename" select="parent::*">
+          <xsl:with-param name="recursive" select="true()"/>
+        </xsl:apply-templates>
+      </xsl:if>
+      <xsl:text>ix</xsl:text>
+      <xsl:number level="any" format="01" from="book"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:when test="name(.)='setindex'">
+      <xsl:text>si</xsl:text>
+      <xsl:number level="any" format="01" from="set"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:text>chunk-filename-error-</xsl:text>
+      <xsl:value-of select="name(.)"/>
+      <xsl:number level="any" format="01" from="set"/>
+      <xsl:if test="not($recursive)">
+        <xsl:value-of select="$html.ext"/>
+      </xsl:if>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="href.target">
+  <xsl:param name="object" select="."/>
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk">
+      <xsl:with-param name="node" select="$object"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:apply-templates mode="chunk-filename" select="$object"/>
+
+  <xsl:if test="$ischunk='0'">
+    <xsl:text>#</xsl:text>
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="$object"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="html.head">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:variable name="home" select="/*[1]"/>
+  <xsl:variable name="up" select="parent::*"/>
+
+  <head>
+    <xsl:call-template name="head.content"/>
+    <xsl:call-template name="user.head.content"/>
+
+    <xsl:if test="$home">
+      <link rel="home">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$home"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$home"
+                               mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+
+    <xsl:if test="$up">
+      <link rel="up">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$up"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+
+    <xsl:if test="$prev">
+      <link rel="previous">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$prev"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+
+    <xsl:if test="$next">
+      <link rel="next">
+        <xsl:attribute name="href">
+          <xsl:call-template name="href.target">
+            <xsl:with-param name="object" select="$next"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="title">
+          <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
+        </xsl:attribute>
+      </link>
+    </xsl:if>
+  </head>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="header.navigation">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:variable name="home" select="/*[1]"/>
+  <xsl:variable name="up" select="parent::*"/>
+
+  <xsl:if test="$suppress.navigation = '0'">
+    <div class="navheader">
+      <table width="100%" summary="Navigation header">
+       <xsl:if test="$navig.showtitles != 0">
+         <tr>
+           <th colspan="3" align="center">
+              <xsl:apply-templates select="." mode="object.title.markup"/>
+            </th>
+          </tr>
+        </xsl:if>
+        <tr>
+          <td width="20%" align="left">
+            <xsl:if test="count($prev)>0">
+              <a accesskey="p">
+                <xsl:attribute name="href">
+                  <xsl:call-template name="href.target">
+                    <xsl:with-param name="object" select="$prev"/>
+                  </xsl:call-template>
+                </xsl:attribute>
+                <xsl:call-template name="navig.content">
+                   <xsl:with-param name="direction" select="'prev'"/>
+               </xsl:call-template>
+              </a>
+            </xsl:if>
+            <xsl:text>&#160;</xsl:text>
+          </td>
+          <th width="60%" align="center">
+            <xsl:choose>
+              <xsl:when test="count($up) > 0 and $up != $home and $navig.showtitles != 0">
+                <xsl:apply-templates select="$up" mode="object.title.markup"/>
+              </xsl:when>
+              <xsl:otherwise>&#160;</xsl:otherwise>
+            </xsl:choose>
+          </th>
+          <td width="20%" align="right">
+            <xsl:text>&#160;</xsl:text>
+            <xsl:if test="count($next)>0">
+              <a accesskey="n">
+                <xsl:attribute name="href">
+                  <xsl:call-template name="href.target">
+                    <xsl:with-param name="object" select="$next"/>
+                  </xsl:call-template>
+                </xsl:attribute>
+                <xsl:call-template name="navig.content">
+                   <xsl:with-param name="direction" select="'next'"/>
+               </xsl:call-template>
+              </a>
+            </xsl:if>
+          </td>
+        </tr>
+      </table>
+      <hr/>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="footer.navigation">
+  <xsl:param name="prev" select="/foo"/>
+  <xsl:param name="next" select="/foo"/>
+  <xsl:variable name="home" select="/*[1]"/>
+  <xsl:variable name="up" select="parent::*"/>
+
+  <xsl:if test="$suppress.navigation = '0'">
+    <div class="navfooter">
+      <hr/>
+      <table width="100%" summary="Navigation footer">
+        <tr>
+          <td width="40%" align="left">
+            <xsl:if test="count($prev)>0">
+              <a accesskey="p">
+                <xsl:attribute name="href">
+                  <xsl:call-template name="href.target">
+                    <xsl:with-param name="object" select="$prev"/>
+                  </xsl:call-template>
+                </xsl:attribute>
+               <xsl:call-template name="navig.content">
+                   <xsl:with-param name="direction" select="'prev'"/>
+               </xsl:call-template>
+             </a>
+            </xsl:if>
+            <xsl:text>&#160;</xsl:text>
+          </td>
+          <td width="20%" align="center">
+            <xsl:choose>
+              <xsl:when test="count($up)>0">
+                <a accesskey="u">
+                  <xsl:attribute name="href">
+                    <xsl:call-template name="href.target">
+                      <xsl:with-param name="object" select="$up"/>
+                    </xsl:call-template>
+                  </xsl:attribute>
+                  <xsl:call-template name="navig.content">
+                     <xsl:with-param name="direction" select="'up'"/>
+                 </xsl:call-template>
+                </a>
+              </xsl:when>
+              <xsl:otherwise>&#160;</xsl:otherwise>
+            </xsl:choose>
+          </td>
+          <td width="40%" align="right">
+            <xsl:text>&#160;</xsl:text>
+            <xsl:if test="count($next)>0">
+              <a accesskey="n">
+                <xsl:attribute name="href">
+                  <xsl:call-template name="href.target">
+                    <xsl:with-param name="object" select="$next"/>
+                  </xsl:call-template>
+                </xsl:attribute>
+                <xsl:call-template name="navig.content">
+                   <xsl:with-param name="direction" select="'next'"/>
+               </xsl:call-template>
+              </a>
+            </xsl:if>
+          </td>
+        </tr>
+
+        <tr>
+          <td width="40%" align="left" valign="top">
+           <xsl:if test="$navig.showtitles != 0">
+              <xsl:apply-templates select="$prev" mode="object.title.markup"/>
+            </xsl:if>
+            <xsl:text>&#160;</xsl:text>
+          </td>
+          <td width="20%" align="center">
+            <xsl:choose>
+              <xsl:when test="$home != .">
+                <a accesskey="h">
+                  <xsl:attribute name="href">
+                    <xsl:call-template name="href.target">
+                      <xsl:with-param name="object" select="$home"/>
+                    </xsl:call-template>
+                  </xsl:attribute>
+                  <xsl:call-template name="navig.content">
+                   <xsl:with-param name="direction" select="'home'"/>
+                 </xsl:call-template>
+                </a>
+              </xsl:when>
+              <xsl:otherwise>&#160;</xsl:otherwise>
+            </xsl:choose>
+          </td>
+          <td width="40%" align="right" valign="top">
+            <xsl:text>&#160;</xsl:text>
+            <xsl:if test="$navig.showtitles != 0">
+              <xsl:apply-templates select="$next" mode="object.title.markup"/>
+           </xsl:if>
+          </td>
+        </tr>
+      </table>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="navig.content">
+    <xsl:param name="direction" select="next"/>
+    <xsl:variable name="navtext">
+        <xsl:choose>
+           <xsl:when test="$direction = 'prev'">
+               <xsl:call-template name="gentext.nav.prev"/>
+           </xsl:when>
+           <xsl:when test="$direction = 'next'">
+               <xsl:call-template name="gentext.nav.next"/>
+           </xsl:when>
+           <xsl:when test="$direction = 'up'">
+               <xsl:call-template name="gentext.nav.up"/>
+           </xsl:when>
+           <xsl:when test="$direction = 'home'">
+               <xsl:call-template name="gentext.nav.home"/>
+           </xsl:when>
+           <xsl:otherwise>
+               <xsl:text>xxx</xsl:text>
+           </xsl:otherwise>
+       </xsl:choose>
+    </xsl:variable>
+
+    <xsl:choose>
+       <xsl:when test="$navig.graphics != 0">
+           <img>
+               <xsl:attribute name="src">
+                   <xsl:value-of select="$navig.graphics.path"/>
+                   <xsl:value-of select="$direction"/>
+                   <xsl:value-of select="$navig.graphics.extension"/>
+               </xsl:attribute>
+               <xsl:attribute name="alt">
+                   <xsl:value-of select="$navtext"/>
+               </xsl:attribute>
+           </img>
+       </xsl:when>
+       <xsl:otherwise>
+           <xsl:value-of select="$navtext"/>
+       </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="processing-instruction('dbhtml')">
+  <!-- nop -->
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="chunk-element-content">
+  <xsl:param name="prev"></xsl:param>
+  <xsl:param name="next"></xsl:param>
+
+  <html>
+    <xsl:call-template name="html.head">
+      <xsl:with-param name="prev" select="$prev"/>
+      <xsl:with-param name="next" select="$next"/>
+    </xsl:call-template>
+
+    <body>
+      <xsl:call-template name="body.attributes"/>
+      <xsl:call-template name="user.header.navigation"/>
+
+      <xsl:call-template name="header.navigation">
+       <xsl:with-param name="prev" select="$prev"/>
+       <xsl:with-param name="next" select="$next"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="user.header.content"/>
+
+      <xsl:apply-imports/>
+
+      <xsl:call-template name="user.footer.content"/>
+
+      <xsl:call-template name="footer.navigation">
+       <xsl:with-param name="prev" select="$prev"/>
+       <xsl:with-param name="next" select="$next"/>
+      </xsl:call-template>
+
+      <xsl:call-template name="user.footer.navigation"/>
+    </body>
+  </html>
+</xsl:template>
+
+</xsl:stylesheet>
index c8de36c4bf13c1c09214ea3a5632073b7c09b867..6c171532473b2c5487882641465836775be1b6a8 100644 (file)
@@ -4,702 +4,7 @@
                 exclude-result-prefixes="doc">
 
 <xsl:import href="docbook.xsl"/>
-
-<!-- ==================================================================== -->
-<!-- What's a chunk?
-
-     The root element
-     appendix
-     article
-     bibliography  in article or book
-     book
-     chapter
-     colophon
-     glossary      in article or book
-     index         in article or book
-     part
-     preface
-     refentry
-     reference
-     sect{1,2,3,4,5}  if position()>1 && depth < chunk.section.depth
-     section          if position()>1 && depth < chunk.section.depth
-     set
-     setindex
-                                                                          -->
-<!-- ==================================================================== -->
-
-<xsl:template name="chunk">
-  <xsl:param name="node" select="."/>
-  <!-- returns 1 if $node is a chunk -->
-
-<!--
-  <xsl:message>
-    <xsl:text>chunk: </xsl:text>
-    <xsl:value-of select="name($node)"/>
-    <xsl:text>(</xsl:text>
-    <xsl:value-of select="$node/@id"/>
-    <xsl:text>)</xsl:text>
-    <xsl:text> csd: </xsl:text>
-    <xsl:value-of select="$chunk.section.depth"/>
-    <xsl:text> cfs: </xsl:text>
-    <xsl:value-of select="$chunk.first.sections"/>
-    <xsl:text> ps: </xsl:text>
-    <xsl:value-of select="count($node/parent::section)"/>
-    <xsl:text> prs: </xsl:text>
-    <xsl:value-of select="count($node/preceding-sibling::section)"/>
-  </xsl:message>
--->
-
-  <xsl:choose>
-    <xsl:when test="not($node/parent::*)">1</xsl:when>
-
-    <xsl:when test="local-name($node) = 'sect1'
-                    and $chunk.section.depth &gt;= 1
-                    and ($chunk.first.sections != 0
-                         or count($node/preceding-sibling::sect1) &gt; 0)">
-      <xsl:text>1</xsl:text>
-    </xsl:when>
-    <xsl:when test="local-name($node) = 'sect2'
-                    and $chunk.section.depth &gt;= 2
-                    and ($chunk.first.sections != 0
-                         or count($node/preceding-sibling::sect2) &gt; 0)">
-      <xsl:call-template name="chunk">
-        <xsl:with-param name="node" select="$node/parent::*"/>
-      </xsl:call-template>
-    </xsl:when>
-    <xsl:when test="local-name($node) = 'sect3'
-                    and $chunk.section.depth &gt;= 3
-                    and ($chunk.first.sections != 0
-                         or count($node/preceding-sibling::sect3) &gt; 0)">
-      <xsl:call-template name="chunk">
-        <xsl:with-param name="node" select="$node/parent::*"/>
-      </xsl:call-template>
-    </xsl:when>
-    <xsl:when test="local-name($node) = 'sect4'
-                    and $chunk.section.depth &gt;= 4
-                    and ($chunk.first.sections != 0
-                         or count($node/preceding-sibling::sect4) &gt; 0)">
-      <xsl:call-template name="chunk">
-        <xsl:with-param name="node" select="$node/parent::*"/>
-      </xsl:call-template>
-    </xsl:when>
-    <xsl:when test="local-name($node) = 'sect5'
-                    and $chunk.section.depth &gt;= 5
-                    and ($chunk.first.sections != 0
-                         or count($node/preceding-sibling::sect5) &gt; 0)">
-      <xsl:call-template name="chunk">
-        <xsl:with-param name="node" select="$node/parent::*"/>
-      </xsl:call-template>
-    </xsl:when>
-    <xsl:when test="local-name($node) = 'section'
-                    and $chunk.section.depth &gt;= count(ancestor::section)+1
-                    and ($chunk.first.sections != 0
-                         or count($node/preceding-sibling::section) &gt; 0)">
-      <xsl:call-template name="chunk">
-        <xsl:with-param name="node" select="$node/parent::*"/>
-      </xsl:call-template>
-    </xsl:when>
-
-    <xsl:when test="name($node)='preface'">1</xsl:when>
-    <xsl:when test="name($node)='chapter'">1</xsl:when>
-    <xsl:when test="name($node)='appendix'">1</xsl:when>
-    <xsl:when test="name($node)='article'">1</xsl:when>
-    <xsl:when test="name($node)='part'">1</xsl:when>
-    <xsl:when test="name($node)='reference'">1</xsl:when>
-    <xsl:when test="name($node)='refentry'">1</xsl:when>
-    <xsl:when test="name($node)='index'
-                    and (name($node/parent::*) = 'article'
-                         or name($node/parent::*) = 'book')">1</xsl:when>
-    <xsl:when test="name($node)='bibliography'
-                    and (name($node/parent::*) = 'article'
-                         or name($node/parent::*) = 'book')">1</xsl:when>
-    <xsl:when test="name($node)='glossary'
-                    and (name($node/parent::*) = 'article'
-                         or name($node/parent::*) = 'book')">1</xsl:when>
-    <xsl:when test="name($node)='colophon'">1</xsl:when>
-    <xsl:when test="name($node)='book'">1</xsl:when>
-    <xsl:when test="name($node)='set'">1</xsl:when>
-    <xsl:when test="name($node)='setindex'">1</xsl:when>
-    <xsl:otherwise>0</xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="*" mode="chunk-filename">
-  <xsl:param name="recursive" select="false()"/>
-
-  <!-- returns the filename of a chunk -->
-  <xsl:variable name="ischunk">
-    <xsl:call-template name="chunk"/>
-  </xsl:variable>
-
-<!--
-  <xsl:message>
-    <xsl:value-of select="local-name(.)"/>
-    <xsl:if test="@id">
-      <xsl:text> [</xsl:text>
-      <xsl:value-of select="@id"/>
-      <xsl:text>]</xsl:text>
-    </xsl:if>
-    <xsl:text>, </xsl:text>
-    <xsl:value-of select="$ischunk"/>
-  </xsl:message>
--->
-
-  <xsl:variable name="dbhtml-filename">
-    <xsl:call-template name="dbhtml-filename"/>
-  </xsl:variable>
-
-  <xsl:variable name="filename">
-    <xsl:choose>
-      <xsl:when test="$dbhtml-filename != ''">
-        <xsl:value-of select="$dbhtml-filename"/>
-      </xsl:when>
-      <!-- if this is the root element, use the root.filename -->
-      <xsl:when test="not(parent::*) and $root.filename != ''">
-        <xsl:value-of select="$root.filename"/>
-        <xsl:value-of select="$html.ext"/>
-      </xsl:when>
-      <!-- if there's no dbhtml filename, and if we're to use IDs as -->
-      <!-- filenames, then use the ID to generate the filename. -->
-      <xsl:when test="@id and $use.id.as.filename != 0">
-        <xsl:value-of select="@id"/>
-        <xsl:value-of select="$html.ext"/>
-      </xsl:when>
-      <xsl:otherwise></xsl:otherwise>
-    </xsl:choose>
-  </xsl:variable>
-
-  <xsl:variable name="dir">
-    <xsl:call-template name="dbhtml-dir"/>
-  </xsl:variable>
-
-  <xsl:choose>
-    <xsl:when test="$ischunk='0'">
-      <!-- if called on something that isn't a chunk, walk up... -->
-      <xsl:choose>
-        <xsl:when test="count(parent::*)>0">
-          <xsl:apply-templates mode="chunk-filename" select="parent::*">
-            <xsl:with-param name="recursive" select="$recursive"/>
-          </xsl:apply-templates>
-        </xsl:when>
-        <!-- unless there is no up, in which case return "" -->
-        <xsl:otherwise></xsl:otherwise>
-      </xsl:choose>
-    </xsl:when>
-
-    <xsl:when test="not($recursive) and $filename != ''">
-      <!-- if this chunk has an explicit name, use it -->
-      <xsl:if test="$dir != ''">
-        <xsl:value-of select="$dir"/>
-        <xsl:text>/</xsl:text>
-      </xsl:if>
-      <xsl:value-of select="$filename"/>
-    </xsl:when>
-
-    <xsl:when test="name(.)='set'">
-      <xsl:value-of select="$root.filename"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='book'">
-      <xsl:text>bk</xsl:text>
-      <xsl:number level="any" format="01"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='article'">
-      <xsl:if test="/set">
-        <!-- in a set, make sure we inherit the right book info... -->
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>ar</xsl:text>
-      <xsl:number level="any" format="01" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='preface'">
-      <xsl:if test="/set">
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>pr</xsl:text>
-      <xsl:number level="any" format="01" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='chapter'">
-      <xsl:if test="/set">
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>ch</xsl:text>
-      <xsl:number level="any" format="01" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='appendix'">
-      <xsl:if test="/set">
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>ap</xsl:text>
-      <xsl:number level="any" format="a" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='part'">
-      <xsl:if test="/set">
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>pt</xsl:text>
-      <xsl:number level="any" format="01" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='reference'">
-      <xsl:if test="/set">
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>rn</xsl:text>
-      <xsl:number level="any" format="01" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='refentry'">
-      <xsl:if test="parent::reference">
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>re</xsl:text>
-      <xsl:number level="any" format="01" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='colophon'">
-      <xsl:if test="/set">
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>co</xsl:text>
-      <xsl:number level="any" format="01" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="local-name(.) = 'sect1'
-                    or local-name(.) = 'sect2'
-                    or local-name(.) = 'sect3'
-                    or local-name(.) = 'sect4'
-                    or local-name(.) = 'sect5'
-                    or local-name(.) = 'section'">
-      <xsl:apply-templates mode="chunk-filename" select="parent::*">
-        <xsl:with-param name="recursive" select="true()"/>
-      </xsl:apply-templates>
-      <xsl:text>s</xsl:text>
-      <xsl:number format="01"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='sect1' or name(.)='section'">
-      <xsl:apply-templates mode="chunk-filename" select="parent::*">
-        <xsl:with-param name="recursive" select="true()"/>
-      </xsl:apply-templates>
-      <xsl:text>s</xsl:text>
-      <xsl:number level="any" format="01" from="preface|chapter|appendix"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='bibliography'">
-      <xsl:if test="/set">
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>bi</xsl:text>
-      <xsl:number level="any" format="01" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='glossary'">
-      <xsl:if test="/set">
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>go</xsl:text>
-      <xsl:number level="any" format="01" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='index'">
-      <xsl:if test="/set">
-        <xsl:apply-templates mode="chunk-filename" select="parent::*">
-          <xsl:with-param name="recursive" select="true()"/>
-        </xsl:apply-templates>
-      </xsl:if>
-      <xsl:text>ix</xsl:text>
-      <xsl:number level="any" format="01" from="book"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:when test="name(.)='setindex'">
-      <xsl:text>si</xsl:text>
-      <xsl:number level="any" format="01" from="set"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:when>
-
-    <xsl:otherwise>
-      <xsl:text>chunk-filename-error-</xsl:text>
-      <xsl:value-of select="name(.)"/>
-      <xsl:number level="any" format="01" from="set"/>
-      <xsl:if test="not($recursive)">
-        <xsl:value-of select="$html.ext"/>
-      </xsl:if>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="href.target">
-  <xsl:param name="object" select="."/>
-  <xsl:variable name="ischunk">
-    <xsl:call-template name="chunk">
-      <xsl:with-param name="node" select="$object"/>
-    </xsl:call-template>
-  </xsl:variable>
-
-  <xsl:apply-templates mode="chunk-filename" select="$object"/>
-
-  <xsl:if test="$ischunk='0'">
-    <xsl:text>#</xsl:text>
-    <xsl:call-template name="object.id">
-      <xsl:with-param name="object" select="$object"/>
-    </xsl:call-template>
-  </xsl:if>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="html.head">
-  <xsl:param name="prev" select="/foo"/>
-  <xsl:param name="next" select="/foo"/>
-  <xsl:variable name="home" select="/*[1]"/>
-  <xsl:variable name="up" select="parent::*"/>
-
-  <head>
-    <xsl:call-template name="head.content"/>
-    <xsl:call-template name="user.head.content"/>
-
-    <xsl:if test="$home">
-      <link rel="home">
-        <xsl:attribute name="href">
-          <xsl:call-template name="href.target">
-            <xsl:with-param name="object" select="$home"/>
-          </xsl:call-template>
-        </xsl:attribute>
-        <xsl:attribute name="title">
-          <xsl:apply-templates select="$home"
-                               mode="object.title.markup.textonly"/>
-        </xsl:attribute>
-      </link>
-    </xsl:if>
-
-    <xsl:if test="$up">
-      <link rel="up">
-        <xsl:attribute name="href">
-          <xsl:call-template name="href.target">
-            <xsl:with-param name="object" select="$up"/>
-          </xsl:call-template>
-        </xsl:attribute>
-        <xsl:attribute name="title">
-          <xsl:apply-templates select="$up" mode="object.title.markup.textonly"/>
-        </xsl:attribute>
-      </link>
-    </xsl:if>
-
-    <xsl:if test="$prev">
-      <link rel="previous">
-        <xsl:attribute name="href">
-          <xsl:call-template name="href.target">
-            <xsl:with-param name="object" select="$prev"/>
-          </xsl:call-template>
-        </xsl:attribute>
-        <xsl:attribute name="title">
-          <xsl:apply-templates select="$prev" mode="object.title.markup.textonly"/>
-        </xsl:attribute>
-      </link>
-    </xsl:if>
-
-    <xsl:if test="$next">
-      <link rel="next">
-        <xsl:attribute name="href">
-          <xsl:call-template name="href.target">
-            <xsl:with-param name="object" select="$next"/>
-          </xsl:call-template>
-        </xsl:attribute>
-        <xsl:attribute name="title">
-          <xsl:apply-templates select="$next" mode="object.title.markup.textonly"/>
-        </xsl:attribute>
-      </link>
-    </xsl:if>
-  </head>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="header.navigation">
-  <xsl:param name="prev" select="/foo"/>
-  <xsl:param name="next" select="/foo"/>
-  <xsl:variable name="home" select="/*[1]"/>
-  <xsl:variable name="up" select="parent::*"/>
-
-  <xsl:if test="$suppress.navigation = '0'">
-    <div class="navheader">
-      <table width="100%" summary="Navigation header">
-       <xsl:if test="$navig.showtitles != 0">
-         <tr>
-           <th colspan="3" align="center">
-              <xsl:apply-templates select="." mode="object.title.markup"/>
-            </th>
-          </tr>
-        </xsl:if>
-        <tr>
-          <td width="20%" align="left">
-            <xsl:if test="count($prev)>0">
-              <a accesskey="p">
-                <xsl:attribute name="href">
-                  <xsl:call-template name="href.target">
-                    <xsl:with-param name="object" select="$prev"/>
-                  </xsl:call-template>
-                </xsl:attribute>
-                <xsl:call-template name="navig.content">
-                   <xsl:with-param name="direction" select="'prev'"/>
-               </xsl:call-template>
-              </a>
-            </xsl:if>
-            <xsl:text>&#160;</xsl:text>
-          </td>
-          <th width="60%" align="center">
-            <xsl:choose>
-              <xsl:when test="count($up) > 0 and $up != $home and $navig.showtitles != 0">
-                <xsl:apply-templates select="$up" mode="object.title.markup"/>
-              </xsl:when>
-              <xsl:otherwise>&#160;</xsl:otherwise>
-            </xsl:choose>
-          </th>
-          <td width="20%" align="right">
-            <xsl:text>&#160;</xsl:text>
-            <xsl:if test="count($next)>0">
-              <a accesskey="n">
-                <xsl:attribute name="href">
-                  <xsl:call-template name="href.target">
-                    <xsl:with-param name="object" select="$next"/>
-                  </xsl:call-template>
-                </xsl:attribute>
-                <xsl:call-template name="navig.content">
-                   <xsl:with-param name="direction" select="'next'"/>
-               </xsl:call-template>
-              </a>
-            </xsl:if>
-          </td>
-        </tr>
-      </table>
-      <hr/>
-    </div>
-  </xsl:if>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="footer.navigation">
-  <xsl:param name="prev" select="/foo"/>
-  <xsl:param name="next" select="/foo"/>
-  <xsl:variable name="home" select="/*[1]"/>
-  <xsl:variable name="up" select="parent::*"/>
-
-  <xsl:if test="$suppress.navigation = '0'">
-    <div class="navfooter">
-      <hr/>
-      <table width="100%" summary="Navigation footer">
-        <tr>
-          <td width="40%" align="left">
-            <xsl:if test="count($prev)>0">
-              <a accesskey="p">
-                <xsl:attribute name="href">
-                  <xsl:call-template name="href.target">
-                    <xsl:with-param name="object" select="$prev"/>
-                  </xsl:call-template>
-                </xsl:attribute>
-               <xsl:call-template name="navig.content">
-                   <xsl:with-param name="direction" select="'prev'"/>
-               </xsl:call-template>
-             </a>
-            </xsl:if>
-            <xsl:text>&#160;</xsl:text>
-          </td>
-          <td width="20%" align="center">
-            <xsl:choose>
-              <xsl:when test="count($up)>0">
-                <a accesskey="u">
-                  <xsl:attribute name="href">
-                    <xsl:call-template name="href.target">
-                      <xsl:with-param name="object" select="$up"/>
-                    </xsl:call-template>
-                  </xsl:attribute>
-                  <xsl:call-template name="navig.content">
-                     <xsl:with-param name="direction" select="'up'"/>
-                 </xsl:call-template>
-                </a>
-              </xsl:when>
-              <xsl:otherwise>&#160;</xsl:otherwise>
-            </xsl:choose>
-          </td>
-          <td width="40%" align="right">
-            <xsl:text>&#160;</xsl:text>
-            <xsl:if test="count($next)>0">
-              <a accesskey="n">
-                <xsl:attribute name="href">
-                  <xsl:call-template name="href.target">
-                    <xsl:with-param name="object" select="$next"/>
-                  </xsl:call-template>
-                </xsl:attribute>
-                <xsl:call-template name="navig.content">
-                   <xsl:with-param name="direction" select="'next'"/>
-               </xsl:call-template>
-              </a>
-            </xsl:if>
-          </td>
-        </tr>
-
-        <tr>
-          <td width="40%" align="left" valign="top">
-           <xsl:if test="$navig.showtitles != 0">
-              <xsl:apply-templates select="$prev" mode="object.title.markup"/>
-            </xsl:if>
-            <xsl:text>&#160;</xsl:text>
-          </td>
-          <td width="20%" align="center">
-            <xsl:choose>
-              <xsl:when test="$home != .">
-                <a accesskey="h">
-                  <xsl:attribute name="href">
-                    <xsl:call-template name="href.target">
-                      <xsl:with-param name="object" select="$home"/>
-                    </xsl:call-template>
-                  </xsl:attribute>
-                  <xsl:call-template name="navig.content">
-                   <xsl:with-param name="direction" select="'home'"/>
-                 </xsl:call-template>
-                </a>
-              </xsl:when>
-              <xsl:otherwise>&#160;</xsl:otherwise>
-            </xsl:choose>
-          </td>
-          <td width="40%" align="right" valign="top">
-            <xsl:text>&#160;</xsl:text>
-            <xsl:if test="$navig.showtitles != 0">
-              <xsl:apply-templates select="$next" mode="object.title.markup"/>
-           </xsl:if>
-          </td>
-        </tr>
-      </table>
-    </div>
-  </xsl:if>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template name="navig.content">
-    <xsl:param name="direction" select="next"/>
-    <xsl:variable name="navtext">
-        <xsl:choose>
-           <xsl:when test="$direction = 'prev'">
-               <xsl:call-template name="gentext.nav.prev"/>
-           </xsl:when>
-           <xsl:when test="$direction = 'next'">
-               <xsl:call-template name="gentext.nav.next"/>
-           </xsl:when>
-           <xsl:when test="$direction = 'up'">
-               <xsl:call-template name="gentext.nav.up"/>
-           </xsl:when>
-           <xsl:when test="$direction = 'home'">
-               <xsl:call-template name="gentext.nav.home"/>
-           </xsl:when>
-           <xsl:otherwise>
-               <xsl:text>xxx</xsl:text>
-           </xsl:otherwise>
-       </xsl:choose>
-    </xsl:variable>
-
-    <xsl:choose>
-       <xsl:when test="$navig.graphics != 0">
-           <img>
-               <xsl:attribute name="src">
-                   <xsl:value-of select="$navig.graphics.path"/>
-                   <xsl:value-of select="$direction"/>
-                   <xsl:value-of select="$navig.graphics.extension"/>
-               </xsl:attribute>
-               <xsl:attribute name="alt">
-                   <xsl:value-of select="$navtext"/>
-               </xsl:attribute>
-           </img>
-       </xsl:when>
-       <xsl:otherwise>
-           <xsl:value-of select="$navtext"/>
-       </xsl:otherwise>
-    </xsl:choose>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
-<xsl:template match="processing-instruction('dbhtml')">
-  <!-- nop -->
-</xsl:template>
+<xsl:import href="chunk-common.xsl"/>
 
 <!-- ==================================================================== -->
 
 
 <!-- ==================================================================== -->
 
-<xsl:template name="chunk-element-content">
-  <xsl:param name="prev"></xsl:param>
-  <xsl:param name="next"></xsl:param>
-
-  <html>
-    <xsl:call-template name="html.head">
-      <xsl:with-param name="prev" select="$prev"/>
-      <xsl:with-param name="next" select="$next"/>
-    </xsl:call-template>
-
-    <body>
-      <xsl:call-template name="body.attributes"/>
-      <xsl:call-template name="user.header.navigation"/>
-
-      <xsl:call-template name="header.navigation">
-       <xsl:with-param name="prev" select="$prev"/>
-       <xsl:with-param name="next" select="$next"/>
-      </xsl:call-template>
-
-      <xsl:call-template name="user.header.content"/>
-
-      <xsl:apply-imports/>
-
-      <xsl:call-template name="user.footer.content"/>
-
-      <xsl:call-template name="footer.navigation">
-       <xsl:with-param name="prev" select="$prev"/>
-       <xsl:with-param name="next" select="$next"/>
-      </xsl:call-template>
-
-      <xsl:call-template name="user.footer.navigation"/>
-    </body>
-  </html>
-</xsl:template>
-
-<!-- ==================================================================== -->
-
 <xsl:template match="/">
   <xsl:choose>
     <xsl:when test="$rootid != ''">
diff --git a/xsl/html/chunktoc.xsl b/xsl/html/chunktoc.xsl
new file mode 100644 (file)
index 0000000..f136ecc
--- /dev/null
@@ -0,0 +1,230 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
+               version="1.0"
+                exclude-result-prefixes="doc">
+
+<xsl:import href="docbook.xsl"/>
+<xsl:import href="chunk-common.xsl"/>
+
+<xsl:template name="chunk">
+  <xsl:param name="node" select="."/>
+  <!-- returns 1 if $node is a chunk -->
+
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id">
+      <xsl:with-param name="object" select="$node"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:variable name="chunks" select="document($chunk.toc,$node)"/>
+
+  <xsl:choose>
+    <xsl:when test="$chunks//tocentry[@linkend=$id]">1</xsl:when>
+    <xsl:otherwise>0</xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="*" mode="chunk-filename">
+  <!-- returns the filename of a chunk -->
+
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="chunks" select="document($chunk.toc,.)"/>
+
+  <xsl:variable name="chunk" select="$chunks//tocentry[@linkend=$id]"/>
+  <xsl:variable name="filename">
+    <xsl:call-template name="dbhtml-filename">
+      <xsl:with-param name="pis" select="$chunk/processing-instruction('dbhtml')"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$chunk">
+      <xsl:value-of select="$filename"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="parent::*" mode="chunk-filename"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template name="process-chunk">
+  <xsl:variable name="id">
+    <xsl:call-template name="object.id"/>
+  </xsl:variable>
+
+  <xsl:variable name="chunks" select="document($chunk.toc,.)"/>
+
+  <xsl:variable name="chunk" select="$chunks//tocentry[@linkend=$id]"/>
+  <xsl:variable name="prev-id"
+                select="($chunk/preceding::tocentry
+                         |$chunk/ancestor::tocentry)[last()]/@linkend"/>
+  <xsl:variable name="next-id"
+                select="($chunk/following::tocentry
+                         |$chunk/child::tocentry)[1]/@linkend"/>
+
+  <xsl:variable name="prev" select="key('id',$prev-id)"/>
+  <xsl:variable name="next" select="key('id',$next-id)"/>
+
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:variable name="chunkfn">
+    <xsl:if test="$ischunk='1'">
+      <xsl:apply-templates mode="chunk-filename" select="."/>
+    </xsl:if>
+  </xsl:variable>
+
+  <xsl:variable name="filename">
+    <xsl:call-template name="make-relative-filename">
+      <xsl:with-param name="base.dir" select="$base.dir"/>
+      <xsl:with-param name="base.name" select="$chunkfn"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$ischunk = 0">
+      <xsl:apply-imports/>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:call-template name="write.chunk">
+        <xsl:with-param name="filename" select="$filename"/>
+        <xsl:with-param name="content">
+          <xsl:call-template name="chunk-element-content">
+            <xsl:with-param name="prev" select="$prev"/>
+            <xsl:with-param name="next" select="$next"/>
+          </xsl:call-template>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="set">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="book">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="book/appendix">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="book/glossary">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="book/bibliography">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="dedication" mode="dedication">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="preface|chapter">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="part|reference">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="refentry">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="colophon">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="article">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="article/appendix">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="article/glossary">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="article/bibliography">
+  <xsl:call-template name="process-chunk"/>
+</xsl:template>
+
+<xsl:template match="sect1|sect2|sect3|sect4|sect5|section">
+  <xsl:variable name="ischunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:choose>
+    <xsl:when test="$ischunk != 0">
+      <xsl:call-template name="process-chunk"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-imports/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="setindex
+                     |book/index
+                     |article/index">
+  <!-- some implementations use completely empty index tags to indicate -->
+  <!-- where an automatically generated index should be inserted. so -->
+  <!-- if the index is completely empty, skip it. -->
+  <xsl:if test="count(*)>0 or $generate.index != '0'">
+    <xsl:call-template name="process-chunk"/>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="/">
+  <xsl:choose>
+    <xsl:when test="$chunk.toc = ''">
+      <xsl:message terminate="yes">
+        <xsl:text>The chunk.toc file is not set.</xsl:text>
+      </xsl:message>
+    </xsl:when>
+
+    <xsl:when test="$rootid != ''">
+      <xsl:choose>
+        <xsl:when test="count(key('id',$rootid)) = 0">
+          <xsl:message terminate="yes">
+            <xsl:text>ID '</xsl:text>
+            <xsl:value-of select="$rootid"/>
+            <xsl:text>' not found in document.</xsl:text>
+          </xsl:message>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates select="key('id',$rootid)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+
+    <xsl:otherwise>
+      <xsl:apply-templates select="/" mode="process.root"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="*" mode="process.root">
+  <xsl:apply-templates select="."/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xsl/html/maketoc.xsl b/xsl/html/maketoc.xsl
new file mode 100644 (file)
index 0000000..baa2838
--- /dev/null
@@ -0,0 +1,60 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
+               version="1.0"
+                exclude-result-prefixes="doc">
+
+<xsl:import href="docbook.xsl"/>
+<xsl:import href="chunk.xsl"/>
+
+<xsl:output method="xml" indent="no" encoding='utf-8'/>
+
+<xsl:param name="toc.list.type" select="'tocentry'"/>
+
+<xsl:template name="subtoc">
+  <xsl:param name="nodes" select="NOT-AN-ELEMENT"/>
+  <xsl:variable name="filename">
+    <xsl:apply-templates select="." mode="chunk-filename"/>
+  </xsl:variable>
+
+  <xsl:variable name="chunk">
+    <xsl:call-template name="chunk"/>
+  </xsl:variable>
+
+  <xsl:if test="$chunk != 0">
+    <xsl:call-template name="indent-spaces"/>
+    <tocentry linkend="{@id}">
+      <xsl:processing-instruction name="dbhtml">
+        <xsl:text>filename="</xsl:text>
+        <xsl:value-of select="$filename"/>
+        <xsl:text>"</xsl:text>
+      </xsl:processing-instruction>
+      <xsl:text>&#xA;</xsl:text>
+      <xsl:apply-templates mode="toc" select="$nodes"/>
+      <xsl:call-template name="indent-spaces"/>
+    </tocentry>
+    <xsl:text>&#xA;</xsl:text>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template name="indent-spaces">
+  <xsl:param name="node" select="."/>
+  <xsl:text>  </xsl:text>
+  <xsl:if test="$node/parent::*">
+    <xsl:call-template name="indent-spaces">
+      <xsl:with-param name="node" select="$node/parent::*"/>
+    </xsl:call-template>
+  </xsl:if>
+</xsl:template>
+
+<!-- ==================================================================== -->
+
+<xsl:template match="/" priority="-1">
+  <xsl:text>&#xA;</xsl:text>
+  <toc role="chunk-toc">
+    <xsl:text>&#xA;</xsl:text>
+    <xsl:apply-templates select="/" mode="toc"/>
+  </toc>
+  <xsl:text>&#xA;</xsl:text>
+</xsl:template>
+
+</xsl:stylesheet>
index 3c37c5c5f3a2215d3bcfebd2a042dead5d81a21b..a3592a2c3b5a259f774a8a42a418595f45d0eb82 100644 (file)
@@ -24,6 +24,7 @@
 <!ENTITY chunk.datafile SYSTEM "../params/chunk.datafile.xml">
 <!ENTITY chunk.first.sections SYSTEM "../params/chunk.first.sections.xml">
 <!ENTITY chunk.section.depth SYSTEM "../params/chunk.section.depth.xml">
+<!ENTITY chunk.toc SYSTEM "../params/chunk.toc.xml">
 <!ENTITY citerefentry.link SYSTEM "../params/citerefentry.link.xml">
 <!ENTITY css.decoration SYSTEM "../params/css.decoration.xml">
 <!ENTITY default.encoding SYSTEM "../params/default.encoding.xml">
@@ -86,6 +87,7 @@
 <!ENTITY make.valid.html SYSTEM "../params/make.valid.html.xml">
 <!ENTITY make.single.year.ranges SYSTEM "../params/make.single.year.ranges.xml">
 <!ENTITY make.year.ranges SYSTEM "../params/make.year.ranges.xml">
+<!ENTITY manual.toc SYSTEM "../params/manual.toc.xml">
 <!ENTITY navig.graphics SYSTEM "../params/navig.graphics.xml">
 <!ENTITY navig.graphics.extension SYSTEM "../params/navig.graphics.extension.xml">
 <!ENTITY navig.graphics.path SYSTEM "../params/navig.graphics.path.xml">
index 4113ab96ca613f56acbaeabee79b176c68507d7d..d18a094352011ca8cd17e700443462a20300d3c9 100644 (file)
@@ -108,6 +108,7 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 &process.source.toc;
 &process.empty.source.toc;
 &bridgehead.in.toc;
+&manual.toc;
 </reference>
 
 <reference><title>Extensions</title>
@@ -234,6 +235,7 @@ to be incomplete. Don't forget to read the source, too :-)</para>
 &html.ext;
 &root.filename;
 &base.dir;
+&chunk.toc;
 &chunk.section.depth;
 &chunk.first.sections;
 &saxon.character.representation;
@@ -311,6 +313,7 @@ around all these parameters.</para>
 <src:fragref linkend="chunk.datafile.frag"/>
 <src:fragref linkend="chunk.first.sections.frag"/>
 <src:fragref linkend="chunk.section.depth.frag"/>
+<src:fragref linkend="chunk.toc.frag"/>
 <src:fragref linkend="citerefentry.link.frag"/>
 <src:fragref linkend="css.decoration.frag"/>
 <src:fragref linkend="default.encoding.frag"/>
@@ -373,6 +376,7 @@ around all these parameters.</para>
 <src:fragref linkend="make.single.year.ranges.frag"/>
 <src:fragref linkend="make.valid.html.frag"/>
 <src:fragref linkend="make.year.ranges.frag"/>
+<src:fragref linkend="manual.toc.frag"/>
 <src:fragref linkend="navig.graphics.extension.frag"/>
 <src:fragref linkend="navig.graphics.frag"/>
 <src:fragref linkend="navig.graphics.path.frag"/>
diff --git a/xsl/params/chunk.toc.xml b/xsl/params/chunk.toc.xml
new file mode 100644 (file)
index 0000000..279b1c2
--- /dev/null
@@ -0,0 +1,25 @@
+<refentry id="chunk.toc">
+<refmeta>
+<refentrytitle>chunk.toc</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>chunk.toc</refname>
+<refpurpose>An explicit TOC to be used for chunking</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='chunk.toc.frag'>
+<xsl:param name="chunk.toc" select="''"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>The <parameter>chunk.toc</parameter> identifies an explicit TOC that
+will be used for chunking. This parameter is only used by the
+<filename>chunktoc.xsl</filename> stylesheet (and customization layers built
+from it).</para>
+
+</refsect1>
+</refentry>
diff --git a/xsl/params/manual.toc.xml b/xsl/params/manual.toc.xml
new file mode 100644 (file)
index 0000000..760e612
--- /dev/null
@@ -0,0 +1,24 @@
+<refentry id="manual.toc">
+<refmeta>
+<refentrytitle>manual.toc</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>manual.toc</refname>
+<refpurpose>An explicit TOC to be used for the TOC</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='manual.toc.frag'>
+<xsl:param name="manual.toc" select="''"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>The <parameter>manual.toc</parameter> identifies an explicit TOC that
+will be used for building the printed TOC.
+</para>
+
+</refsect1>
+</refentry>