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