Debian Codegraph @

docbook-xsl-ns/xhtml/lists.xsl

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