source: clfs-embedded/BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/lists.xsl@ c2f4c89

Last change on this file since c2f4c89 was 9882b55, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Added the new lfs-xsl stylesheets.

  • Property mode set to 100644
File size: 34.4 KB
Line 
1<?xml version="1.0" encoding="ASCII"?>
2<!--This file was created automatically by html2xhtml-->
3<!--from the HTML stylesheets.-->
4<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6<!-- ********************************************************************
7 $Id$
8 ********************************************************************
9
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
13
14 ******************************************************************** -->
15
16<!-- ==================================================================== -->
17
18<xsl:template match="itemizedlist">
19 <div>
20 <xsl:apply-templates select="." mode="class.attribute"/>
21 <xsl:call-template name="anchor"/>
22 <xsl:if test="title">
23 <xsl:call-template name="formal.object.heading"/>
24 </xsl:if>
25
26 <!-- Preserve order of PIs and comments -->
27 <xsl:apply-templates select="*[not(self::listitem or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::listitem)] |processing-instruction()[not(preceding-sibling::listitem)]"/>
28
29 <ul>
30 <xsl:if test="$css.decoration != 0">
31 <xsl:attribute name="type">
32 <xsl:call-template name="list.itemsymbol"/>
33 </xsl:attribute>
34 </xsl:if>
35
36 <xsl:if test="@spacing='compact'">
37 <xsl:attribute name="compact">
38 <xsl:value-of select="@spacing"/>
39 </xsl:attribute>
40 </xsl:if>
41 <xsl:apply-templates select="listitem |comment()[preceding-sibling::listitem] |processing-instruction()[preceding-sibling::listitem]"/>
42 </ul>
43 </div>
44</xsl:template>
45
46<xsl:template match="itemizedlist/title">
47 <!-- nop -->
48</xsl:template>
49
50<xsl:template match="itemizedlist/listitem">
51 <xsl:variable name="mark" select="../@mark"/>
52 <xsl:variable name="override" select="@override"/>
53
54 <xsl:variable name="usemark">
55 <xsl:choose>
56 <xsl:when test="$override != ''">
57 <xsl:value-of select="$override"/>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:value-of select="$mark"/>
61 </xsl:otherwise>
62 </xsl:choose>
63 </xsl:variable>
64
65 <xsl:variable name="cssmark">
66 <xsl:choose>
67 <xsl:when test="$usemark = 'opencircle'">circle</xsl:when>
68 <xsl:when test="$usemark = 'bullet'">disc</xsl:when>
69 <xsl:when test="$usemark = 'box'">square</xsl:when>
70 <xsl:otherwise>
71 <xsl:value-of select="$usemark"/>
72 </xsl:otherwise>
73 </xsl:choose>
74 </xsl:variable>
75
76 <li>
77 <xsl:if test="$css.decoration = '1' and $cssmark != ''">
78 <xsl:attribute name="style">
79 <xsl:text>list-style-type: </xsl:text>
80 <xsl:value-of select="$cssmark"/>
81 </xsl:attribute>
82 </xsl:if>
83
84 <!-- we can't just drop the anchor in since some browsers (Opera)
85 get confused about line breaks if we do. So if the first child
86 is a para, assume the para will put in the anchor. Otherwise,
87 put the anchor in anyway. -->
88 <xsl:if test="local-name(child::*[1]) != 'para'">
89 <xsl:call-template name="anchor"/>
90 </xsl:if>
91
92 <xsl:choose>
93 <xsl:when test="$show.revisionflag != 0 and @revisionflag">
94 <div class="{@revisionflag}">
95 <xsl:apply-templates/>
96 </div>
97 </xsl:when>
98 <xsl:otherwise>
99 <xsl:apply-templates/>
100 </xsl:otherwise>
101 </xsl:choose>
102 </li>
103</xsl:template>
104
105<xsl:template match="orderedlist">
106 <xsl:variable name="start">
107 <xsl:call-template name="orderedlist-starting-number"/>
108 </xsl:variable>
109
110 <xsl:variable name="numeration">
111 <xsl:call-template name="list.numeration"/>
112 </xsl:variable>
113
114 <xsl:variable name="type">
115 <xsl:choose>
116 <xsl:when test="$numeration='arabic'">1</xsl:when>
117 <xsl:when test="$numeration='loweralpha'">a</xsl:when>
118 <xsl:when test="$numeration='lowerroman'">i</xsl:when>
119 <xsl:when test="$numeration='upperalpha'">A</xsl:when>
120 <xsl:when test="$numeration='upperroman'">I</xsl:when>
121 <!-- What!? This should never happen -->
122 <xsl:otherwise>
123 <xsl:message>
124 <xsl:text>Unexpected numeration: </xsl:text>
125 <xsl:value-of select="$numeration"/>
126 </xsl:message>
127 <xsl:value-of select="1"/>
128 </xsl:otherwise>
129 </xsl:choose>
130 </xsl:variable>
131
132 <div>
133 <xsl:apply-templates select="." mode="class.attribute"/>
134 <xsl:call-template name="anchor"/>
135
136 <xsl:if test="title">
137 <xsl:call-template name="formal.object.heading"/>
138 </xsl:if>
139
140 <!-- Preserve order of PIs and comments -->
141 <xsl:apply-templates select="*[not(self::listitem or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::listitem)] |processing-instruction()[not(preceding-sibling::listitem)]"/>
142
143 <ol>
144 <xsl:if test="$start != '1'">
145 <xsl:attribute name="start">
146 <xsl:value-of select="$start"/>
147 </xsl:attribute>
148 </xsl:if>
149 <xsl:if test="$numeration != ''">
150 <xsl:attribute name="type">
151 <xsl:value-of select="$type"/>
152 </xsl:attribute>
153 </xsl:if>
154 <xsl:if test="@spacing='compact'">
155 <xsl:attribute name="compact">
156 <xsl:value-of select="@spacing"/>
157 </xsl:attribute>
158 </xsl:if>
159 <xsl:apply-templates select="listitem |comment()[preceding-sibling::listitem] |processing-instruction()[preceding-sibling::listitem]"/>
160 </ol>
161 </div>
162</xsl:template>
163
164<xsl:template match="orderedlist/title">
165 <!-- nop -->
166</xsl:template>
167
168<xsl:template match="orderedlist/listitem">
169 <li>
170 <xsl:if test="@override">
171 <xsl:attribute name="value">
172 <xsl:value-of select="@override"/>
173 </xsl:attribute>
174 </xsl:if>
175
176 <!-- we can't just drop the anchor in since some browsers (Opera)
177 get confused about line breaks if we do. So if the first child
178 is a para, assume the para will put in the anchor. Otherwise,
179 put the anchor in anyway. -->
180 <xsl:if test="local-name(child::*[1]) != 'para'">
181 <xsl:call-template name="anchor"/>
182 </xsl:if>
183
184 <xsl:choose>
185 <xsl:when test="$show.revisionflag != 0 and @revisionflag">
186 <div class="{@revisionflag}">
187 <xsl:apply-templates/>
188 </div>
189 </xsl:when>
190 <xsl:otherwise>
191 <xsl:apply-templates/>
192 </xsl:otherwise>
193 </xsl:choose>
194 </li>
195</xsl:template>
196
197<xsl:template match="variablelist">
198 <xsl:variable name="pi-presentation">
199 <xsl:call-template name="dbhtml-attribute">
200 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
201 <xsl:with-param name="attribute" select="'list-presentation'"/>
202 </xsl:call-template>
203 </xsl:variable>
204
205 <xsl:variable name="presentation">
206 <xsl:choose>
207 <xsl:when test="$pi-presentation != ''">
208 <xsl:value-of select="$pi-presentation"/>
209 </xsl:when>
210 <xsl:when test="$variablelist.as.table != 0">
211 <xsl:value-of select="'table'"/>
212 </xsl:when>
213 <xsl:otherwise>
214 <xsl:value-of select="'list'"/>
215 </xsl:otherwise>
216 </xsl:choose>
217 </xsl:variable>
218
219 <xsl:variable name="list-width">
220 <xsl:call-template name="dbhtml-attribute">
221 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
222 <xsl:with-param name="attribute" select="'list-width'"/>
223 </xsl:call-template>
224 </xsl:variable>
225
226 <xsl:variable name="term-width">
227 <xsl:call-template name="dbhtml-attribute">
228 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
229 <xsl:with-param name="attribute" select="'term-width'"/>
230 </xsl:call-template>
231 </xsl:variable>
232
233 <xsl:variable name="table-summary">
234 <xsl:call-template name="dbhtml-attribute">
235 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
236 <xsl:with-param name="attribute" select="'table-summary'"/>
237 </xsl:call-template>
238 </xsl:variable>
239
240 <div>
241 <xsl:apply-templates select="." mode="class.attribute"/>
242 <xsl:call-template name="anchor"/>
243 <xsl:if test="title">
244 <xsl:call-template name="formal.object.heading"/>
245 </xsl:if>
246
247 <xsl:choose>
248 <xsl:when test="$presentation = 'table'">
249 <!-- Preserve order of PIs and comments -->
250 <xsl:apply-templates select="*[not(self::varlistentry or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::varlistentry)] |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
251 <table border="0">
252 <xsl:if test="$list-width != ''">
253 <xsl:attribute name="width">
254 <xsl:value-of select="$list-width"/>
255 </xsl:attribute>
256 </xsl:if>
257 <xsl:if test="$table-summary != ''">
258 <xsl:attribute name="summary">
259 <xsl:value-of select="$table-summary"/>
260 </xsl:attribute>
261 </xsl:if>
262 <col align="left" valign="top">
263 <xsl:if test="$term-width != ''">
264 <xsl:attribute name="width">
265 <xsl:value-of select="$term-width"/>
266 </xsl:attribute>
267 </xsl:if>
268 </col>
269 <tbody>
270 <xsl:apply-templates mode="varlist-table" select="varlistentry |comment()[preceding-sibling::varlistentry] |processing-instruction()[preceding-sibling::varlistentry]"/>
271 </tbody>
272 </table>
273 </xsl:when>
274 <xsl:otherwise>
275 <!-- Preserve order of PIs and comments -->
276 <xsl:apply-templates select="*[not(self::varlistentry or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::varlistentry)] |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
277 <dl>
278 <xsl:apply-templates select="varlistentry |comment()[preceding-sibling::varlistentry] |processing-instruction()[preceding-sibling::varlistentry]"/>
279 </dl>
280 </xsl:otherwise>
281 </xsl:choose>
282 </div>
283</xsl:template>
284
285<xsl:template match="variablelist/title">
286 <!-- nop -->
287</xsl:template>
288
289<xsl:template match="itemizedlist/titleabbrev|orderedlist/titleabbrev">
290 <!--nop-->
291</xsl:template>
292
293<xsl:template match="variablelist/titleabbrev">
294 <!--nop-->
295</xsl:template>
296
297<xsl:template match="listitem" mode="xref">
298 <xsl:number format="1"/>
299</xsl:template>
300
301<xsl:template match="listitem/simpara" priority="2">
302 <!-- If a listitem contains only a single simpara, don't output
303 the <p> wrapper; this has the effect of creating an li
304 with simple text content. -->
305 <xsl:choose>
306 <xsl:when test="not(preceding-sibling::*) and not (following-sibling::*)">
307 <xsl:call-template name="anchor"/>
308 <xsl:apply-templates/>
309 </xsl:when>
310 <xsl:otherwise>
311 <p>
312 <xsl:if test="@role and $para.propagates.style != 0">
313 <xsl:apply-templates select="." mode="class.attribute">
314 <xsl:with-param name="class" select="@role"/>
315 </xsl:apply-templates>
316 </xsl:if>
317
318 <xsl:call-template name="anchor"/>
319 <xsl:apply-templates/>
320 </p>
321 </xsl:otherwise>
322 </xsl:choose>
323</xsl:template>
324
325<xsl:template match="varlistentry">
326 <dt>
327 <xsl:call-template name="anchor"/>
328 <xsl:apply-templates select="term"/>
329 </dt>
330 <dd>
331 <xsl:apply-templates select="listitem"/>
332 </dd>
333</xsl:template>
334
335<xsl:template match="varlistentry" mode="varlist-table">
336 <xsl:variable name="presentation">
337 <xsl:call-template name="dbhtml-attribute">
338 <xsl:with-param name="pis" select="../processing-instruction('dbhtml')"/>
339 <xsl:with-param name="attribute" select="'term-presentation'"/>
340 </xsl:call-template>
341 </xsl:variable>
342
343 <xsl:variable name="separator">
344 <xsl:call-template name="dbhtml-attribute">
345 <xsl:with-param name="pis" select="../processing-instruction('dbhtml')"/>
346 <xsl:with-param name="attribute" select="'term-separator'"/>
347 </xsl:call-template>
348 </xsl:variable>
349 <tr>
350 <xsl:call-template name="tr.attributes">
351 <xsl:with-param name="rownum">
352 <xsl:number from="variablelist" count="varlistentry"/>
353 </xsl:with-param>
354 </xsl:call-template>
355
356 <td>
357 <p>
358 <xsl:call-template name="anchor"/>
359 <xsl:choose>
360 <xsl:when test="$presentation = 'bold'">
361 <b>
362 <xsl:apply-templates select="term"/>
363 <xsl:value-of select="$separator"/>
364 </b>
365 </xsl:when>
366 <xsl:when test="$presentation = 'italic'">
367 <i>
368 <xsl:apply-templates select="term"/>
369 <xsl:value-of select="$separator"/>
370 </i>
371 </xsl:when>
372 <xsl:when test="$presentation = 'bold-italic'">
373 <b>
374 <i>
375 <xsl:apply-templates select="term"/>
376 <xsl:value-of select="$separator"/>
377 </i>
378 </b>
379 </xsl:when>
380 <xsl:otherwise>
381 <xsl:apply-templates select="term"/>
382 <xsl:value-of select="$separator"/>
383 </xsl:otherwise>
384 </xsl:choose>
385 </p>
386 </td>
387 <td>
388 <xsl:apply-templates select="listitem"/>
389 </td>
390 </tr>
391</xsl:template>
392
393<xsl:template match="varlistentry/term">
394 <span class="term">
395 <xsl:call-template name="anchor"/>
396 <xsl:call-template name="simple.xlink">
397 <xsl:with-param name="content">
398 <xsl:apply-templates/>
399 </xsl:with-param>
400 </xsl:call-template>
401 <xsl:choose>
402 <xsl:when test="position() = last()"/> <!-- do nothing -->
403 <xsl:otherwise>
404 <!-- * if we have multiple terms in the same varlistentry, generate -->
405 <!-- * a separator (", " by default) and/or an additional line -->
406 <!-- * break after each one except the last -->
407 <xsl:value-of select="$variablelist.term.separator"/>
408 <xsl:if test="not($variablelist.term.break.after = '0')">
409 <br/>
410 </xsl:if>
411 </xsl:otherwise>
412 </xsl:choose>
413 </span>
414</xsl:template>
415
416<xsl:template match="varlistentry/listitem">
417 <!-- we can't just drop the anchor in since some browsers (Opera)
418 get confused about line breaks if we do. So if the first child
419 is a para, assume the para will put in the anchor. Otherwise,
420 put the anchor in anyway. -->
421 <xsl:if test="local-name(child::*[1]) != 'para'">
422 <xsl:call-template name="anchor"/>
423 </xsl:if>
424
425 <xsl:choose>
426 <xsl:when test="$show.revisionflag != 0 and @revisionflag">
427 <div class="{@revisionflag}">
428 <xsl:apply-templates/>
429 </div>
430 </xsl:when>
431 <xsl:otherwise>
432 <xsl:apply-templates/>
433 </xsl:otherwise>
434 </xsl:choose>
435</xsl:template>
436
437<!-- ==================================================================== -->
438
439<xsl:template match="simplelist">
440 <!-- with no type specified, the default is 'vert' -->
441 <xsl:call-template name="anchor"/>
442 <table class="simplelist" border="0" summary="Simple list">
443 <xsl:call-template name="simplelist.vert">
444 <xsl:with-param name="cols">
445 <xsl:choose>
446 <xsl:when test="@columns">
447 <xsl:value-of select="@columns"/>
448 </xsl:when>
449 <xsl:otherwise>1</xsl:otherwise>
450 </xsl:choose>
451 </xsl:with-param>
452 </xsl:call-template>
453 </table>
454</xsl:template>
455
456<xsl:template match="simplelist[@type='inline']">
457 <span>
458 <xsl:apply-templates select="." mode="class.attribute"/>
459 <!-- if dbchoice PI exists, use that to determine the choice separator -->
460 <!-- (that is, equivalent of "and" or "or" in current locale), or literal -->
461 <!-- value of "choice" otherwise -->
462 <xsl:variable name="localized-choice-separator">
463 <xsl:choose>
464 <xsl:when test="processing-instruction('dbchoice')">
465 <xsl:call-template name="select.choice.separator"/>
466 </xsl:when>
467 <xsl:otherwise>
468 <!-- empty -->
469 </xsl:otherwise>
470 </xsl:choose>
471 </xsl:variable>
472
473 <xsl:for-each select="member">
474 <xsl:call-template name="simple.xlink">
475 <xsl:with-param name="content">
476 <xsl:apply-templates/>
477 </xsl:with-param>
478 </xsl:call-template>
479 <xsl:choose>
480 <xsl:when test="position() = last()"/> <!-- do nothing -->
481 <xsl:otherwise>
482 <xsl:text>, </xsl:text>
483 <xsl:if test="position() = last() - 1">
484 <xsl:if test="$localized-choice-separator != ''">
485 <xsl:value-of select="$localized-choice-separator"/>
486 <xsl:text> </xsl:text>
487 </xsl:if>
488 </xsl:if>
489 </xsl:otherwise>
490 </xsl:choose>
491 </xsl:for-each>
492 </span>
493</xsl:template>
494
495<xsl:template match="simplelist[@type='horiz']">
496 <xsl:call-template name="anchor"/>
497 <table class="simplelist" border="0" summary="Simple list">
498 <xsl:call-template name="simplelist.horiz">
499 <xsl:with-param name="cols">
500 <xsl:choose>
501 <xsl:when test="@columns">
502 <xsl:value-of select="@columns"/>
503 </xsl:when>
504 <xsl:otherwise>1</xsl:otherwise>
505 </xsl:choose>
506 </xsl:with-param>
507 </xsl:call-template>
508 </table>
509</xsl:template>
510
511<xsl:template match="simplelist[@type='vert']">
512 <xsl:call-template name="anchor"/>
513 <table class="simplelist" border="0" summary="Simple list">
514 <xsl:call-template name="simplelist.vert">
515 <xsl:with-param name="cols">
516 <xsl:choose>
517 <xsl:when test="@columns">
518 <xsl:value-of select="@columns"/>
519 </xsl:when>
520 <xsl:otherwise>1</xsl:otherwise>
521 </xsl:choose>
522 </xsl:with-param>
523 </xsl:call-template>
524 </table>
525</xsl:template>
526
527<xsl:template name="simplelist.horiz">
528 <xsl:param name="cols">1</xsl:param>
529 <xsl:param name="cell">1</xsl:param>
530 <xsl:param name="members" select="./member"/>
531
532 <xsl:if test="$cell &lt;= count($members)">
533 <tr>
534 <xsl:call-template name="tr.attributes">
535 <xsl:with-param name="row" select="$members[1]"/>
536 <xsl:with-param name="rownum" select="(($cell - 1) div $cols) + 1"/>
537 </xsl:call-template>
538
539 <xsl:call-template name="simplelist.horiz.row">
540 <xsl:with-param name="cols" select="$cols"/>
541 <xsl:with-param name="cell" select="$cell"/>
542 <xsl:with-param name="members" select="$members"/>
543 </xsl:call-template>
544 </tr>
545 <xsl:call-template name="simplelist.horiz">
546 <xsl:with-param name="cols" select="$cols"/>
547 <xsl:with-param name="cell" select="$cell + $cols"/>
548 <xsl:with-param name="members" select="$members"/>
549 </xsl:call-template>
550 </xsl:if>
551</xsl:template>
552
553<xsl:template name="simplelist.horiz.row">
554 <xsl:param name="cols">1</xsl:param>
555 <xsl:param name="cell">1</xsl:param>
556 <xsl:param name="members" select="./member"/>
557 <xsl:param name="curcol">1</xsl:param>
558
559 <xsl:if test="$curcol &lt;= $cols">
560 <td>
561 <xsl:choose>
562 <xsl:when test="$members[position()=$cell]">
563 <xsl:apply-templates select="$members[position()=$cell]"/>
564 </xsl:when>
565 <xsl:otherwise>
566 <xsl:text>&#160;</xsl:text>
567 </xsl:otherwise>
568 </xsl:choose>
569 </td>
570 <xsl:call-template name="simplelist.horiz.row">
571 <xsl:with-param name="cols" select="$cols"/>
572 <xsl:with-param name="cell" select="$cell+1"/>
573 <xsl:with-param name="members" select="$members"/>
574 <xsl:with-param name="curcol" select="$curcol+1"/>
575 </xsl:call-template>
576 </xsl:if>
577</xsl:template>
578
579<xsl:template name="simplelist.vert">
580 <xsl:param name="cols">1</xsl:param>
581 <xsl:param name="cell">1</xsl:param>
582 <xsl:param name="members" select="./member"/>
583 <xsl:param name="rows" select="floor((count($members)+$cols - 1) div $cols)"/>
584
585 <xsl:if test="$cell &lt;= $rows">
586 <tr>
587 <xsl:call-template name="tr.attributes">
588 <xsl:with-param name="row" select="$members[1]"/>
589 <xsl:with-param name="rownum" select="$cell"/>
590 </xsl:call-template>
591
592 <xsl:call-template name="simplelist.vert.row">
593 <xsl:with-param name="cols" select="$cols"/>
594 <xsl:with-param name="rows" select="$rows"/>
595 <xsl:with-param name="cell" select="$cell"/>
596 <xsl:with-param name="members" select="$members"/>
597 </xsl:call-template>
598 </tr>
599 <xsl:call-template name="simplelist.vert">
600 <xsl:with-param name="cols" select="$cols"/>
601 <xsl:with-param name="cell" select="$cell+1"/>
602 <xsl:with-param name="members" select="$members"/>
603 <xsl:with-param name="rows" select="$rows"/>
604 </xsl:call-template>
605 </xsl:if>
606</xsl:template>
607
608<xsl:template name="simplelist.vert.row">
609 <xsl:param name="cols">1</xsl:param>
610 <xsl:param name="rows">1</xsl:param>
611 <xsl:param name="cell">1</xsl:param>
612 <xsl:param name="members" select="./member"/>
613 <xsl:param name="curcol">1</xsl:param>
614
615 <xsl:if test="$curcol &lt;= $cols">
616 <td>
617 <xsl:choose>
618 <xsl:when test="$members[position()=$cell]">
619 <xsl:apply-templates select="$members[position()=$cell]"/>
620 </xsl:when>
621 <xsl:otherwise>
622 <xsl:text>&#160;</xsl:text>
623 </xsl:otherwise>
624 </xsl:choose>
625 </td>
626 <xsl:call-template name="simplelist.vert.row">
627 <xsl:with-param name="cols" select="$cols"/>
628 <xsl:with-param name="rows" select="$rows"/>
629 <xsl:with-param name="cell" select="$cell+$rows"/>
630 <xsl:with-param name="members" select="$members"/>
631 <xsl:with-param name="curcol" select="$curcol+1"/>
632 </xsl:call-template>
633 </xsl:if>
634</xsl:template>
635
636<xsl:template match="member">
637 <xsl:call-template name="anchor"/>
638 <xsl:call-template name="simple.xlink">
639 <xsl:with-param name="content">
640 <xsl:apply-templates/>
641 </xsl:with-param>
642 </xsl:call-template>
643</xsl:template>
644
645<!-- ==================================================================== -->
646
647<xsl:template match="procedure">
648 <xsl:variable name="param.placement" select="substring-after(normalize-space($formal.title.placement), concat(local-name(.), ' '))"/>
649
650 <xsl:variable name="placement">
651 <xsl:choose>
652 <xsl:when test="contains($param.placement, ' ')">
653 <xsl:value-of select="substring-before($param.placement, ' ')"/>
654 </xsl:when>
655 <xsl:when test="$param.placement = ''">before</xsl:when>
656 <xsl:otherwise>
657 <xsl:value-of select="$param.placement"/>
658 </xsl:otherwise>
659 </xsl:choose>
660 </xsl:variable>
661
662 <!-- Preserve order of PIs and comments -->
663 <xsl:variable name="preamble" select="*[not(self::step or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::step)] |processing-instruction()[not(preceding-sibling::step)]"/>
664
665 <div>
666 <xsl:apply-templates select="." mode="class.attribute"/>
667 <xsl:call-template name="anchor">
668 <xsl:with-param name="conditional">
669 <xsl:choose>
670 <xsl:when test="title">0</xsl:when>
671 <xsl:otherwise>1</xsl:otherwise>
672 </xsl:choose>
673 </xsl:with-param>
674 </xsl:call-template>
675
676 <xsl:if test="title and $placement = 'before'">
677 <xsl:call-template name="formal.object.heading"/>
678 </xsl:if>
679
680 <xsl:apply-templates select="$preamble"/>
681
682 <xsl:choose>
683 <xsl:when test="count(step) = 1">
684 <ul>
685 <xsl:apply-templates select="step |comment()[preceding-sibling::step] |processing-instruction()[preceding-sibling::step]"/>
686 </ul>
687 </xsl:when>
688 <xsl:otherwise>
689 <ol>
690 <xsl:attribute name="type">
691 <xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
692 </xsl:attribute>
693 <xsl:apply-templates select="step |comment()[preceding-sibling::step] |processing-instruction()[preceding-sibling::step]"/>
694 </ol>
695 </xsl:otherwise>
696 </xsl:choose>
697
698 <xsl:if test="title and $placement != 'before'">
699 <xsl:call-template name="formal.object.heading"/>
700 </xsl:if>
701 </div>
702</xsl:template>
703
704<xsl:template match="procedure/title">
705 <!-- nop -->
706</xsl:template>
707
708<xsl:template match="substeps">
709 <xsl:variable name="numeration">
710 <xsl:call-template name="procedure.step.numeration"/>
711 </xsl:variable>
712
713 <xsl:call-template name="anchor"/>
714
715 <ol type="{$numeration}">
716 <xsl:apply-templates/>
717 </ol>
718</xsl:template>
719
720<xsl:template match="step">
721 <li>
722 <xsl:call-template name="anchor"/>
723 <xsl:apply-templates/>
724 </li>
725</xsl:template>
726
727<xsl:template match="stepalternatives">
728 <xsl:call-template name="anchor"/>
729 <ul>
730 <xsl:apply-templates/>
731 </ul>
732</xsl:template>
733
734<xsl:template match="step/title">
735 <p class="title">
736 <b>
737 <xsl:apply-templates/>
738 </b>
739 </p>
740</xsl:template>
741
742<!-- ==================================================================== -->
743
744<xsl:template match="segmentedlist">
745 <xsl:variable name="presentation">
746 <xsl:call-template name="dbhtml-attribute">
747 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
748 <xsl:with-param name="attribute" select="'list-presentation'"/>
749 </xsl:call-template>
750 </xsl:variable>
751
752 <div>
753 <xsl:apply-templates select="." mode="class.attribute"/>
754 <xsl:call-template name="anchor"/>
755
756 <xsl:choose>
757 <xsl:when test="$presentation = 'table'">
758 <xsl:apply-templates select="." mode="seglist-table"/>
759 </xsl:when>
760 <xsl:when test="$presentation = 'list'">
761 <xsl:apply-templates/>
762 </xsl:when>
763 <xsl:when test="$segmentedlist.as.table != 0">
764 <xsl:apply-templates select="." mode="seglist-table"/>
765 </xsl:when>
766 <xsl:otherwise>
767 <xsl:apply-templates/>
768 </xsl:otherwise>
769 </xsl:choose>
770 </div>
771</xsl:template>
772
773<xsl:template match="segmentedlist/title">
774 <div class="title">
775 <strong><span class="title"><xsl:apply-templates/></span></strong>
776 </div>
777</xsl:template>
778
779<xsl:template match="segtitle">
780</xsl:template>
781
782<xsl:template match="segtitle" mode="segtitle-in-seg">
783 <xsl:apply-templates/>
784</xsl:template>
785
786<xsl:template match="seglistitem">
787 <div class="seglistitem">
788 <xsl:call-template name="anchor"/>
789 <xsl:apply-templates/>
790 </div>
791</xsl:template>
792
793<xsl:template match="seg">
794 <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
795 <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
796 <xsl:variable name="segtitles" select="$seglist/segtitle"/>
797
798 <!--
799 Note: segtitle is only going to be the right thing in a well formed
800 SegmentedList. If there are too many Segs or too few SegTitles,
801 you'll get something odd...maybe an error
802 -->
803
804 <div class="seg">
805 <strong>
806 <span class="segtitle">
807 <xsl:apply-templates select="$segtitles[$segnum=position()]" mode="segtitle-in-seg"/>
808 <xsl:text>: </xsl:text>
809 </span>
810 </strong>
811 <xsl:apply-templates/>
812 </div>
813</xsl:template>
814
815<xsl:template match="segmentedlist" mode="seglist-table">
816 <xsl:variable name="table-summary">
817 <xsl:call-template name="dbhtml-attribute">
818 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
819 <xsl:with-param name="attribute" select="'table-summary'"/>
820 </xsl:call-template>
821 </xsl:variable>
822
823 <xsl:variable name="list-width">
824 <xsl:call-template name="dbhtml-attribute">
825 <xsl:with-param name="pis" select="processing-instruction('dbhtml')"/>
826 <xsl:with-param name="attribute" select="'list-width'"/>
827 </xsl:call-template>
828 </xsl:variable>
829
830 <xsl:apply-templates select="title"/>
831
832 <table border="0">
833 <xsl:if test="$list-width != ''">
834 <xsl:attribute name="width">
835 <xsl:value-of select="$list-width"/>
836 </xsl:attribute>
837 </xsl:if>
838 <xsl:if test="$table-summary != ''">
839 <xsl:attribute name="summary">
840 <xsl:value-of select="$table-summary"/>
841 </xsl:attribute>
842 </xsl:if>
843 <thead>
844 <tr class="segtitle">
845 <xsl:call-template name="tr.attributes">
846 <xsl:with-param name="row" select="segtitle[1]"/>
847 <xsl:with-param name="rownum" select="1"/>
848 </xsl:call-template>
849 <xsl:apply-templates select="segtitle" mode="seglist-table"/>
850 </tr>
851 </thead>
852 <tbody>
853 <xsl:apply-templates select="seglistitem" mode="seglist-table"/>
854 </tbody>
855 </table>
856</xsl:template>
857
858<xsl:template match="segtitle" mode="seglist-table">
859 <th><xsl:apply-templates/></th>
860</xsl:template>
861
862<xsl:template match="seglistitem" mode="seglist-table">
863 <xsl:variable name="seglinum">
864 <xsl:number from="segmentedlist" count="seglistitem"/>
865 </xsl:variable>
866
867 <tr class="seglistitem">
868 <xsl:call-template name="tr.attributes">
869 <xsl:with-param name="rownum" select="$seglinum + 1"/>
870 </xsl:call-template>
871 <xsl:apply-templates mode="seglist-table"/>
872 </tr>
873</xsl:template>
874
875<xsl:template match="seg" mode="seglist-table">
876 <td class="seg"><xsl:apply-templates/></td>
877</xsl:template>
878
879<xsl:template match="seg[1]" mode="seglist-table">
880 <td class="seg">
881 <xsl:call-template name="anchor">
882 <xsl:with-param name="node" select="ancestor::seglistitem"/>
883 </xsl:call-template>
884 <xsl:apply-templates/>
885 </td>
886</xsl:template>
887
888<!-- ==================================================================== -->
889
890<xsl:template match="calloutlist">
891 <div>
892 <xsl:apply-templates select="." mode="class.attribute"/>
893 <xsl:call-template name="anchor"/>
894 <xsl:if test="title|info/title">
895 <xsl:call-template name="formal.object.heading"/>
896 </xsl:if>
897
898 <!-- Preserve order of PIs and comments -->
899 <xsl:apply-templates select="*[not(self::callout or self::title or self::titleabbrev)] |comment()[not(preceding-sibling::callout)] |processing-instruction()[not(preceding-sibling::callout)]"/>
900
901 <xsl:choose>
902 <xsl:when test="$callout.list.table != 0">
903 <table border="0" summary="Callout list">
904 <xsl:apply-templates select="callout |comment()[preceding-sibling::callout] |processing-instruction()[preceding-sibling::callout]"/>
905 </table>
906 </xsl:when>
907 <xsl:otherwise>
908 <dl compact="compact">
909 <xsl:apply-templates select="callout |comment()[preceding-sibling::callout] |processing-instruction()[preceding-sibling::callout]"/>
910 </dl>
911 </xsl:otherwise>
912 </xsl:choose>
913 </div>
914</xsl:template>
915
916<xsl:template match="calloutlist/title">
917</xsl:template>
918
919<xsl:template match="callout">
920 <xsl:choose>
921 <xsl:when test="$callout.list.table != 0">
922 <tr>
923 <xsl:call-template name="tr.attributes">
924 <xsl:with-param name="rownum">
925 <xsl:number from="calloutlist" count="callout"/>
926 </xsl:with-param>
927 </xsl:call-template>
928
929 <td width="5%" valign="top" align="left">
930 <p>
931 <xsl:call-template name="anchor"/>
932 <xsl:call-template name="callout.arearefs">
933 <xsl:with-param name="arearefs" select="@arearefs"/>
934 </xsl:call-template>
935 </p>
936 </td>
937 <td valign="top" align="left">
938 <xsl:apply-templates/>
939 </td>
940 </tr>
941 </xsl:when>
942 <xsl:otherwise>
943 <dt>
944 <xsl:call-template name="anchor"/>
945 <xsl:call-template name="callout.arearefs">
946 <xsl:with-param name="arearefs" select="@arearefs"/>
947 </xsl:call-template>
948 </dt>
949 <dd><xsl:apply-templates/></dd>
950 </xsl:otherwise>
951 </xsl:choose>
952</xsl:template>
953
954<xsl:template match="callout/simpara" priority="2">
955 <!-- If a callout contains only a single simpara, don't output
956 the <p> wrapper; this has the effect of creating an li
957 with simple text content. -->
958 <xsl:choose>
959 <xsl:when test="not(preceding-sibling::*) and not (following-sibling::*)">
960 <xsl:call-template name="anchor"/>
961 <xsl:apply-templates/>
962 </xsl:when>
963 <xsl:otherwise>
964 <p>
965 <xsl:if test="@role and $para.propagates.style != 0">
966 <xsl:apply-templates select="." mode="class.attribute">
967 <xsl:with-param name="class" select="@role"/>
968 </xsl:apply-templates>
969 </xsl:if>
970
971 <xsl:call-template name="anchor"/>
972 <xsl:apply-templates/>
973 </p>
974 </xsl:otherwise>
975 </xsl:choose>
976</xsl:template>
977
978<xsl:template name="callout.arearefs">
979 <xsl:param name="arearefs"/>
980 <xsl:if test="$arearefs!=''">
981 <xsl:choose>
982 <xsl:when test="substring-before($arearefs,' ')=''">
983 <xsl:call-template name="callout.arearef">
984 <xsl:with-param name="arearef" select="$arearefs"/>
985 </xsl:call-template>
986 </xsl:when>
987 <xsl:otherwise>
988 <xsl:call-template name="callout.arearef">
989 <xsl:with-param name="arearef" select="substring-before($arearefs,' ')"/>
990 </xsl:call-template>
991 </xsl:otherwise>
992 </xsl:choose>
993 <xsl:call-template name="callout.arearefs">
994 <xsl:with-param name="arearefs" select="substring-after($arearefs,' ')"/>
995 </xsl:call-template>
996 </xsl:if>
997</xsl:template>
998
999<xsl:template name="callout.arearef">
1000 <xsl:param name="arearef"/>
1001 <xsl:variable name="targets" select="key('id',$arearef)"/>
1002 <xsl:variable name="target" select="$targets[1]"/>
1003
1004 <xsl:call-template name="check.id.unique">
1005 <xsl:with-param name="linkend" select="$arearef"/>
1006 </xsl:call-template>
1007
1008 <xsl:choose>
1009 <xsl:when test="count($target)=0">
1010 <xsl:text>???</xsl:text>
1011 </xsl:when>
1012 <xsl:when test="local-name($target)='co'">
1013 <a>
1014 <xsl:attribute name="href">
1015 <xsl:text>#</xsl:text>
1016 <xsl:value-of select="$arearef"/>
1017 </xsl:attribute>
1018 <xsl:apply-templates select="$target" mode="callout-bug"/>
1019 </a>
1020 <xsl:text> </xsl:text>
1021 </xsl:when>
1022 <xsl:when test="local-name($target)='areaset'">
1023 <xsl:call-template name="callout-bug">
1024 <xsl:with-param name="conum">
1025 <xsl:apply-templates select="$target" mode="conumber"/>
1026 </xsl:with-param>
1027 </xsl:call-template>
1028 </xsl:when>
1029 <xsl:when test="local-name($target)='area'">
1030 <xsl:choose>
1031 <xsl:when test="$target/parent::areaset">
1032 <xsl:call-template name="callout-bug">
1033 <xsl:with-param name="conum">
1034 <xsl:apply-templates select="$target/parent::areaset" mode="conumber"/>
1035 </xsl:with-param>
1036 </xsl:call-template>
1037 </xsl:when>
1038 <xsl:otherwise>
1039 <xsl:call-template name="callout-bug">
1040 <xsl:with-param name="conum">
1041 <xsl:apply-templates select="$target" mode="conumber"/>
1042 </xsl:with-param>
1043 </xsl:call-template>
1044 </xsl:otherwise>
1045 </xsl:choose>
1046 </xsl:when>
1047 <xsl:otherwise>
1048 <xsl:text>???</xsl:text>
1049 </xsl:otherwise>
1050 </xsl:choose>
1051</xsl:template>
1052
1053<!-- ==================================================================== -->
1054
1055</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.