Whamcloud - gitweb
LUDOC-104 meta: support lustre versions thru 2.9.
[doc/manual.git] / style / customstyle.xsl
1 <?xml version='1.0'?>
2 <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
3
4 <!-- xsl:import takes place at compile time. For this reason, I sed in the correct
5                 primary xsl (for html,xhtml), and then run xsltproc -->
6 <xsl:import href="PRIMARYXSL"/>
7
8 <xsl:param name="html.stylesheet" select="'./style/manual.css'"/>
9
10 <xsl:param name="chapter.autolabel" select="1"></xsl:param>
11 <xsl:param name="section.autolabel" select="1"></xsl:param>
12 <xsl:param name="appendix.autolabel" select="1"></xsl:param>
13 <xsl:param name="autotoc.label.in.hyperlink" select="1"></xsl:param>
14 <xsl:param name="section.label.includes.component.label" select="1"></xsl:param>
15
16 <!--  textdecoration_1 applies the style to the text to highlight an region
17                 of the documentation refers to a lustre specific version.
18
19                 template_{1,2,3} all use the 'condition="{l23,l24}" attributes and add
20                 decoration to the rendered version of the manual to show lustre version
21                 specific features. -->
22
23 <!-- textdecoration_1: a template to apply a div with a class
24                 around the relevant sections of text. -->
25 <xsl:template name='textdecoration_1'>
26         <xsl:param name='version'/>
27         <xsl:param name='chunkid'/>
28         <div class='versioncontent'>
29                 <span class='versionlabel'>
30                         <xsl:value-of select='$version'/>
31                 </span>
32                 <xsl:apply-templates/>
33         </div>
34 </xsl:template>
35
36 <!-- conditional matching template: this calls text decoration
37      template with the correct variables. -->
38 <xsl:template match="*[@condition]">
39         <xsl:variable name="id">
40                 <xsl:call-template name="object.id"/>
41         </xsl:variable>
42         <xsl:call-template name='section.titlepage'/>
43         <xsl:choose>
44                 <xsl:when test="@condition = 'l21'">
45                         <xsl:call-template name='textdecoration_1'>
46                                 <xsl:with-param name='version' select="'introduced in Lustre 2.1'"/>
47                                 <xsl:with-param name='chunkid' select="$id"/>
48                         </xsl:call-template>
49                 </xsl:when>
50                 <xsl:when test="@condition = 'l22'">
51                         <xsl:call-template name='textdecoration_1'>
52                                 <xsl:with-param name='version' select="'introduced in Lustre 2.2'"/>
53                                 <xsl:with-param name='chunkid' select="$id"/>
54                         </xsl:call-template>
55                 </xsl:when>
56                 <xsl:when test="@condition = 'l23'">
57                         <xsl:call-template name='textdecoration_1'>
58                                 <xsl:with-param name='version' select="'introduced in Lustre 2.3'"/>
59                                 <xsl:with-param name='chunkid' select="$id"/>
60                         </xsl:call-template>
61                 </xsl:when>
62                 <xsl:when test="@condition = 'l24'">
63                         <xsl:call-template name='textdecoration_1'>
64                                 <xsl:with-param name='version' select="'introduced in Lustre 2.4'"/>
65                                 <xsl:with-param name='chunkid' select="$id"/>
66                         </xsl:call-template>
67                 </xsl:when>
68                 <xsl:when test="@condition = 'l25'">
69                         <xsl:call-template name='textdecoration_1'>
70                                 <xsl:with-param name='version' select="'introduced in Lustre 2.5'"/>
71                                 <xsl:with-param name='chunkid' select="$id"/>
72                         </xsl:call-template>
73                 </xsl:when>
74                 <xsl:when test="@condition = 'l26'">
75                         <xsl:call-template name='textdecoration_1'>
76                                 <xsl:with-param name='version' select="'introduced in Lustre 2.6'"/>
77                                 <xsl:with-param name='chunkid' select="$id"/>
78                         </xsl:call-template>
79                 </xsl:when>
80                 <xsl:when test="@condition = 'l27'">
81                         <xsl:call-template name='textdecoration_1'>
82                                 <xsl:with-param name='version' select="'introduced in Lustre 2.7'"/>
83                                 <xsl:with-param name='chunkid' select="$id"/>
84                         </xsl:call-template>
85                 </xsl:when>
86                 <xsl:when test="@condition = 'l28'">
87                         <xsl:call-template name='textdecoration_1'>
88                                 <xsl:with-param name='version' select="'introduced in Lustre 2.8'"/>
89                                 <xsl:with-param name='chunkid' select="$id"/>
90                         </xsl:call-template>
91                 </xsl:when>
92                 <xsl:when test="@condition = 'l29'">
93                         <xsl:call-template name='textdecoration_1'>
94                                 <xsl:with-param name='version' select="'introduced in Lustre 2.9'"/>
95                                 <xsl:with-param name='chunkid' select="$id"/>
96                         </xsl:call-template>
97                 </xsl:when>
98                 <xsl:otherwise>
99                         <xsl:call-template name='textdecoration_1'>
100                                 <xsl:with-param name='version' select="'unrecognised Lustre version'"/>
101                                 <xsl:with-param name='chunkid' select="$id"/>
102                         </xsl:call-template>
103                 </xsl:otherwise>
104         </xsl:choose>
105 </xsl:template>
106
107 <!-- toc.line template: This template over loads the behavior of creating the table of contents. It
108                 adds in a small entry to identify lustre version specific features.
109                 for more information, see this page:
110                 http://xml.web.cern.ch/XML/www.sagehill.net/xml/docbookxsl/PrintCustomEx.html#PrintTocEntries -->
111 <xsl:template name="toc.line">
112         <xsl:param name="toc-context" select="."/>
113         <xsl:param name="depth" select="1"/>
114         <xsl:param name="depth.from.context" select="8"/>
115
116         <span>
117         <xsl:attribute name="class">
118                 <xsl:value-of select="local-name(.)"/>
119         </xsl:attribute>
120
121         <!-- * if $autotoc.label.in.hyperlink is zero, then output the label -->
122         <!-- * before the hyperlinked title (as the DSSSL stylesheet does) -->
123         <xsl:if test="$autotoc.label.in.hyperlink = 0">
124                 <xsl:variable name="label">
125                         <xsl:apply-templates select="." mode="label.markup"/>
126                 </xsl:variable>
127                 <xsl:copy-of select="$label"/>
128                 <xsl:if test="$label != ''">
129                         <xsl:value-of select="$autotoc.label.separator"/>
130                 </xsl:if>
131         </xsl:if>
132
133         <a>
134                 <xsl:attribute name="href">
135                         <xsl:call-template name="href.target">
136                                 <xsl:with-param name="context" select="$toc-context"/>
137                                 <xsl:with-param name="toc-context" select="$toc-context"/>
138                         </xsl:call-template>
139                 </xsl:attribute>
140
141         <!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label
142                          as part of the hyperlinked title -->
143                 <xsl:if test="not($autotoc.label.in.hyperlink = 0)">
144                         <xsl:variable name="label">
145                                 <xsl:apply-templates select="." mode="label.markup"/>
146                         </xsl:variable>
147                         <xsl:copy-of select="$label"/>
148                         <xsl:if test="$label != ''">
149                                 <xsl:value-of select="$autotoc.label.separator"/>
150                         </xsl:if>
151                 </xsl:if>
152                 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
153         </a>
154         </span>
155         <!-- add another span to hold the lustre version annotation -->
156         <xsl:if test="@condition='l21'">
157                 <span class='floatright'>L 2.1 </span>
158         </xsl:if>
159         <xsl:if test="@condition='l22'">
160                 <span class='floatright'>L 2.2 </span>
161         </xsl:if>
162         <xsl:if test="@condition='l23'">
163                 <span class='floatright'>L 2.3 </span>
164         </xsl:if>
165         <xsl:if test="@condition='l24'">
166                 <span class='floatright'>L 2.4 </span>
167         </xsl:if>
168         <xsl:if test="@condition='l25'">
169                 <span class='floatright'>L 2.5 </span>
170         </xsl:if>
171         <xsl:if test="@condition='l26'">
172                 <span class='floatright'>L 2.6 </span>
173         </xsl:if>
174         <xsl:if test="@condition='l27'">
175                 <span class='floatright'>L 2.7 </span>
176         </xsl:if>
177         <xsl:if test="@condition='l28'">
178                 <span class='floatright'>L 2.8 </span>
179         </xsl:if>
180         <xsl:if test="@condition='l29'">
181                 <span class='floatright'>L 2.9 </span>
182         </xsl:if>
183 </xsl:template>
184
185 </xsl:stylesheet>