Whamcloud - gitweb
LUDOC-104 style: added style elements for 2.1, 2.2 and 2.5
authorRichard Henwood <richard.henwood@intel.com>
Fri, 22 Mar 2013 20:21:37 +0000 (15:21 -0500)
committerRichard Henwood <richard.henwood@intel.com>
Fri, 22 Mar 2013 20:40:49 +0000 (16:40 -0400)
Style rules now support condition='{l21|l22|l23|l24|l25}'.
Code refactored for simplicity.

Signed-off-by: Richard Henwood <richard.henwood@intel.com>
Change-Id: I2ef60e50f390b566a2193a0114bfbac3aee54979
Reviewed-on: http://review.whamcloud.com/5753
Tested-by: Hudson
style/customstyle.xsl
style/customstyle_fo.xsl

index 77c5576..0ff1926 100644 (file)
        </div>
 </xsl:template>
 
-<!-- template_1: this tempate matches condition='l23' and calls
-               the textdecoration_1 template with the relevant class. -->
-<xsl:template match="*[@condition='l23']">
+<!-- conditional matching template: this calls text decoration
+     template with the correct variables. -->
+<xsl:template match="*[@condition]">
        <xsl:variable name="id">
                <xsl:call-template name="object.id"/>
        </xsl:variable>
        <xsl:call-template name='section.titlepage'/>
-       <xsl:call-template name='textdecoration_1'>
-               <xsl:with-param name='version' select="'introduced in Lustre 2.3'"/>
-               <xsl:with-param name='chunkid' select="$id"/>
-       </xsl:call-template>
-</xsl:template>
-
-<!-- template_2: this tempate matches condition='l24' and calls
-               the textdecoration_1 template with the relevant class. -->
-<xsl:template match="*[@condition='l24']">
-       <xsl:variable name="id">
-               <xsl:call-template name="object.id"/>
-       </xsl:variable>
-       <xsl:call-template name='section.titlepage'/>
-       <xsl:call-template name='textdecoration_1'>
-               <xsl:with-param name='version' select="'introduced in Lustre 2.4'"/>
-               <xsl:with-param name='chunkid' select="$id"/>
-       </xsl:call-template>
+       <xsl:choose>
+               <xsl:when test="@condition = 'l21'">
+                       <xsl:call-template name='textdecoration_1'>
+                               <xsl:with-param name='version' select="'introduced in Lustre 2.1'"/>
+                               <xsl:with-param name='chunkid' select="$id"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l22'">
+                       <xsl:call-template name='textdecoration_1'>
+                               <xsl:with-param name='version' select="'introduced in Lustre 2.2'"/>
+                               <xsl:with-param name='chunkid' select="$id"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l23'">
+                       <xsl:call-template name='textdecoration_1'>
+                               <xsl:with-param name='version' select="'introduced in Lustre 2.3'"/>
+                               <xsl:with-param name='chunkid' select="$id"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l24'">
+                       <xsl:call-template name='textdecoration_1'>
+                               <xsl:with-param name='version' select="'introduced in Lustre 2.4'"/>
+                               <xsl:with-param name='chunkid' select="$id"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:when test="@condition = 'l25'">
+                       <xsl:call-template name='textdecoration_1'>
+                               <xsl:with-param name='version' select="'introduced in Lustre 2.5'"/>
+                               <xsl:with-param name='chunkid' select="$id"/>
+                       </xsl:call-template>
+               </xsl:when>
+               <xsl:otherwise>
+                       <xsl:call-template name='textdecoration_1'>
+                               <xsl:with-param name='version' select="'unrecognised Lustre version'"/>
+                               <xsl:with-param name='chunkid' select="$id"/>
+                       </xsl:call-template>
+               </xsl:otherwise>
+       </xsl:choose>
 </xsl:template>
 
-
-<!-- template_3: This template over loads the behavior of creating the table of contents. It
+<!-- toc.line template: This template over loads the behavior of creating the table of contents. It
                adds in a small entry to identify lustre version specific features.
                for more information, see this page:
                http://xml.web.cern.ch/XML/www.sagehill.net/xml/docbookxsl/PrintCustomEx.html#PrintTocEntries -->
        </a>
        </span>
        <!-- add another span to hold the lustre version annotation -->
-       <xsl:if test="@condition='l24'">
-               <span class='floatright'>L 2.4 </span>
+       <xsl:if test="@condition='l21'">
+               <span class='floatright'>L 2.1 </span>
+       </xsl:if>
+       <xsl:if test="@condition='l22'">
+               <span class='floatright'>L 2.2 </span>
        </xsl:if>
        <xsl:if test="@condition='l23'">
                <span class='floatright'>L 2.3 </span>
        </xsl:if>
+       <xsl:if test="@condition='l24'">
+               <span class='floatright'>L 2.4 </span>
+       </xsl:if>
+       <xsl:if test="@condition='l25'">
+               <span class='floatright'>L 2.5 </span>
+       </xsl:if>
 </xsl:template>
 
 </xsl:stylesheet>
index aeee0c0..37d191f 100644 (file)
        </fo:block-container>
 </xsl:template>
 
-<!-- template_1: this tempate matches condition='l23' and calls
-               the textdecoration_1 template with the relevant image. -->
-<xsl:template match="*[@condition='l23']">
-       <xsl:variable name="id">
-               <xsl:call-template name="object.id"/>
-       </xsl:variable>
-       <xsl:call-template name='section.titlepage'/>
-       <xsl:call-template name='textdecoration_1'>
-               <xsl:with-param name='version' select="'introduced in Lustre 2.3'"/>
-               <xsl:with-param name='chunkid' select="$id"/>
-       </xsl:call-template>
-</xsl:template>
-<!-- template_2: this tempate matches condition='l24' and calls
-               the textdecoration_1 template with the relevant image. -->
-<xsl:template match="*[@condition='l24']">
-       <xsl:variable name="id">
-               <xsl:call-template name="object.id"/>
-       </xsl:variable>
-       <xsl:call-template name='section.titlepage'/>
-       <xsl:call-template name='textdecoration_1'>
-               <xsl:with-param name='version' select="'introduced in Lustre 2.4'"/>
-               <xsl:with-param name='chunkid' select="$id"/>
-       </xsl:call-template>
+<!-- conditional matching template: this calls text decoration
+          template with the correct variables. -->
+<xsl:template match="*[@condition]">
+    <xsl:variable name="id">
+        <xsl:call-template name="object.id"/>
+    </xsl:variable>
+    <xsl:call-template name='section.titlepage'/>
+    <xsl:choose>
+        <xsl:when test="@condition = 'l21'">
+            <xsl:call-template name='textdecoration_1'>
+                <xsl:with-param name='version' select="'introduced in Lustre 2.1'"/>
+                <xsl:with-param name='chunkid' select="$id"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="@condition = 'l22'">
+            <xsl:call-template name='textdecoration_1'>
+                <xsl:with-param name='version' select="'introduced in Lustre 2.2'"/>
+                <xsl:with-param name='chunkid' select="$id"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="@condition = 'l23'">
+            <xsl:call-template name='textdecoration_1'>
+                <xsl:with-param name='version' select="'introduced in Lustre 2.3'"/>
+                <xsl:with-param name='chunkid' select="$id"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="@condition = 'l24'">
+            <xsl:call-template name='textdecoration_1'>
+                <xsl:with-param name='version' select="'introduced in Lustre 2.4'"/>
+                <xsl:with-param name='chunkid' select="$id"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="@condition = 'l25'">
+            <xsl:call-template name='textdecoration_1'>
+                <xsl:with-param name='version' select="'introduced in Lustre 2.5'"/>
+                <xsl:with-param name='chunkid' select="$id"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:call-template name='textdecoration_1'>
+                <xsl:with-param name='version' select="'unrecognised Lustre version'"/>
+                <xsl:with-param name='chunkid' select="$id"/>
+            </xsl:call-template>
+        </xsl:otherwise>
+    </xsl:choose>
 </xsl:template>
 
-<!-- template_3: This template over loads the behavior of creating the table of contents. It
+<!-- toc.line template: This template over loads the behavior of creating the table of contents. It
                adds in a small entry to identify lustre version specific features.
                for more information, see this page:
                http://xml.web.cern.ch/XML/www.sagehill.net/xml/docbookxsl/PrintCustomEx.html#PrintTocEntries -->
        </xsl:variable>
        <xsl:variable name="lustrecond">
                <xsl:choose>
+                       <xsl:when test="@condition='l21'">L 2.1</xsl:when>
+                       <xsl:when test="@condition='l22'">L 2.2</xsl:when>
                        <xsl:when test="@condition='l23'">L 2.3</xsl:when>
                        <xsl:when test="@condition='l24'">L 2.4</xsl:when>
+                       <xsl:when test="@condition='l25'">L 2.5</xsl:when>
                        <xsl:otherwise></xsl:otherwise>
                </xsl:choose>
        </xsl:variable>