[library-web] do not include empty subsections in toc



commit 29dbad0bf9c767620ad84680d8a7ac5599e6134e
Author: Frédéric Péters <fpeters 0d be>
Date:   Sat Apr 2 19:16:18 2011 +0530

    do not include empty subsections in toc

 data/xslt/dev_indexes.xsl |   56 ++++++++++++++++++++++++---------------------
 1 files changed, 30 insertions(+), 26 deletions(-)
---
diff --git a/data/xslt/dev_indexes.xsl b/data/xslt/dev_indexes.xsl
index 9e1ac4b..8aad7b2 100644
--- a/data/xslt/dev_indexes.xsl
+++ b/data/xslt/dev_indexes.xsl
@@ -443,26 +443,28 @@ doctype-system="http://www.w3.org/TR/html4/loose.dtd";>
     <xsl:for-each select="section">
       <xsl:sort select="format-number(@weight, '0.000')" order="descending"/>
       <xsl:variable name="title" select="@title"/>
-      <h3 class="subsection" id="{ title}">
-        <xsl:apply-templates select="document('../overlay.xml')//subsection[ id = $title]"
+      <xsl:if test="document">
+        <h3 class="subsection" id="{ title}">
+          <xsl:apply-templates select="document('../overlay.xml')//subsection[ id = $title]"
                              mode="title">
+            <xsl:with-param name="lang" select="$lang" />
+          </xsl:apply-templates>
+        </h3>
+        <xsl:apply-templates select="document('../overlay.xml')//subsection[ id = $title]"
+                           mode="intro">
           <xsl:with-param name="lang" select="$lang" />
         </xsl:apply-templates>
-      </h3>
-      <xsl:apply-templates select="document('../overlay.xml')//subsection[ id = $title]"
-                           mode="intro">
-        <xsl:with-param name="lang" select="$lang" />
-      </xsl:apply-templates>
-      <dl class="doc-index">
-      <xsl:for-each select="document">
-        <xsl:sort select="format-number(@weight, '0.000')" order="descending"/>
-        <xsl:sort select="translate(title, $ucletters, $lcletters)"/>
-        <xsl:apply-templates select="." mode="channelindex">
-          <xsl:with-param name="lang" select="$lang"/>
-          <xsl:with-param name="ignoredeprecated" select="true()"/>
-	</xsl:apply-templates>
-      </xsl:for-each>
-      </dl>
+        <dl class="doc-index">
+        <xsl:for-each select="document">
+          <xsl:sort select="format-number(@weight, '0.000')" order="descending"/>
+          <xsl:sort select="translate(title, $ucletters, $lcletters)"/>
+          <xsl:apply-templates select="." mode="channelindex">
+            <xsl:with-param name="lang" select="$lang"/>
+            <xsl:with-param name="ignoredeprecated" select="true()"/>
+  	</xsl:apply-templates>
+        </xsl:for-each>
+        </dl>
+      </xsl:if>
     </xsl:for-each>
 
     <xsl:if test="section and document">
@@ -508,15 +510,17 @@ doctype-system="http://www.w3.org/TR/html4/loose.dtd";>
       <ul>
        <xsl:for-each select="section">
         <xsl:sort select="format-number(@weight, '0.000')" order="descending"/>
-        <li>
-        <xsl:variable name="title" select="@title"/>
-        <a href="#{ title}"><xsl:apply-templates select="document('../overlay.xml')//subsection[ id = $title]"
-        mode="title">
-        <xsl:with-param name="lang" select="$lang" />
-        </xsl:apply-templates></a>
-        </li>
-        </xsl:for-each>
-       </ul>
+        <xsl:if test="document">
+          <li>
+            <xsl:variable name="title" select="@title"/>
+            <a href="#{ title}"><xsl:apply-templates select="document('../overlay.xml')//subsection[ id = $title]"
+              mode="title">
+             <xsl:with-param name="lang" select="$lang" />
+             </xsl:apply-templates></a>
+          </li>
+        </xsl:if>
+       </xsl:for-each>
+      </ul>
       </xsl:if>
       </li>
      </xsl:for-each>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]