Whamcloud - gitweb
LUDOC-11 misc: remove some 'l23' conditions add 'l2C'
[doc/manual.git] / style / customstyle_common.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
5 <!--  textdecoration-1 applies the style to the text to highlight an region
6                 of the documentation refers to a lustre specific version.
7
8                 the overall purpose of this custom style is to add 
9                 decoration to the rendered version of the manual to show lustre version
10                 specific features. This is used in the manual docbook markup by
11                 adding a condition='lNM' element to a node. When rendered,
12                 the node contents is decorated to indicate it is only available in
13                 the N.M version of lustre. -->
14
15 <!-- textdecoration-1: a template to apply a div with a class
16                 around the relevant sections of text. -->
17 <xsl:template name='textdecoration-1'>
18         <xsl:param name='version'/>
19         <xsl:param name='content'/>
20         <div class='versionbox'>
21                 <span class='versionlabel'>
22                         <xsl:value-of select='$version'/>
23                 </span>
24                 <span class='versioncontent'>
25                         <xsl:copy-of select="$content"/>
26                 </span>
27         </div>
28 </xsl:template>
29
30 <!-- conditional matching template: this calls text decoration
31      template with the correct variables. -->
32 <xsl:template name="condition-decorator">
33         <xsl:param name='content'/>
34         <xsl:choose>
35                 <xsl:when test="@condition = 'l23'">
36                         <xsl:call-template name='textdecoration-1'>
37                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.3'"/>
38                                 <xsl:with-param name='content' select="$content"/>
39                         </xsl:call-template>
40                 </xsl:when>
41                 <xsl:when test="@condition = 'l24'">
42                         <xsl:call-template name='textdecoration-1'>
43                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.4'"/>
44                                 <xsl:with-param name='content' select="$content"/>
45                         </xsl:call-template>
46                 </xsl:when>
47                 <xsl:when test="@condition = 'l25'">
48                         <xsl:call-template name='textdecoration-1'>
49                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.5'"/>
50                                 <xsl:with-param name='content' select="$content"/>
51                         </xsl:call-template>
52                 </xsl:when>
53                 <xsl:when test="@condition = 'l26'">
54                         <xsl:call-template name='textdecoration-1'>
55                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.6'"/>
56                                 <xsl:with-param name='content' select="$content"/>
57                         </xsl:call-template>
58                 </xsl:when>
59                 <xsl:when test="@condition = 'l27'">
60                         <xsl:call-template name='textdecoration-1'>
61                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.7'"/>
62                                 <xsl:with-param name='content' select="$content"/>
63                         </xsl:call-template>
64                 </xsl:when>
65                 <xsl:when test="@condition = 'l28'">
66                         <xsl:call-template name='textdecoration-1'>
67                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.8'"/>
68                                 <xsl:with-param name='content' select="$content"/>
69                         </xsl:call-template>
70                 </xsl:when>
71                 <xsl:when test="@condition = 'l29'">
72                         <xsl:call-template name='textdecoration-1'>
73                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.9'"/>
74                                 <xsl:with-param name='content' select="$content"/>
75                         </xsl:call-template>
76                 </xsl:when>
77                 <xsl:when test="@condition = 'l2A'">
78                         <xsl:call-template name='textdecoration-1'>
79                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.10'"/>
80                                 <xsl:with-param name='content' select="$content"/>
81                         </xsl:call-template>
82                 </xsl:when>
83                 <xsl:when test="@condition = 'l2B'">
84                         <xsl:call-template name='textdecoration-1'>
85                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.11'"/>
86                                 <xsl:with-param name='content' select="$content"/>
87                         </xsl:call-template>
88                 </xsl:when>
89                 <xsl:when test="@condition = 'l2C'">
90                         <xsl:call-template name='textdecoration-1'>
91                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.12'"/>
92                                 <xsl:with-param name='content' select="$content"/>
93                         </xsl:call-template>
94                 </xsl:when>
95                 <xsl:when test="@condition != ''">
96                         <xsl:call-template name='textdecoration-1'>
97                                 <xsl:with-param name='version' select="'Introduced before Lustre 2.3'"/>
98                                 <xsl:with-param name='content' select="$content"/>
99                         </xsl:call-template>
100                 </xsl:when>
101                 <xsl:otherwise>
102                         <xsl:copy-of select="$content"/>
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         <xsl:call-template name="condition-title">
156                 <xsl:with-param name="condition" select="@condition"/>
157         </xsl:call-template>
158 </xsl:template>
159
160 <xsl:template name="condition-title">
161         <xsl:param name='condition'/>
162         <!-- add another span to hold the lustre version annotation -->
163         <xsl:choose>
164                 <xsl:when test="$condition = 'l23'">
165                         <span class='floatright'>L 2.3 </span>
166                 </xsl:when>
167                 <xsl:when test="$condition = 'l24'">
168                         <span class='floatright'>L 2.4 </span>
169                 </xsl:when>
170                 <xsl:when test="$condition = 'l25'">
171                         <span class='floatright'>L 2.5 </span>
172                 </xsl:when>
173                 <xsl:when test="$condition = 'l26'">
174                         <span class='floatright'>L 2.6 </span>
175                 </xsl:when>
176                 <xsl:when test="$condition = 'l27'">
177                         <span class='floatright'>L 2.7 </span>
178                 </xsl:when>
179                 <xsl:when test="$condition = 'l28'">
180                         <span class='floatright'>L 2.8 </span>
181                 </xsl:when>
182                 <xsl:when test="$condition = 'l29'">
183                         <span class='floatright'>L 2.9 </span>
184                 </xsl:when>
185                 <xsl:when test="$condition = 'l2A'">
186                         <span class='floatright'>L 2.10 </span>
187                 </xsl:when>
188                 <xsl:when test="$condition = 'l2B'">
189                         <span class='floatright'>L 2.11 </span>
190                 </xsl:when>
191                 <xsl:when test="$condition = 'l2C'">
192                         <span class='floatright'>L 2.12 </span>
193                 </xsl:when>
194                 <xsl:when test="$condition != ''">
195                         <span class='floatright'>L ?.? </span>
196                 </xsl:when>
197                 <xsl:otherwise>
198                 </xsl:otherwise>
199         </xsl:choose>
200 </xsl:template>
201
202 </xsl:stylesheet>