Debian Codegraph @

xslt/dita/html/dita2html-list.xsl

raw
1 <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
2 <!--
3 This program is free software; you can redistribute it and/or modify it under
4 the terms of the GNU Lesser General Public License as published by the Free
5 Software Foundation; either version 2 of the License, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful, but WITHOUT
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 details.
12
13 You should have received a copy of the GNU Lesser General Public License
14 along with this program; see the file COPYING.LGPL. If not, see <http://www.gnu.org/licenses/>.
15 -->
16 <!DOCTYPE xsl:stylesheet [
17 <!ENTITY % selectors SYSTEM "../common/dita-selectors.mod">
18 %selectors;
19 ]>
20
21 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
22 xmlns:yelp="http://projects.gnome.org/yelp/"
23 xmlns="http://www.w3.org/1999/xhtml"
24 exclude-result-prefixes="yelp"
25 version="1.0">
26
27 <!--!!==========================================================================
28 DITA to HTML - Lists
29
30 REMARK: Describe this module
31 -->
32
33
34 <!-- == Matched Templates == -->
35
36 <!-- = choice = -->
37 <xsl:template mode="dita2html.topic.mode" match="&topic_choice;">
38 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
39 <li>
40 <xsl:call-template name="dita.id"/>
41 <xsl:call-template name="html.lang.attrs"/>
42 <xsl:call-template name="html.class.attr">
43 <xsl:with-param name="class" select="'list'"/>
44 </xsl:call-template>
45 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
46 </li>
47 </xsl:template>
48
49 <!-- = choices = -->
50 <xsl:template mode="dita2html.topic.mode" match="&topic_choices;">
51 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
52 <div>
53 <xsl:call-template name="dita.id"/>
54 <xsl:call-template name="html.lang.attrs"/>
55 <xsl:call-template name="html.class.attr">
56 <xsl:with-param name="class" select="'list'"/>
57 </xsl:call-template>
58 <div class="inner">
59 <ul class="list">
60 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
61 </ul>
62 </div>
63 </div>
64 </xsl:template>
65
66 <!-- = dd = -->
67 <xsl:template mode="dita2html.topic.mode" match="&topic_dd;">
68 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
69 <dd>
70 <xsl:call-template name="dita.id"/>
71 <xsl:call-template name="html.lang.attrs"/>
72 <xsl:call-template name="html.class.attr">
73 <xsl:with-param name="class" select="'terms'"/>
74 </xsl:call-template>
75 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
76 </dd>
77 </xsl:template>
78
79 <!-- = ddhd = -->
80 <xsl:template mode="dita2html.topic.mode" match="&topic_ddhd;">
81 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
82 <dd>
83 <xsl:call-template name="dita.id"/>
84 <xsl:call-template name="html.lang.attrs"/>
85 <xsl:call-template name="html.class.attr">
86 <xsl:with-param name="class" select="'terms ddhd'"/>
87 </xsl:call-template>
88 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
89 </dd>
90 </xsl:template>
91
92 <!-- = dl = -->
93 <xsl:template mode="dita2html.topic.mode" match="&topic_dl;">
94 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
95 <xsl:variable name="compact">
96 <xsl:call-template name="dita.ref.conref.attr">
97 <xsl:with-param name="attr" select="'compact'"/>
98 <xsl:with-param name="node" select="."/>
99 <xsl:with-param name="conref" select="$conref"/>
100 </xsl:call-template>
101 </xsl:variable>
102 <div>
103 <xsl:call-template name="dita.id"/>
104 <xsl:call-template name="html.lang.attrs"/>
105 <xsl:call-template name="html.class.attr">
106 <xsl:with-param name="class" select="'terms'"/>
107 </xsl:call-template>
108 <dl>
109 <xsl:attribute name="class">
110 <xsl:text>terms</xsl:text>
111 <xsl:if test="$compact = 'yes'">
112 <xsl:text> compact</xsl:text>
113 </xsl:if>
114 </xsl:attribute>
115 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
116 </dl>
117 </div>
118 </xsl:template>
119
120 <!-- = dlentry = -->
121 <xsl:template mode="dita2html.topic.mode" match="&topic_dlentry;">
122 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
123 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
124 </xsl:template>
125
126 <!-- = dlhead = -->
127 <xsl:template mode="dita2html.topic.mode" match="&topic_dlhead;">
128 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
129 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
130 </xsl:template>
131
132 <!-- = dt = -->
133 <xsl:template mode="dita2html.topic.mode" match="&topic_dt;">
134 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
135 <dt>
136 <xsl:call-template name="dita.id"/>
137 <xsl:call-template name="html.lang.attrs"/>
138 <xsl:call-template name="html.class.attr">
139 <xsl:with-param name="class" select="'terms'"/>
140 </xsl:call-template>
141 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
142 </dt>
143 </xsl:template>
144
145 <!-- = dthd = -->
146 <xsl:template mode="dita2html.topic.mode" match="&topic_dthd;">
147 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
148 <dt>
149 <xsl:call-template name="dita.id"/>
150 <xsl:call-template name="html.lang.attrs"/>
151 <xsl:call-template name="html.class.attr">
152 <xsl:with-param name="class" select="'terms dthd'"/>
153 </xsl:call-template>
154 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
155 </dt>
156 </xsl:template>
157
158 <!-- = li = -->
159 <xsl:template mode="dita2html.topic.mode" match="&topic_li;">
160 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
161 <li>
162 <xsl:call-template name="dita.id"/>
163 <xsl:call-template name="html.lang.attrs"/>
164 <xsl:call-template name="html.class.attr">
165 <xsl:with-param name="class" select="'list'"/>
166 </xsl:call-template>
167 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
168 </li>
169 </xsl:template>
170
171 <!-- = ol = -->
172 <xsl:template mode="dita2html.topic.mode" match="&topic_ol;">
173 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
174 <xsl:variable name="compact">
175 <xsl:call-template name="dita.ref.conref.attr">
176 <xsl:with-param name="attr" select="'compact'"/>
177 <xsl:with-param name="node" select="."/>
178 <xsl:with-param name="conref" select="$conref"/>
179 </xsl:call-template>
180 </xsl:variable>
181 <div>
182 <xsl:call-template name="dita.id"/>
183 <xsl:call-template name="html.lang.attrs"/>
184 <xsl:call-template name="html.class.attr">
185 <xsl:with-param name="class" select="'list'"/>
186 </xsl:call-template>
187 <div class="inner">
188 <ol>
189 <xsl:attribute name="class">
190 <xsl:text>list</xsl:text>
191 <xsl:if test="$compact = 'yes'">
192 <xsl:text> compact</xsl:text>
193 </xsl:if>
194 </xsl:attribute>
195 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
196 </ol>
197 </div>
198 </div>
199 </xsl:template>
200
201 <!-- = sl = -->
202 <xsl:template mode="dita2html.topic.mode" match="&topic_sl;">
203 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
204 <xsl:variable name="compact">
205 <xsl:call-template name="dita.ref.conref.attr">
206 <xsl:with-param name="attr" select="'compact'"/>
207 <xsl:with-param name="node" select="."/>
208 <xsl:with-param name="conref" select="$conref"/>
209 </xsl:call-template>
210 </xsl:variable>
211 <div>
212 <xsl:call-template name="dita.id"/>
213 <xsl:call-template name="html.lang.attrs"/>
214 <xsl:call-template name="html.class.attr">
215 <xsl:with-param name="class" select="'list'"/>
216 </xsl:call-template>
217 <div class="inner">
218 <ul>
219 <xsl:attribute name="class">
220 <xsl:text>list list-sli</xsl:text>
221 <!-- Non-compact sl is compact other lists. Compact sl is compacter. -->
222 <xsl:choose>
223 <xsl:when test="$compact = 'yes'">
224 <xsl:text> compact-sli</xsl:text>
225 </xsl:when>
226 <xsl:otherwise>
227 <xsl:text> compact</xsl:text>
228 </xsl:otherwise>
229 </xsl:choose>
230 </xsl:attribute>
231 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
232 </ul>
233 </div>
234 </div>
235 </xsl:template>
236
237 <!-- = sli = -->
238 <xsl:template mode="dita2html.topic.mode" match="&topic_sli;">
239 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
240 <li>
241 <xsl:call-template name="dita.id"/>
242 <xsl:call-template name="html.lang.attrs"/>
243 <xsl:call-template name="html.class.attr">
244 <xsl:with-param name="class" select="'list'"/>
245 </xsl:call-template>
246 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
247 </li>
248 </xsl:template>
249
250 <!-- = step = -->
251 <xsl:template mode="dita2html.topic.mode" match="&topic_step;">
252 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
253 <xsl:variable name="pre" select="preceding-sibling::&topic_step;"/>
254 <li value="{count($pre) + 1}">
255 <xsl:call-template name="dita.id"/>
256 <xsl:call-template name="html.lang.attrs"/>
257 <xsl:call-template name="html.class.attr">
258 <xsl:with-param name="class" select="'steps'"/>
259 </xsl:call-template>
260 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
261 </li>
262 </xsl:template>
263
264 <!-- = steps = -->
265 <xsl:template mode="dita2html.topic.mode" match="&topic_steps;">
266 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
267 <div>
268 <xsl:call-template name="dita.id"/>
269 <xsl:call-template name="html.lang.attrs"/>
270 <xsl:call-template name="html.class.attr">
271 <xsl:with-param name="class" select="'steps'"/>
272 </xsl:call-template>
273 <div class="inner">
274 <div class="region">
275 <ol class="steps">
276 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
277 </ol>
278 </div>
279 </div>
280 </div>
281 </xsl:template>
282
283 <!-- = steps-unordered = -->
284 <xsl:template mode="dita2html.topic.mode" match="&topic_steps-unordered;">
285 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
286 <div>
287 <xsl:call-template name="dita.id"/>
288 <xsl:call-template name="html.lang.attrs"/>
289 <xsl:call-template name="html.class.attr">
290 <xsl:with-param name="class" select="'steps'"/>
291 </xsl:call-template>
292 <div class="inner">
293 <div class="region">
294 <ul class="steps">
295 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
296 </ul>
297 </div>
298 </div>
299 </div>
300 </xsl:template>
301
302 <!-- = stepsection = -->
303 <xsl:template mode="dita2html.topic.mode" match="&topic_stepsection;">
304 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
305 <li>
306 <xsl:call-template name="dita.id"/>
307 <xsl:call-template name="html.lang.attrs"/>
308 <xsl:call-template name="html.class.attr">
309 <xsl:with-param name="class" select="'stepsection'"/>
310 </xsl:call-template>
311 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
312 </li>
313 </xsl:template>
314
315 <!-- = substep = -->
316 <xsl:template mode="dita2html.topic.mode" match="&topic_substep;">
317 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
318 <li>
319 <xsl:call-template name="dita.id"/>
320 <xsl:call-template name="html.lang.attrs"/>
321 <xsl:call-template name="html.class.attr">
322 <xsl:with-param name="class" select="'steps substeps'"/>
323 </xsl:call-template>
324 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
325 </li>
326 </xsl:template>
327
328 <!-- = substeps = -->
329 <xsl:template mode="dita2html.topic.mode" match="&topic_substeps;">
330 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
331 <div>
332 <xsl:call-template name="dita.id"/>
333 <xsl:call-template name="html.lang.attrs"/>
334 <xsl:call-template name="html.class.attr">
335 <xsl:with-param name="class" select="'substeps'"/>
336 </xsl:call-template>
337 <ol class="substeps">
338 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
339 </ol>
340 </div>
341 </xsl:template>
342
343 <!-- = ul = -->
344 <xsl:template mode="dita2html.topic.mode" match="&topic_ul;">
345 <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
346 <xsl:variable name="compact">
347 <xsl:call-template name="dita.ref.conref.attr">
348 <xsl:with-param name="attr" select="'compact'"/>
349 <xsl:with-param name="node" select="."/>
350 <xsl:with-param name="conref" select="$conref"/>
351 </xsl:call-template>
352 </xsl:variable>
353 <div>
354 <xsl:call-template name="dita.id"/>
355 <xsl:call-template name="html.lang.attrs"/>
356 <xsl:call-template name="html.class.attr">
357 <xsl:with-param name="class" select="'list'"/>
358 </xsl:call-template>
359 <div class="inner">
360 <ul>
361 <xsl:attribute name="class">
362 <xsl:text>list</xsl:text>
363 <xsl:if test="$compact = 'yes'">
364 <xsl:text> compact</xsl:text>
365 </xsl:if>
366 </xsl:attribute>
367 <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
368 </ul>
369 </div>
370 </div>
371 </xsl:template>
372
373 </xsl:stylesheet>