source: clfs-embedded/BOOK/stylesheets/lfs-xsl/docbook-xsl-snapshot/xhtml/lists.xsl

Last change on this file was 00b1e11, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

Merged r8226 from new-xsl branch.

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