Debian Codegraph @

docs/xsl-generic/html/lists.xsl

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