]> git.stg.codes - stg.git/blob - doc/xslt/manpages/lists.xsl
Set output encoding to utf-8.
[stg.git] / doc / xslt / manpages / lists.xsl
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                 version='1.0'>
4
5 <!-- ********************************************************************
6      $Id: lists.xsl 8530 2009-11-02 02:38:47Z dleidert $
7      ********************************************************************
8
9      This file is part of the XSL DocBook Stylesheet distribution.
10      See ../README or http://docbook.sf.net/release/xsl/current/ for
11      copyright and other information.
12
13      ******************************************************************** -->
14
15 <xsl:variable name="list-indent">
16   <xsl:choose>
17     <xsl:when test="not($man.indent.lists = 0)">
18       <xsl:value-of select="$man.indent.width"/>
19     </xsl:when>
20     <xsl:when test="not($man.indent.refsect = 0)">
21       <!-- * "zq" is the name of a register we set for -->
22       <!-- * preserving the original default indent value -->
23       <!-- * when $man.indent.refsect is non-zero; -->
24       <!-- * "u" is a roff unit specifier -->
25       <xsl:text>\n(zqu</xsl:text>
26     </xsl:when>
27     <xsl:otherwise/> <!-- * otherwise, just leave it empty -->
28   </xsl:choose>
29 </xsl:variable>
30
31 <!-- ================================================================== -->
32
33 <xsl:template match="para[ancestor::listitem or ancestor::step or ancestor::glossdef]|
34   simpara[ancestor::listitem or ancestor::step or ancestor::glossdef]|
35   remark[ancestor::listitem or ancestor::step or ancestor::glossdef]">
36   <xsl:call-template name="mixed-block"/>
37   <xsl:text>&#10;</xsl:text>
38   <xsl:if test="following-sibling::*[1][
39     self::para or
40     self::simpara or
41     self::remark
42     ]">
43     <!-- * Make sure multiple paragraphs within a list item don't -->
44     <!-- * merge together.                                        -->
45     <xsl:text>.sp&#10;</xsl:text>
46   </xsl:if>
47 </xsl:template>
48
49 <xsl:template match="bibliolist">
50   <xsl:apply-templates/>
51   <xsl:text>&#10;</xsl:text>
52 </xsl:template>
53
54 <xsl:template match="variablelist|glosslist">
55   <xsl:if test="title">
56     <xsl:text>.PP&#10;</xsl:text>
57     <xsl:call-template name="bold">
58       <xsl:with-param name="node" select="title"/>
59       <xsl:with-param name="context" select="."/>
60     </xsl:call-template>
61     <xsl:text>&#10;</xsl:text>
62   </xsl:if>
63   <xsl:apply-templates/>
64 </xsl:template>
65
66 <xsl:template match="varlistentry|glossentry">
67   <xsl:text>.PP&#10;</xsl:text> 
68   <xsl:for-each select="term|glossterm">
69     <xsl:variable name="content">
70       <xsl:apply-templates/>
71     </xsl:variable>
72     <xsl:value-of select="normalize-space($content)"/>
73     <xsl:choose>
74       <xsl:when test="position() = last()"/> <!-- do nothing -->
75       <xsl:otherwise>
76         <!-- * if we have multiple terms in the same varlistentry, generate -->
77         <!-- * a separator (", " by default) and/or an additional line -->
78         <!-- * break after each one except the last -->
79         <!-- * -->
80         <!-- * note that it is not valid to have multiple glossterms -->
81         <!-- * within a glossentry, so this logic never gets exercised -->
82         <!-- * for glossterms (every glossterm is always the last in -->
83         <!-- * its parent glossentry) -->
84         <xsl:value-of select="$variablelist.term.separator"/>
85         <xsl:if test="not($variablelist.term.break.after = '0')">
86           <xsl:text>&#10;</xsl:text>
87           <xsl:text>.br&#10;</xsl:text>
88         </xsl:if>
89       </xsl:otherwise>
90     </xsl:choose>
91   </xsl:for-each>
92   <xsl:text>&#10;</xsl:text>
93   <xsl:text>.RS</xsl:text> 
94   <xsl:if test="not($list-indent = '')">
95     <xsl:text> </xsl:text>
96     <xsl:value-of select="$list-indent"/>
97   </xsl:if>
98   <xsl:text>&#10;</xsl:text>
99   <xsl:apply-templates/>
100   <xsl:text>.RE&#10;</xsl:text>
101 </xsl:template>
102
103 <xsl:template match="varlistentry/term"/>
104 <xsl:template match="glossentry/glossterm"/>
105
106 <xsl:template match="variablelist[ancestor::listitem or ancestor::step or ancestor::glossdef]|
107   glosslist[ancestor::listitem or ancestor::step or ancestor::glossdef]">
108   <xsl:apply-templates/>
109   <xsl:if test="following-sibling::node() or
110     parent::para[following-sibling::node()] or
111     parent::simpara[following-sibling::node()] or
112     parent::remark[following-sibling::node()]">
113     <xsl:text>.sp</xsl:text> 
114     <xsl:text>&#10;</xsl:text>
115   </xsl:if>
116 </xsl:template>
117
118 <xsl:template match="varlistentry/listitem|glossentry/glossdef">
119   <xsl:apply-templates/>
120 </xsl:template>
121
122 <xsl:template match="itemizedlist/listitem">
123   <!-- * We output a real bullet here (rather than, "\(bu", -->
124   <!-- * the roff bullet) because, when we do character-map -->
125   <!-- * processing before final output, the character-map will -->
126   <!-- * handle conversion of the &#x2022; to "\(bu" for us -->
127   <xsl:text>&#10;</xsl:text>
128   <xsl:text>.sp</xsl:text>
129   <xsl:text>&#10;</xsl:text>
130   <xsl:text>.RS</xsl:text>
131   <xsl:if test="not($list-indent = '')">
132     <xsl:text> </xsl:text>
133     <xsl:value-of select="$list-indent"/>
134   </xsl:if>
135   <xsl:text>&#10;</xsl:text>
136   <!-- * if "n" then we are using "nroff", which means the output is for -->
137   <!-- * TTY; so we do some fixed-width-font hackery with \h to make a -->
138   <!-- * hanging indent (instead of using .IP, which has some -->
139   <!-- * undesirable side effects under certain circumstances) -->
140   <xsl:call-template name="roff-if-else-start"/>
141   <xsl:text>\h'-</xsl:text>
142   <xsl:choose>
143     <xsl:when test="not($list-indent = '')">
144       <xsl:text>0</xsl:text>
145       <xsl:value-of select="$list-indent"/>
146     </xsl:when>
147     <xsl:otherwise>
148       <xsl:text>\n(INu</xsl:text>
149     </xsl:otherwise>
150   </xsl:choose>
151   <xsl:text>'</xsl:text>
152   <xsl:text>&#x2022;</xsl:text>
153   <xsl:text>\h'+</xsl:text>
154   <xsl:choose>
155     <xsl:when test="not($list-indent = '')">
156       <xsl:text>0</xsl:text>
157       <xsl:value-of select="$list-indent - 1"/>
158     </xsl:when>
159     <xsl:otherwise>
160       <xsl:text>\n(INu-1</xsl:text>
161     </xsl:otherwise>
162   </xsl:choose>
163   <xsl:text>'\c&#10;</xsl:text>
164   <!-- * else, we are not using for "nroff", but instead "troff" - which -->
165   <!-- * means not for TTY, but for PS or whatever; so we’re not using a -->
166   <!-- * fixed-width font, so use a real .IP instead -->
167   <xsl:call-template name="roff-else"/>
168   <!-- * .IP generates a blank like of space, so let’s go backwards one -->
169   <!-- * line up to compensate for that -->
170   <xsl:text>.sp -1&#10;</xsl:text>
171   <xsl:text>.IP \(bu 2.3&#10;</xsl:text>
172   <!-- * The value 2.3 is the amount of indentation; we use 2.3 instead -->
173   <!-- * of 2 because when the font family is New Century Schoolbook it -->
174   <!-- * seems to require the extra space. -->
175   <xsl:call-template name="roff-if-end"/>
176   <xsl:apply-templates/>
177   <xsl:text>.RE&#10;</xsl:text>
178 </xsl:template>
179
180 <xsl:template match="orderedlist/listitem|procedure/step">
181   <xsl:text>&#10;</xsl:text>
182   <xsl:text>.sp</xsl:text>
183   <xsl:text>&#10;</xsl:text>
184   <xsl:text>.RS</xsl:text>
185   <xsl:if test="not($list-indent = '')">
186     <xsl:text> </xsl:text>
187     <xsl:value-of select="$list-indent"/>
188   </xsl:if>
189   <xsl:text>&#10;</xsl:text>
190   <!-- * if "n" then we are using "nroff", which means the output is for -->
191   <!-- * TTY; so we do some fixed-width-font hackery with \h to make a -->
192   <!-- * hanging indents (instead of using .IP, which has some -->
193   <!-- * undesirable side effects under certain circumstances) -->
194   <xsl:call-template name="roff-if-else-start"/>
195   <xsl:text>\h'-</xsl:text>
196   <xsl:choose>
197     <xsl:when test="not($list-indent = '')">
198       <xsl:text>0</xsl:text>
199       <xsl:value-of select="$list-indent"/>
200     </xsl:when>
201     <xsl:otherwise>
202       <xsl:text>\n(INu+3n</xsl:text>
203     </xsl:otherwise>
204   </xsl:choose>
205   <xsl:text>'</xsl:text>
206   <xsl:if test="count(preceding-sibling::listitem) &lt; 9">
207     <xsl:text> </xsl:text>
208   </xsl:if>
209   <xsl:number format="1."/>
210   <xsl:text>\h'+</xsl:text>
211   <xsl:choose>
212     <xsl:when test="not($list-indent = '')">
213       <xsl:text>0</xsl:text>
214       <xsl:value-of select="$list-indent - 3"/>
215     </xsl:when>
216     <xsl:otherwise>
217       <xsl:text>1n</xsl:text>
218     </xsl:otherwise>
219   </xsl:choose>
220   <xsl:text>'\c&#10;</xsl:text>
221   <!-- * else, we are not using for "nroff", but instead "troff" - which -->
222   <!-- * means not for TTY, but for PS or whatever; so we’re not using a -->
223   <!-- * fixed-width font, so use a real .IP instead -->
224   <xsl:call-template name="roff-else"/>
225   <!-- * .IP generates a blank line of space, so let’s go backwards one -->
226   <!-- * line up to compensate for that -->
227   <xsl:text>.sp -1&#10;</xsl:text>
228   <xsl:text>.IP "</xsl:text>
229   <xsl:if test="count(preceding-sibling::listitem) &lt; 9">
230     <xsl:text>  </xsl:text>
231   </xsl:if>
232   <xsl:number format="1."/>
233   <xsl:text>" 4.2&#10;</xsl:text>
234   <!-- * The value 4.2 is the amount of indentation; we use 4.2 instead -->
235   <!-- * of 4 because when the font family is Bookman it seems to require -->
236   <!-- * the extra space. -->
237   <xsl:call-template name="roff-if-end"/>
238   <xsl:apply-templates/>
239   <xsl:text>.RE&#10;</xsl:text>
240   <xsl:text>&#10;</xsl:text>
241 </xsl:template>
242
243 <xsl:template match="itemizedlist|orderedlist|procedure">
244   <xsl:if test="title">
245     <xsl:text>.PP&#10;</xsl:text>
246     <xsl:call-template name="bold">
247       <xsl:with-param name="node" select="title"/>
248       <xsl:with-param name="context" select="."/>
249     </xsl:call-template>
250     <xsl:text>&#10;</xsl:text>
251   </xsl:if>
252   <!-- * DocBook allows just about any block content to appear in -->
253   <!-- * lists before the actual list items, so we need to get that -->
254   <!-- * content (if any) before getting the list items -->
255   <xsl:apply-templates
256     select="*[not(self::listitem) and not(self::title)]"/>
257   <xsl:apply-templates select="listitem"/>
258   <!-- * If this list is a child of para and has content following -->
259   <!-- * it, within the same para, then add a blank line and move -->
260   <!-- * the left margin back to where it was -->
261   <xsl:if test="parent::para and following-sibling::node()">
262     <xsl:text>.sp</xsl:text>
263     <xsl:text>&#10;</xsl:text>
264   </xsl:if>
265 </xsl:template>
266
267 <xsl:template match="itemizedlist[ancestor::listitem or ancestor::step  or ancestor::glossdef]|
268   orderedlist[ancestor::listitem or ancestor::step or ancestor::glossdef]|
269   procedure[ancestor::listitem or ancestor::step or ancestor::glossdef]">
270   <xsl:if test="title">
271     <xsl:text>.PP&#10;</xsl:text>
272     <xsl:call-template name="bold">
273       <xsl:with-param name="node" select="title"/>
274       <xsl:with-param name="context" select="."/>
275     </xsl:call-template>
276     <xsl:text>&#10;</xsl:text>
277   </xsl:if>
278   <xsl:apply-templates/>
279   <xsl:if test="following-sibling::node() or
280     parent::para[following-sibling::node()] or
281     parent::simpara[following-sibling::node()] or
282     parent::remark[following-sibling::node()]">
283     <xsl:text>.sp</xsl:text> 
284     <xsl:text>&#10;</xsl:text>
285   </xsl:if>
286 </xsl:template>
287
288 <!-- ================================================================== -->
289   
290 <!-- * for simplelist type="inline", render it as a comma-separated list -->
291 <xsl:template match="simplelist[@type='inline']">
292   <!-- * if dbchoice PI exists, use that to determine the choice separator -->
293   <!-- * (that is, equivalent of "and" or "or" in current locale), or literal -->
294   <!-- * value of "choice" otherwise -->
295   <xsl:variable name="localized-choice-separator">
296     <xsl:choose>
297       <xsl:when test="processing-instruction('dbchoice')">
298         <xsl:call-template name="select.choice.separator"/>
299       </xsl:when>
300       <xsl:otherwise>
301         <!-- * empty -->
302       </xsl:otherwise>
303     </xsl:choose>
304   </xsl:variable>
305
306   <xsl:for-each select="member">
307     <xsl:apply-templates/>
308     <xsl:choose>
309       <xsl:when test="position() = last()"/> <!-- do nothing -->
310       <xsl:otherwise>
311         <xsl:text>, </xsl:text>
312         <xsl:if test="position() = last() - 1">
313           <xsl:if test="$localized-choice-separator != ''">
314             <xsl:value-of select="$localized-choice-separator"/>
315             <xsl:text> </xsl:text>
316           </xsl:if>
317         </xsl:if>
318       </xsl:otherwise>
319     </xsl:choose>
320   </xsl:for-each>
321   <xsl:text>&#10;</xsl:text>
322 </xsl:template>
323
324 <!-- * if simplelist type is not inline, render it as a one-column vertical -->
325 <!-- * list (ignoring the values of the type and columns attributes) -->
326 <xsl:template match="simplelist">
327   <xsl:for-each select="member">
328     <xsl:text>.RS</xsl:text> 
329     <xsl:if test="not($list-indent = '')">
330       <xsl:text> </xsl:text>
331       <xsl:value-of select="$list-indent"/>
332     </xsl:if>
333     <xsl:text>&#10;</xsl:text>
334     <xsl:apply-templates/>
335     <xsl:text>&#10;</xsl:text>
336     <xsl:text>.RE&#10;</xsl:text>
337   </xsl:for-each>
338 </xsl:template>
339
340 <!-- ================================================================== -->
341
342 <!-- * We output Segmentedlist as a table, using tbl(1) markup. There -->
343 <!-- * is no option for outputting it in manpages in "list" form. -->
344 <xsl:template match="segmentedlist">
345   <xsl:if test="title">
346     <xsl:text>.PP&#10;</xsl:text>
347     <xsl:call-template name="bold">
348       <xsl:with-param name="node" select="title"/>
349       <xsl:with-param name="context" select="."/>
350     </xsl:call-template>
351     <xsl:text>&#10;</xsl:text>
352   </xsl:if>
353   <xsl:text>.\" line length increase to cope w/ tbl weirdness&#10;</xsl:text>
354   <xsl:text>.ll +(\n(LLu * 62u / 100u)&#10;</xsl:text>
355   <!-- * .TS = "Table Start" -->
356   <xsl:text>.TS&#10;</xsl:text>
357   <!-- * first output the table "format" spec, which tells tbl(1) how -->
358   <!-- * how to format each row and column. -->
359   <xsl:for-each select=".//segtitle">
360     <!-- * l = "left", which hard-codes left-alignment for tabular -->
361     <!-- * output of all segmentedlist content -->
362     <xsl:text>l</xsl:text>
363   </xsl:for-each>
364   <!-- * last line of table format section must end with a dot -->
365   <xsl:text>.&#10;</xsl:text>
366   <!-- * optionally suppress output of segtitle -->
367   <xsl:choose>
368     <xsl:when test="$man.segtitle.suppress != 0">
369       <!-- * non-zero = "suppress", so do nothing -->
370     </xsl:when>
371     <xsl:otherwise>
372       <!-- * "0" = "do not suppress", so output the segtitle(s) -->
373       <xsl:apply-templates select=".//segtitle" mode="table-title"/>
374       <xsl:text>&#10;</xsl:text>
375     </xsl:otherwise>
376   </xsl:choose>
377   <xsl:apply-templates/>
378   <!-- * .TE = "Table End" -->
379   <xsl:text>.TE&#10;</xsl:text>
380   <xsl:text>.\" line length decrease back to previous value&#10;</xsl:text>
381   <xsl:text>.ll -(\n(LLu * 62u / 100u)&#10;</xsl:text>
382   <!-- * put a blank line of space below the table -->
383   <xsl:text>.sp&#10;</xsl:text>
384 </xsl:template>
385
386 <xsl:template match="segmentedlist/segtitle" mode="table-title">
387   <xsl:call-template name="italic">
388     <xsl:with-param name="node" select="."/>
389     <xsl:with-param name="context" select="."/>
390   </xsl:call-template>
391   <xsl:choose>
392     <xsl:when test="position() = last()"/> <!-- do nothing -->
393     <xsl:otherwise>
394       <!-- * tbl(1) treats tab characters as delimiters between -->
395       <!-- * cells; so we need to output a tab after each -->
396       <!-- * segtitle except the last one -->
397       <xsl:text>&#09;</xsl:text>
398     </xsl:otherwise>
399   </xsl:choose>
400 </xsl:template>
401
402 <xsl:template match="segmentedlist/seglistitem">
403   <xsl:apply-templates/>
404   <xsl:text>&#10;</xsl:text>
405 </xsl:template>
406
407 <xsl:template match="segmentedlist/seglistitem/seg">
408   <!-- * the T{ and T} stuff are delimiters to tell tbl(1) that -->
409   <!-- * the delimited contents are "text blocks" that groff(1) -->
410   <!-- * needs to process -->
411   <xsl:text>T{&#10;</xsl:text>
412   <xsl:variable name="contents">
413     <xsl:apply-templates/>
414   </xsl:variable>
415   <xsl:value-of select="normalize-space($contents)"/>
416   <xsl:text>&#10;T}</xsl:text>
417   <xsl:choose>
418     <xsl:when test="position() = last()"/> <!-- do nothing -->
419     <xsl:otherwise>
420       <!-- * tbl(1) treats tab characters as delimiters between -->
421       <!-- * cells; so we need to output a tab after each -->
422       <!-- * segtitle except the last one -->
423       <xsl:text>&#09;</xsl:text>
424     </xsl:otherwise>
425   </xsl:choose>
426 </xsl:template>
427
428 <!-- ==================================================================== -->
429
430 <xsl:template match="calloutlist">
431   <xsl:if test="title|info/title">
432     <xsl:call-template name="formal.object.heading"/>
433   </xsl:if>
434   <!-- * This template was originally copied over from the HTML -->
435   <!-- * calloutlist template, which precedes the following -->
436   <!-- * apply-templates with the comment "Preserve order of PIs and -->
437   <!-- * comments"; I'm not certain that it will actually have that -->
438   <!-- * effect for all cases, and it seems like there is probably a -->
439   <!-- * better way to do it, but anyway, I’m preserving it here for -->
440   <!-- * consistency. -->
441   <xsl:apply-templates 
442     select="*[not(self::callout or self::title or self::titleabbrev)]
443     |comment()[not(preceding-sibling::callout)]
444     |processing-instruction()[not(preceding-sibling::callout)]"/>
445   <!-- * put callout list into a table -->
446   <xsl:text>.TS&#10;</xsl:text>
447   <xsl:text>tab(:);&#10;</xsl:text>
448   <!-- * the following defines the row layout for the table: two columns, -->
449   <!-- * with the first cell in each row right-aligned, and the second -->
450   <!-- * cell left aligned with a width of 75% of the line length -->
451   <xsl:text>r lw(\n(.lu*75u/100u).&#10;</xsl:text>
452   <xsl:apply-templates select="callout
453     |comment()[preceding-sibling::callout]
454     |processing-instruction()[preceding-sibling::callout]"/>
455   <xsl:text>.TE&#10;</xsl:text>
456 </xsl:template>
457
458 <xsl:template match="calloutlist/title"/>
459
460 <xsl:template match="callout">
461   <!-- * first cell of each row is the set of callout numbers for this -->
462   <!-- * particular callout -->
463   <xsl:call-template name="callout.arearefs">
464     <xsl:with-param name="arearefs" select="@arearefs"/>
465   </xsl:call-template>
466   <!-- * end of the first cell in the row; the \h hackery is to correct -->
467   <!-- * for the excessive horizontal whitespace that tbl(1) adds between -->
468   <!-- * cells in the same row -->
469   <xsl:text>\h'-2n':</xsl:text>
470   <!-- * start the next cell in the row, which has the prose contents -->
471   <!-- * (description/explanation) for the callout -->
472   <xsl:text>T{&#10;</xsl:text>
473   <xsl:apply-templates/>
474   <xsl:text>T}&#10;</xsl:text>
475   <!-- * end of the last cell and end of the row -->
476 </xsl:template>
477
478 <xsl:template name="callout.arearefs">
479   <xsl:param name="arearefs"></xsl:param>
480   <!-- * callout can have multiple values in its arearefs attribute, so -->
481   <!-- * we use the position param to track the postion of each value -->
482   <xsl:param name="position">1</xsl:param>
483   <xsl:if test="$arearefs!=''">
484     <xsl:choose>
485       <xsl:when test="substring-before($arearefs,' ')=''">
486         <xsl:call-template name="callout.arearef">
487           <xsl:with-param name="arearef" select="$arearefs"/>
488           <xsl:with-param name="position" select="$position"/>
489         </xsl:call-template>
490       </xsl:when>
491       <xsl:otherwise>
492         <xsl:call-template name="callout.arearef">
493           <xsl:with-param name="arearef"
494             select="substring-before($arearefs,' ')"/>
495           <xsl:with-param name="position" select="$position"/>
496         </xsl:call-template>
497       </xsl:otherwise>
498     </xsl:choose>
499     <xsl:call-template name="callout.arearefs">
500       <xsl:with-param name="arearefs"
501         select="substring-after($arearefs,' ')"/>
502       <xsl:with-param name="position" select="$position + 1"/>
503     </xsl:call-template>
504   </xsl:if>
505 </xsl:template>
506
507 <xsl:template name="callout.arearef">
508   <xsl:param name="arearef"></xsl:param>
509   <!-- * callout can have multiple values in its arearefs attribute, so -->
510   <!-- * we use the position param to track the postion of each value -->
511   <xsl:param name="position"></xsl:param>
512   <xsl:variable name="targets" select="key('id',$arearef)"/>
513   <xsl:variable name="target" select="$targets[1]"/>
514
515   <xsl:call-template name="check.id.unique">
516     <xsl:with-param name="linkend" select="$arearef"/>
517   </xsl:call-template>
518
519   <xsl:choose>
520     <xsl:when test="count($target)=0">
521       <xsl:text>???</xsl:text>
522     </xsl:when>
523     <xsl:when test="local-name($target)='co'">
524       <!-- * if this is not the first value in the set of values in the -->
525       <!-- * arearef attribute for this callout, then we prepend a groff -->
526       <!-- * non-breaking space to it, to prevent groff from injecting -->
527       <!-- * linebreaks into the output. For callout instances with -->
528       <!-- * multiple values in their arearefs attributes, that results -->
529       <!-- * in all of callout numbers beings listed on the same line. -->
530       <xsl:if test="not($position = 1)">
531         <xsl:text>\ </xsl:text>
532       </xsl:if>
533       <xsl:apply-templates select="$target"
534         mode="calloutlist-callout-number"/>
535     </xsl:when>
536     <!-- * the manpages stylesheet does not really support areaset and -->
537     <!-- * area (because we can't/don't actually render the callout bugs -->
538     <!-- * at the specified coordinates); however, the following (for -->
539     <!-- * what it's worth) might cause the callout numbers in the -->
540     <!-- * calloutlist to be render at least (then again, maybe it won't; -->
541     <!-- * it's not actually been tested... -->
542     <xsl:when test="local-name($target)='areaset'">
543       <xsl:call-template name="callout-bug">
544         <xsl:with-param name="conum">
545           <xsl:apply-templates select="$target" mode="conumber"/>
546         </xsl:with-param>
547       </xsl:call-template>
548     </xsl:when>
549     <xsl:when test="local-name($target)='area'">
550       <xsl:choose>
551         <xsl:when test="$target/parent::areaset">
552           <xsl:call-template name="callout-bug">
553             <xsl:with-param name="conum">
554               <xsl:apply-templates
555                 select="$target/parent::areaset" mode="conumber"/>
556             </xsl:with-param>
557           </xsl:call-template>
558         </xsl:when>
559         <xsl:otherwise>
560           <xsl:call-template name="callout-bug">
561             <xsl:with-param name="conum">
562               <xsl:apply-templates select="$target"
563                 mode="conumber"/>
564             </xsl:with-param>
565           </xsl:call-template>
566         </xsl:otherwise>
567       </xsl:choose>
568     </xsl:when>
569     <xsl:otherwise>
570       <xsl:text>???</xsl:text>
571     </xsl:otherwise>
572   </xsl:choose>
573 </xsl:template>
574
575 <!-- * we bold the actual callout bugs and put -->
576 <!-- * parenthesis around them -->
577 <xsl:template name="callout-bug">
578   <xsl:param name="conum" select='1'/>
579   <xsl:text>\fB(</xsl:text>
580   <xsl:value-of select="$conum"/>
581   <xsl:text>)\fR</xsl:text>
582 </xsl:template>
583
584 <!-- * we bold the callout numbers and follow each -->
585 <!-- * with a period -->
586 <xsl:template name="calloutlist-callout-number">
587   <xsl:param name="conum" select='1'/>
588   <xsl:text>\fB</xsl:text>
589   <xsl:value-of select="$conum"/>
590   <xsl:text>.\fR</xsl:text>
591 </xsl:template>
592
593 <xsl:template match="co" mode="calloutlist-callout-number">
594   <xsl:call-template name="calloutlist-callout-number">
595     <xsl:with-param name="conum">
596       <xsl:number count="co"
597         level="any"
598         from="programlisting|screen|literallayout|synopsis"
599         format="1"/>
600     </xsl:with-param>
601   </xsl:call-template>
602 </xsl:template>
603
604 </xsl:stylesheet>