Project

General

Profile

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 8435 2009-05-11 08:14:54Z bobstayton $
7
     ********************************************************************
8

    
9
     This file is part of the XSL DocBook Stylesheet distribution.
10
     See ../README or http://docbook.sf.net/release/xsl/current/ for
11
     copyright and other information.
12

    
13
     ******************************************************************** -->
14

    
15
<!-- ==================================================================== -->
16

    
17
<xsl:template match="itemizedlist">
18
  <div>
19
    <xsl:call-template name="common.html.attributes"/>
20
    <xsl:call-template name="anchor"/>
21
    <xsl:if test="title">
22
      <xsl:call-template name="formal.object.heading"/>
23
    </xsl:if>
24

    
25
    <!-- Preserve order of PIs and comments -->
26
    <xsl:apply-templates 
27
        select="*[not(self::listitem
28
                  or self::title
29
                  or self::titleabbrev)]
30
                |comment()[not(preceding-sibling::listitem)]
31
                |processing-instruction()[not(preceding-sibling::listitem)]"/>
32

    
33
    <ul>
34
      <xsl:call-template name="generate.class.attribute"/>
35
      <xsl:if test="$css.decoration != 0">
36
        <xsl:attribute name="type">
37
          <xsl:call-template name="list.itemsymbol"/>
38
        </xsl:attribute>
39
      </xsl:if>
40

    
41
      <xsl:if test="@spacing='compact'">
42
        <xsl:attribute name="compact">
43
          <xsl:value-of select="@spacing"/>
44
        </xsl:attribute>
45
      </xsl:if>
46
      <xsl:apply-templates 
47
            select="listitem
48
                    |comment()[preceding-sibling::listitem]
49
                    |processing-instruction()[preceding-sibling::listitem]"/>
50
    </ul>
51
  </div>
52
</xsl:template>
53

    
54
<xsl:template match="itemizedlist/title">
55
  <!-- nop -->
56
</xsl:template>
57

    
58
<xsl:template match="itemizedlist/listitem">
59
  <xsl:variable name="mark" select="../@mark"/>
60
  <xsl:variable name="override" select="@override"/>
61

    
62
  <xsl:variable name="usemark">
63
    <xsl:choose>
64
      <xsl:when test="$override != ''">
65
        <xsl:value-of select="$override"/>
66
      </xsl:when>
67
      <xsl:otherwise>
68
        <xsl:value-of select="$mark"/>
69
      </xsl:otherwise>
70
    </xsl:choose>
71
  </xsl:variable>
72

    
73
  <xsl:variable name="cssmark">
74
    <xsl:choose>
75
      <xsl:when test="$usemark = 'opencircle'">circle</xsl:when>
76
      <xsl:when test="$usemark = 'bullet'">disc</xsl:when>
77
      <xsl:when test="$usemark = 'box'">square</xsl:when>
78
      <xsl:otherwise>
79
        <xsl:value-of select="$usemark"/>
80
      </xsl:otherwise>
81
    </xsl:choose>
82
  </xsl:variable>
83

    
84
  <li>
85
    <xsl:call-template name="common.html.attributes"/>
86
    <xsl:if test="$css.decoration = '1' and $cssmark != ''">
87
      <xsl:attribute name="style">
88
        <xsl:text>list-style-type: </xsl:text>
89
        <xsl:value-of select="$cssmark"/>
90
      </xsl:attribute>
91
    </xsl:if>
92

    
93
    <!-- we can't just drop the anchor in since some browsers (Opera)
94
         get confused about line breaks if we do. So if the first child
95
         is a para, assume the para will put in the anchor. Otherwise,
96
         put the anchor in anyway. -->
97
    <xsl:if test="local-name(child::*[1]) != 'para'">
98
      <xsl:call-template name="anchor"/>
99
    </xsl:if>
100

    
101
    <xsl:choose>
102
      <xsl:when test="$show.revisionflag != 0 and @revisionflag">
103
        <div class="{@revisionflag}">
104
          <xsl:apply-templates/>
105
        </div>
106
      </xsl:when>
107
      <xsl:otherwise>
108
        <xsl:apply-templates/>
109
      </xsl:otherwise>
110
    </xsl:choose>
111
  </li>
112
</xsl:template>
113

    
114
<xsl:template match="orderedlist">
115
  <xsl:variable name="start">
116
    <xsl:call-template name="orderedlist-starting-number"/>
117
  </xsl:variable>
118

    
119
  <xsl:variable name="numeration">
120
    <xsl:call-template name="list.numeration"/>
121
  </xsl:variable>
122

    
123
  <xsl:variable name="type">
124
    <xsl:choose>
125
      <xsl:when test="$numeration='arabic'">1</xsl:when>
126
      <xsl:when test="$numeration='loweralpha'">a</xsl:when>
127
      <xsl:when test="$numeration='lowerroman'">i</xsl:when>
128
      <xsl:when test="$numeration='upperalpha'">A</xsl:when>
129
      <xsl:when test="$numeration='upperroman'">I</xsl:when>
130
      <!-- What!? This should never happen -->
131
      <xsl:otherwise>
132
        <xsl:message>
133
          <xsl:text>Unexpected numeration: </xsl:text>
134
          <xsl:value-of select="$numeration"/>
135
        </xsl:message>
136
        <xsl:value-of select="1"/>
137
      </xsl:otherwise>
138
    </xsl:choose>
139
  </xsl:variable>
140

    
141
  <div>
142
    <xsl:call-template name="common.html.attributes"/>
143
    <xsl:call-template name="anchor"/>
144

    
145
    <xsl:if test="title">
146
      <xsl:call-template name="formal.object.heading"/>
147
    </xsl:if>
148

    
149
    <!-- Preserve order of PIs and comments -->
150
    <xsl:apply-templates 
151
        select="*[not(self::listitem
152
                  or self::title
153
                  or self::titleabbrev)]
154
                |comment()[not(preceding-sibling::listitem)]
155
                |processing-instruction()[not(preceding-sibling::listitem)]"/>
156

    
157
    <xsl:choose>
158
      <xsl:when test="@inheritnum='inherit' and ancestor::listitem[parent::orderedlist]">
159
        <table border="0">
160
          <xsl:call-template name="generate.class.attribute"/>
161
          <col align="{$direction.align.start}" valign="top"/>
162
          <tbody>
163
            <xsl:apply-templates 
164
                mode="orderedlist-table"
165
                select="listitem
166
                        |comment()[preceding-sibling::listitem]
167
                        |processing-instruction()[preceding-sibling::listitem]"/>
168
          </tbody>
169
        </table>
170
      </xsl:when>
171
      <xsl:otherwise>
172
        <ol>
173
          <xsl:call-template name="generate.class.attribute"/>
174
          <xsl:if test="$start != '1'">
175
            <xsl:attribute name="start">
176
              <xsl:value-of select="$start"/>
177
            </xsl:attribute>
178
          </xsl:if>
179
          <xsl:if test="$numeration != ''">
180
            <xsl:attribute name="type">
181
              <xsl:value-of select="$type"/>
182
            </xsl:attribute>
183
          </xsl:if>
184
          <xsl:if test="@spacing='compact'">
185
            <xsl:attribute name="compact">
186
              <xsl:value-of select="@spacing"/>
187
            </xsl:attribute>
188
          </xsl:if>
189
          <xsl:apply-templates 
190
                select="listitem
191
                        |comment()[preceding-sibling::listitem]
192
                        |processing-instruction()[preceding-sibling::listitem]"/>
193
        </ol>
194
      </xsl:otherwise>
195
    </xsl:choose>
196
  </div>
197
</xsl:template>
198

    
199
<xsl:template match="orderedlist/title">
200
  <!-- nop -->
201
</xsl:template>
202

    
203
<xsl:template match="orderedlist/listitem">
204
  <li>
205
    <xsl:call-template name="common.html.attributes"/>
206
    <xsl:if test="@override">
207
      <xsl:attribute name="value">
208
        <xsl:value-of select="@override"/>
209
      </xsl:attribute>
210
    </xsl:if>
211

    
212
    <!-- we can't just drop the anchor in since some browsers (Opera)
213
         get confused about line breaks if we do. So if the first child
214
         is a para, assume the para will put in the anchor. Otherwise,
215
         put the anchor in anyway. -->
216
    <xsl:if test="local-name(child::*[1]) != 'para'">
217
      <xsl:call-template name="anchor"/>
218
    </xsl:if>
219

    
220
    <xsl:choose>
221
      <xsl:when test="$show.revisionflag != 0 and @revisionflag">
222
        <div class="{@revisionflag}">
223
          <xsl:apply-templates/>
224
        </div>
225
      </xsl:when>
226
      <xsl:otherwise>
227
        <xsl:apply-templates/>
228
      </xsl:otherwise>
229
    </xsl:choose>
230
  </li>
231
</xsl:template>
232

    
233
<xsl:template match="orderedlist/listitem" mode="orderedlist-table">
234
  <tr>
235
    <td>
236
      <xsl:apply-templates select="." mode="item-number"/>
237
    </td>
238
    <td>
239
      <xsl:if test="local-name(child::*[1]) != 'para'">
240
        <xsl:call-template name="anchor"/>
241
      </xsl:if>
242

    
243
      <xsl:choose>
244
        <xsl:when test="$show.revisionflag != 0 and @revisionflag">
245
          <div class="{@revisionflag}">
246
            <xsl:apply-templates/>
247
          </div>
248
        </xsl:when>
249
        <xsl:otherwise>
250
          <xsl:apply-templates/>
251
        </xsl:otherwise>
252
      </xsl:choose>
253
    </td>
254
  </tr>
255
</xsl:template>
256

    
257
<xsl:template match="variablelist">
258
  <xsl:variable name="pi-presentation">
259
    <xsl:call-template name="pi.dbhtml_list-presentation"/>
260
  </xsl:variable>
261

    
262
  <xsl:variable name="presentation">
263
    <xsl:choose>
264
      <xsl:when test="$pi-presentation != ''">
265
        <xsl:value-of select="$pi-presentation"/>
266
      </xsl:when>
267
      <xsl:when test="$variablelist.as.table != 0">
268
        <xsl:value-of select="'table'"/>
269
      </xsl:when>
270
      <xsl:otherwise>
271
        <xsl:value-of select="'list'"/>
272
      </xsl:otherwise>
273
    </xsl:choose>
274
  </xsl:variable>
275

    
276
  <xsl:variable name="list-width">
277
    <xsl:call-template name="pi.dbhtml_list-width"/>
278
  </xsl:variable>
279

    
280
  <xsl:variable name="term-width">
281
    <xsl:call-template name="pi.dbhtml_term-width"/>
282
  </xsl:variable>
283

    
284
  <xsl:variable name="table-summary">
285
    <xsl:call-template name="pi.dbhtml_table-summary"/>
286
  </xsl:variable>
287

    
288
  <div>
289
    <xsl:call-template name="common.html.attributes"/>
290
    <xsl:call-template name="anchor"/>
291
    <xsl:if test="title">
292
      <xsl:call-template name="formal.object.heading"/>
293
    </xsl:if>
294

    
295
    <xsl:choose>
296
      <xsl:when test="$presentation = 'table'">
297
        <!-- Preserve order of PIs and comments -->
298
        <xsl:apply-templates 
299
          select="*[not(self::varlistentry
300
                    or self::title
301
                    or self::titleabbrev)]
302
                  |comment()[not(preceding-sibling::varlistentry)]
303
                  |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
304
        <table border="0">
305
          <xsl:if test="$list-width != ''">
306
            <xsl:attribute name="width">
307
              <xsl:value-of select="$list-width"/>
308
            </xsl:attribute>
309
          </xsl:if>
310
          <xsl:if test="$table-summary != ''">
311
            <xsl:attribute name="summary">
312
              <xsl:value-of select="$table-summary"/>
313
            </xsl:attribute>
314
          </xsl:if>
315
          <col align="{$direction.align.start}" valign="top">
316
            <xsl:if test="$term-width != ''">
317
              <xsl:attribute name="width">
318
                <xsl:value-of select="$term-width"/>
319
              </xsl:attribute>
320
            </xsl:if>
321
          </col>
322
          <tbody>
323
            <xsl:apply-templates mode="varlist-table"
324
              select="varlistentry
325
                      |comment()[preceding-sibling::varlistentry]
326
                      |processing-instruction()[preceding-sibling::varlistentry]"/>
327
          </tbody>
328
        </table>
329
      </xsl:when>
330
      <xsl:otherwise>
331
        <!-- Preserve order of PIs and comments -->
332
        <xsl:apply-templates 
333
          select="*[not(self::varlistentry
334
                    or self::title
335
                    or self::titleabbrev)]
336
                  |comment()[not(preceding-sibling::varlistentry)]
337
                  |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
338
        <dl>
339
          <xsl:apply-templates 
340
              select="varlistentry
341
                      |comment()[preceding-sibling::varlistentry]
342
                      |processing-instruction()[preceding-sibling::varlistentry]"/>
343
        </dl>
344
      </xsl:otherwise>
345
    </xsl:choose>
346
  </div>
347
</xsl:template>
348

    
349
<xsl:template match="variablelist/title">
350
  <!-- nop -->
351
</xsl:template>
352

    
353
<xsl:template match="itemizedlist/titleabbrev|orderedlist/titleabbrev">
354
  <!--nop-->
355
</xsl:template>
356

    
357
<xsl:template match="variablelist/titleabbrev">
358
  <!--nop-->
359
</xsl:template>
360

    
361
<xsl:template match="listitem" mode="xref">
362
  <xsl:number format="1"/>
363
</xsl:template>
364

    
365
<xsl:template match="listitem/simpara" priority="2">
366
  <!-- If a listitem contains only a single simpara, don't output
367
       the <p> wrapper; this has the effect of creating an li
368
       with simple text content. -->
369
  <xsl:choose>
370
    <xsl:when test="not(preceding-sibling::*)
371
                    and not (following-sibling::*)">
372
      <xsl:call-template name="anchor"/>
373
      <xsl:apply-templates/>
374
    </xsl:when>
375
    <xsl:otherwise>
376
      <p>
377
        <xsl:choose>
378
          <xsl:when test="@role and $para.propagates.style != 0">
379
            <xsl:call-template name="common.html.attributes">
380
              <xsl:with-param name="class" select="@role"/>
381
            </xsl:call-template>
382
          </xsl:when>
383
          <xsl:otherwise>
384
            <xsl:call-template name="common.html.attributes"/>
385
          </xsl:otherwise>
386
        </xsl:choose>
387

    
388
        <xsl:call-template name="anchor"/>
389
        <xsl:apply-templates/>
390
      </p>
391
    </xsl:otherwise>
392
  </xsl:choose>
393
</xsl:template>
394

    
395
<xsl:template match="varlistentry">
396
  <dt>
397
    <xsl:call-template name="anchor"/>
398
    <xsl:apply-templates select="term"/>
399
  </dt>
400
  <dd>
401
    <xsl:apply-templates select="listitem"/>
402
  </dd>
403
</xsl:template>
404

    
405
<xsl:template match="varlistentry" mode="varlist-table">
406
  <xsl:variable name="presentation">
407
    <xsl:call-template name="pi.dbhtml_term-presentation">
408
      <xsl:with-param name="node" select=".."/>
409
    </xsl:call-template>
410
  </xsl:variable>
411

    
412
  <xsl:variable name="separator">
413
    <xsl:call-template name="pi.dbhtml_term-separator">
414
      <xsl:with-param name="node" select=".."/>
415
    </xsl:call-template>
416
  </xsl:variable>
417
  <tr>
418
    <xsl:call-template name="tr.attributes">
419
      <xsl:with-param name="rownum">
420
        <xsl:number from="variablelist" count="varlistentry"/>
421
      </xsl:with-param>
422
    </xsl:call-template>
423

    
424
    <td>
425
      <p>
426
      <xsl:call-template name="anchor"/>
427
      <xsl:choose>
428
        <xsl:when test="$presentation = 'bold'">
429
          <b>
430
            <xsl:apply-templates select="term"/>
431
            <xsl:value-of select="$separator"/>
432
          </b>
433
        </xsl:when>
434
        <xsl:when test="$presentation = 'italic'">
435
          <i>
436
            <xsl:apply-templates select="term"/>
437
            <xsl:value-of select="$separator"/>
438
          </i>
439
        </xsl:when>
440
        <xsl:when test="$presentation = 'bold-italic'">
441
          <b>
442
            <i>
443
              <xsl:apply-templates select="term"/>
444
              <xsl:value-of select="$separator"/>
445
            </i>
446
          </b>
447
        </xsl:when>
448
        <xsl:otherwise>
449
          <xsl:apply-templates select="term"/>
450
          <xsl:value-of select="$separator"/>
451
        </xsl:otherwise>
452
      </xsl:choose>
453
      </p>
454
    </td>
455
    <td>
456
      <xsl:apply-templates select="listitem"/>
457
    </td>
458
  </tr>
459
</xsl:template>
460

    
461
<xsl:template match="varlistentry/term">
462
  <span>
463
    <xsl:call-template name="common.html.attributes"/>
464
    <xsl:call-template name="anchor"/>
465
    <xsl:call-template name="simple.xlink">
466
      <xsl:with-param name="content">
467
        <xsl:apply-templates/>
468
      </xsl:with-param>
469
    </xsl:call-template>
470
    <xsl:choose>
471
      <xsl:when test="position() = last()"/> <!-- do nothing -->
472
      <xsl:otherwise>
473
        <!-- * if we have multiple terms in the same varlistentry, generate -->
474
        <!-- * a separator (", " by default) and/or an additional line -->
475
        <!-- * break after each one except the last -->
476
        <xsl:value-of select="$variablelist.term.separator"/>
477
        <xsl:if test="not($variablelist.term.break.after = '0')">
478
          <br/>
479
        </xsl:if>
480
      </xsl:otherwise>
481
    </xsl:choose>
482
  </span>
483
</xsl:template>
484

    
485
<xsl:template match="varlistentry/listitem">
486
  <!-- we can't just drop the anchor in since some browsers (Opera)
487
       get confused about line breaks if we do. So if the first child
488
       is a para, assume the para will put in the anchor. Otherwise,
489
       put the anchor in anyway. -->
490
  <xsl:if test="local-name(child::*[1]) != 'para'">
491
    <xsl:call-template name="anchor"/>
492
  </xsl:if>
493

    
494
  <xsl:choose>
495
    <xsl:when test="$show.revisionflag != 0 and @revisionflag">
496
      <div class="{@revisionflag}">
497
        <xsl:apply-templates/>
498
      </div>
499
    </xsl:when>
500
    <xsl:otherwise>
501
      <xsl:apply-templates/>
502
    </xsl:otherwise>
503
  </xsl:choose>
504
</xsl:template>
505

    
506
<!-- ==================================================================== -->
507

    
508
<xsl:template match="simplelist">
509
  <!-- with no type specified, the default is 'vert' -->
510
  <xsl:call-template name="anchor"/>
511
  <table border="0" summary="Simple list">
512
    <xsl:call-template name="common.html.attributes"/>
513
    <xsl:call-template name="simplelist.vert">
514
      <xsl:with-param name="cols">
515
        <xsl:choose>
516
          <xsl:when test="@columns">
517
            <xsl:value-of select="@columns"/>
518
          </xsl:when>
519
          <xsl:otherwise>1</xsl:otherwise>
520
        </xsl:choose>
521
      </xsl:with-param>
522
    </xsl:call-template>
523
  </table>
524
</xsl:template>
525

    
526
<xsl:template match="simplelist[@type='inline']">
527
  <span>
528
    <xsl:call-template name="common.html.attributes"/>
529
    <!-- if dbchoice PI exists, use that to determine the choice separator -->
530
    <!-- (that is, equivalent of "and" or "or" in current locale), or literal -->
531
    <!-- value of "choice" otherwise -->
532
    <xsl:variable name="localized-choice-separator">
533
      <xsl:choose>
534
        <xsl:when test="processing-instruction('dbchoice')">
535
          <xsl:call-template name="select.choice.separator"/>
536
        </xsl:when>
537
        <xsl:otherwise>
538
          <!-- empty -->
539
        </xsl:otherwise>
540
      </xsl:choose>
541
    </xsl:variable>
542
  
543
    <xsl:for-each select="member">
544
      <xsl:call-template name="simple.xlink">
545
        <xsl:with-param name="content">
546
          <xsl:apply-templates/>
547
        </xsl:with-param>
548
      </xsl:call-template>
549
      <xsl:choose>
550
        <xsl:when test="position() = last()"/> <!-- do nothing -->
551
        <xsl:otherwise>
552
          <xsl:text>, </xsl:text>
553
          <xsl:if test="position() = last() - 1">
554
            <xsl:if test="$localized-choice-separator != ''">
555
              <xsl:value-of select="$localized-choice-separator"/>
556
              <xsl:text> </xsl:text>
557
            </xsl:if>
558
          </xsl:if>
559
        </xsl:otherwise>
560
      </xsl:choose>
561
    </xsl:for-each>
562
  </span>
563
</xsl:template>
564

    
565
<xsl:template match="simplelist[@type='horiz']">
566
  <xsl:call-template name="anchor"/>
567
  <table border="0" summary="Simple list">
568
    <xsl:call-template name="common.html.attributes"/>
569
    <xsl:call-template name="simplelist.horiz">
570
      <xsl:with-param name="cols">
571
        <xsl:choose>
572
          <xsl:when test="@columns">
573
            <xsl:value-of select="@columns"/>
574
          </xsl:when>
575
          <xsl:otherwise>1</xsl:otherwise>
576
        </xsl:choose>
577
      </xsl:with-param>
578
    </xsl:call-template>
579
  </table>
580
</xsl:template>
581

    
582
<xsl:template match="simplelist[@type='vert']">
583
  <xsl:call-template name="anchor"/>
584
  <table border="0" summary="Simple list">
585
    <xsl:call-template name="common.html.attributes"/>
586
    <xsl:call-template name="simplelist.vert">
587
      <xsl:with-param name="cols">
588
        <xsl:choose>
589
          <xsl:when test="@columns">
590
            <xsl:value-of select="@columns"/>
591
          </xsl:when>
592
          <xsl:otherwise>1</xsl:otherwise>
593
        </xsl:choose>
594
      </xsl:with-param>
595
    </xsl:call-template>
596
  </table>
597
</xsl:template>
598

    
599
<xsl:template name="simplelist.horiz">
600
  <xsl:param name="cols">1</xsl:param>
601
  <xsl:param name="cell">1</xsl:param>
602
  <xsl:param name="members" select="./member"/>
603

    
604
  <xsl:if test="$cell &lt;= count($members)">
605
    <tr>
606
      <xsl:call-template name="tr.attributes">
607
        <xsl:with-param name="row" select="$members[1]"/>
608
        <xsl:with-param name="rownum" select="(($cell - 1) div $cols) + 1"/>
609
      </xsl:call-template>
610

    
611
      <xsl:call-template name="simplelist.horiz.row">
612
        <xsl:with-param name="cols" select="$cols"/>
613
        <xsl:with-param name="cell" select="$cell"/>
614
        <xsl:with-param name="members" select="$members"/>
615
      </xsl:call-template>
616
   </tr>
617
    <xsl:call-template name="simplelist.horiz">
618
      <xsl:with-param name="cols" select="$cols"/>
619
      <xsl:with-param name="cell" select="$cell + $cols"/>
620
      <xsl:with-param name="members" select="$members"/>
621
    </xsl:call-template>
622
  </xsl:if>
623
</xsl:template>
624

    
625
<xsl:template name="simplelist.horiz.row">
626
  <xsl:param name="cols">1</xsl:param>
627
  <xsl:param name="cell">1</xsl:param>
628
  <xsl:param name="members" select="./member"/>
629
  <xsl:param name="curcol">1</xsl:param>
630

    
631
  <xsl:if test="$curcol &lt;= $cols">
632
    <td>
633
      <xsl:choose>
634
        <xsl:when test="$members[position()=$cell]">
635
          <xsl:apply-templates select="$members[position()=$cell]"/>
636
        </xsl:when>
637
        <xsl:otherwise>
638
          <xsl:text>&#160;</xsl:text>
639
        </xsl:otherwise>
640
      </xsl:choose>
641
    </td>
642
    <xsl:call-template name="simplelist.horiz.row">
643
      <xsl:with-param name="cols" select="$cols"/>
644
      <xsl:with-param name="cell" select="$cell+1"/>
645
      <xsl:with-param name="members" select="$members"/>
646
      <xsl:with-param name="curcol" select="$curcol+1"/>
647
    </xsl:call-template>
648
  </xsl:if>
649
</xsl:template>
650

    
651
<xsl:template name="simplelist.vert">
652
  <xsl:param name="cols">1</xsl:param>
653
  <xsl:param name="cell">1</xsl:param>
654
  <xsl:param name="members" select="./member"/>
655
  <xsl:param name="rows"
656
             select="floor((count($members)+$cols - 1) div $cols)"/>
657

    
658
  <xsl:if test="$cell &lt;= $rows">
659
    <tr>
660
      <xsl:call-template name="tr.attributes">
661
        <xsl:with-param name="row" select="$members[1]"/>
662
        <xsl:with-param name="rownum" select="$cell"/>
663
      </xsl:call-template>
664

    
665
      <xsl:call-template name="simplelist.vert.row">
666
        <xsl:with-param name="cols" select="$cols"/>
667
        <xsl:with-param name="rows" select="$rows"/>
668
        <xsl:with-param name="cell" select="$cell"/>
669
        <xsl:with-param name="members" select="$members"/>
670
      </xsl:call-template>
671
    </tr>
672
    <xsl:call-template name="simplelist.vert">
673
      <xsl:with-param name="cols" select="$cols"/>
674
      <xsl:with-param name="cell" select="$cell+1"/>
675
      <xsl:with-param name="members" select="$members"/>
676
      <xsl:with-param name="rows" select="$rows"/>
677
    </xsl:call-template>
678
  </xsl:if>
679
</xsl:template>
680

    
681
<xsl:template name="simplelist.vert.row">
682
  <xsl:param name="cols">1</xsl:param>
683
  <xsl:param name="rows">1</xsl:param>
684
  <xsl:param name="cell">1</xsl:param>
685
  <xsl:param name="members" select="./member"/>
686
  <xsl:param name="curcol">1</xsl:param>
687

    
688
  <xsl:if test="$curcol &lt;= $cols">
689
    <td>
690
      <xsl:choose>
691
        <xsl:when test="$members[position()=$cell]">
692
          <xsl:apply-templates select="$members[position()=$cell]"/>
693
        </xsl:when>
694
        <xsl:otherwise>
695
          <xsl:text>&#160;</xsl:text>
696
        </xsl:otherwise>
697
      </xsl:choose>
698
    </td>
699
    <xsl:call-template name="simplelist.vert.row">
700
      <xsl:with-param name="cols" select="$cols"/>
701
      <xsl:with-param name="rows" select="$rows"/>
702
      <xsl:with-param name="cell" select="$cell+$rows"/>
703
      <xsl:with-param name="members" select="$members"/>
704
      <xsl:with-param name="curcol" select="$curcol+1"/>
705
    </xsl:call-template>
706
  </xsl:if>
707
</xsl:template>
708

    
709
<xsl:template match="member">
710
  <xsl:call-template name="anchor"/>
711
  <xsl:call-template name="simple.xlink">
712
    <xsl:with-param name="content">
713
      <xsl:apply-templates/>
714
    </xsl:with-param>
715
  </xsl:call-template>
716
</xsl:template>
717

    
718
<!-- ==================================================================== -->
719

    
720
<xsl:template match="procedure">
721
  <xsl:variable name="param.placement"
722
                select="substring-after(normalize-space($formal.title.placement),
723
                                        concat(local-name(.), ' '))"/>
724

    
725
  <xsl:variable name="placement">
726
    <xsl:choose>
727
      <xsl:when test="contains($param.placement, ' ')">
728
        <xsl:value-of select="substring-before($param.placement, ' ')"/>
729
      </xsl:when>
730
      <xsl:when test="$param.placement = ''">before</xsl:when>
731
      <xsl:otherwise>
732
        <xsl:value-of select="$param.placement"/>
733
      </xsl:otherwise>
734
    </xsl:choose>
735
  </xsl:variable>
736

    
737
  <!-- Preserve order of PIs and comments -->
738
  <xsl:variable name="preamble"
739
        select="*[not(self::step
740
                  or self::title
741
                  or self::titleabbrev)]
742
                |comment()[not(preceding-sibling::step)]
743
                |processing-instruction()[not(preceding-sibling::step)]"/>
744

    
745
  <div>
746
    <xsl:call-template name="common.html.attributes"/>
747
    <xsl:call-template name="anchor">
748
      <xsl:with-param name="conditional">
749
        <xsl:choose>
750
          <xsl:when test="title">0</xsl:when>
751
          <xsl:otherwise>1</xsl:otherwise>
752
        </xsl:choose>
753
      </xsl:with-param>
754
    </xsl:call-template>
755

    
756
    <xsl:if test="title and $placement = 'before'">
757
      <xsl:call-template name="formal.object.heading"/>
758
    </xsl:if>
759

    
760
    <xsl:apply-templates select="$preamble"/>
761

    
762
    <xsl:choose>
763
      <xsl:when test="count(step) = 1">
764
        <ul>
765
          <xsl:call-template name="generate.class.attribute"/>
766
          <xsl:apply-templates 
767
            select="step
768
                    |comment()[preceding-sibling::step]
769
                    |processing-instruction()[preceding-sibling::step]"/>
770
        </ul>
771
      </xsl:when>
772
      <xsl:otherwise>
773
        <ol>
774
          <xsl:call-template name="generate.class.attribute"/>
775
          <xsl:attribute name="type">
776
            <xsl:value-of select="substring($procedure.step.numeration.formats,1,1)"/>
777
          </xsl:attribute>
778
          <xsl:apply-templates 
779
            select="step
780
                    |comment()[preceding-sibling::step]
781
                    |processing-instruction()[preceding-sibling::step]"/>
782
        </ol>
783
      </xsl:otherwise>
784
    </xsl:choose>
785

    
786
    <xsl:if test="title and $placement != 'before'">
787
      <xsl:call-template name="formal.object.heading"/>
788
    </xsl:if>
789
  </div>
790
</xsl:template>
791

    
792
<xsl:template match="procedure/title">
793
  <!-- nop -->
794
</xsl:template>
795

    
796
<xsl:template match="substeps">
797
  <xsl:variable name="numeration">
798
    <xsl:call-template name="procedure.step.numeration"/>
799
  </xsl:variable>
800

    
801
  <xsl:call-template name="anchor"/>
802

    
803
  <ol type="{$numeration}">
804
    <xsl:call-template name="common.html.attributes"/>
805
    <xsl:apply-templates/>
806
  </ol>
807
</xsl:template>
808

    
809
<xsl:template match="step">
810
  <li>
811
    <xsl:call-template name="common.html.attributes"/>
812
    <xsl:call-template name="anchor"/>
813
    <xsl:apply-templates/>
814
  </li>
815
</xsl:template>
816

    
817
<xsl:template match="stepalternatives">
818
  <xsl:call-template name="anchor"/>
819
  <ul>
820
    <xsl:call-template name="common.html.attributes"/>
821
    <xsl:apply-templates/>
822
  </ul>
823
</xsl:template>
824

    
825
<xsl:template match="step/title">
826
  <p>
827
    <xsl:call-template name="common.html.attributes"/>
828
    <b>
829
      <xsl:apply-templates/>
830
    </b>
831
  </p>
832
</xsl:template>
833

    
834
<!-- ==================================================================== -->
835

    
836
<xsl:template match="segmentedlist">
837
  <xsl:variable name="presentation">
838
    <xsl:call-template name="pi.dbhtml_list-presentation"/>
839
  </xsl:variable>
840

    
841
  <div>
842
    <xsl:call-template name="common.html.attributes"/>
843
    <xsl:call-template name="anchor"/>
844

    
845
    <xsl:choose>
846
      <xsl:when test="$presentation = 'table'">
847
        <xsl:apply-templates select="." mode="seglist-table"/>
848
      </xsl:when>
849
      <xsl:when test="$presentation = 'list'">
850
        <xsl:apply-templates/>
851
      </xsl:when>
852
      <xsl:when test="$segmentedlist.as.table != 0">
853
        <xsl:apply-templates select="." mode="seglist-table"/>
854
      </xsl:when>
855
      <xsl:otherwise>
856
        <xsl:apply-templates/>
857
      </xsl:otherwise>
858
    </xsl:choose>
859
  </div>
860
</xsl:template>
861

    
862
<xsl:template match="segmentedlist/title">
863
  <div>
864
    <xsl:call-template name="common.html.attributes"/>
865
    <strong>
866
      <span>
867
        <xsl:call-template name="generate.class.attribute"/>
868
        <xsl:apply-templates/>
869
      </span>
870
    </strong>
871
  </div>
872
</xsl:template>
873

    
874
<xsl:template match="segtitle">
875
</xsl:template>
876

    
877
<xsl:template match="segtitle" mode="segtitle-in-seg">
878
  <xsl:apply-templates/>
879
</xsl:template>
880

    
881
<xsl:template match="seglistitem">
882
  <div>
883
    <xsl:call-template name="common.html.attributes"/>
884
    <xsl:call-template name="anchor"/>
885
    <xsl:apply-templates/>
886
  </div>
887
</xsl:template>
888

    
889
<xsl:template match="seg">
890
  <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
891
  <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
892
  <xsl:variable name="segtitles" select="$seglist/segtitle"/>
893

    
894
  <!--
895
     Note: segtitle is only going to be the right thing in a well formed
896
     SegmentedList.  If there are too many Segs or too few SegTitles,
897
     you'll get something odd...maybe an error
898
  -->
899

    
900
  <div>
901
    <xsl:call-template name="common.html.attributes"/>
902
    <strong>
903
      <span class="segtitle">
904
        <xsl:apply-templates select="$segtitles[$segnum=position()]"
905
                             mode="segtitle-in-seg"/>
906
        <xsl:text>: </xsl:text>
907
      </span>
908
    </strong>
909
    <xsl:apply-templates/>
910
  </div>
911
</xsl:template>
912

    
913
<xsl:template match="segmentedlist" mode="seglist-table">
914
  <xsl:variable name="table-summary">
915
    <xsl:call-template name="pi.dbhtml_table-summary"/>
916
  </xsl:variable>
917

    
918
  <xsl:variable name="list-width">
919
    <xsl:call-template name="pi.dbhtml_list-width"/>
920
  </xsl:variable>
921

    
922
  <xsl:apply-templates select="title"/>
923

    
924
  <table border="0">
925
    <xsl:if test="$list-width != ''">
926
      <xsl:attribute name="width">
927
        <xsl:value-of select="$list-width"/>
928
      </xsl:attribute>
929
    </xsl:if>
930
    <xsl:if test="$table-summary != ''">
931
      <xsl:attribute name="summary">
932
        <xsl:value-of select="$table-summary"/>
933
      </xsl:attribute>
934
    </xsl:if>
935
    <thead>
936
      <tr class="segtitle">
937
        <xsl:call-template name="tr.attributes">
938
          <xsl:with-param name="row" select="segtitle[1]"/>
939
          <xsl:with-param name="rownum" select="1"/>
940
        </xsl:call-template>
941
        <xsl:apply-templates select="segtitle" mode="seglist-table"/>
942
      </tr>
943
    </thead>
944
    <tbody>
945
      <xsl:apply-templates select="seglistitem" mode="seglist-table"/>
946
    </tbody>
947
  </table>
948
</xsl:template>
949

    
950
<xsl:template match="segtitle" mode="seglist-table">
951
  <th><xsl:apply-templates/></th>
952
</xsl:template>
953

    
954
<xsl:template match="seglistitem" mode="seglist-table">
955
  <xsl:variable name="seglinum">
956
    <xsl:number from="segmentedlist" count="seglistitem"/>
957
  </xsl:variable>
958

    
959
  <tr>
960
    <xsl:call-template name="common.html.attributes"/>
961
    <xsl:call-template name="tr.attributes">
962
      <xsl:with-param name="rownum" select="$seglinum + 1"/>
963
    </xsl:call-template>
964
    <xsl:apply-templates mode="seglist-table"/>
965
  </tr>
966
</xsl:template>
967

    
968
<xsl:template match="seg" mode="seglist-table">
969
  <td>
970
    <xsl:call-template name="common.html.attributes"/>
971
    <xsl:apply-templates/>
972
  </td>
973
</xsl:template>
974

    
975
<xsl:template match="seg[1]" mode="seglist-table">
976
  <td>
977
    <xsl:call-template name="common.html.attributes"/>
978
    <xsl:call-template name="anchor">
979
      <xsl:with-param name="node" select="ancestor::seglistitem"/>
980
    </xsl:call-template>
981
    <xsl:apply-templates/>
982
  </td>
983
</xsl:template>
984

    
985
<!-- ==================================================================== -->
986

    
987
<xsl:template match="calloutlist">
988
  <div>
989
    <xsl:call-template name="common.html.attributes"/>
990
    <xsl:call-template name="anchor"/>
991
    <xsl:if test="title|info/title">
992
      <xsl:call-template name="formal.object.heading"/>
993
    </xsl:if>
994

    
995
    <!-- Preserve order of PIs and comments -->
996
    <xsl:apply-templates 
997
         select="*[not(self::callout or self::title or self::titleabbrev)]
998
                   |comment()[not(preceding-sibling::callout)]
999
                   |processing-instruction()[not(preceding-sibling::callout)]"/>
1000

    
1001
    <xsl:choose>
1002
      <xsl:when test="$callout.list.table != 0">
1003
        <table border="0" summary="Callout list">
1004
          <xsl:apply-templates select="callout
1005
                                |comment()[preceding-sibling::callout]
1006
                                |processing-instruction()[preceding-sibling::callout]"/>
1007
        </table>
1008
      </xsl:when>
1009
      <xsl:otherwise>
1010
        <dl compact="compact">
1011
          <xsl:apply-templates select="callout
1012
                                |comment()[preceding-sibling::callout]
1013
                                |processing-instruction()[preceding-sibling::callout]"/>
1014
        </dl>
1015
      </xsl:otherwise>
1016
    </xsl:choose>
1017
  </div>
1018
</xsl:template>
1019

    
1020
<xsl:template match="calloutlist/title">
1021
</xsl:template>
1022

    
1023
<xsl:template match="callout">
1024
  <xsl:choose>
1025
    <xsl:when test="$callout.list.table != 0">
1026
      <tr>
1027
        <xsl:call-template name="tr.attributes">
1028
          <xsl:with-param name="rownum">
1029
            <xsl:number from="calloutlist" count="callout"/>
1030
          </xsl:with-param>
1031
        </xsl:call-template>
1032

    
1033
        <td width="5%" valign="top" align="{$direction.align.start}">
1034
          <p>
1035
            <xsl:call-template name="anchor"/>
1036
            <xsl:call-template name="callout.arearefs">
1037
              <xsl:with-param name="arearefs" select="@arearefs"/>
1038
            </xsl:call-template>
1039
          </p>
1040
        </td>
1041
        <td valign="top" align="{$direction.align.start}">
1042
          <xsl:apply-templates/>
1043
        </td>
1044
      </tr>
1045
    </xsl:when>
1046
    <xsl:otherwise>
1047
      <dt>
1048
        <xsl:call-template name="anchor"/>
1049
        <xsl:call-template name="callout.arearefs">
1050
          <xsl:with-param name="arearefs" select="@arearefs"/>
1051
        </xsl:call-template>
1052
      </dt>
1053
      <dd><xsl:apply-templates/></dd>
1054
    </xsl:otherwise>
1055
  </xsl:choose>
1056
</xsl:template>
1057

    
1058
<xsl:template match="callout/simpara" priority="2">
1059
  <!-- If a callout contains only a single simpara, don't output
1060
       the <p> wrapper; this has the effect of creating an li
1061
       with simple text content. -->
1062
  <xsl:choose>
1063
    <xsl:when test="not(preceding-sibling::*)
1064
                    and not (following-sibling::*)">
1065
      <xsl:call-template name="anchor"/>
1066
      <xsl:apply-templates/>
1067
    </xsl:when>
1068
    <xsl:otherwise>
1069
      <p>
1070
        <xsl:if test="@role and $para.propagates.style != 0">
1071
          <xsl:choose>
1072
            <xsl:when test="@role and $para.propagates.style != 0">
1073
              <xsl:call-template name="common.html.attributes">
1074
                <xsl:with-param name="class" select="@role"/>
1075
              </xsl:call-template>
1076
            </xsl:when>
1077
            <xsl:otherwise>
1078
              <xsl:call-template name="common.html.attributes"/>
1079
            </xsl:otherwise>
1080
          </xsl:choose>
1081
        </xsl:if>
1082

    
1083
        <xsl:call-template name="anchor"/>
1084
        <xsl:apply-templates/>
1085
      </p>
1086
    </xsl:otherwise>
1087
  </xsl:choose>
1088
</xsl:template>
1089

    
1090
<xsl:template name="callout.arearefs">
1091
  <xsl:param name="arearefs"></xsl:param>
1092
  <xsl:if test="$arearefs!=''">
1093
    <xsl:choose>
1094
      <xsl:when test="substring-before($arearefs,' ')=''">
1095
        <xsl:call-template name="callout.arearef">
1096
          <xsl:with-param name="arearef" select="$arearefs"/>
1097
        </xsl:call-template>
1098
      </xsl:when>
1099
      <xsl:otherwise>
1100
        <xsl:call-template name="callout.arearef">
1101
          <xsl:with-param name="arearef"
1102
                          select="substring-before($arearefs,' ')"/>
1103
        </xsl:call-template>
1104
      </xsl:otherwise>
1105
    </xsl:choose>
1106
    <xsl:call-template name="callout.arearefs">
1107
      <xsl:with-param name="arearefs"
1108
                      select="substring-after($arearefs,' ')"/>
1109
    </xsl:call-template>
1110
  </xsl:if>
1111
</xsl:template>
1112

    
1113
<xsl:template name="callout.arearef">
1114
  <xsl:param name="arearef"></xsl:param>
1115
  <xsl:variable name="targets" select="key('id',$arearef)"/>
1116
  <xsl:variable name="target" select="$targets[1]"/>
1117

    
1118
  <xsl:call-template name="check.id.unique">
1119
    <xsl:with-param name="linkend" select="$arearef"/>
1120
  </xsl:call-template>
1121

    
1122
  <xsl:choose>
1123
    <xsl:when test="count($target)=0">
1124
      <xsl:text>???</xsl:text>
1125
    </xsl:when>
1126
    <xsl:when test="local-name($target)='co'">
1127
      <a>
1128
        <xsl:attribute name="href">
1129
          <xsl:text>#</xsl:text>
1130
          <xsl:value-of select="$arearef"/>
1131
        </xsl:attribute>
1132
        <xsl:apply-templates select="$target" mode="callout-bug"/>
1133
      </a>
1134
      <xsl:text> </xsl:text>
1135
    </xsl:when>
1136
    <xsl:when test="local-name($target)='areaset'">
1137
      <xsl:call-template name="callout-bug">
1138
        <xsl:with-param name="conum">
1139
          <xsl:apply-templates select="$target" mode="conumber"/>
1140
        </xsl:with-param>
1141
      </xsl:call-template>
1142
    </xsl:when>
1143
    <xsl:when test="local-name($target)='area'">
1144
      <xsl:choose>
1145
        <xsl:when test="$target/parent::areaset">
1146
          <xsl:call-template name="callout-bug">
1147
            <xsl:with-param name="conum">
1148
              <xsl:apply-templates select="$target/parent::areaset"
1149
                                   mode="conumber"/>
1150
            </xsl:with-param>
1151
          </xsl:call-template>
1152
        </xsl:when>
1153
        <xsl:otherwise>
1154
          <xsl:call-template name="callout-bug">
1155
            <xsl:with-param name="conum">
1156
              <xsl:apply-templates select="$target" mode="conumber"/>
1157
            </xsl:with-param>
1158
          </xsl:call-template>
1159
        </xsl:otherwise>
1160
      </xsl:choose>
1161
    </xsl:when>
1162
    <xsl:otherwise>
1163
      <xsl:text>???</xsl:text>
1164
    </xsl:otherwise>
1165
  </xsl:choose>
1166
</xsl:template>
1167

    
1168
<!-- ==================================================================== -->
1169

    
1170
<xsl:template name="orderedlist-starting-number">
1171
  <xsl:param name="list" select="."/>
1172
  <xsl:variable name="pi-start">
1173
    <xsl:call-template name="pi.dbhtml_start">
1174
      <xsl:with-param name="node" select="$list"/>
1175
    </xsl:call-template>
1176
  </xsl:variable>
1177
  <xsl:call-template name="output-orderedlist-starting-number">
1178
    <xsl:with-param name="list" select="$list"/>
1179
    <xsl:with-param name="pi-start" select="$pi-start"/>
1180
  </xsl:call-template>
1181
</xsl:template>
1182

    
1183
</xsl:stylesheet>
(25-25/39)