Jitterbug no more.
[fvwm.git] / doc / docbook-xsl / html / lists.xsl
blob9244f7947718dfede94bf57f0d3c9414612c5023
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 version='1.0'>
5 <!-- ********************************************************************
6 $Id: lists.xsl,v 1.1 2007/03/10 05:15:13 scott Exp $
7 ********************************************************************
9 This file is part of the XSL DocBook Stylesheet distribution.
10 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
11 and other information.
13 ******************************************************************** -->
15 <!-- ==================================================================== -->
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>
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)]"/>
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>
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>
53 <xsl:template match="itemizedlist/title">
54 <!-- nop -->
55 </xsl:template>
57 <xsl:template match="itemizedlist/listitem">
58 <xsl:variable name="mark" select="../@mark"/>
59 <xsl:variable name="override" select="@override"/>
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>
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>
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>
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>
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>
112 <xsl:template match="orderedlist">
113 <xsl:variable name="start">
114 <xsl:call-template name="orderedlist-starting-number"/>
115 </xsl:variable>
117 <xsl:variable name="numeration">
118 <xsl:call-template name="list.numeration"/>
119 </xsl:variable>
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>
139 <div>
140 <xsl:apply-templates select="." mode="class.attribute"/>
141 <xsl:call-template name="anchor"/>
143 <xsl:if test="title">
144 <xsl:call-template name="formal.object.heading"/>
145 </xsl:if>
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)]"/>
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>
179 <xsl:template match="orderedlist/title">
180 <!-- nop -->
181 </xsl:template>
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>
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>
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>
212 <xsl:template match="variablelist">
213 <xsl:variable name="pi-presentation">
214 <xsl:call-template name="dbhtml-attribute">
215 <xsl:with-param name="pis"
216 select="processing-instruction('dbhtml')"/>
217 <xsl:with-param name="attribute" select="'list-presentation'"/>
218 </xsl:call-template>
219 </xsl:variable>
221 <xsl:variable name="presentation">
222 <xsl:choose>
223 <xsl:when test="$pi-presentation != ''">
224 <xsl:value-of select="$pi-presentation"/>
225 </xsl:when>
226 <xsl:when test="$variablelist.as.table != 0">
227 <xsl:value-of select="'table'"/>
228 </xsl:when>
229 <xsl:otherwise>
230 <xsl:value-of select="'list'"/>
231 </xsl:otherwise>
232 </xsl:choose>
233 </xsl:variable>
235 <xsl:variable name="list-width">
236 <xsl:call-template name="dbhtml-attribute">
237 <xsl:with-param name="pis"
238 select="processing-instruction('dbhtml')"/>
239 <xsl:with-param name="attribute" select="'list-width'"/>
240 </xsl:call-template>
241 </xsl:variable>
243 <xsl:variable name="term-width">
244 <xsl:call-template name="dbhtml-attribute">
245 <xsl:with-param name="pis"
246 select="processing-instruction('dbhtml')"/>
247 <xsl:with-param name="attribute" select="'term-width'"/>
248 </xsl:call-template>
249 </xsl:variable>
251 <xsl:variable name="table-summary">
252 <xsl:call-template name="dbhtml-attribute">
253 <xsl:with-param name="pis"
254 select="processing-instruction('dbhtml')"/>
255 <xsl:with-param name="attribute" select="'table-summary'"/>
256 </xsl:call-template>
257 </xsl:variable>
259 <div>
260 <xsl:apply-templates select="." mode="class.attribute"/>
261 <xsl:call-template name="anchor"/>
262 <xsl:if test="title">
263 <xsl:call-template name="formal.object.heading"/>
264 </xsl:if>
266 <xsl:choose>
267 <xsl:when test="$presentation = 'table'">
268 <!-- Preserve order of PIs and comments -->
269 <xsl:apply-templates
270 select="*[not(self::varlistentry
271 or self::title
272 or self::titleabbrev)]
273 |comment()[not(preceding-sibling::varlistentry)]
274 |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
275 <table border="0">
276 <xsl:if test="$list-width != ''">
277 <xsl:attribute name="width">
278 <xsl:value-of select="$list-width"/>
279 </xsl:attribute>
280 </xsl:if>
281 <xsl:if test="$table-summary != ''">
282 <xsl:attribute name="summary">
283 <xsl:value-of select="$table-summary"/>
284 </xsl:attribute>
285 </xsl:if>
286 <col align="left" valign="top">
287 <xsl:if test="$term-width != ''">
288 <xsl:attribute name="width">
289 <xsl:value-of select="$term-width"/>
290 </xsl:attribute>
291 </xsl:if>
292 </col>
293 <tbody>
294 <xsl:apply-templates mode="varlist-table"
295 select="varlistentry
296 |comment()[preceding-sibling::varlistentry]
297 |processing-instruction()[preceding-sibling::varlistentry]"/>
298 </tbody>
299 </table>
300 </xsl:when>
301 <xsl:otherwise>
302 <!-- Preserve order of PIs and comments -->
303 <xsl:apply-templates
304 select="*[not(self::varlistentry
305 or self::title
306 or self::titleabbrev)]
307 |comment()[not(preceding-sibling::varlistentry)]
308 |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
309 <dl>
310 <xsl:apply-templates
311 select="varlistentry
312 |comment()[preceding-sibling::varlistentry]
313 |processing-instruction()[preceding-sibling::varlistentry]"/>
314 </dl>
315 </xsl:otherwise>
316 </xsl:choose>
317 </div>
318 </xsl:template>
320 <xsl:template match="variablelist/title">
321 <!-- nop -->
322 </xsl:template>
324 <xsl:template match="itemizedlist/titleabbrev|orderedlist/titleabbrev">
325 <!--nop-->
326 </xsl:template>
328 <xsl:template match="variablelist/titleabbrev">
329 <!--nop-->
330 </xsl:template>
332 <xsl:template match="listitem" mode="xref">
333 <xsl:number format="1"/>
334 </xsl:template>
336 <xsl:template match="listitem/simpara" priority="2">
337 <!-- If a listitem contains only a single simpara, don't output
338 the <p> wrapper; this has the effect of creating an li
339 with simple text content. -->
340 <xsl:choose>
341 <xsl:when test="not(preceding-sibling::*)
342 and not (following-sibling::*)">
343 <xsl:call-template name="anchor"/>
344 <xsl:apply-templates/>
345 </xsl:when>
346 <xsl:otherwise>
348 <xsl:if test="@role and $para.propagates.style != 0">
349 <xsl:apply-templates select="." mode="class.attribute">
350 <xsl:with-param name="class" select="@role"/>
351 </xsl:apply-templates>
352 </xsl:if>
354 <xsl:call-template name="anchor"/>
355 <xsl:apply-templates/>
356 </p>
357 </xsl:otherwise>
358 </xsl:choose>
359 </xsl:template>
361 <xsl:template match="varlistentry">
362 <dt>
363 <xsl:call-template name="anchor"/>
364 <xsl:apply-templates select="term"/>
365 </dt>
366 <dd>
367 <xsl:apply-templates select="listitem"/>
368 </dd>
369 </xsl:template>
371 <xsl:template match="varlistentry" mode="varlist-table">
372 <xsl:variable name="presentation">
373 <xsl:call-template name="dbhtml-attribute">
374 <xsl:with-param name="pis"
375 select="../processing-instruction('dbhtml')"/>
376 <xsl:with-param name="attribute" select="'term-presentation'"/>
377 </xsl:call-template>
378 </xsl:variable>
380 <xsl:variable name="separator">
381 <xsl:call-template name="dbhtml-attribute">
382 <xsl:with-param name="pis"
383 select="../processing-instruction('dbhtml')"/>
384 <xsl:with-param name="attribute" select="'term-separator'"/>
385 </xsl:call-template>
386 </xsl:variable>
387 <tr>
388 <xsl:call-template name="tr.attributes">
389 <xsl:with-param name="rownum">
390 <xsl:number from="variablelist" count="varlistentry"/>
391 </xsl:with-param>
392 </xsl:call-template>
394 <td>
395 <xsl:call-template name="anchor"/>
396 <xsl:choose>
397 <xsl:when test="$presentation = 'bold'">
399 <xsl:apply-templates select="term"/>
400 <xsl:value-of select="$separator"/>
401 </b>
402 </xsl:when>
403 <xsl:when test="$presentation = 'italic'">
405 <xsl:apply-templates select="term"/>
406 <xsl:value-of select="$separator"/>
407 </i>
408 </xsl:when>
409 <xsl:when test="$presentation = 'bold-italic'">
412 <xsl:apply-templates select="term"/>
413 <xsl:value-of select="$separator"/>
414 </i>
415 </b>
416 </xsl:when>
417 <xsl:otherwise>
418 <xsl:apply-templates select="term"/>
419 <xsl:value-of select="$separator"/>
420 </xsl:otherwise>
421 </xsl:choose>
422 </td>
423 <td>
424 <xsl:apply-templates select="listitem"/>
425 </td>
426 </tr>
427 </xsl:template>
429 <xsl:template match="varlistentry/term">
430 <span class="term">
431 <xsl:call-template name="anchor"/>
432 <xsl:call-template name="simple.xlink">
433 <xsl:with-param name="content">
434 <xsl:apply-templates/>
435 </xsl:with-param>
436 </xsl:call-template>
437 <xsl:choose>
438 <xsl:when test="position() = last()"/> <!-- do nothing -->
439 <xsl:otherwise>
440 <!-- * if we have multiple terms in the same varlistentry, generate -->
441 <!-- * a separator (", " by default) and/or an additional line -->
442 <!-- * break after each one except the last -->
443 <xsl:value-of select="$variablelist.term.separator"/>
444 <xsl:if test="not($variablelist.term.break.after = '0')">
445 <br/>
446 </xsl:if>
447 </xsl:otherwise>
448 </xsl:choose>
449 </span>
450 </xsl:template>
452 <xsl:template match="varlistentry/listitem">
453 <!-- we can't just drop the anchor in since some browsers (Opera)
454 get confused about line breaks if we do. So if the first child
455 is a para, assume the para will put in the anchor. Otherwise,
456 put the anchor in anyway. -->
457 <xsl:if test="local-name(child::*[1]) != 'para'">
458 <xsl:call-template name="anchor"/>
459 </xsl:if>
461 <xsl:choose>
462 <xsl:when test="$show.revisionflag != 0 and @revisionflag">
463 <div class="{@revisionflag}">
464 <xsl:apply-templates/>
465 </div>
466 </xsl:when>
467 <xsl:otherwise>
468 <xsl:apply-templates/>
469 </xsl:otherwise>
470 </xsl:choose>
471 </xsl:template>
473 <!-- ==================================================================== -->
475 <xsl:template match="simplelist">
476 <!-- with no type specified, the default is 'vert' -->
477 <xsl:call-template name="anchor"/>
478 <table class="simplelist" border="0" summary="Simple list">
479 <xsl:call-template name="simplelist.vert">
480 <xsl:with-param name="cols">
481 <xsl:choose>
482 <xsl:when test="@columns">
483 <xsl:value-of select="@columns"/>
484 </xsl:when>
485 <xsl:otherwise>1</xsl:otherwise>
486 </xsl:choose>
487 </xsl:with-param>
488 </xsl:call-template>
489 </table>
490 </xsl:template>
492 <xsl:template match="simplelist[@type='inline']">
493 <span>
494 <xsl:apply-templates select="." mode="class.attribute"/>
495 <!-- if dbchoice PI exists, use that to determine the choice separator -->
496 <!-- (that is, equivalent of "and" or "or" in current locale), or literal -->
497 <!-- value of "choice" otherwise -->
498 <xsl:variable name="localized-choice-separator">
499 <xsl:choose>
500 <xsl:when test="processing-instruction('dbchoice')">
501 <xsl:call-template name="select.choice.separator"/>
502 </xsl:when>
503 <xsl:otherwise>
504 <!-- empty -->
505 </xsl:otherwise>
506 </xsl:choose>
507 </xsl:variable>
509 <xsl:for-each select="member">
510 <xsl:call-template name="simple.xlink">
511 <xsl:with-param name="content">
512 <xsl:apply-templates/>
513 </xsl:with-param>
514 </xsl:call-template>
515 <xsl:choose>
516 <xsl:when test="position() = last()"/> <!-- do nothing -->
517 <xsl:otherwise>
518 <xsl:text>, </xsl:text>
519 <xsl:if test="position() = last() - 1">
520 <xsl:if test="$localized-choice-separator != ''">
521 <xsl:value-of select="$localized-choice-separator"/>
522 <xsl:text> </xsl:text>
523 </xsl:if>
524 </xsl:if>
525 </xsl:otherwise>
526 </xsl:choose>
527 </xsl:for-each>
528 </span>
529 </xsl:template>
531 <xsl:template match="simplelist[@type='horiz']">
532 <xsl:call-template name="anchor"/>
533 <table class="simplelist" border="0" summary="Simple list">
534 <xsl:call-template name="simplelist.horiz">
535 <xsl:with-param name="cols">
536 <xsl:choose>
537 <xsl:when test="@columns">
538 <xsl:value-of select="@columns"/>
539 </xsl:when>
540 <xsl:otherwise>1</xsl:otherwise>
541 </xsl:choose>
542 </xsl:with-param>
543 </xsl:call-template>
544 </table>
545 </xsl:template>
547 <xsl:template match="simplelist[@type='vert']">
548 <xsl:call-template name="anchor"/>
549 <table class="simplelist" border="0" summary="Simple list">
550 <xsl:call-template name="simplelist.vert">
551 <xsl:with-param name="cols">
552 <xsl:choose>
553 <xsl:when test="@columns">
554 <xsl:value-of select="@columns"/>
555 </xsl:when>
556 <xsl:otherwise>1</xsl:otherwise>
557 </xsl:choose>
558 </xsl:with-param>
559 </xsl:call-template>
560 </table>
561 </xsl:template>
563 <xsl:template name="simplelist.horiz">
564 <xsl:param name="cols">1</xsl:param>
565 <xsl:param name="cell">1</xsl:param>
566 <xsl:param name="members" select="./member"/>
568 <xsl:if test="$cell &lt;= count($members)">
569 <tr>
570 <xsl:call-template name="tr.attributes">
571 <xsl:with-param name="row" select="$members[1]"/>
572 <xsl:with-param name="rownum" select="(($cell - 1) div $cols) + 1"/>
573 </xsl:call-template>
575 <xsl:call-template name="simplelist.horiz.row">
576 <xsl:with-param name="cols" select="$cols"/>
577 <xsl:with-param name="cell" select="$cell"/>
578 <xsl:with-param name="members" select="$members"/>
579 </xsl:call-template>
580 </tr>
581 <xsl:call-template name="simplelist.horiz">
582 <xsl:with-param name="cols" select="$cols"/>
583 <xsl:with-param name="cell" select="$cell + $cols"/>
584 <xsl:with-param name="members" select="$members"/>
585 </xsl:call-template>
586 </xsl:if>
587 </xsl:template>
589 <xsl:template name="simplelist.horiz.row">
590 <xsl:param name="cols">1</xsl:param>
591 <xsl:param name="cell">1</xsl:param>
592 <xsl:param name="members" select="./member"/>
593 <xsl:param name="curcol">1</xsl:param>
595 <xsl:if test="$curcol &lt;= $cols">
596 <td>
597 <xsl:choose>
598 <xsl:when test="$members[position()=$cell]">
599 <xsl:apply-templates select="$members[position()=$cell]"/>
600 </xsl:when>
601 <xsl:otherwise>
602 <xsl:text>&#160;</xsl:text>
603 </xsl:otherwise>
604 </xsl:choose>
605 </td>
606 <xsl:call-template name="simplelist.horiz.row">
607 <xsl:with-param name="cols" select="$cols"/>
608 <xsl:with-param name="cell" select="$cell+1"/>
609 <xsl:with-param name="members" select="$members"/>
610 <xsl:with-param name="curcol" select="$curcol+1"/>
611 </xsl:call-template>
612 </xsl:if>
613 </xsl:template>
615 <xsl:template name="simplelist.vert">
616 <xsl:param name="cols">1</xsl:param>
617 <xsl:param name="cell">1</xsl:param>
618 <xsl:param name="members" select="./member"/>
619 <xsl:param name="rows"
620 select="floor((count($members)+$cols - 1) div $cols)"/>
622 <xsl:if test="$cell &lt;= $rows">
623 <tr>
624 <xsl:call-template name="tr.attributes">
625 <xsl:with-param name="row" select="$members[1]"/>
626 <xsl:with-param name="rownum" select="$cell"/>
627 </xsl:call-template>
629 <xsl:call-template name="simplelist.vert.row">
630 <xsl:with-param name="cols" select="$cols"/>
631 <xsl:with-param name="rows" select="$rows"/>
632 <xsl:with-param name="cell" select="$cell"/>
633 <xsl:with-param name="members" select="$members"/>
634 </xsl:call-template>
635 </tr>
636 <xsl:call-template name="simplelist.vert">
637 <xsl:with-param name="cols" select="$cols"/>
638 <xsl:with-param name="cell" select="$cell+1"/>
639 <xsl:with-param name="members" select="$members"/>
640 <xsl:with-param name="rows" select="$rows"/>
641 </xsl:call-template>
642 </xsl:if>
643 </xsl:template>
645 <xsl:template name="simplelist.vert.row">
646 <xsl:param name="cols">1</xsl:param>
647 <xsl:param name="rows">1</xsl:param>
648 <xsl:param name="cell">1</xsl:param>
649 <xsl:param name="members" select="./member"/>
650 <xsl:param name="curcol">1</xsl:param>
652 <xsl:if test="$curcol &lt;= $cols">
653 <td>
654 <xsl:choose>
655 <xsl:when test="$members[position()=$cell]">
656 <xsl:apply-templates select="$members[position()=$cell]"/>
657 </xsl:when>
658 <xsl:otherwise>
659 <xsl:text>&#160;</xsl:text>
660 </xsl:otherwise>
661 </xsl:choose>
662 </td>
663 <xsl:call-template name="simplelist.vert.row">
664 <xsl:with-param name="cols" select="$cols"/>
665 <xsl:with-param name="rows" select="$rows"/>
666 <xsl:with-param name="cell" select="$cell+$rows"/>
667 <xsl:with-param name="members" select="$members"/>
668 <xsl:with-param name="curcol" select="$curcol+1"/>
669 </xsl:call-template>
670 </xsl:if>
671 </xsl:template>
673 <xsl:template match="member">
674 <xsl:call-template name="anchor"/>
675 <xsl:call-template name="simple.xlink">
676 <xsl:with-param name="content">
677 <xsl:apply-templates/>
678 </xsl:with-param>
679 </xsl:call-template>
680 </xsl:template>
682 <!-- ==================================================================== -->
684 <xsl:template match="procedure">
685 <xsl:variable name="param.placement"
686 select="substring-after(normalize-space($formal.title.placement),
687 concat(local-name(.), ' '))"/>
689 <xsl:variable name="placement">
690 <xsl:choose>
691 <xsl:when test="contains($param.placement, ' ')">
692 <xsl:value-of select="substring-before($param.placement, ' ')"/>
693 </xsl:when>
694 <xsl:when test="$param.placement = ''">before</xsl:when>
695 <xsl:otherwise>
696 <xsl:value-of select="$param.placement"/>
697 </xsl:otherwise>
698 </xsl:choose>
699 </xsl:variable>
701 <!-- Preserve order of PIs and comments -->
702 <xsl:variable name="preamble"
703 select="*[not(self::step
704 or self::title
705 or self::titleabbrev)]
706 |comment()[not(preceding-sibling::step)]
707 |processing-instruction()[not(preceding-sibling::step)]"/>
709 <div>
710 <xsl:apply-templates select="." mode="class.attribute"/>
711 <xsl:call-template name="anchor">
712 <xsl:with-param name="conditional">
713 <xsl:choose>
714 <xsl:when test="title">0</xsl:when>
715 <xsl:otherwise>1</xsl:otherwise>
716 </xsl:choose>
717 </xsl:with-param>
718 </xsl:call-template>
720 <xsl:if test="title and $placement = 'before'">
721 <xsl:call-template name="formal.object.heading"/>
722 </xsl:if>
724 <xsl:apply-templates select="$preamble"/>
726 <xsl:choose>
727 <xsl:when test="count(step) = 1">
728 <ul>
729 <xsl:apply-templates
730 select="step
731 |comment()[preceding-sibling::step]
732 |processing-instruction()[preceding-sibling::step]"/>
733 </ul>
734 </xsl:when>
735 <xsl:otherwise>
736 <ol>
737 <xsl:attribute name="type">
738 <xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
739 </xsl:attribute>
740 <xsl:apply-templates
741 select="step
742 |comment()[preceding-sibling::step]
743 |processing-instruction()[preceding-sibling::step]"/>
744 </ol>
745 </xsl:otherwise>
746 </xsl:choose>
748 <xsl:if test="title and $placement != 'before'">
749 <xsl:call-template name="formal.object.heading"/>
750 </xsl:if>
751 </div>
752 </xsl:template>
754 <xsl:template match="procedure/title">
755 <!-- nop -->
756 </xsl:template>
758 <xsl:template match="substeps">
759 <xsl:variable name="numeration">
760 <xsl:call-template name="procedure.step.numeration"/>
761 </xsl:variable>
763 <xsl:call-template name="anchor"/>
765 <ol type="{$numeration}">
766 <xsl:apply-templates/>
767 </ol>
768 </xsl:template>
770 <xsl:template match="step">
771 <li>
772 <xsl:call-template name="anchor"/>
773 <xsl:apply-templates/>
774 </li>
775 </xsl:template>
777 <xsl:template match="stepalternatives">
778 <xsl:call-template name="anchor"/>
779 <ul>
780 <xsl:apply-templates/>
781 </ul>
782 </xsl:template>
784 <xsl:template match="step/title">
785 <p class="title">
787 <xsl:apply-templates/>
788 </b>
789 </p>
790 </xsl:template>
792 <!-- ==================================================================== -->
794 <xsl:template match="segmentedlist">
795 <xsl:variable name="presentation">
796 <xsl:call-template name="dbhtml-attribute">
797 <xsl:with-param name="pis"
798 select="processing-instruction('dbhtml')"/>
799 <xsl:with-param name="attribute" select="'list-presentation'"/>
800 </xsl:call-template>
801 </xsl:variable>
803 <div>
804 <xsl:apply-templates select="." mode="class.attribute"/>
805 <xsl:call-template name="anchor"/>
807 <xsl:choose>
808 <xsl:when test="$presentation = 'table'">
809 <xsl:apply-templates select="." mode="seglist-table"/>
810 </xsl:when>
811 <xsl:when test="$presentation = 'list'">
812 <xsl:apply-templates/>
813 </xsl:when>
814 <xsl:when test="$segmentedlist.as.table != 0">
815 <xsl:apply-templates select="." mode="seglist-table"/>
816 </xsl:when>
817 <xsl:otherwise>
818 <xsl:apply-templates/>
819 </xsl:otherwise>
820 </xsl:choose>
821 </div>
822 </xsl:template>
824 <xsl:template match="segmentedlist/title">
825 <div class="title">
826 <strong><span class="title"><xsl:apply-templates/></span></strong>
827 </div>
828 </xsl:template>
830 <xsl:template match="segtitle">
831 </xsl:template>
833 <xsl:template match="segtitle" mode="segtitle-in-seg">
834 <xsl:apply-templates/>
835 </xsl:template>
837 <xsl:template match="seglistitem">
838 <div class="seglistitem">
839 <xsl:call-template name="anchor"/>
840 <xsl:apply-templates/>
841 </div>
842 </xsl:template>
844 <xsl:template match="seg">
845 <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
846 <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
847 <xsl:variable name="segtitles" select="$seglist/segtitle"/>
849 <!--
850 Note: segtitle is only going to be the right thing in a well formed
851 SegmentedList. If there are too many Segs or too few SegTitles,
852 you'll get something odd...maybe an error
855 <div class="seg">
856 <strong>
857 <span class="segtitle">
858 <xsl:apply-templates select="$segtitles[$segnum=position()]"
859 mode="segtitle-in-seg"/>
860 <xsl:text>: </xsl:text>
861 </span>
862 </strong>
863 <xsl:apply-templates/>
864 </div>
865 </xsl:template>
867 <xsl:template match="segmentedlist" mode="seglist-table">
868 <xsl:variable name="table-summary">
869 <xsl:call-template name="dbhtml-attribute">
870 <xsl:with-param name="pis"
871 select="processing-instruction('dbhtml')"/>
872 <xsl:with-param name="attribute" select="'table-summary'"/>
873 </xsl:call-template>
874 </xsl:variable>
876 <xsl:variable name="list-width">
877 <xsl:call-template name="dbhtml-attribute">
878 <xsl:with-param name="pis"
879 select="processing-instruction('dbhtml')"/>
880 <xsl:with-param name="attribute" select="'list-width'"/>
881 </xsl:call-template>
882 </xsl:variable>
884 <xsl:apply-templates select="title"/>
886 <table border="0">
887 <xsl:if test="$list-width != ''">
888 <xsl:attribute name="width">
889 <xsl:value-of select="$list-width"/>
890 </xsl:attribute>
891 </xsl:if>
892 <xsl:if test="$table-summary != ''">
893 <xsl:attribute name="summary">
894 <xsl:value-of select="$table-summary"/>
895 </xsl:attribute>
896 </xsl:if>
897 <thead>
898 <tr class="segtitle">
899 <xsl:call-template name="tr.attributes">
900 <xsl:with-param name="row" select="segtitle[1]"/>
901 <xsl:with-param name="rownum" select="1"/>
902 </xsl:call-template>
903 <xsl:apply-templates select="segtitle" mode="seglist-table"/>
904 </tr>
905 </thead>
906 <tbody>
907 <xsl:apply-templates select="seglistitem" mode="seglist-table"/>
908 </tbody>
909 </table>
910 </xsl:template>
912 <xsl:template match="segtitle" mode="seglist-table">
913 <th><xsl:apply-templates/></th>
914 </xsl:template>
916 <xsl:template match="seglistitem" mode="seglist-table">
917 <xsl:variable name="seglinum">
918 <xsl:number from="segmentedlist" count="seglistitem"/>
919 </xsl:variable>
921 <tr class="seglistitem">
922 <xsl:call-template name="tr.attributes">
923 <xsl:with-param name="rownum" select="$seglinum + 1"/>
924 </xsl:call-template>
925 <xsl:apply-templates mode="seglist-table"/>
926 </tr>
927 </xsl:template>
929 <xsl:template match="seg" mode="seglist-table">
930 <td class="seg"><xsl:apply-templates/></td>
931 </xsl:template>
933 <xsl:template match="seg[1]" mode="seglist-table">
934 <td class="seg">
935 <xsl:call-template name="anchor">
936 <xsl:with-param name="node" select="ancestor::seglistitem"/>
937 </xsl:call-template>
938 <xsl:apply-templates/>
939 </td>
940 </xsl:template>
942 <!-- ==================================================================== -->
944 <xsl:template match="calloutlist">
945 <div>
946 <xsl:apply-templates select="." mode="class.attribute"/>
947 <xsl:call-template name="anchor"/>
948 <xsl:if test="title|info/title">
949 <xsl:call-template name="formal.object.heading"/>
950 </xsl:if>
952 <!-- Preserve order of PIs and comments -->
953 <xsl:apply-templates
954 select="*[not(self::callout or self::title or self::titleabbrev)]
955 |comment()[not(preceding-sibling::callout)]
956 |processing-instruction()[not(preceding-sibling::callout)]"/>
958 <xsl:choose>
959 <xsl:when test="$callout.list.table != 0">
960 <table border="0" summary="Callout list">
961 <xsl:apply-templates select="callout
962 |comment()[preceding-sibling::calllout]
963 |processing-instruction()[preceding-sibling::callout]"/>
964 </table>
965 </xsl:when>
966 <xsl:otherwise>
967 <dl compact="compact">
968 <xsl:apply-templates select="callout
969 |comment()[preceding-sibling::calllout]
970 |processing-instruction()[preceding-sibling::callout]"/>
971 </dl>
972 </xsl:otherwise>
973 </xsl:choose>
974 </div>
975 </xsl:template>
977 <xsl:template match="calloutlist/title">
978 </xsl:template>
980 <xsl:template match="callout">
981 <xsl:choose>
982 <xsl:when test="$callout.list.table != 0">
983 <tr>
984 <xsl:call-template name="tr.attributes">
985 <xsl:with-param name="rownum">
986 <xsl:number from="calloutlist" count="callout"/>
987 </xsl:with-param>
988 </xsl:call-template>
990 <td width="5%" valign="top" align="left">
991 <xsl:call-template name="anchor"/>
992 <xsl:call-template name="callout.arearefs">
993 <xsl:with-param name="arearefs" select="@arearefs"/>
994 </xsl:call-template>
995 </td>
996 <td valign="top" align="left">
997 <xsl:apply-templates/>
998 </td>
999 </tr>
1000 </xsl:when>
1001 <xsl:otherwise>
1002 <dt>
1003 <xsl:call-template name="anchor"/>
1004 <xsl:call-template name="callout.arearefs">
1005 <xsl:with-param name="arearefs" select="@arearefs"/>
1006 </xsl:call-template>
1007 </dt>
1008 <dd><xsl:apply-templates/></dd>
1009 </xsl:otherwise>
1010 </xsl:choose>
1011 </xsl:template>
1013 <xsl:template match="callout/simpara" priority="2">
1014 <!-- If a callout contains only a single simpara, don't output
1015 the <p> wrapper; this has the effect of creating an li
1016 with simple text content. -->
1017 <xsl:choose>
1018 <xsl:when test="not(preceding-sibling::*)
1019 and not (following-sibling::*)">
1020 <xsl:call-template name="anchor"/>
1021 <xsl:apply-templates/>
1022 </xsl:when>
1023 <xsl:otherwise>
1025 <xsl:if test="@role and $para.propagates.style != 0">
1026 <xsl:apply-templates select="." mode="class.attribute">
1027 <xsl:with-param name="class" select="@role"/>
1028 </xsl:apply-templates>
1029 </xsl:if>
1031 <xsl:call-template name="anchor"/>
1032 <xsl:apply-templates/>
1033 </p>
1034 </xsl:otherwise>
1035 </xsl:choose>
1036 </xsl:template>
1038 <xsl:template name="callout.arearefs">
1039 <xsl:param name="arearefs"></xsl:param>
1040 <xsl:if test="$arearefs!=''">
1041 <xsl:choose>
1042 <xsl:when test="substring-before($arearefs,' ')=''">
1043 <xsl:call-template name="callout.arearef">
1044 <xsl:with-param name="arearef" select="$arearefs"/>
1045 </xsl:call-template>
1046 </xsl:when>
1047 <xsl:otherwise>
1048 <xsl:call-template name="callout.arearef">
1049 <xsl:with-param name="arearef"
1050 select="substring-before($arearefs,' ')"/>
1051 </xsl:call-template>
1052 </xsl:otherwise>
1053 </xsl:choose>
1054 <xsl:call-template name="callout.arearefs">
1055 <xsl:with-param name="arearefs"
1056 select="substring-after($arearefs,' ')"/>
1057 </xsl:call-template>
1058 </xsl:if>
1059 </xsl:template>
1061 <xsl:template name="callout.arearef">
1062 <xsl:param name="arearef"></xsl:param>
1063 <xsl:variable name="targets" select="key('id',$arearef)"/>
1064 <xsl:variable name="target" select="$targets[1]"/>
1066 <xsl:call-template name="check.id.unique">
1067 <xsl:with-param name="linkend" select="$arearef"/>
1068 </xsl:call-template>
1070 <xsl:choose>
1071 <xsl:when test="count($target)=0">
1072 <xsl:text>???</xsl:text>
1073 </xsl:when>
1074 <xsl:when test="local-name($target)='co'">
1076 <xsl:attribute name="href">
1077 <xsl:text>#</xsl:text>
1078 <xsl:value-of select="$arearef"/>
1079 </xsl:attribute>
1080 <xsl:apply-templates select="$target" mode="callout-bug"/>
1081 </a>
1082 <xsl:text> </xsl:text>
1083 </xsl:when>
1084 <xsl:when test="local-name($target)='areaset'">
1085 <xsl:call-template name="callout-bug">
1086 <xsl:with-param name="conum">
1087 <xsl:apply-templates select="$target" mode="conumber"/>
1088 </xsl:with-param>
1089 </xsl:call-template>
1090 </xsl:when>
1091 <xsl:when test="local-name($target)='area'">
1092 <xsl:choose>
1093 <xsl:when test="$target/parent::areaset">
1094 <xsl:call-template name="callout-bug">
1095 <xsl:with-param name="conum">
1096 <xsl:apply-templates select="$target/parent::areaset"
1097 mode="conumber"/>
1098 </xsl:with-param>
1099 </xsl:call-template>
1100 </xsl:when>
1101 <xsl:otherwise>
1102 <xsl:call-template name="callout-bug">
1103 <xsl:with-param name="conum">
1104 <xsl:apply-templates select="$target" mode="conumber"/>
1105 </xsl:with-param>
1106 </xsl:call-template>
1107 </xsl:otherwise>
1108 </xsl:choose>
1109 </xsl:when>
1110 <xsl:otherwise>
1111 <xsl:text>???</xsl:text>
1112 </xsl:otherwise>
1113 </xsl:choose>
1114 </xsl:template>
1116 <!-- ==================================================================== -->
1118 </xsl:stylesheet>