1 | <?xml version='1.0'?> |
---|
2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
3 | xmlns:fo="http://www.w3.org/1999/XSL/Format" |
---|
4 | version='1.0'> |
---|
5 | |
---|
6 | <!-- ******************************************************************** |
---|
7 | $Id$ |
---|
8 | ******************************************************************** |
---|
9 | |
---|
10 | This file is part of the XSL DocBook Stylesheet distribution. |
---|
11 | See ../README or http://docbook.sf.net/release/xsl/current/ for |
---|
12 | copyright and other information. |
---|
13 | |
---|
14 | ******************************************************************** --> |
---|
15 | |
---|
16 | <!-- ==================================================================== --> |
---|
17 | |
---|
18 | <xsl:template match="itemizedlist"> |
---|
19 | <xsl:variable name="id"> |
---|
20 | <xsl:call-template name="object.id"/> |
---|
21 | </xsl:variable> |
---|
22 | |
---|
23 | <xsl:variable name="pi-label-width"> |
---|
24 | <xsl:call-template name="pi.dbfo_label-width"/> |
---|
25 | </xsl:variable> |
---|
26 | |
---|
27 | <xsl:variable name="label-width"> |
---|
28 | <xsl:choose> |
---|
29 | <xsl:when test="$pi-label-width = ''"> |
---|
30 | <xsl:value-of select="$itemizedlist.label.width"/> |
---|
31 | </xsl:when> |
---|
32 | <xsl:otherwise> |
---|
33 | <xsl:value-of select="$pi-label-width"/> |
---|
34 | </xsl:otherwise> |
---|
35 | </xsl:choose> |
---|
36 | </xsl:variable> |
---|
37 | |
---|
38 | <xsl:if test="title"> |
---|
39 | <xsl:apply-templates select="title" mode="list.title.mode"/> |
---|
40 | </xsl:if> |
---|
41 | |
---|
42 | <!-- Preserve order of PIs and comments --> |
---|
43 | <xsl:apply-templates |
---|
44 | select="*[not(self::listitem |
---|
45 | or self::title |
---|
46 | or self::titleabbrev)] |
---|
47 | |comment()[not(preceding-sibling::listitem)] |
---|
48 | |processing-instruction()[not(preceding-sibling::listitem)]"/> |
---|
49 | |
---|
50 | <xsl:variable name="content"> |
---|
51 | <xsl:apply-templates |
---|
52 | select="listitem |
---|
53 | |comment()[preceding-sibling::listitem] |
---|
54 | |processing-instruction()[preceding-sibling::listitem]"/> |
---|
55 | </xsl:variable> |
---|
56 | |
---|
57 | <!-- nested lists don't add extra list-block spacing --> |
---|
58 | <xsl:choose> |
---|
59 | <xsl:when test="ancestor::listitem"> |
---|
60 | <fo:list-block id="{$id}" xsl:use-attribute-sets="itemizedlist.properties"> |
---|
61 | <xsl:attribute name="provisional-distance-between-starts"> |
---|
62 | <xsl:value-of select="$label-width"/> |
---|
63 | </xsl:attribute> |
---|
64 | <xsl:copy-of select="$content"/> |
---|
65 | </fo:list-block> |
---|
66 | </xsl:when> |
---|
67 | <xsl:otherwise> |
---|
68 | <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing itemizedlist.properties"> |
---|
69 | <xsl:attribute name="provisional-distance-between-starts"> |
---|
70 | <xsl:value-of select="$label-width"/> |
---|
71 | </xsl:attribute> |
---|
72 | <xsl:copy-of select="$content"/> |
---|
73 | </fo:list-block> |
---|
74 | </xsl:otherwise> |
---|
75 | </xsl:choose> |
---|
76 | |
---|
77 | </xsl:template> |
---|
78 | |
---|
79 | <xsl:template match="itemizedlist/title|orderedlist/title"> |
---|
80 | <!--nop--> |
---|
81 | </xsl:template> |
---|
82 | |
---|
83 | <xsl:template match="variablelist/title" mode="vl.as.list"> |
---|
84 | <!--nop--> |
---|
85 | </xsl:template> |
---|
86 | |
---|
87 | <xsl:template match="variablelist/title" mode="vl.as.blocks"> |
---|
88 | <!--nop--> |
---|
89 | </xsl:template> |
---|
90 | |
---|
91 | <xsl:template match="itemizedlist/titleabbrev|orderedlist/titleabbrev"> |
---|
92 | <!--nop--> |
---|
93 | </xsl:template> |
---|
94 | |
---|
95 | <xsl:template match="procedure/titleabbrev"> |
---|
96 | <!--nop--> |
---|
97 | </xsl:template> |
---|
98 | |
---|
99 | <xsl:template match="variablelist/titleabbrev" mode="vl.as.list"> |
---|
100 | <!--nop--> |
---|
101 | </xsl:template> |
---|
102 | |
---|
103 | <xsl:template match="variablelist/titleabbrev" mode="vl.as.blocks"> |
---|
104 | <!--nop--> |
---|
105 | </xsl:template> |
---|
106 | |
---|
107 | <xsl:template match="itemizedlist/listitem"> |
---|
108 | <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable> |
---|
109 | |
---|
110 | <xsl:variable name="item.contents"> |
---|
111 | <fo:list-item-label end-indent="label-end()" xsl:use-attribute-sets="itemizedlist.label.properties"> |
---|
112 | <fo:block> |
---|
113 | <xsl:call-template name="itemizedlist.label.markup"> |
---|
114 | <xsl:with-param name="itemsymbol"> |
---|
115 | <xsl:call-template name="list.itemsymbol"> |
---|
116 | <xsl:with-param name="node" select="parent::itemizedlist"/> |
---|
117 | </xsl:call-template> |
---|
118 | </xsl:with-param> |
---|
119 | </xsl:call-template> |
---|
120 | </fo:block> |
---|
121 | </fo:list-item-label> |
---|
122 | <fo:list-item-body start-indent="body-start()"> |
---|
123 | <xsl:choose> |
---|
124 | <!-- * work around broken passivetex list-item-body rendering --> |
---|
125 | <xsl:when test="$passivetex.extensions = '1'"> |
---|
126 | <xsl:apply-templates/> |
---|
127 | </xsl:when> |
---|
128 | <xsl:otherwise> |
---|
129 | <fo:block> |
---|
130 | <xsl:apply-templates/> |
---|
131 | </fo:block> |
---|
132 | </xsl:otherwise> |
---|
133 | </xsl:choose> |
---|
134 | </fo:list-item-body> |
---|
135 | </xsl:variable> |
---|
136 | |
---|
137 | <xsl:choose> |
---|
138 | <xsl:when test="parent::*/@spacing = 'compact'"> |
---|
139 | <fo:list-item id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing"> |
---|
140 | <xsl:copy-of select="$item.contents"/> |
---|
141 | </fo:list-item> |
---|
142 | </xsl:when> |
---|
143 | <xsl:otherwise> |
---|
144 | <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing"> |
---|
145 | <xsl:copy-of select="$item.contents"/> |
---|
146 | </fo:list-item> |
---|
147 | </xsl:otherwise> |
---|
148 | </xsl:choose> |
---|
149 | </xsl:template> |
---|
150 | |
---|
151 | <xsl:template name="itemizedlist.label.markup"> |
---|
152 | <xsl:param name="itemsymbol" select="'disc'"/> |
---|
153 | |
---|
154 | <xsl:choose> |
---|
155 | <xsl:when test="$itemsymbol='none'"></xsl:when> |
---|
156 | <xsl:when test="$itemsymbol='disc'">•</xsl:when> |
---|
157 | <xsl:when test="$itemsymbol='bullet'">•</xsl:when> |
---|
158 | <xsl:when test="$itemsymbol='endash'">–</xsl:when> |
---|
159 | <xsl:when test="$itemsymbol='emdash'">—</xsl:when> |
---|
160 | <!-- Some of these may work in your XSL-FO processor and fonts --> |
---|
161 | <!-- |
---|
162 | <xsl:when test="$itemsymbol='square'">■</xsl:when> |
---|
163 | <xsl:when test="$itemsymbol='box'">■</xsl:when> |
---|
164 | <xsl:when test="$itemsymbol='smallblacksquare'">▪</xsl:when> |
---|
165 | <xsl:when test="$itemsymbol='circle'">○</xsl:when> |
---|
166 | <xsl:when test="$itemsymbol='opencircle'">○</xsl:when> |
---|
167 | <xsl:when test="$itemsymbol='whitesquare'">□</xsl:when> |
---|
168 | <xsl:when test="$itemsymbol='smallwhitesquare'">▫</xsl:when> |
---|
169 | <xsl:when test="$itemsymbol='round'">●</xsl:when> |
---|
170 | <xsl:when test="$itemsymbol='blackcircle'">●</xsl:when> |
---|
171 | <xsl:when test="$itemsymbol='whitebullet'">◦</xsl:when> |
---|
172 | <xsl:when test="$itemsymbol='triangle'">‣</xsl:when> |
---|
173 | <xsl:when test="$itemsymbol='point'">›</xsl:when> |
---|
174 | <xsl:when test="$itemsymbol='hand'"><fo:inline |
---|
175 | font-family="Wingdings 2">A</fo:inline></xsl:when> |
---|
176 | --> |
---|
177 | <xsl:otherwise>•</xsl:otherwise> |
---|
178 | </xsl:choose> |
---|
179 | </xsl:template> |
---|
180 | |
---|
181 | <xsl:template match="orderedlist"> |
---|
182 | <xsl:variable name="id"> |
---|
183 | <xsl:call-template name="object.id"/> |
---|
184 | </xsl:variable> |
---|
185 | |
---|
186 | <xsl:variable name="pi-label-width"> |
---|
187 | <xsl:call-template name="pi.dbfo_label-width"/> |
---|
188 | </xsl:variable> |
---|
189 | |
---|
190 | <xsl:variable name="label-width"> |
---|
191 | <xsl:choose> |
---|
192 | <xsl:when test="$pi-label-width = ''"> |
---|
193 | <xsl:value-of select="$orderedlist.label.width"/> |
---|
194 | </xsl:when> |
---|
195 | <xsl:otherwise> |
---|
196 | <xsl:value-of select="$pi-label-width"/> |
---|
197 | </xsl:otherwise> |
---|
198 | </xsl:choose> |
---|
199 | </xsl:variable> |
---|
200 | |
---|
201 | <xsl:if test="title"> |
---|
202 | <xsl:apply-templates select="title" mode="list.title.mode"/> |
---|
203 | </xsl:if> |
---|
204 | |
---|
205 | <!-- Preserve order of PIs and comments --> |
---|
206 | <xsl:apply-templates |
---|
207 | select="*[not(self::listitem |
---|
208 | or self::title |
---|
209 | or self::titleabbrev)] |
---|
210 | |comment()[not(preceding-sibling::listitem)] |
---|
211 | |processing-instruction()[not(preceding-sibling::listitem)]"/> |
---|
212 | |
---|
213 | <xsl:variable name="content"> |
---|
214 | <xsl:apply-templates |
---|
215 | select="listitem |
---|
216 | |comment()[preceding-sibling::listitem] |
---|
217 | |processing-instruction()[preceding-sibling::listitem]"/> |
---|
218 | </xsl:variable> |
---|
219 | |
---|
220 | <!-- nested lists don't add extra list-block spacing --> |
---|
221 | <xsl:choose> |
---|
222 | <xsl:when test="ancestor::listitem"> |
---|
223 | <fo:list-block id="{$id}" xsl:use-attribute-sets="orderedlist.properties"> |
---|
224 | <xsl:attribute name="provisional-distance-between-starts"> |
---|
225 | <xsl:value-of select="$label-width"/> |
---|
226 | </xsl:attribute> |
---|
227 | <xsl:copy-of select="$content"/> |
---|
228 | </fo:list-block> |
---|
229 | </xsl:when> |
---|
230 | <xsl:otherwise> |
---|
231 | <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing orderedlist.properties"> |
---|
232 | <xsl:attribute name="provisional-distance-between-starts"> |
---|
233 | <xsl:value-of select="$label-width"/> |
---|
234 | </xsl:attribute> |
---|
235 | <xsl:copy-of select="$content"/> |
---|
236 | </fo:list-block> |
---|
237 | </xsl:otherwise> |
---|
238 | </xsl:choose> |
---|
239 | </xsl:template> |
---|
240 | |
---|
241 | <xsl:template match="orderedlist/listitem" mode="item-number"> |
---|
242 | <xsl:variable name="numeration"> |
---|
243 | <xsl:call-template name="list.numeration"> |
---|
244 | <xsl:with-param name="node" select="parent::orderedlist"/> |
---|
245 | </xsl:call-template> |
---|
246 | </xsl:variable> |
---|
247 | |
---|
248 | <xsl:variable name="type"> |
---|
249 | <xsl:choose> |
---|
250 | <xsl:when test="$numeration='arabic'">1.</xsl:when> |
---|
251 | <xsl:when test="$numeration='loweralpha'">a.</xsl:when> |
---|
252 | <xsl:when test="$numeration='lowerroman'">i.</xsl:when> |
---|
253 | <xsl:when test="$numeration='upperalpha'">A.</xsl:when> |
---|
254 | <xsl:when test="$numeration='upperroman'">I.</xsl:when> |
---|
255 | <!-- What!? This should never happen --> |
---|
256 | <xsl:otherwise> |
---|
257 | <xsl:message> |
---|
258 | <xsl:text>Unexpected numeration: </xsl:text> |
---|
259 | <xsl:value-of select="$numeration"/> |
---|
260 | </xsl:message> |
---|
261 | <xsl:value-of select="1."/> |
---|
262 | </xsl:otherwise> |
---|
263 | </xsl:choose> |
---|
264 | </xsl:variable> |
---|
265 | |
---|
266 | <xsl:variable name="item-number"> |
---|
267 | <xsl:call-template name="orderedlist-item-number"/> |
---|
268 | </xsl:variable> |
---|
269 | |
---|
270 | <xsl:if test="parent::orderedlist/@inheritnum='inherit' |
---|
271 | and ancestor::listitem[parent::orderedlist]"> |
---|
272 | <xsl:apply-templates select="ancestor::listitem[parent::orderedlist][1]" |
---|
273 | mode="item-number"/> |
---|
274 | </xsl:if> |
---|
275 | |
---|
276 | <xsl:number value="$item-number" format="{$type}"/> |
---|
277 | </xsl:template> |
---|
278 | |
---|
279 | <xsl:template match="orderedlist/listitem"> |
---|
280 | <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable> |
---|
281 | |
---|
282 | <xsl:variable name="item.contents"> |
---|
283 | <fo:list-item-label end-indent="label-end()" xsl:use-attribute-sets="orderedlist.label.properties"> |
---|
284 | <fo:block> |
---|
285 | <xsl:apply-templates select="." mode="item-number"/> |
---|
286 | </fo:block> |
---|
287 | </fo:list-item-label> |
---|
288 | <fo:list-item-body start-indent="body-start()"> |
---|
289 | <fo:block> |
---|
290 | <xsl:apply-templates/> |
---|
291 | </fo:block> |
---|
292 | </fo:list-item-body> |
---|
293 | </xsl:variable> |
---|
294 | |
---|
295 | <xsl:choose> |
---|
296 | <xsl:when test="parent::*/@spacing = 'compact'"> |
---|
297 | <fo:list-item id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing"> |
---|
298 | <xsl:copy-of select="$item.contents"/> |
---|
299 | </fo:list-item> |
---|
300 | </xsl:when> |
---|
301 | <xsl:otherwise> |
---|
302 | <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing"> |
---|
303 | <xsl:copy-of select="$item.contents"/> |
---|
304 | </fo:list-item> |
---|
305 | </xsl:otherwise> |
---|
306 | </xsl:choose> |
---|
307 | </xsl:template> |
---|
308 | |
---|
309 | <xsl:template match="listitem/*[1][local-name()='para' or |
---|
310 | local-name()='simpara' or |
---|
311 | local-name()='formalpara'] |
---|
312 | |glossdef/*[1][local-name()='para' or |
---|
313 | local-name()='simpara' or |
---|
314 | local-name()='formalpara'] |
---|
315 | |step/*[1][local-name()='para' or |
---|
316 | local-name()='simpara' or |
---|
317 | local-name()='formalpara'] |
---|
318 | |callout/*[1][local-name()='para' or |
---|
319 | local-name()='simpara' or |
---|
320 | local-name()='formalpara']" |
---|
321 | priority="2"> |
---|
322 | <fo:block> |
---|
323 | <xsl:call-template name="anchor"/> |
---|
324 | <xsl:apply-templates/> |
---|
325 | </fo:block> |
---|
326 | </xsl:template> |
---|
327 | |
---|
328 | <xsl:template match="variablelist"> |
---|
329 | <xsl:variable name="presentation"> |
---|
330 | <xsl:call-template name="pi.dbfo_list-presentation"/> |
---|
331 | </xsl:variable> |
---|
332 | |
---|
333 | <xsl:choose> |
---|
334 | <xsl:when test="$presentation = 'list'"> |
---|
335 | <xsl:apply-templates select="." mode="vl.as.list"/> |
---|
336 | </xsl:when> |
---|
337 | <xsl:when test="$presentation = 'blocks'"> |
---|
338 | <xsl:apply-templates select="." mode="vl.as.blocks"/> |
---|
339 | </xsl:when> |
---|
340 | <xsl:when test="$variablelist.as.blocks != 0"> |
---|
341 | <xsl:apply-templates select="." mode="vl.as.blocks"/> |
---|
342 | </xsl:when> |
---|
343 | <xsl:otherwise> |
---|
344 | <xsl:apply-templates select="." mode="vl.as.list"/> |
---|
345 | </xsl:otherwise> |
---|
346 | </xsl:choose> |
---|
347 | </xsl:template> |
---|
348 | |
---|
349 | <xsl:template match="variablelist" mode="vl.as.list"> |
---|
350 | <xsl:variable name="id"> |
---|
351 | <xsl:call-template name="object.id"/> |
---|
352 | </xsl:variable> |
---|
353 | |
---|
354 | <xsl:variable name="term-width"> |
---|
355 | <xsl:call-template name="pi.dbfo_term-width"/> |
---|
356 | </xsl:variable> |
---|
357 | |
---|
358 | <xsl:variable name="termlength"> |
---|
359 | <xsl:choose> |
---|
360 | <xsl:when test="$term-width != ''"> |
---|
361 | <xsl:value-of select="$term-width"/> |
---|
362 | </xsl:when> |
---|
363 | <xsl:when test="@termlength"> |
---|
364 | <xsl:variable name="termlength.is.number"> |
---|
365 | <xsl:value-of select="@termlength + 0"/> |
---|
366 | </xsl:variable> |
---|
367 | <xsl:choose> |
---|
368 | <xsl:when test="string($termlength.is.number) = 'NaN'"> |
---|
369 | <!-- if the term length isn't just a number, assume it's a measurement --> |
---|
370 | <xsl:value-of select="@termlength"/> |
---|
371 | </xsl:when> |
---|
372 | <xsl:otherwise> |
---|
373 | <xsl:value-of select="@termlength"/> |
---|
374 | <xsl:choose> |
---|
375 | <!-- workaround for passivetex lack of support for non-constant expressions --> |
---|
376 | <xsl:when test="$passivetex.extensions != 0"> |
---|
377 | <xsl:text>em</xsl:text> |
---|
378 | </xsl:when> |
---|
379 | <xsl:otherwise> |
---|
380 | <xsl:text>em * 0.60</xsl:text> |
---|
381 | </xsl:otherwise> |
---|
382 | </xsl:choose> |
---|
383 | </xsl:otherwise> |
---|
384 | </xsl:choose> |
---|
385 | </xsl:when> |
---|
386 | <xsl:otherwise> |
---|
387 | <xsl:call-template name="longest.term"> |
---|
388 | <xsl:with-param name="terms" select="varlistentry/term"/> |
---|
389 | <xsl:with-param name="maxlength" select="$variablelist.max.termlength"/> |
---|
390 | </xsl:call-template> |
---|
391 | <xsl:choose> |
---|
392 | <!-- workaround for passivetex lack of support for non-constant expressions --> |
---|
393 | <xsl:when test="$passivetex.extensions != 0"> |
---|
394 | <xsl:text>em</xsl:text> |
---|
395 | </xsl:when> |
---|
396 | <xsl:otherwise> |
---|
397 | <xsl:text>em * 0.60</xsl:text> |
---|
398 | </xsl:otherwise> |
---|
399 | </xsl:choose> |
---|
400 | </xsl:otherwise> |
---|
401 | </xsl:choose> |
---|
402 | </xsl:variable> |
---|
403 | |
---|
404 | <!-- |
---|
405 | <xsl:message> |
---|
406 | <xsl:text>term width: </xsl:text> |
---|
407 | <xsl:value-of select="$termlength"/> |
---|
408 | </xsl:message> |
---|
409 | --> |
---|
410 | |
---|
411 | <xsl:variable name="label-separation">1em</xsl:variable> |
---|
412 | <xsl:variable name="distance-between-starts"> |
---|
413 | <xsl:choose> |
---|
414 | <!-- workaround for passivetex lack of support for non-constant expressions --> |
---|
415 | <xsl:when test="$passivetex.extensions != 0"> |
---|
416 | <xsl:value-of select="$termlength"/> |
---|
417 | </xsl:when> |
---|
418 | <xsl:otherwise> |
---|
419 | <xsl:value-of select="$termlength"/> |
---|
420 | <xsl:text>+</xsl:text> |
---|
421 | <xsl:value-of select="$label-separation"/> |
---|
422 | </xsl:otherwise> |
---|
423 | </xsl:choose> |
---|
424 | </xsl:variable> |
---|
425 | |
---|
426 | <xsl:if test="title"> |
---|
427 | <xsl:apply-templates select="title" mode="list.title.mode"/> |
---|
428 | </xsl:if> |
---|
429 | |
---|
430 | <!-- Preserve order of PIs and comments --> |
---|
431 | <xsl:apply-templates |
---|
432 | select="*[not(self::varlistentry |
---|
433 | or self::title |
---|
434 | or self::titleabbrev)] |
---|
435 | |comment()[not(preceding-sibling::varlistentry)] |
---|
436 | |processing-instruction()[not(preceding-sibling::varlistentry)]"/> |
---|
437 | |
---|
438 | <xsl:variable name="content"> |
---|
439 | <xsl:apply-templates mode="vl.as.list" |
---|
440 | select="varlistentry |
---|
441 | |comment()[preceding-sibling::varlistentry] |
---|
442 | |processing-instruction()[preceding-sibling::varlistentry]"/> |
---|
443 | </xsl:variable> |
---|
444 | |
---|
445 | <!-- nested lists don't add extra list-block spacing --> |
---|
446 | <xsl:choose> |
---|
447 | <xsl:when test="ancestor::listitem"> |
---|
448 | <fo:list-block id="{$id}" |
---|
449 | provisional-distance-between-starts= |
---|
450 | "{$distance-between-starts}" |
---|
451 | provisional-label-separation="{$label-separation}"> |
---|
452 | <xsl:copy-of select="$content"/> |
---|
453 | </fo:list-block> |
---|
454 | </xsl:when> |
---|
455 | <xsl:otherwise> |
---|
456 | <fo:list-block id="{$id}" |
---|
457 | provisional-distance-between-starts= |
---|
458 | "{$distance-between-starts}" |
---|
459 | provisional-label-separation="{$label-separation}" |
---|
460 | xsl:use-attribute-sets="list.block.spacing"> |
---|
461 | <xsl:copy-of select="$content"/> |
---|
462 | </fo:list-block> |
---|
463 | </xsl:otherwise> |
---|
464 | </xsl:choose> |
---|
465 | </xsl:template> |
---|
466 | |
---|
467 | <xsl:template name="longest.term"> |
---|
468 | <xsl:param name="longest" select="0"/> |
---|
469 | <xsl:param name="terms" select="."/> |
---|
470 | <xsl:param name="maxlength" select="-1"/> |
---|
471 | |
---|
472 | <!-- Process out any indexterms in the term --> |
---|
473 | <xsl:variable name="term.text"> |
---|
474 | <xsl:apply-templates select="$terms[1]"/> |
---|
475 | </xsl:variable> |
---|
476 | |
---|
477 | <xsl:choose> |
---|
478 | <xsl:when test="$longest > $maxlength and $maxlength > 0"> |
---|
479 | <xsl:value-of select="$maxlength"/> |
---|
480 | </xsl:when> |
---|
481 | <xsl:when test="not($terms)"> |
---|
482 | <xsl:value-of select="$longest"/> |
---|
483 | </xsl:when> |
---|
484 | <xsl:when test="string-length($term.text) > $longest"> |
---|
485 | <xsl:call-template name="longest.term"> |
---|
486 | <xsl:with-param name="longest" |
---|
487 | select="string-length($term.text)"/> |
---|
488 | <xsl:with-param name="maxlength" select="$maxlength"/> |
---|
489 | <xsl:with-param name="terms" select="$terms[position() > 1]"/> |
---|
490 | </xsl:call-template> |
---|
491 | </xsl:when> |
---|
492 | <xsl:otherwise> |
---|
493 | <xsl:call-template name="longest.term"> |
---|
494 | <xsl:with-param name="longest" select="$longest"/> |
---|
495 | <xsl:with-param name="maxlength" select="$maxlength"/> |
---|
496 | <xsl:with-param name="terms" select="$terms[position() > 1]"/> |
---|
497 | </xsl:call-template> |
---|
498 | </xsl:otherwise> |
---|
499 | </xsl:choose> |
---|
500 | </xsl:template> |
---|
501 | |
---|
502 | <xsl:template match="varlistentry" mode="vl.as.list"> |
---|
503 | <xsl:variable name="id"> |
---|
504 | <xsl:call-template name="object.id"/> |
---|
505 | </xsl:variable> |
---|
506 | <xsl:variable name="item.contents"> |
---|
507 | <fo:list-item-label end-indent="label-end()" text-align="start"> |
---|
508 | <fo:block> |
---|
509 | <xsl:apply-templates select="term"/> |
---|
510 | </fo:block> |
---|
511 | </fo:list-item-label> |
---|
512 | <fo:list-item-body start-indent="body-start()"> |
---|
513 | <fo:block> |
---|
514 | <xsl:apply-templates select="listitem"/> |
---|
515 | </fo:block> |
---|
516 | </fo:list-item-body> |
---|
517 | </xsl:variable> |
---|
518 | |
---|
519 | <xsl:choose> |
---|
520 | <xsl:when test="parent::*/@spacing = 'compact'"> |
---|
521 | <fo:list-item id="{$id}" |
---|
522 | xsl:use-attribute-sets="compact.list.item.spacing"> |
---|
523 | <xsl:copy-of select="$item.contents"/> |
---|
524 | </fo:list-item> |
---|
525 | </xsl:when> |
---|
526 | <xsl:otherwise> |
---|
527 | <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing"> |
---|
528 | <xsl:copy-of select="$item.contents"/> |
---|
529 | </fo:list-item> |
---|
530 | </xsl:otherwise> |
---|
531 | </xsl:choose> |
---|
532 | </xsl:template> |
---|
533 | |
---|
534 | |
---|
535 | <xsl:template match="variablelist" mode="vl.as.blocks"> |
---|
536 | <xsl:variable name="id"> |
---|
537 | <xsl:call-template name="object.id"/> |
---|
538 | </xsl:variable> |
---|
539 | |
---|
540 | <!-- termlength is irrelevant --> |
---|
541 | |
---|
542 | <xsl:if test="title"> |
---|
543 | <xsl:apply-templates select="title" mode="list.title.mode"/> |
---|
544 | </xsl:if> |
---|
545 | |
---|
546 | <!-- Preserve order of PIs and comments --> |
---|
547 | <xsl:apply-templates |
---|
548 | select="*[not(self::varlistentry |
---|
549 | or self::title |
---|
550 | or self::titleabbrev)] |
---|
551 | |comment()[not(preceding-sibling::varlistentry)] |
---|
552 | |processing-instruction()[not(preceding-sibling::varlistentry)]"/> |
---|
553 | |
---|
554 | <xsl:variable name="content"> |
---|
555 | <xsl:apply-templates mode="vl.as.blocks" |
---|
556 | select="varlistentry |
---|
557 | |comment()[preceding-sibling::varlistentry] |
---|
558 | |processing-instruction()[preceding-sibling::varlistentry]"/> |
---|
559 | </xsl:variable> |
---|
560 | |
---|
561 | <!-- nested lists don't add extra list-block spacing --> |
---|
562 | <xsl:choose> |
---|
563 | <xsl:when test="ancestor::listitem"> |
---|
564 | <fo:block id="{$id}"> |
---|
565 | <xsl:copy-of select="$content"/> |
---|
566 | </fo:block> |
---|
567 | </xsl:when> |
---|
568 | <xsl:otherwise> |
---|
569 | <fo:block id="{$id}" xsl:use-attribute-sets="list.block.spacing"> |
---|
570 | <xsl:copy-of select="$content"/> |
---|
571 | </fo:block> |
---|
572 | </xsl:otherwise> |
---|
573 | </xsl:choose> |
---|
574 | </xsl:template> |
---|
575 | |
---|
576 | <xsl:template match="varlistentry" mode="vl.as.blocks"> |
---|
577 | <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable> |
---|
578 | |
---|
579 | <fo:block id="{$id}" xsl:use-attribute-sets="list.item.spacing" |
---|
580 | keep-together.within-column="always" |
---|
581 | keep-with-next.within-column="always"> |
---|
582 | <xsl:apply-templates select="term"/> |
---|
583 | </fo:block> |
---|
584 | |
---|
585 | <fo:block margin-left="0.25in"> |
---|
586 | <xsl:apply-templates select="listitem"/> |
---|
587 | </fo:block> |
---|
588 | </xsl:template> |
---|
589 | |
---|
590 | <xsl:template match="varlistentry/term"> |
---|
591 | <fo:inline> |
---|
592 | <xsl:call-template name="simple.xlink"> |
---|
593 | <xsl:with-param name="content"> |
---|
594 | <xsl:apply-templates/> |
---|
595 | </xsl:with-param> |
---|
596 | </xsl:call-template> |
---|
597 | </fo:inline> |
---|
598 | <xsl:choose> |
---|
599 | <xsl:when test="not(following-sibling::term)"/> <!-- do nothing --> |
---|
600 | <xsl:otherwise> |
---|
601 | <!-- * if we have multiple terms in the same varlistentry, generate --> |
---|
602 | <!-- * a separator (", " by default) and/or an additional line --> |
---|
603 | <!-- * break after each one except the last --> |
---|
604 | <fo:inline><xsl:value-of select="$variablelist.term.separator"/></fo:inline> |
---|
605 | <xsl:if test="not($variablelist.term.break.after = '0')"> |
---|
606 | <fo:block/> |
---|
607 | </xsl:if> |
---|
608 | </xsl:otherwise> |
---|
609 | </xsl:choose> |
---|
610 | </xsl:template> |
---|
611 | |
---|
612 | <xsl:template match="varlistentry/listitem"> |
---|
613 | <xsl:apply-templates/> |
---|
614 | </xsl:template> |
---|
615 | |
---|
616 | <!-- ==================================================================== --> |
---|
617 | |
---|
618 | <xsl:template match="title" mode="list.title.mode"> |
---|
619 | <xsl:call-template name="formal.object.heading"> |
---|
620 | <xsl:with-param name="object" select=".."/> |
---|
621 | </xsl:call-template> |
---|
622 | </xsl:template> |
---|
623 | |
---|
624 | <!-- ==================================================================== --> |
---|
625 | |
---|
626 | <xsl:template match="simplelist|simplelist[@type='vert']"> |
---|
627 | <!-- with no type specified, the default is 'vert' --> |
---|
628 | |
---|
629 | <xsl:variable name="explicit.table.width"> |
---|
630 | <xsl:call-template name="dbfo-attribute"> |
---|
631 | <xsl:with-param name="pis" |
---|
632 | select="processing-instruction('dbfo')"/> |
---|
633 | <xsl:with-param name="attribute" select="'list-width'"/> |
---|
634 | </xsl:call-template> |
---|
635 | </xsl:variable> |
---|
636 | |
---|
637 | <xsl:variable name="table.width"> |
---|
638 | <xsl:choose> |
---|
639 | <xsl:when test="$explicit.table.width != ''"> |
---|
640 | <xsl:value-of select="$explicit.table.width"/> |
---|
641 | </xsl:when> |
---|
642 | <xsl:when test="$default.table.width = ''"> |
---|
643 | <xsl:text>100%</xsl:text> |
---|
644 | </xsl:when> |
---|
645 | <xsl:otherwise> |
---|
646 | <xsl:value-of select="$default.table.width"/> |
---|
647 | </xsl:otherwise> |
---|
648 | </xsl:choose> |
---|
649 | </xsl:variable> |
---|
650 | |
---|
651 | <fo:table xsl:use-attribute-sets="normal.para.spacing"> |
---|
652 | |
---|
653 | <xsl:choose> |
---|
654 | <xsl:when test="$axf.extensions != 0 or $xep.extensions != 0"> |
---|
655 | <xsl:attribute name="table-layout">auto</xsl:attribute> |
---|
656 | <xsl:if test="$explicit.table.width != ''"> |
---|
657 | <xsl:attribute name="width"><xsl:value-of |
---|
658 | select="$explicit.table.width"/></xsl:attribute> |
---|
659 | </xsl:if> |
---|
660 | </xsl:when> |
---|
661 | <xsl:otherwise> |
---|
662 | <xsl:attribute name="table-layout">fixed</xsl:attribute> |
---|
663 | <xsl:attribute name="width"><xsl:value-of |
---|
664 | select="$table.width"/></xsl:attribute> |
---|
665 | </xsl:otherwise> |
---|
666 | </xsl:choose> |
---|
667 | |
---|
668 | <xsl:call-template name="simplelist.table.columns"> |
---|
669 | <xsl:with-param name="cols"> |
---|
670 | <xsl:choose> |
---|
671 | <xsl:when test="@columns"> |
---|
672 | <xsl:value-of select="@columns"/> |
---|
673 | </xsl:when> |
---|
674 | <xsl:otherwise>1</xsl:otherwise> |
---|
675 | </xsl:choose> |
---|
676 | </xsl:with-param> |
---|
677 | </xsl:call-template> |
---|
678 | <fo:table-body start-indent="0pt" end-indent="0pt"> |
---|
679 | <xsl:call-template name="simplelist.vert"> |
---|
680 | <xsl:with-param name="cols"> |
---|
681 | <xsl:choose> |
---|
682 | <xsl:when test="@columns"> |
---|
683 | <xsl:value-of select="@columns"/> |
---|
684 | </xsl:when> |
---|
685 | <xsl:otherwise>1</xsl:otherwise> |
---|
686 | </xsl:choose> |
---|
687 | </xsl:with-param> |
---|
688 | </xsl:call-template> |
---|
689 | </fo:table-body> |
---|
690 | </fo:table> |
---|
691 | </xsl:template> |
---|
692 | |
---|
693 | <xsl:template match="simplelist[@type='inline']"> |
---|
694 | <!-- if dbchoice PI exists, use that to determine the choice separator --> |
---|
695 | <!-- (that is, equivalent of "and" or "or" in current locale), or literal --> |
---|
696 | <!-- value of "choice" otherwise --> |
---|
697 | <fo:inline><xsl:variable name="localized-choice-separator"> |
---|
698 | <xsl:choose> |
---|
699 | <xsl:when test="processing-instruction('dbchoice')"> |
---|
700 | <xsl:call-template name="select.choice.separator"/> |
---|
701 | </xsl:when> |
---|
702 | <xsl:otherwise> |
---|
703 | <!-- empty --> |
---|
704 | </xsl:otherwise> |
---|
705 | </xsl:choose> |
---|
706 | </xsl:variable> |
---|
707 | |
---|
708 | <xsl:for-each select="member"> |
---|
709 | <xsl:apply-templates/> |
---|
710 | <xsl:choose> |
---|
711 | <xsl:when test="position() = last()"/> <!-- do nothing --> |
---|
712 | <xsl:otherwise> |
---|
713 | <xsl:text>, </xsl:text> |
---|
714 | <xsl:if test="position() = last() - 1"> |
---|
715 | <xsl:if test="$localized-choice-separator != ''"> |
---|
716 | <xsl:value-of select="$localized-choice-separator"/> |
---|
717 | <xsl:text> </xsl:text> |
---|
718 | </xsl:if> |
---|
719 | </xsl:if> |
---|
720 | </xsl:otherwise> |
---|
721 | </xsl:choose> |
---|
722 | </xsl:for-each></fo:inline> |
---|
723 | </xsl:template> |
---|
724 | |
---|
725 | <xsl:template match="simplelist[@type='horiz']"> |
---|
726 | |
---|
727 | <xsl:variable name="explicit.table.width"> |
---|
728 | <xsl:call-template name="pi.dbfo_list-width"/> |
---|
729 | </xsl:variable> |
---|
730 | |
---|
731 | <xsl:variable name="table.width"> |
---|
732 | <xsl:choose> |
---|
733 | <xsl:when test="$explicit.table.width != ''"> |
---|
734 | <xsl:value-of select="$explicit.table.width"/> |
---|
735 | </xsl:when> |
---|
736 | <xsl:when test="$default.table.width = ''"> |
---|
737 | <xsl:text>100%</xsl:text> |
---|
738 | </xsl:when> |
---|
739 | <xsl:otherwise> |
---|
740 | <xsl:value-of select="$default.table.width"/> |
---|
741 | </xsl:otherwise> |
---|
742 | </xsl:choose> |
---|
743 | </xsl:variable> |
---|
744 | |
---|
745 | <fo:table xsl:use-attribute-sets="normal.para.spacing"> |
---|
746 | <xsl:choose> |
---|
747 | <xsl:when test="$axf.extensions != 0 or $xep.extensions != 0"> |
---|
748 | <xsl:attribute name="table-layout">auto</xsl:attribute> |
---|
749 | <xsl:if test="$explicit.table.width != ''"> |
---|
750 | <xsl:attribute name="width"><xsl:value-of |
---|
751 | select="$explicit.table.width"/></xsl:attribute> |
---|
752 | </xsl:if> |
---|
753 | </xsl:when> |
---|
754 | <xsl:otherwise> |
---|
755 | <xsl:attribute name="table-layout">fixed</xsl:attribute> |
---|
756 | <xsl:attribute name="width"><xsl:value-of |
---|
757 | select="$table.width"/></xsl:attribute> |
---|
758 | </xsl:otherwise> |
---|
759 | </xsl:choose> |
---|
760 | <xsl:call-template name="simplelist.table.columns"> |
---|
761 | <xsl:with-param name="cols"> |
---|
762 | <xsl:choose> |
---|
763 | <xsl:when test="@columns"> |
---|
764 | <xsl:value-of select="@columns"/> |
---|
765 | </xsl:when> |
---|
766 | <xsl:otherwise>1</xsl:otherwise> |
---|
767 | </xsl:choose> |
---|
768 | </xsl:with-param> |
---|
769 | </xsl:call-template> |
---|
770 | <fo:table-body start-indent="0pt" end-indent="0pt"> |
---|
771 | <xsl:call-template name="simplelist.horiz"> |
---|
772 | <xsl:with-param name="cols"> |
---|
773 | <xsl:choose> |
---|
774 | <xsl:when test="@columns"> |
---|
775 | <xsl:value-of select="@columns"/> |
---|
776 | </xsl:when> |
---|
777 | <xsl:otherwise>1</xsl:otherwise> |
---|
778 | </xsl:choose> |
---|
779 | </xsl:with-param> |
---|
780 | </xsl:call-template> |
---|
781 | </fo:table-body> |
---|
782 | </fo:table> |
---|
783 | </xsl:template> |
---|
784 | |
---|
785 | <xsl:template name="simplelist.table.columns"> |
---|
786 | <xsl:param name="cols" select="1"/> |
---|
787 | <xsl:param name="curcol" select="1"/> |
---|
788 | <fo:table-column column-number="{$curcol}" |
---|
789 | column-width="proportional-column-width(1)"/> |
---|
790 | <xsl:if test="$curcol < $cols"> |
---|
791 | <xsl:call-template name="simplelist.table.columns"> |
---|
792 | <xsl:with-param name="cols" select="$cols"/> |
---|
793 | <xsl:with-param name="curcol" select="$curcol + 1"/> |
---|
794 | </xsl:call-template> |
---|
795 | </xsl:if> |
---|
796 | </xsl:template> |
---|
797 | |
---|
798 | <xsl:template name="simplelist.horiz"> |
---|
799 | <xsl:param name="cols">1</xsl:param> |
---|
800 | <xsl:param name="cell">1</xsl:param> |
---|
801 | <xsl:param name="members" select="./member"/> |
---|
802 | |
---|
803 | <xsl:if test="$cell <= count($members)"> |
---|
804 | <fo:table-row> |
---|
805 | <xsl:call-template name="simplelist.horiz.row"> |
---|
806 | <xsl:with-param name="cols" select="$cols"/> |
---|
807 | <xsl:with-param name="cell" select="$cell"/> |
---|
808 | <xsl:with-param name="members" select="$members"/> |
---|
809 | </xsl:call-template> |
---|
810 | </fo:table-row> |
---|
811 | <xsl:call-template name="simplelist.horiz"> |
---|
812 | <xsl:with-param name="cols" select="$cols"/> |
---|
813 | <xsl:with-param name="cell" select="$cell + $cols"/> |
---|
814 | <xsl:with-param name="members" select="$members"/> |
---|
815 | </xsl:call-template> |
---|
816 | </xsl:if> |
---|
817 | </xsl:template> |
---|
818 | |
---|
819 | <xsl:template name="simplelist.horiz.row"> |
---|
820 | <xsl:param name="cols">1</xsl:param> |
---|
821 | <xsl:param name="cell">1</xsl:param> |
---|
822 | <xsl:param name="members" select="./member"/> |
---|
823 | <xsl:param name="curcol">1</xsl:param> |
---|
824 | |
---|
825 | <xsl:if test="$curcol <= $cols"> |
---|
826 | <fo:table-cell> |
---|
827 | <fo:block> |
---|
828 | <xsl:if test="$members[position()=$cell]"> |
---|
829 | <xsl:apply-templates select="$members[position()=$cell]"/> |
---|
830 | </xsl:if> |
---|
831 | </fo:block> |
---|
832 | </fo:table-cell> |
---|
833 | <xsl:call-template name="simplelist.horiz.row"> |
---|
834 | <xsl:with-param name="cols" select="$cols"/> |
---|
835 | <xsl:with-param name="cell" select="$cell+1"/> |
---|
836 | <xsl:with-param name="members" select="$members"/> |
---|
837 | <xsl:with-param name="curcol" select="$curcol+1"/> |
---|
838 | </xsl:call-template> |
---|
839 | </xsl:if> |
---|
840 | </xsl:template> |
---|
841 | |
---|
842 | <xsl:template name="simplelist.vert"> |
---|
843 | <xsl:param name="cols">1</xsl:param> |
---|
844 | <xsl:param name="cell">1</xsl:param> |
---|
845 | <xsl:param name="members" select="./member"/> |
---|
846 | <xsl:param name="rows" |
---|
847 | select="floor((count($members)+$cols - 1) div $cols)"/> |
---|
848 | |
---|
849 | <xsl:if test="$cell <= $rows"> |
---|
850 | <fo:table-row> |
---|
851 | <xsl:call-template name="simplelist.vert.row"> |
---|
852 | <xsl:with-param name="cols" select="$cols"/> |
---|
853 | <xsl:with-param name="rows" select="$rows"/> |
---|
854 | <xsl:with-param name="cell" select="$cell"/> |
---|
855 | <xsl:with-param name="members" select="$members"/> |
---|
856 | </xsl:call-template> |
---|
857 | </fo:table-row> |
---|
858 | <xsl:call-template name="simplelist.vert"> |
---|
859 | <xsl:with-param name="cols" select="$cols"/> |
---|
860 | <xsl:with-param name="cell" select="$cell+1"/> |
---|
861 | <xsl:with-param name="members" select="$members"/> |
---|
862 | <xsl:with-param name="rows" select="$rows"/> |
---|
863 | </xsl:call-template> |
---|
864 | </xsl:if> |
---|
865 | </xsl:template> |
---|
866 | |
---|
867 | <xsl:template name="simplelist.vert.row"> |
---|
868 | <xsl:param name="cols">1</xsl:param> |
---|
869 | <xsl:param name="rows">1</xsl:param> |
---|
870 | <xsl:param name="cell">1</xsl:param> |
---|
871 | <xsl:param name="members" select="./member"/> |
---|
872 | <xsl:param name="curcol">1</xsl:param> |
---|
873 | |
---|
874 | <xsl:if test="$curcol <= $cols"> |
---|
875 | <fo:table-cell> |
---|
876 | <fo:block> |
---|
877 | <xsl:if test="$members[position()=$cell]"> |
---|
878 | <xsl:apply-templates select="$members[position()=$cell]"/> |
---|
879 | </xsl:if> |
---|
880 | </fo:block> |
---|
881 | </fo:table-cell> |
---|
882 | <xsl:call-template name="simplelist.vert.row"> |
---|
883 | <xsl:with-param name="cols" select="$cols"/> |
---|
884 | <xsl:with-param name="rows" select="$rows"/> |
---|
885 | <xsl:with-param name="cell" select="$cell+$rows"/> |
---|
886 | <xsl:with-param name="members" select="$members"/> |
---|
887 | <xsl:with-param name="curcol" select="$curcol+1"/> |
---|
888 | </xsl:call-template> |
---|
889 | </xsl:if> |
---|
890 | </xsl:template> |
---|
891 | |
---|
892 | <xsl:template match="member"> |
---|
893 | <xsl:call-template name="simple.xlink"> |
---|
894 | <xsl:with-param name="content"> |
---|
895 | <xsl:apply-templates/> |
---|
896 | </xsl:with-param> |
---|
897 | </xsl:call-template> |
---|
898 | </xsl:template> |
---|
899 | |
---|
900 | <!-- ==================================================================== --> |
---|
901 | |
---|
902 | <xsl:template match="procedure"> |
---|
903 | <xsl:variable name="id"> |
---|
904 | <xsl:call-template name="object.id"/> |
---|
905 | </xsl:variable> |
---|
906 | |
---|
907 | <xsl:variable name="param.placement" |
---|
908 | select="substring-after(normalize-space($formal.title.placement), |
---|
909 | concat(local-name(.), ' '))"/> |
---|
910 | |
---|
911 | <xsl:variable name="placement"> |
---|
912 | <xsl:choose> |
---|
913 | <xsl:when test="contains($param.placement, ' ')"> |
---|
914 | <xsl:value-of select="substring-before($param.placement, ' ')"/> |
---|
915 | </xsl:when> |
---|
916 | <xsl:when test="$param.placement = ''">before</xsl:when> |
---|
917 | <xsl:otherwise> |
---|
918 | <xsl:value-of select="$param.placement"/> |
---|
919 | </xsl:otherwise> |
---|
920 | </xsl:choose> |
---|
921 | </xsl:variable> |
---|
922 | |
---|
923 | <!-- Preserve order of PIs and comments --> |
---|
924 | <xsl:variable name="preamble" |
---|
925 | select="*[not(self::step |
---|
926 | or self::title |
---|
927 | or self::titleabbrev)] |
---|
928 | |comment()[not(preceding-sibling::step)] |
---|
929 | |processing-instruction()[not(preceding-sibling::step)]"/> |
---|
930 | |
---|
931 | <xsl:variable name="steps" |
---|
932 | select="step |
---|
933 | |comment()[preceding-sibling::step] |
---|
934 | |processing-instruction()[preceding-sibling::step]"/> |
---|
935 | |
---|
936 | <fo:block id="{$id}" xsl:use-attribute-sets="procedure.properties list.block.spacing"> |
---|
937 | <xsl:if test="./title and $placement = 'before'"> |
---|
938 | <!-- n.b. gentext code tests for $formal.procedures and may make an "informal" --> |
---|
939 | <!-- heading even though we called formal.object.heading. odd but true. --> |
---|
940 | <xsl:call-template name="formal.object.heading"/> |
---|
941 | </xsl:if> |
---|
942 | |
---|
943 | <xsl:apply-templates select="$preamble"/> |
---|
944 | |
---|
945 | <fo:list-block xsl:use-attribute-sets="list.block.spacing" |
---|
946 | provisional-distance-between-starts="2em" |
---|
947 | provisional-label-separation="0.2em"> |
---|
948 | <xsl:apply-templates select="$steps"/> |
---|
949 | </fo:list-block> |
---|
950 | |
---|
951 | <xsl:if test="./title and $placement != 'before'"> |
---|
952 | <!-- n.b. gentext code tests for $formal.procedures and may make an "informal" --> |
---|
953 | <!-- heading even though we called formal.object.heading. odd but true. --> |
---|
954 | <xsl:call-template name="formal.object.heading"/> |
---|
955 | </xsl:if> |
---|
956 | </fo:block> |
---|
957 | </xsl:template> |
---|
958 | |
---|
959 | <xsl:template match="procedure/title"> |
---|
960 | </xsl:template> |
---|
961 | |
---|
962 | <xsl:template match="substeps"> |
---|
963 | <fo:list-block xsl:use-attribute-sets="list.block.spacing" |
---|
964 | provisional-distance-between-starts="2em" |
---|
965 | provisional-label-separation="0.2em"> |
---|
966 | <xsl:apply-templates/> |
---|
967 | </fo:list-block> |
---|
968 | </xsl:template> |
---|
969 | |
---|
970 | <xsl:template match="procedure/step|substeps/step"> |
---|
971 | <xsl:variable name="id"> |
---|
972 | <xsl:call-template name="object.id"/> |
---|
973 | </xsl:variable> |
---|
974 | |
---|
975 | <fo:list-item xsl:use-attribute-sets="list.item.spacing"> |
---|
976 | <fo:list-item-label end-indent="label-end()"> |
---|
977 | <fo:block id="{$id}"> |
---|
978 | <!-- dwc: fix for one step procedures. Use a bullet if there's no step 2 --> |
---|
979 | <xsl:choose> |
---|
980 | <xsl:when test="count(../step) = 1"> |
---|
981 | <xsl:text>•</xsl:text> |
---|
982 | </xsl:when> |
---|
983 | <xsl:otherwise> |
---|
984 | <xsl:apply-templates select="." mode="number"> |
---|
985 | <xsl:with-param name="recursive" select="0"/> |
---|
986 | </xsl:apply-templates>. |
---|
987 | </xsl:otherwise> |
---|
988 | </xsl:choose> |
---|
989 | </fo:block> |
---|
990 | </fo:list-item-label> |
---|
991 | <fo:list-item-body start-indent="body-start()"> |
---|
992 | <fo:block> |
---|
993 | <xsl:apply-templates/> |
---|
994 | </fo:block> |
---|
995 | </fo:list-item-body> |
---|
996 | </fo:list-item> |
---|
997 | </xsl:template> |
---|
998 | |
---|
999 | <xsl:template match="stepalternatives"> |
---|
1000 | <fo:list-block provisional-distance-between-starts="2em" |
---|
1001 | provisional-label-separation="0.2em"> |
---|
1002 | <xsl:apply-templates select="step"/> |
---|
1003 | </fo:list-block> |
---|
1004 | </xsl:template> |
---|
1005 | |
---|
1006 | <xsl:template match="stepalternatives/step"> |
---|
1007 | <xsl:variable name="id"> |
---|
1008 | <xsl:call-template name="object.id"/> |
---|
1009 | </xsl:variable> |
---|
1010 | |
---|
1011 | <fo:list-item xsl:use-attribute-sets="list.item.spacing"> |
---|
1012 | <fo:list-item-label end-indent="label-end()"> |
---|
1013 | <fo:block id="{$id}"> |
---|
1014 | <xsl:text>•</xsl:text> |
---|
1015 | </fo:block> |
---|
1016 | </fo:list-item-label> |
---|
1017 | <fo:list-item-body start-indent="body-start()"> |
---|
1018 | <fo:block> |
---|
1019 | <xsl:apply-templates/> |
---|
1020 | </fo:block> |
---|
1021 | </fo:list-item-body> |
---|
1022 | </fo:list-item> |
---|
1023 | </xsl:template> |
---|
1024 | |
---|
1025 | <xsl:template match="step/title"> |
---|
1026 | <fo:block font-weight="bold" |
---|
1027 | keep-together.within-column="always" |
---|
1028 | keep-with-next.within-column="always"> |
---|
1029 | <xsl:apply-templates/> |
---|
1030 | </fo:block> |
---|
1031 | </xsl:template> |
---|
1032 | |
---|
1033 | <!-- ==================================================================== --> |
---|
1034 | |
---|
1035 | <xsl:template match="segmentedlist"> |
---|
1036 | <xsl:variable name="presentation"> |
---|
1037 | <xsl:call-template name="pi.dbfo_list-presentation"/> |
---|
1038 | </xsl:variable> |
---|
1039 | |
---|
1040 | <xsl:variable name="id"> |
---|
1041 | <xsl:call-template name="object.id"/> |
---|
1042 | </xsl:variable> |
---|
1043 | |
---|
1044 | <xsl:choose> |
---|
1045 | <xsl:when test="$presentation = 'table'"> |
---|
1046 | <fo:block id="{$id}"> |
---|
1047 | <xsl:apply-templates select="." mode="seglist-table"/> |
---|
1048 | </fo:block> |
---|
1049 | </xsl:when> |
---|
1050 | <xsl:when test="$presentation = 'list'"> |
---|
1051 | <fo:block id="{$id}"> |
---|
1052 | <xsl:apply-templates/> |
---|
1053 | </fo:block> |
---|
1054 | </xsl:when> |
---|
1055 | <xsl:when test="$segmentedlist.as.table != 0"> |
---|
1056 | <fo:block id="{$id}"> |
---|
1057 | <xsl:apply-templates select="." mode="seglist-table"/> |
---|
1058 | </fo:block> |
---|
1059 | </xsl:when> |
---|
1060 | <xsl:otherwise> |
---|
1061 | <fo:block id="{$id}"> |
---|
1062 | <xsl:apply-templates/> |
---|
1063 | </fo:block> |
---|
1064 | </xsl:otherwise> |
---|
1065 | </xsl:choose> |
---|
1066 | </xsl:template> |
---|
1067 | |
---|
1068 | <xsl:template match="segmentedlist/title"> |
---|
1069 | <xsl:apply-templates select="." mode="list.title.mode" /> |
---|
1070 | </xsl:template> |
---|
1071 | |
---|
1072 | <xsl:template match="segtitle"> |
---|
1073 | </xsl:template> |
---|
1074 | |
---|
1075 | <xsl:template match="segtitle" mode="segtitle-in-seg"> |
---|
1076 | <xsl:apply-templates/> |
---|
1077 | </xsl:template> |
---|
1078 | |
---|
1079 | <xsl:template match="seglistitem"> |
---|
1080 | <xsl:variable name="id"> |
---|
1081 | <xsl:call-template name="object.id"/> |
---|
1082 | </xsl:variable> |
---|
1083 | <fo:block id="{$id}"> |
---|
1084 | <xsl:apply-templates/> |
---|
1085 | </fo:block> |
---|
1086 | </xsl:template> |
---|
1087 | |
---|
1088 | <xsl:template match="seg"> |
---|
1089 | <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/> |
---|
1090 | <xsl:variable name="seglist" select="ancestor::segmentedlist"/> |
---|
1091 | <xsl:variable name="segtitles" select="$seglist/segtitle"/> |
---|
1092 | |
---|
1093 | <!-- |
---|
1094 | Note: segtitle is only going to be the right thing in a well formed |
---|
1095 | SegmentedList. If there are too many Segs or too few SegTitles, |
---|
1096 | you'll get something odd...maybe an error |
---|
1097 | --> |
---|
1098 | |
---|
1099 | <fo:block> |
---|
1100 | <fo:inline font-weight="bold"> |
---|
1101 | <xsl:apply-templates select="$segtitles[$segnum=position()]" |
---|
1102 | mode="segtitle-in-seg"/> |
---|
1103 | <xsl:text>: </xsl:text> |
---|
1104 | </fo:inline> |
---|
1105 | <xsl:apply-templates/> |
---|
1106 | </fo:block> |
---|
1107 | </xsl:template> |
---|
1108 | |
---|
1109 | <xsl:template match="segmentedlist" mode="seglist-table"> |
---|
1110 | <xsl:apply-templates select="title" mode="list.title.mode" /> |
---|
1111 | <fo:table> |
---|
1112 | <fo:table-column column-number="1" column-width="proportional-column-width(1)"/> |
---|
1113 | <fo:table-column column-number="2" column-width="proportional-column-width(1)"/> |
---|
1114 | <fo:table-header start-indent="0pt" end-indent="0pt"> |
---|
1115 | <fo:table-row> |
---|
1116 | <xsl:apply-templates select="segtitle" mode="seglist-table"/> |
---|
1117 | </fo:table-row> |
---|
1118 | </fo:table-header> |
---|
1119 | <fo:table-body start-indent="0pt" end-indent="0pt"> |
---|
1120 | <xsl:apply-templates select="seglistitem" mode="seglist-table"/> |
---|
1121 | </fo:table-body> |
---|
1122 | </fo:table> |
---|
1123 | </xsl:template> |
---|
1124 | |
---|
1125 | <xsl:template match="segtitle" mode="seglist-table"> |
---|
1126 | <fo:table-cell> |
---|
1127 | <fo:block font-weight="bold"> |
---|
1128 | <xsl:apply-templates/> |
---|
1129 | </fo:block> |
---|
1130 | </fo:table-cell> |
---|
1131 | </xsl:template> |
---|
1132 | |
---|
1133 | <xsl:template match="seglistitem" mode="seglist-table"> |
---|
1134 | <xsl:variable name="id"> |
---|
1135 | <xsl:call-template name="object.id"/> |
---|
1136 | </xsl:variable> |
---|
1137 | <fo:table-row id="{$id}"> |
---|
1138 | <xsl:apply-templates mode="seglist-table"/> |
---|
1139 | </fo:table-row> |
---|
1140 | </xsl:template> |
---|
1141 | |
---|
1142 | <xsl:template match="seg" mode="seglist-table"> |
---|
1143 | <fo:table-cell> |
---|
1144 | <fo:block> |
---|
1145 | <xsl:apply-templates/> |
---|
1146 | </fo:block> |
---|
1147 | </fo:table-cell> |
---|
1148 | </xsl:template> |
---|
1149 | |
---|
1150 | <!-- ==================================================================== --> |
---|
1151 | |
---|
1152 | <xsl:template match="calloutlist"> |
---|
1153 | <xsl:variable name="id"> |
---|
1154 | <xsl:call-template name="object.id"/> |
---|
1155 | </xsl:variable> |
---|
1156 | |
---|
1157 | <fo:block id="{$id}" |
---|
1158 | text-align="{$alignment}"> |
---|
1159 | <!-- The above restores alignment altered by image align attribute --> |
---|
1160 | <xsl:if test="title|info/title"> |
---|
1161 | <xsl:apply-templates select="(title|info/title)[1]" |
---|
1162 | mode="list.title.mode"/> |
---|
1163 | </xsl:if> |
---|
1164 | |
---|
1165 | <!-- Preserve order of PIs and comments --> |
---|
1166 | <xsl:apply-templates |
---|
1167 | select="*[not(self::callout or self::title or self::titleabbrev)] |
---|
1168 | |comment()[not(preceding-sibling::callout)] |
---|
1169 | |processing-instruction()[not(preceding-sibling::callout)]"/> |
---|
1170 | |
---|
1171 | <fo:list-block space-before.optimum="1em" |
---|
1172 | space-before.minimum="0.8em" |
---|
1173 | space-before.maximum="1.2em" |
---|
1174 | provisional-distance-between-starts="2.2em" |
---|
1175 | provisional-label-separation="0.2em"> |
---|
1176 | <xsl:apply-templates select="callout |
---|
1177 | |comment()[preceding-sibling::callout] |
---|
1178 | |processing-instruction()[preceding-sibling::callout]"/> |
---|
1179 | </fo:list-block> |
---|
1180 | </fo:block> |
---|
1181 | </xsl:template> |
---|
1182 | |
---|
1183 | <xsl:template match="calloutlist/title"> |
---|
1184 | </xsl:template> |
---|
1185 | |
---|
1186 | <xsl:template match="callout"> |
---|
1187 | <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable> |
---|
1188 | <fo:list-item id="{$id}"> |
---|
1189 | <fo:list-item-label end-indent="label-end()"> |
---|
1190 | <fo:block> |
---|
1191 | <xsl:call-template name="callout.arearefs"> |
---|
1192 | <xsl:with-param name="arearefs" select="@arearefs"/> |
---|
1193 | </xsl:call-template> |
---|
1194 | </fo:block> |
---|
1195 | </fo:list-item-label> |
---|
1196 | <fo:list-item-body start-indent="body-start()"> |
---|
1197 | <fo:block> |
---|
1198 | <xsl:apply-templates/> |
---|
1199 | </fo:block> |
---|
1200 | </fo:list-item-body> |
---|
1201 | </fo:list-item> |
---|
1202 | </xsl:template> |
---|
1203 | |
---|
1204 | <xsl:template name="callout.arearefs"> |
---|
1205 | <xsl:param name="arearefs"></xsl:param> |
---|
1206 | <xsl:if test="$arearefs!=''"> |
---|
1207 | <xsl:choose> |
---|
1208 | <xsl:when test="substring-before($arearefs,' ')=''"> |
---|
1209 | <xsl:call-template name="callout.arearef"> |
---|
1210 | <xsl:with-param name="arearef" select="$arearefs"/> |
---|
1211 | </xsl:call-template> |
---|
1212 | </xsl:when> |
---|
1213 | <xsl:otherwise> |
---|
1214 | <xsl:call-template name="callout.arearef"> |
---|
1215 | <xsl:with-param name="arearef" |
---|
1216 | select="substring-before($arearefs,' ')"/> |
---|
1217 | </xsl:call-template> |
---|
1218 | </xsl:otherwise> |
---|
1219 | </xsl:choose> |
---|
1220 | <xsl:call-template name="callout.arearefs"> |
---|
1221 | <xsl:with-param name="arearefs" |
---|
1222 | select="substring-after($arearefs,' ')"/> |
---|
1223 | </xsl:call-template> |
---|
1224 | </xsl:if> |
---|
1225 | </xsl:template> |
---|
1226 | |
---|
1227 | <xsl:template name="callout.arearef"> |
---|
1228 | <xsl:param name="arearef"></xsl:param> |
---|
1229 | <xsl:variable name="targets" select="key('id',$arearef)"/> |
---|
1230 | <xsl:variable name="target" select="$targets[1]"/> |
---|
1231 | |
---|
1232 | <xsl:choose> |
---|
1233 | <xsl:when test="count($target)=0"> |
---|
1234 | <xsl:value-of select="$arearef"/> |
---|
1235 | <xsl:text>: ???</xsl:text> |
---|
1236 | </xsl:when> |
---|
1237 | <xsl:when test="local-name($target)='co'"> |
---|
1238 | <xsl:apply-templates select="$target" mode="callout-bug"/> |
---|
1239 | </xsl:when> |
---|
1240 | <xsl:when test="local-name($target)='areaset'"> |
---|
1241 | <xsl:call-template name="callout-bug"> |
---|
1242 | <xsl:with-param name="conum"> |
---|
1243 | <xsl:apply-templates select="$target" mode="conumber"/> |
---|
1244 | </xsl:with-param> |
---|
1245 | </xsl:call-template> |
---|
1246 | </xsl:when> |
---|
1247 | <xsl:when test="local-name($target)='area'"> |
---|
1248 | <xsl:choose> |
---|
1249 | <xsl:when test="$target/parent::areaset"> |
---|
1250 | <xsl:call-template name="callout-bug"> |
---|
1251 | <xsl:with-param name="conum"> |
---|
1252 | <xsl:apply-templates select="$target/parent::areaset" |
---|
1253 | mode="conumber"/> |
---|
1254 | </xsl:with-param> |
---|
1255 | </xsl:call-template> |
---|
1256 | </xsl:when> |
---|
1257 | <xsl:otherwise> |
---|
1258 | <xsl:call-template name="callout-bug"> |
---|
1259 | <xsl:with-param name="conum"> |
---|
1260 | <xsl:apply-templates select="$target" mode="conumber"/> |
---|
1261 | </xsl:with-param> |
---|
1262 | </xsl:call-template> |
---|
1263 | </xsl:otherwise> |
---|
1264 | </xsl:choose> |
---|
1265 | </xsl:when> |
---|
1266 | <xsl:otherwise> |
---|
1267 | <xsl:text>???</xsl:text> |
---|
1268 | </xsl:otherwise> |
---|
1269 | </xsl:choose> |
---|
1270 | </xsl:template> |
---|
1271 | |
---|
1272 | <!-- ==================================================================== --> |
---|
1273 | |
---|
1274 | </xsl:stylesheet> |
---|
1275 | |
---|