[mm-common] Correct conditional generation of Devhelp chapters



commit 2111d89324e10140fa3e80166e37e0a31543e0e8
Author: Daniel Elstner <danielk openismus com>
Date:   Mon Sep 21 13:31:25 2009 +0200

    Correct conditional generation of Devhelp chapters
    
    * util/tagfile-to-devhelp2.xsl (chapters): Assign node sets to the
    intermediate variables using the select attribute, rather than trying
    to apply the templates in the element content.  With this change, the
    test whether there are any child elements now correctly evaluates to
    false if the node set is empty.

 util/tagfile-to-devhelp2.xsl |   32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/util/tagfile-to-devhelp2.xsl b/util/tagfile-to-devhelp2.xsl
index f834051..67b64da 100644
--- a/util/tagfile-to-devhelp2.xsl
+++ b/util/tagfile-to-devhelp2.xsl
@@ -29,36 +29,28 @@
     <book title="{$book_title}" name="{$book_name}" base="{$book_base}"
           link="index.html" version="2" language="c++">
       <chapters>
-        <xsl:variable name="modules">
-          <xsl:apply-templates select="tagfile/compound[ kind='group']" mode="module">
-            <xsl:sort lang="en" select="title"/>
-          </xsl:apply-templates>
-        </xsl:variable>
+        <xsl:variable name="modules" select="tagfile/compound[ kind='group']"/>
         <xsl:if test="$modules">
           <sub name="Modules" link="modules.html">
-            <xsl:copy-of select="$modules"/>
+            <xsl:apply-templates select="$modules" mode="module">
+              <xsl:sort lang="en" select="title"/>
+            </xsl:apply-templates>
           </sub>
         </xsl:if>
-
-        <xsl:variable name="namespaces">
-          <xsl:apply-templates select="tagfile/compound[ kind='namespace']" mode="sub">
-            <xsl:sort lang="en" case-order="upper-first" select="name"/>
-          </xsl:apply-templates>
-        </xsl:variable>
+        <xsl:variable name="namespaces" select="tagfile/compound[ kind='namespace']"/>
         <xsl:if test="$namespaces">
           <sub name="Namespaces" link="namespaces.html">
-            <xsl:copy-of select="$namespaces"/>
+            <xsl:apply-templates select="$namespaces" mode="sub">
+              <xsl:sort lang="en" case-order="upper-first" select="name"/>
+            </xsl:apply-templates>
           </sub>
         </xsl:if>
-
-        <xsl:variable name="classes">
-          <xsl:apply-templates select="tagfile/compound[ kind='class' or @kind='struct']" mode="sub">
-            <xsl:sort lang="en" case-order="upper-first" select="name"/>
-          </xsl:apply-templates>
-        </xsl:variable>
+        <xsl:variable name="classes" select="tagfile/compound[ kind='class' or @kind='struct']"/>
         <xsl:if test="$classes">
           <sub name="Classes" link="classes.html">
-            <xsl:copy-of select="$classes"/>
+            <xsl:apply-templates select="$classes" mode="sub">
+              <xsl:sort lang="en" case-order="upper-first" select="name"/>
+            </xsl:apply-templates>
           </sub>
         </xsl:if>
       </chapters>



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