]> granicus.if.org Git - docbook-dsssl/commitdiff
Add '.' to the autotoc.label.separator; suppress the separator if there is no label
authorNorman Walsh <ndw@nwalsh.com>
Sat, 4 Aug 2001 22:03:03 +0000 (22:03 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sat, 4 Aug 2001 22:03:03 +0000 (22:03 +0000)
xsl/html/autotoc.xsl

index a8e210bd2570128f7f4aef64b1635f7e959b12f0..33af7b64bbb16a83c780c98df05fa5d4456742a3 100644 (file)
@@ -12,7 +12,7 @@
 
      ******************************************************************** -->
 
-<xsl:param name="autotoc.label.separator" select="' '"/>
+<xsl:param name="autotoc.label.separator" select="'. '"/>
 
 <xsl:template name="href.target">
   <xsl:param name="object" select="."/>
   </xsl:variable>
 
   <xsl:element name="{$toc.listitem.type}">
-    <xsl:apply-templates select="." mode="label.markup"/>
-    <xsl:value-of select="$autotoc.label.separator"/>
+    <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:variable>
 
   <xsl:element name="{$toc.listitem.type}">
-    <xsl:apply-templates select="." mode="label.markup"/>
-    <xsl:value-of select="$autotoc.label.separator"/>
+    <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:variable>
 
   <xsl:element name="{$toc.listitem.type}">
-    <xsl:apply-templates select="." mode="label.markup"/>
-    <xsl:value-of select="$autotoc.label.separator"/>
+    <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:variable>
 
   <xsl:element name="{$toc.listitem.type}">
-    <xsl:apply-templates select="." mode="label.markup"/>
-    <xsl:value-of select="$autotoc.label.separator"/>
+    <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:variable>
 
   <xsl:element name="{$toc.listitem.type}">
-    <xsl:apply-templates select="." mode="label.markup"/>
-    <xsl:value-of select="$autotoc.label.separator"/>
+    <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:variable>
 
   <xsl:element name="{$toc.listitem.type}">
-    <xsl:apply-templates select="." mode="label.markup"/>
-    <xsl:value-of select="$autotoc.label.separator"/>
+    <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:variable>
 
   <xsl:element name="{$toc.listitem.type}">
-    <xsl:apply-templates select="." mode="label.markup"/>
-    <xsl:value-of select="$autotoc.label.separator"/>
+    <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:template match="sect5" mode="toc">
   <xsl:element name="{$toc.listitem.type}">
-    <xsl:apply-templates select="." mode="label.markup"/>
-    <xsl:value-of select="$autotoc.label.separator"/>
+    <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:variable>
 
   <xsl:element name="{$toc.listitem.type}">
-    <xsl:apply-templates select="." mode="label.markup"/>
-    <xsl:value-of select="$autotoc.label.separator"/>
+    <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:template match="bridgehead" mode="toc">
   <xsl:if test="$bridgehead.in.toc != 0">
     <xsl:element name="{$toc.listitem.type}">
-      <xsl:apply-templates select="." mode="label.markup"/>
-      <xsl:value-of select="$autotoc.label.separator"/>
+      <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"/>