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