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