Whamcloud - gitweb
6c5439591957a7ea2b327cb6d2f2e72808945fed
[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 != ''">
90                         <xsl:call-template name='textdecoration-1'>
91                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.10'"/>
92                                 <xsl:with-param name='content' select="$content"/>
93                         </xsl:call-template>
94                 </xsl:when>
95                 <xsl:otherwise>
96                         <xsl:copy-of select="$content"/>
97                 </xsl:otherwise>
98         </xsl:choose>
99 </xsl:template>
100
101 <!-- toc.line template: This template over loads the behavior of creating the table of contents. It
102                 adds in a small entry to identify lustre version specific features.
103                 for more information, see this page:
104                 http://xml.web.cern.ch/XML/www.sagehill.net/xml/docbookxsl/PrintCustomEx.html#PrintTocEntries -->
105 <xsl:template name="toc.line">
106         <xsl:param name="toc-context" select="."/>
107         <xsl:param name="depth" select="1"/>
108         <xsl:param name="depth.from.context" select="8"/>
109
110         <span>
111         <xsl:attribute name="class">
112                 <xsl:value-of select="local-name(.)"/>
113         </xsl:attribute>
114
115         <!-- * if $autotoc.label.in.hyperlink is zero, then output the label -->
116         <!-- * before the hyperlinked title (as the DSSSL stylesheet does) -->
117         <xsl:if test="$autotoc.label.in.hyperlink = 0">
118                 <xsl:variable name="label">
119                         <xsl:apply-templates select="." mode="label.markup"/>
120                 </xsl:variable>
121                 <xsl:copy-of select="$label"/>
122                 <xsl:if test="$label != ''">
123                         <xsl:value-of select="$autotoc.label.separator"/>
124                 </xsl:if>
125         </xsl:if>
126
127         <a>
128                 <xsl:attribute name="href">
129                         <xsl:call-template name="href.target">
130                                 <xsl:with-param name="context" select="$toc-context"/>
131                                 <xsl:with-param name="toc-context" select="$toc-context"/>
132                         </xsl:call-template>
133                 </xsl:attribute>
134
135         <!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label
136                          as part of the hyperlinked title -->
137                 <xsl:if test="not($autotoc.label.in.hyperlink = 0)">
138                         <xsl:variable name="label">
139                                 <xsl:apply-templates select="." mode="label.markup"/>
140                         </xsl:variable>
141                         <xsl:copy-of select="$label"/>
142                         <xsl:if test="$label != ''">
143                                 <xsl:value-of select="$autotoc.label.separator"/>
144                         </xsl:if>
145                 </xsl:if>
146                 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
147         </a>
148         </span>
149         <xsl:call-template name="condition-title">
150                 <xsl:with-param name="condition" select="@condition"/>
151         </xsl:call-template>
152 </xsl:template>
153
154 <xsl:template name="condition-title">
155         <xsl:param name='condition'/>
156         <!-- add another span to hold the lustre version annotation -->
157         <xsl:choose>
158                 <xsl:when test="$condition = 'l23'">
159                         <span class='floatright'>L 2.3 </span>
160                 </xsl:when>
161                 <xsl:when test="$condition = 'l24'">
162                         <span class='floatright'>L 2.4 </span>
163                 </xsl:when>
164                 <xsl:when test="$condition = 'l25'">
165                         <span class='floatright'>L 2.5 </span>
166                 </xsl:when>
167                 <xsl:when test="$condition = 'l26'">
168                         <span class='floatright'>L 2.6 </span>
169                 </xsl:when>
170                 <xsl:when test="$condition = 'l27'">
171                         <span class='floatright'>L 2.7 </span>
172                 </xsl:when>
173                 <xsl:when test="$condition = 'l28'">
174                         <span class='floatright'>L 2.8 </span>
175                 </xsl:when>
176                 <xsl:when test="$condition = 'l29'">
177                         <span class='floatright'>L 2.9 </span>
178                 </xsl:when>
179                 <xsl:when test="$condition = 'l2A'">
180                         <span class='floatright'>L 2.10 </span>
181                 </xsl:when>
182                 <xsl:when test="$condition = 'l2B'">
183                         <span class='floatright'>L 2.11 </span>
184                 </xsl:when>
185                 <xsl:when test="$condition != ''">
186                         <span class='floatright'>L ?.? </span>
187                 </xsl:when>
188                 <xsl:otherwise>
189                 </xsl:otherwise>
190         </xsl:choose>
191 </xsl:template>
192
193 </xsl:stylesheet>