Whamcloud - gitweb
LUDOC-321 style: ensure ID attributes are unique.
[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='versionbox'>
29                 <span class='versionlabel'>
30                         <xsl:value-of select='$version'/>
31                 </span>
32                 <span class='versioncontent'>
33                         <xsl:apply-templates/>
34                 </span>
35         </div>
36 </xsl:template>
37
38 <!-- conditional matching template: this calls text decoration
39      template with the correct variables. -->
40 <xsl:template match="*[@condition]">
41         <xsl:variable name="id">
42                 <xsl:call-template name="object.id"/>
43         </xsl:variable>
44         <xsl:call-template name='section.titlepage'/>
45         <xsl:choose>
46                 <xsl:when test="@condition = 'l21'">
47                         <xsl:call-template name='textdecoration_1'>
48                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.1'"/>
49                                 <xsl:with-param name='chunkid' select="$id"/>
50                         </xsl:call-template>
51                 </xsl:when>
52                 <xsl:when test="@condition = 'l22'">
53                         <xsl:call-template name='textdecoration_1'>
54                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.2'"/>
55                                 <xsl:with-param name='chunkid' select="$id"/>
56                         </xsl:call-template>
57                 </xsl:when>
58                 <xsl:when test="@condition = 'l23'">
59                         <xsl:call-template name='textdecoration_1'>
60                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.3'"/>
61                                 <xsl:with-param name='chunkid' select="$id"/>
62                         </xsl:call-template>
63                 </xsl:when>
64                 <xsl:when test="@condition = 'l24'">
65                         <xsl:call-template name='textdecoration_1'>
66                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.4'"/>
67                                 <xsl:with-param name='chunkid' select="$id"/>
68                         </xsl:call-template>
69                 </xsl:when>
70                 <xsl:when test="@condition = 'l25'">
71                         <xsl:call-template name='textdecoration_1'>
72                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.5'"/>
73                                 <xsl:with-param name='chunkid' select="$id"/>
74                         </xsl:call-template>
75                 </xsl:when>
76                 <xsl:when test="@condition = 'l26'">
77                         <xsl:call-template name='textdecoration_1'>
78                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.6'"/>
79                                 <xsl:with-param name='chunkid' select="$id"/>
80                         </xsl:call-template>
81                 </xsl:when>
82                 <xsl:when test="@condition = 'l27'">
83                         <xsl:call-template name='textdecoration_1'>
84                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.7'"/>
85                                 <xsl:with-param name='chunkid' select="$id"/>
86                         </xsl:call-template>
87                 </xsl:when>
88                 <xsl:when test="@condition = 'l28'">
89                         <xsl:call-template name='textdecoration_1'>
90                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.8'"/>
91                                 <xsl:with-param name='chunkid' select="$id"/>
92                         </xsl:call-template>
93                 </xsl:when>
94                 <xsl:when test="@condition = 'l29'">
95                         <xsl:call-template name='textdecoration_1'>
96                                 <xsl:with-param name='version' select="'Introduced in Lustre 2.9'"/>
97                                 <xsl:with-param name='chunkid' select="$id"/>
98                         </xsl:call-template>
99                 </xsl:when>
100                 <xsl:otherwise>
101                         <xsl:call-template name='textdecoration_1'>
102                                 <xsl:with-param name='version' select="'unrecognised Lustre version'"/>
103                                 <xsl:with-param name='chunkid' select="$id"/>
104                         </xsl:call-template>
105                 </xsl:otherwise>
106         </xsl:choose>
107 </xsl:template>
108
109 <!-- toc.line template: This template over loads the behavior of creating the table of contents. It
110                 adds in a small entry to identify lustre version specific features.
111                 for more information, see this page:
112                 http://xml.web.cern.ch/XML/www.sagehill.net/xml/docbookxsl/PrintCustomEx.html#PrintTocEntries -->
113 <xsl:template name="toc.line">
114         <xsl:param name="toc-context" select="."/>
115         <xsl:param name="depth" select="1"/>
116         <xsl:param name="depth.from.context" select="8"/>
117
118         <span>
119         <xsl:attribute name="class">
120                 <xsl:value-of select="local-name(.)"/>
121         </xsl:attribute>
122
123         <!-- * if $autotoc.label.in.hyperlink is zero, then output the label -->
124         <!-- * before the hyperlinked title (as the DSSSL stylesheet does) -->
125         <xsl:if test="$autotoc.label.in.hyperlink = 0">
126                 <xsl:variable name="label">
127                         <xsl:apply-templates select="." mode="label.markup"/>
128                 </xsl:variable>
129                 <xsl:copy-of select="$label"/>
130                 <xsl:if test="$label != ''">
131                         <xsl:value-of select="$autotoc.label.separator"/>
132                 </xsl:if>
133         </xsl:if>
134
135         <a>
136                 <xsl:attribute name="href">
137                         <xsl:call-template name="href.target">
138                                 <xsl:with-param name="context" select="$toc-context"/>
139                                 <xsl:with-param name="toc-context" select="$toc-context"/>
140                         </xsl:call-template>
141                 </xsl:attribute>
142
143         <!-- * if $autotoc.label.in.hyperlink is non-zero, then output the label
144                          as part of the hyperlinked title -->
145                 <xsl:if test="not($autotoc.label.in.hyperlink = 0)">
146                         <xsl:variable name="label">
147                                 <xsl:apply-templates select="." mode="label.markup"/>
148                         </xsl:variable>
149                         <xsl:copy-of select="$label"/>
150                         <xsl:if test="$label != ''">
151                                 <xsl:value-of select="$autotoc.label.separator"/>
152                         </xsl:if>
153                 </xsl:if>
154                 <xsl:apply-templates select="." mode="titleabbrev.markup"/>
155         </a>
156         </span>
157         <!-- add another span to hold the lustre version annotation -->
158         <xsl:if test="@condition='l21'">
159                 <span class='floatright'>L 2.1 </span>
160         </xsl:if>
161         <xsl:if test="@condition='l22'">
162                 <span class='floatright'>L 2.2 </span>
163         </xsl:if>
164         <xsl:if test="@condition='l23'">
165                 <span class='floatright'>L 2.3 </span>
166         </xsl:if>
167         <xsl:if test="@condition='l24'">
168                 <span class='floatright'>L 2.4 </span>
169         </xsl:if>
170         <xsl:if test="@condition='l25'">
171                 <span class='floatright'>L 2.5 </span>
172         </xsl:if>
173         <xsl:if test="@condition='l26'">
174                 <span class='floatright'>L 2.6 </span>
175         </xsl:if>
176         <xsl:if test="@condition='l27'">
177                 <span class='floatright'>L 2.7 </span>
178         </xsl:if>
179         <xsl:if test="@condition='l28'">
180                 <span class='floatright'>L 2.8 </span>
181         </xsl:if>
182         <xsl:if test="@condition='l29'">
183                 <span class='floatright'>L 2.9 </span>
184         </xsl:if>
185 </xsl:template>
186
187 </xsl:stylesheet>