source: trunk/Distribution/XSL/html/lists.xsl

Last change on this file was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

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