2 <xsl:stylesheet exclude-result-prefixes="d"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:d="http://docbook.org/ns/docbook"
5 xmlns:fo="http://www.w3.org/1999/XSL/Format"
8 <!-- ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://cdn.docbook.org/release/xsl/current/ for
12 copyright and other information.
14 ******************************************************************** -->
16 <!-- ==================================================================== -->
18 <xsl:template match="d:itemizedlist">
19 <xsl:variable name="id">
20 <xsl:call-template name="object.id"/>
23 <xsl:variable name="keep.together">
24 <xsl:call-template name="pi.dbfo_keep-together"/>
27 <xsl:variable name="pi-label-width">
28 <xsl:call-template name="pi.dbfo_label-width"/>
31 <xsl:variable name="label-width">
33 <xsl:when test="$pi-label-width = ''">
34 <xsl:value-of select="$itemizedlist.label.width"/>
37 <xsl:value-of select="$pi-label-width"/>
42 <xsl:if test="d:title">
43 <xsl:apply-templates select="d:title" mode="list.title.mode"/>
46 <!-- Preserve order of PIs and comments -->
48 select="*[not(self::d:listitem
50 or self::d:titleabbrev)]
51 |comment()[not(preceding-sibling::d:listitem)]
52 |processing-instruction()[not(preceding-sibling::d:listitem)]"/>
54 <xsl:variable name="content">
57 |comment()[preceding-sibling::d:listitem]
58 |processing-instruction()[preceding-sibling::d:listitem]"/>
61 <!-- nested lists don't add extra list-block spacing -->
63 <xsl:when test="ancestor::d:listitem">
64 <fo:list-block id="{$id}" xsl:use-attribute-sets="itemizedlist.properties">
65 <xsl:attribute name="provisional-distance-between-starts">
66 <xsl:value-of select="$label-width"/>
68 <xsl:if test="$keep.together != ''">
69 <xsl:attribute name="keep-together.within-column"><xsl:value-of
70 select="$keep.together"/></xsl:attribute>
72 <xsl:copy-of select="$content"/>
76 <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing itemizedlist.properties">
77 <xsl:attribute name="provisional-distance-between-starts">
78 <xsl:value-of select="$label-width"/>
80 <xsl:if test="$keep.together != ''">
81 <xsl:attribute name="keep-together.within-column"><xsl:value-of
82 select="$keep.together"/></xsl:attribute>
84 <xsl:copy-of select="$content"/>
91 <xsl:template match="d:itemizedlist/d:title|d:orderedlist/d:title">
95 <xsl:template match="d:variablelist/d:title" mode="vl.as.list">
99 <xsl:template match="d:variablelist/d:title" mode="vl.as.blocks">
103 <xsl:template match="d:itemizedlist/d:titleabbrev|d:orderedlist/d:titleabbrev">
107 <xsl:template match="d:procedure/d:titleabbrev">
111 <xsl:template match="d:variablelist/d:titleabbrev" mode="vl.as.list">
115 <xsl:template match="d:variablelist/d:titleabbrev" mode="vl.as.blocks">
119 <xsl:template match="d:itemizedlist/d:listitem">
120 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
122 <xsl:variable name="keep.together">
123 <xsl:call-template name="pi.dbfo_keep-together"/>
126 <xsl:variable name="item.contents">
127 <fo:list-item-label end-indent="label-end()" xsl:use-attribute-sets="itemizedlist.label.properties">
129 <xsl:call-template name="itemizedlist.label.markup">
130 <xsl:with-param name="itemsymbol">
131 <xsl:call-template name="list.itemsymbol">
132 <xsl:with-param name="node" select="parent::d:itemizedlist"/>
137 </fo:list-item-label>
138 <fo:list-item-body start-indent="body-start()">
140 <xsl:apply-templates/>
146 <xsl:when test="parent::*/@spacing = 'compact'">
147 <fo:list-item id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing">
148 <xsl:if test="$keep.together != ''">
149 <xsl:attribute name="keep-together.within-column"><xsl:value-of
150 select="$keep.together"/></xsl:attribute>
152 <xsl:copy-of select="$item.contents"/>
156 <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
157 <xsl:if test="$keep.together != ''">
158 <xsl:attribute name="keep-together.within-column"><xsl:value-of
159 select="$keep.together"/></xsl:attribute>
161 <xsl:copy-of select="$item.contents"/>
167 <xsl:template name="itemizedlist.label.markup">
168 <xsl:param name="itemsymbol" select="'disc'"/>
171 <xsl:when test="$itemsymbol='none'"></xsl:when>
172 <xsl:when test="$itemsymbol='disc'">•</xsl:when>
173 <xsl:when test="$itemsymbol='bullet'">•</xsl:when>
174 <xsl:when test="$itemsymbol='endash'">–</xsl:when>
175 <xsl:when test="$itemsymbol='emdash'">—</xsl:when>
176 <!-- Some of these may work in your XSL-FO processor and fonts -->
178 <xsl:when test="$itemsymbol='square'">■</xsl:when>
179 <xsl:when test="$itemsymbol='box'">■</xsl:when>
180 <xsl:when test="$itemsymbol='smallblacksquare'">▪</xsl:when>
181 <xsl:when test="$itemsymbol='circle'">○</xsl:when>
182 <xsl:when test="$itemsymbol='opencircle'">○</xsl:when>
183 <xsl:when test="$itemsymbol='whitesquare'">□</xsl:when>
184 <xsl:when test="$itemsymbol='smallwhitesquare'">▫</xsl:when>
185 <xsl:when test="$itemsymbol='round'">●</xsl:when>
186 <xsl:when test="$itemsymbol='blackcircle'">●</xsl:when>
187 <xsl:when test="$itemsymbol='whitebullet'">◦</xsl:when>
188 <xsl:when test="$itemsymbol='triangle'">‣</xsl:when>
189 <xsl:when test="$itemsymbol='point'">›</xsl:when>
190 <xsl:when test="$itemsymbol='hand'"><fo:inline
191 font-family="Wingdings 2">A</fo:inline></xsl:when>
193 <xsl:otherwise>•</xsl:otherwise>
197 <xsl:template match="d:orderedlist">
198 <xsl:variable name="id">
199 <xsl:call-template name="object.id"/>
202 <xsl:variable name="pi-label-width">
203 <xsl:call-template name="pi.dbfo_label-width"/>
206 <xsl:variable name="label-width">
208 <xsl:when test="$pi-label-width = ''">
209 <xsl:value-of select="$orderedlist.label.width"/>
212 <xsl:value-of select="$pi-label-width"/>
217 <xsl:variable name="keep.together">
218 <xsl:call-template name="pi.dbfo_keep-together"/>
221 <xsl:if test="d:title">
222 <xsl:apply-templates select="d:title" mode="list.title.mode"/>
225 <!-- Preserve order of PIs and comments -->
227 select="*[not(self::d:listitem
229 or self::d:titleabbrev)]
230 |comment()[not(preceding-sibling::d:listitem)]
231 |processing-instruction()[not(preceding-sibling::d:listitem)]"/>
233 <xsl:variable name="content">
236 |comment()[preceding-sibling::d:listitem]
237 |processing-instruction()[preceding-sibling::d:listitem]"/>
240 <!-- nested lists don't add extra list-block spacing -->
242 <xsl:when test="ancestor::d:listitem">
243 <fo:list-block id="{$id}" xsl:use-attribute-sets="orderedlist.properties">
244 <xsl:attribute name="provisional-distance-between-starts">
245 <xsl:value-of select="$label-width"/>
247 <xsl:if test="$keep.together != ''">
248 <xsl:attribute name="keep-together.within-column"><xsl:value-of
249 select="$keep.together"/></xsl:attribute>
251 <xsl:copy-of select="$content"/>
255 <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing orderedlist.properties">
256 <xsl:attribute name="provisional-distance-between-starts">
257 <xsl:value-of select="$label-width"/>
259 <xsl:if test="$keep.together != ''">
260 <xsl:attribute name="keep-together.within-column"><xsl:value-of
261 select="$keep.together"/></xsl:attribute>
263 <xsl:copy-of select="$content"/>
269 <xsl:template match="d:orderedlist/d:listitem">
270 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
272 <xsl:variable name="keep.together">
273 <xsl:call-template name="pi.dbfo_keep-together"/>
276 <xsl:variable name="item.contents">
277 <fo:list-item-label end-indent="label-end()" xsl:use-attribute-sets="orderedlist.label.properties">
279 <xsl:apply-templates select="." mode="item-number"/>
281 </fo:list-item-label>
282 <fo:list-item-body start-indent="body-start()">
284 <xsl:apply-templates/>
290 <xsl:when test="parent::*/@spacing = 'compact'">
291 <fo:list-item id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing">
292 <xsl:if test="$keep.together != ''">
293 <xsl:attribute name="keep-together.within-column"><xsl:value-of
294 select="$keep.together"/></xsl:attribute>
296 <xsl:copy-of select="$item.contents"/>
300 <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
301 <xsl:if test="$keep.together != ''">
302 <xsl:attribute name="keep-together.within-column"><xsl:value-of
303 select="$keep.together"/></xsl:attribute>
305 <xsl:copy-of select="$item.contents"/>
311 <xsl:template match="d:listitem/*[1][local-name()='para' or
312 local-name()='simpara' or
313 local-name()='formalpara']
314 |d:glossdef/*[1][local-name()='para' or
315 local-name()='simpara' or
316 local-name()='formalpara']
317 |d:step/*[1][local-name()='para' or
318 local-name()='simpara' or
319 local-name()='formalpara']
320 |d:callout/*[1][local-name()='para' or
321 local-name()='simpara' or
322 local-name()='formalpara']"
324 <fo:block xsl:use-attribute-sets="para.properties">
325 <xsl:call-template name="anchor"/>
326 <xsl:apply-templates/>
330 <xsl:template match="d:variablelist">
331 <xsl:variable name="presentation">
332 <xsl:call-template name="pi.dbfo_list-presentation"/>
336 <xsl:when test="$presentation = 'list'">
337 <xsl:apply-templates select="." mode="vl.as.list"/>
339 <xsl:when test="$presentation = 'blocks'">
340 <xsl:apply-templates select="." mode="vl.as.blocks"/>
342 <xsl:when test="$variablelist.as.blocks != 0">
343 <xsl:apply-templates select="." mode="vl.as.blocks"/>
346 <xsl:apply-templates select="." mode="vl.as.list"/>
351 <xsl:template match="d:variablelist" mode="vl.as.list">
352 <xsl:variable name="id">
353 <xsl:call-template name="object.id"/>
356 <xsl:variable name="keep.together">
357 <xsl:call-template name="pi.dbfo_keep-together"/>
360 <xsl:variable name="term-width">
361 <xsl:call-template name="pi.dbfo_term-width"/>
364 <xsl:variable name="termlength">
366 <xsl:when test="$term-width != ''">
367 <xsl:value-of select="$term-width"/>
369 <xsl:when test="@termlength">
370 <xsl:variable name="termlength.is.number">
371 <xsl:value-of select="@termlength + 0"/>
374 <xsl:when test="string($termlength.is.number) = 'NaN'">
375 <!-- if the term length isn't just a number, assume it's a measurement -->
376 <xsl:value-of select="@termlength"/>
379 <xsl:value-of select="@termlength"/>
380 <xsl:text>em * 0.60</xsl:text>
385 <xsl:call-template name="longest.term">
386 <xsl:with-param name="terms" select="d:varlistentry/d:term"/>
387 <xsl:with-param name="maxlength" select="$variablelist.max.termlength"/>
389 <xsl:text>em * 0.60</xsl:text>
396 <xsl:text>term width: </xsl:text>
397 <xsl:value-of select="$termlength"/>
401 <xsl:variable name="label-separation">1em</xsl:variable>
402 <xsl:variable name="distance-between-starts">
403 <xsl:value-of select="$termlength"/>
404 <xsl:text>+</xsl:text>
405 <xsl:value-of select="$label-separation"/>
408 <xsl:if test="d:title">
409 <xsl:apply-templates select="d:title" mode="list.title.mode"/>
412 <!-- Preserve order of PIs and comments -->
414 select="*[not(self::d:varlistentry
416 or self::d:titleabbrev)]
417 |comment()[not(preceding-sibling::d:varlistentry)]
418 |processing-instruction()[not(preceding-sibling::d:varlistentry)]"/>
420 <xsl:variable name="content">
421 <xsl:apply-templates mode="vl.as.list"
422 select="d:varlistentry
423 |comment()[preceding-sibling::d:varlistentry]
424 |processing-instruction()[preceding-sibling::d:varlistentry]"/>
427 <!-- nested lists don't add extra list-block spacing -->
429 <xsl:when test="ancestor::d:listitem">
430 <fo:list-block id="{$id}"
431 provisional-distance-between-starts=
432 "{$distance-between-starts}"
433 provisional-label-separation="{$label-separation}">
434 <xsl:if test="$keep.together != ''">
435 <xsl:attribute name="keep-together.within-column"><xsl:value-of
436 select="$keep.together"/></xsl:attribute>
438 <xsl:copy-of select="$content"/>
442 <fo:list-block id="{$id}"
443 provisional-distance-between-starts=
444 "{$distance-between-starts}"
445 provisional-label-separation="{$label-separation}"
446 xsl:use-attribute-sets="list.block.spacing">
447 <xsl:if test="$keep.together != ''">
448 <xsl:attribute name="keep-together.within-column"><xsl:value-of
449 select="$keep.together"/></xsl:attribute>
451 <xsl:copy-of select="$content"/>
457 <xsl:template name="longest.term">
458 <xsl:param name="longest" select="0"/>
459 <xsl:param name="terms" select="."/>
460 <xsl:param name="maxlength" select="-1"/>
462 <!-- Process out any indexterms in the term -->
463 <xsl:variable name="term.text">
464 <xsl:apply-templates select="$terms[1]"/>
468 <xsl:when test="$longest > $maxlength and $maxlength > 0">
469 <xsl:value-of select="$maxlength"/>
471 <xsl:when test="not($terms)">
472 <xsl:value-of select="$longest"/>
474 <xsl:when test="string-length($term.text) > $longest">
475 <xsl:call-template name="longest.term">
476 <xsl:with-param name="longest"
477 select="string-length($term.text)"/>
478 <xsl:with-param name="maxlength" select="$maxlength"/>
479 <xsl:with-param name="terms" select="$terms[position() > 1]"/>
483 <xsl:call-template name="longest.term">
484 <xsl:with-param name="longest" select="$longest"/>
485 <xsl:with-param name="maxlength" select="$maxlength"/>
486 <xsl:with-param name="terms" select="$terms[position() > 1]"/>
492 <xsl:template match="d:varlistentry" mode="vl.as.list">
493 <xsl:variable name="id">
494 <xsl:call-template name="object.id"/>
497 <xsl:variable name="keep.together">
498 <xsl:call-template name="pi.dbfo_keep-together"/>
501 <xsl:variable name="item.contents">
502 <fo:list-item-label end-indent="label-end()" text-align="start">
503 <fo:block xsl:use-attribute-sets="variablelist.term.properties">
504 <xsl:apply-templates select="d:term"/>
506 </fo:list-item-label>
507 <fo:list-item-body start-indent="body-start()">
509 <xsl:apply-templates select="d:listitem"/>
515 <xsl:when test="parent::*/@spacing = 'compact'">
516 <fo:list-item id="{$id}"
517 xsl:use-attribute-sets="compact.list.item.spacing">
518 <xsl:if test="$keep.together != ''">
519 <xsl:attribute name="keep-together.within-column"><xsl:value-of
520 select="$keep.together"/></xsl:attribute>
522 <xsl:copy-of select="$item.contents"/>
526 <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
527 <xsl:if test="$keep.together != ''">
528 <xsl:attribute name="keep-together.within-column"><xsl:value-of
529 select="$keep.together"/></xsl:attribute>
531 <xsl:copy-of select="$item.contents"/>
538 <xsl:template match="d:variablelist" mode="vl.as.blocks">
539 <xsl:variable name="id">
540 <xsl:call-template name="object.id"/>
543 <!-- termlength is irrelevant -->
545 <xsl:if test="d:title">
546 <xsl:apply-templates select="d:title" mode="list.title.mode"/>
549 <!-- Preserve order of PIs and comments -->
551 select="*[not(self::d:varlistentry
553 or self::d:titleabbrev)]
554 |comment()[not(preceding-sibling::d:varlistentry)]
555 |processing-instruction()[not(preceding-sibling::d:varlistentry)]"/>
557 <xsl:variable name="content">
558 <xsl:apply-templates mode="vl.as.blocks"
559 select="d:varlistentry
560 |comment()[preceding-sibling::d:varlistentry]
561 |processing-instruction()[preceding-sibling::d:varlistentry]"/>
564 <!-- nested lists don't add extra list-block spacing -->
566 <xsl:when test="ancestor::d:listitem">
567 <fo:block id="{$id}">
568 <xsl:copy-of select="$content"/>
572 <fo:block id="{$id}" xsl:use-attribute-sets="list.block.spacing">
573 <xsl:copy-of select="$content"/>
579 <xsl:template match="d:varlistentry" mode="vl.as.blocks">
580 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
582 <fo:block id="{$id}" xsl:use-attribute-sets="variablelist.term.properties
584 keep-together.within-column="always"
585 keep-with-next.within-column="always">
586 <xsl:apply-templates select="d:term"/>
590 <xsl:attribute name="margin-{$direction.align.start}">0.25in</xsl:attribute>
591 <xsl:apply-templates select="d:listitem"/>
595 <xsl:template match="d:varlistentry/d:term">
597 <xsl:call-template name="anchor"/>
598 <xsl:call-template name="simple.xlink">
599 <xsl:with-param name="content">
600 <xsl:apply-templates/>
605 <xsl:when test="not(following-sibling::d:term)"/> <!-- do nothing -->
607 <!-- * if we have multiple terms in the same varlistentry, generate -->
608 <!-- * a separator (", " by default) and/or an additional line -->
609 <!-- * break after each one except the last -->
610 <fo:inline><xsl:value-of select="$variablelist.term.separator"/></fo:inline>
611 <xsl:if test="not($variablelist.term.break.after = '0')">
618 <xsl:template match="d:varlistentry/d:listitem">
619 <xsl:apply-templates/>
622 <!-- ==================================================================== -->
624 <xsl:template match="d:title" mode="list.title.mode">
625 <xsl:call-template name="formal.object.heading">
626 <xsl:with-param name="object" select=".."/>
630 <!-- ==================================================================== -->
632 <xsl:template match="d:simplelist|d:simplelist[@type='vert']">
633 <!-- with no type specified, the default is 'vert' -->
635 <xsl:variable name="id">
636 <xsl:call-template name="object.id"/>
639 <xsl:variable name="explicit.table.width">
640 <xsl:call-template name="dbfo-attribute">
641 <xsl:with-param name="pis"
642 select="processing-instruction('dbfo')"/>
643 <xsl:with-param name="attribute" select="'list-width'"/>
647 <xsl:variable name="table.width">
649 <xsl:when test="$explicit.table.width != ''">
650 <xsl:value-of select="$explicit.table.width"/>
652 <xsl:when test="$default.table.width = ''">
653 <xsl:text>100%</xsl:text>
656 <xsl:value-of select="$default.table.width"/>
661 <fo:table id="{$id}" xsl:use-attribute-sets="normal.para.spacing">
664 <xsl:when test="$axf.extensions != 0 or $xep.extensions != 0">
665 <xsl:attribute name="table-layout">auto</xsl:attribute>
666 <xsl:if test="$explicit.table.width != ''">
667 <xsl:attribute name="width"><xsl:value-of
668 select="$explicit.table.width"/></xsl:attribute>
672 <xsl:attribute name="table-layout">fixed</xsl:attribute>
673 <xsl:attribute name="width"><xsl:value-of
674 select="$table.width"/></xsl:attribute>
678 <xsl:call-template name="simplelist.table.columns">
679 <xsl:with-param name="cols">
681 <xsl:when test="@columns">
682 <xsl:value-of select="@columns"/>
684 <xsl:otherwise>1</xsl:otherwise>
688 <fo:table-body start-indent="0pt" end-indent="0pt">
689 <xsl:call-template name="simplelist.vert">
690 <xsl:with-param name="cols">
692 <xsl:when test="@columns">
693 <xsl:value-of select="@columns"/>
695 <xsl:otherwise>1</xsl:otherwise>
703 <xsl:template match="d:simplelist[@type='inline']">
704 <!-- if dbchoice PI exists, use that to determine the choice separator -->
705 <!-- (that is, equivalent of "and" or "or" in current locale), or literal -->
706 <!-- value of "choice" otherwise -->
707 <xsl:variable name="id">
708 <xsl:call-template name="object.id"/>
711 <fo:inline id="{$id}"><xsl:variable name="localized-choice-separator">
713 <xsl:when test="processing-instruction('dbchoice')">
714 <xsl:call-template name="select.choice.separator"/>
722 <xsl:for-each select="d:member">
723 <xsl:apply-templates/>
725 <xsl:when test="position() = last()"/> <!-- do nothing -->
727 <xsl:text>, </xsl:text>
728 <xsl:if test="position() = last() - 1">
729 <xsl:if test="$localized-choice-separator != ''">
730 <xsl:value-of select="$localized-choice-separator"/>
731 <xsl:text> </xsl:text>
736 </xsl:for-each></fo:inline>
739 <xsl:template match="d:simplelist[@type='horiz']">
741 <xsl:variable name="id">
742 <xsl:call-template name="object.id"/>
745 <xsl:variable name="explicit.table.width">
746 <xsl:call-template name="pi.dbfo_list-width"/>
749 <xsl:variable name="table.width">
751 <xsl:when test="$explicit.table.width != ''">
752 <xsl:value-of select="$explicit.table.width"/>
754 <xsl:when test="$default.table.width = ''">
755 <xsl:text>100%</xsl:text>
758 <xsl:value-of select="$default.table.width"/>
763 <fo:table id="{$id}" xsl:use-attribute-sets="normal.para.spacing">
765 <xsl:when test="$axf.extensions != 0 or $xep.extensions != 0">
766 <xsl:attribute name="table-layout">auto</xsl:attribute>
767 <xsl:if test="$explicit.table.width != ''">
768 <xsl:attribute name="width"><xsl:value-of
769 select="$explicit.table.width"/></xsl:attribute>
773 <xsl:attribute name="table-layout">fixed</xsl:attribute>
774 <xsl:attribute name="width"><xsl:value-of
775 select="$table.width"/></xsl:attribute>
778 <xsl:call-template name="simplelist.table.columns">
779 <xsl:with-param name="cols">
781 <xsl:when test="@columns">
782 <xsl:value-of select="@columns"/>
784 <xsl:otherwise>1</xsl:otherwise>
788 <fo:table-body start-indent="0pt" end-indent="0pt">
789 <xsl:call-template name="simplelist.horiz">
790 <xsl:with-param name="cols">
792 <xsl:when test="@columns">
793 <xsl:value-of select="@columns"/>
795 <xsl:otherwise>1</xsl:otherwise>
803 <xsl:template name="simplelist.table.columns">
804 <xsl:param name="cols" select="1"/>
805 <xsl:param name="curcol" select="1"/>
806 <fo:table-column column-number="{$curcol}"
807 column-width="proportional-column-width(1)"/>
808 <xsl:if test="$curcol < $cols">
809 <xsl:call-template name="simplelist.table.columns">
810 <xsl:with-param name="cols" select="$cols"/>
811 <xsl:with-param name="curcol" select="$curcol + 1"/>
816 <xsl:template name="simplelist.horiz">
817 <xsl:param name="cols">1</xsl:param>
818 <xsl:param name="cell">1</xsl:param>
819 <xsl:param name="members" select="./d:member"/>
821 <xsl:if test="$cell <= count($members)">
823 <xsl:call-template name="simplelist.horiz.row">
824 <xsl:with-param name="cols" select="$cols"/>
825 <xsl:with-param name="cell" select="$cell"/>
826 <xsl:with-param name="members" select="$members"/>
829 <xsl:call-template name="simplelist.horiz">
830 <xsl:with-param name="cols" select="$cols"/>
831 <xsl:with-param name="cell" select="$cell + $cols"/>
832 <xsl:with-param name="members" select="$members"/>
837 <xsl:template name="simplelist.horiz.row">
838 <xsl:param name="cols">1</xsl:param>
839 <xsl:param name="cell">1</xsl:param>
840 <xsl:param name="members" select="./d:member"/>
841 <xsl:param name="curcol">1</xsl:param>
843 <xsl:if test="$curcol <= $cols">
846 <xsl:if test="$members[position()=$cell]">
847 <xsl:apply-templates select="$members[position()=$cell]"/>
851 <xsl:call-template name="simplelist.horiz.row">
852 <xsl:with-param name="cols" select="$cols"/>
853 <xsl:with-param name="cell" select="$cell+1"/>
854 <xsl:with-param name="members" select="$members"/>
855 <xsl:with-param name="curcol" select="$curcol+1"/>
860 <xsl:template name="simplelist.vert">
861 <xsl:param name="cols">1</xsl:param>
862 <xsl:param name="cell">1</xsl:param>
863 <xsl:param name="members" select="./d:member"/>
864 <xsl:param name="rows"
865 select="floor((count($members)+$cols - 1) div $cols)"/>
867 <xsl:if test="$cell <= $rows">
869 <xsl:call-template name="simplelist.vert.row">
870 <xsl:with-param name="cols" select="$cols"/>
871 <xsl:with-param name="rows" select="$rows"/>
872 <xsl:with-param name="cell" select="$cell"/>
873 <xsl:with-param name="members" select="$members"/>
876 <xsl:call-template name="simplelist.vert">
877 <xsl:with-param name="cols" select="$cols"/>
878 <xsl:with-param name="cell" select="$cell+1"/>
879 <xsl:with-param name="members" select="$members"/>
880 <xsl:with-param name="rows" select="$rows"/>
885 <xsl:template name="simplelist.vert.row">
886 <xsl:param name="cols">1</xsl:param>
887 <xsl:param name="rows">1</xsl:param>
888 <xsl:param name="cell">1</xsl:param>
889 <xsl:param name="members" select="./d:member"/>
890 <xsl:param name="curcol">1</xsl:param>
892 <xsl:if test="$curcol <= $cols">
895 <xsl:if test="$members[position()=$cell]">
896 <xsl:apply-templates select="$members[position()=$cell]"/>
900 <xsl:call-template name="simplelist.vert.row">
901 <xsl:with-param name="cols" select="$cols"/>
902 <xsl:with-param name="rows" select="$rows"/>
903 <xsl:with-param name="cell" select="$cell+$rows"/>
904 <xsl:with-param name="members" select="$members"/>
905 <xsl:with-param name="curcol" select="$curcol+1"/>
910 <xsl:template match="d:member">
911 <xsl:call-template name="simple.xlink">
912 <xsl:with-param name="content">
913 <xsl:apply-templates/>
918 <!-- ==================================================================== -->
920 <xsl:template match="d:procedure">
921 <xsl:variable name="id">
922 <xsl:call-template name="object.id"/>
925 <xsl:variable name="param.placement"
926 select="substring-after(normalize-space($formal.title.placement),
927 concat(local-name(.), ' '))"/>
929 <xsl:variable name="placement">
931 <xsl:when test="contains($param.placement, ' ')">
932 <xsl:value-of select="substring-before($param.placement, ' ')"/>
934 <xsl:when test="$param.placement = ''">before</xsl:when>
936 <xsl:value-of select="$param.placement"/>
941 <!-- Preserve order of PIs and comments -->
942 <xsl:variable name="preamble"
943 select="*[not(self::d:step
945 or self::d:titleabbrev)]
946 |comment()[not(preceding-sibling::d:step)]
947 |processing-instruction()[not(preceding-sibling::d:step)]"/>
949 <xsl:variable name="steps"
951 |comment()[preceding-sibling::d:step]
952 |processing-instruction()[preceding-sibling::d:step]"/>
954 <fo:block id="{$id}" xsl:use-attribute-sets="procedure.properties list.block.spacing">
955 <xsl:if test="(d:title or d:blockinfo/d:title or d:info/d:title) and $placement = 'before'">
956 <!-- n.b. gentext code tests for $formal.procedures and may make an "informal" -->
957 <!-- heading even though we called formal.object.heading. odd but true. -->
958 <xsl:call-template name="formal.object.heading"/>
961 <xsl:apply-templates select="$preamble"/>
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 select="$steps"/>
969 <xsl:if test="(d:title or d:blockinfo/d:title or d:info/d:title) and $placement != 'before'">
970 <!-- n.b. gentext code tests for $formal.procedures and may make an "informal" -->
971 <!-- heading even though we called formal.object.heading. odd but true. -->
972 <xsl:call-template name="formal.object.heading"/>
977 <xsl:template match="d:procedure/d:title">
980 <xsl:template match="d:substeps">
981 <fo:list-block xsl:use-attribute-sets="list.block.spacing"
982 provisional-distance-between-starts="2em"
983 provisional-label-separation="0.2em">
984 <xsl:apply-templates/>
988 <xsl:template match="d:procedure/d:step|d:substeps/d:step">
989 <xsl:variable name="id">
990 <xsl:call-template name="object.id"/>
993 <xsl:variable name="keep.together">
994 <xsl:call-template name="pi.dbfo_keep-together"/>
997 <fo:list-item xsl:use-attribute-sets="list.item.spacing">
998 <xsl:if test="$keep.together != ''">
999 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1000 select="$keep.together"/></xsl:attribute>
1002 <fo:list-item-label end-indent="label-end()">
1003 <fo:block id="{$id}">
1004 <!-- dwc: fix for one step procedures. Use a bullet if there's no step 2 -->
1006 <xsl:when test="count(../d:step) = 1">
1007 <xsl:text>•</xsl:text>
1010 <xsl:apply-templates select="." mode="number">
1011 <xsl:with-param name="recursive" select="0"/>
1012 </xsl:apply-templates>.
1016 </fo:list-item-label>
1017 <fo:list-item-body start-indent="body-start()">
1019 <xsl:apply-templates/>
1021 </fo:list-item-body>
1025 <xsl:template match="d:stepalternatives">
1026 <fo:list-block provisional-distance-between-starts="2em"
1027 provisional-label-separation="0.2em">
1028 <xsl:apply-templates select="d:step"/>
1032 <xsl:template match="d:stepalternatives/d:step">
1033 <xsl:variable name="id">
1034 <xsl:call-template name="object.id"/>
1037 <xsl:variable name="keep.together">
1038 <xsl:call-template name="pi.dbfo_keep-together"/>
1041 <fo:list-item xsl:use-attribute-sets="list.item.spacing">
1042 <xsl:if test="$keep.together != ''">
1043 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1044 select="$keep.together"/></xsl:attribute>
1046 <fo:list-item-label end-indent="label-end()">
1047 <fo:block id="{$id}">
1048 <xsl:text>•</xsl:text>
1050 </fo:list-item-label>
1051 <fo:list-item-body start-indent="body-start()">
1053 <xsl:apply-templates/>
1055 </fo:list-item-body>
1059 <xsl:template match="d:step/d:title">
1060 <fo:block font-weight="bold"
1061 keep-together.within-column="always"
1062 keep-with-next.within-column="always">
1063 <xsl:apply-templates/>
1067 <!-- Add (Optional) when the step is optional -->
1068 <xsl:template match="d:step[@performance = 'optional']/*[1][self::d:para]" priority="3">
1069 <xsl:variable name="keep.together">
1070 <xsl:call-template name="pi.dbfo_keep-together"/>
1072 <fo:block xsl:use-attribute-sets="para.properties">
1073 <xsl:if test="$keep.together != ''">
1074 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1075 select="$keep.together"/></xsl:attribute>
1077 <xsl:call-template name="anchor"/>
1078 <xsl:if test="$mark.optional.procedure.steps != 0">
1079 <xsl:call-template name="optional.step.marker"/>
1081 <xsl:apply-templates/>
1085 <xsl:template name="optional.step.marker">
1087 <xsl:call-template name="gentext">
1088 <xsl:with-param name="key">optional-step</xsl:with-param>
1089 </xsl:call-template>
1092 <!-- ==================================================================== -->
1094 <xsl:template match="d:segmentedlist">
1095 <xsl:variable name="presentation">
1096 <xsl:call-template name="pi.dbfo_list-presentation"/>
1099 <xsl:variable name="keep.together">
1100 <xsl:call-template name="pi.dbfo_keep-together"/>
1103 <xsl:variable name="id">
1104 <xsl:call-template name="object.id"/>
1108 <xsl:when test="$presentation = 'table'">
1109 <fo:block id="{$id}">
1110 <xsl:if test="$keep.together != ''">
1111 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1112 select="$keep.together"/></xsl:attribute>
1114 <xsl:apply-templates select="." mode="seglist-table"/>
1117 <xsl:when test="$presentation = 'list'">
1118 <fo:block id="{$id}">
1119 <xsl:if test="$keep.together != ''">
1120 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1121 select="$keep.together"/></xsl:attribute>
1123 <xsl:apply-templates/>
1126 <xsl:when test="$segmentedlist.as.table != 0">
1127 <fo:block id="{$id}">
1128 <xsl:if test="$keep.together != ''">
1129 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1130 select="$keep.together"/></xsl:attribute>
1132 <xsl:apply-templates select="." mode="seglist-table"/>
1136 <fo:block id="{$id}">
1137 <xsl:if test="$keep.together != ''">
1138 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1139 select="$keep.together"/></xsl:attribute>
1142 <xsl:apply-templates/>
1148 <xsl:template match="d:segmentedlist/d:title">
1149 <xsl:apply-templates select="." mode="list.title.mode" />
1152 <xsl:template match="d:segtitle">
1155 <xsl:template match="d:segtitle" mode="segtitle-in-seg">
1156 <xsl:apply-templates/>
1159 <xsl:template match="d:seglistitem">
1160 <xsl:variable name="id">
1161 <xsl:call-template name="object.id"/>
1163 <fo:block id="{$id}">
1164 <xsl:apply-templates/>
1168 <xsl:template match="d:seg">
1169 <xsl:variable name="segnum" select="count(preceding-sibling::d:seg)+1"/>
1170 <xsl:variable name="seglist" select="ancestor::d:segmentedlist"/>
1171 <xsl:variable name="segtitles" select="$seglist/d:segtitle"/>
1174 Note: segtitle is only going to be the right thing in a well formed
1175 SegmentedList. If there are too many Segs or too few SegTitles,
1176 you'll get something odd...maybe an error
1180 <fo:inline font-weight="bold">
1181 <xsl:apply-templates select="$segtitles[$segnum=position()]"
1182 mode="segtitle-in-seg"/>
1183 <xsl:text>: </xsl:text>
1185 <xsl:apply-templates/>
1189 <xsl:template match="d:segmentedlist" mode="seglist-table">
1190 <xsl:apply-templates select="d:title" mode="list.title.mode" />
1191 <fo:table table-layout="fixed">
1192 <xsl:call-template name="segmentedlist.table.columns">
1193 <xsl:with-param name="cols" select="count(d:segtitle)"/>
1194 </xsl:call-template>
1195 <fo:table-header start-indent="0pt" end-indent="0pt">
1197 <xsl:apply-templates select="d:segtitle" mode="seglist-table"/>
1200 <fo:table-body start-indent="0pt" end-indent="0pt">
1201 <xsl:apply-templates select="d:seglistitem" mode="seglist-table"/>
1206 <xsl:template name="segmentedlist.table.columns">
1207 <xsl:param name="cols" select="1"/>
1208 <xsl:param name="curcol" select="1"/>
1210 <fo:table-column column-number="{$curcol}"
1211 column-width="proportional-column-width(1)"/>
1212 <xsl:if test="$curcol < $cols">
1213 <xsl:call-template name="segmentedlist.table.columns">
1214 <xsl:with-param name="cols" select="$cols"/>
1215 <xsl:with-param name="curcol" select="$curcol+1"/>
1216 </xsl:call-template>
1220 <xsl:template match="d:segtitle" mode="seglist-table">
1222 <fo:block font-weight="bold">
1223 <xsl:apply-templates/>
1228 <xsl:template match="d:seglistitem" mode="seglist-table">
1229 <xsl:variable name="id">
1230 <xsl:call-template name="object.id"/>
1232 <fo:table-row id="{$id}">
1233 <xsl:apply-templates mode="seglist-table"/>
1237 <xsl:template match="d:seg" mode="seglist-table">
1240 <xsl:apply-templates/>
1245 <!-- ==================================================================== -->
1247 <xsl:template match="d:calloutlist">
1248 <xsl:variable name="id">
1249 <xsl:call-template name="object.id"/>
1252 <xsl:variable name="pi-label-width">
1253 <xsl:call-template name="pi.dbfo_label-width"/>
1256 <fo:block id="{$id}"
1257 text-align="{$alignment}">
1258 <!-- The above restores alignment altered by image align attribute -->
1259 <xsl:if test="d:title|d:info/d:title">
1260 <xsl:apply-templates select="(d:title|d:info/d:title)[1]"
1261 mode="list.title.mode"/>
1264 <!-- Preserve order of PIs and comments -->
1265 <xsl:apply-templates
1266 select="*[not(self::d:callout or self::d:title or self::d:titleabbrev)]
1267 |comment()[not(preceding-sibling::d:callout)]
1268 |processing-instruction()[not(preceding-sibling::d:callout)]"/>
1270 <fo:list-block xsl:use-attribute-sets="calloutlist.properties">
1272 <xsl:if test="$pi-label-width != ''">
1273 <xsl:attribute name="provisional-distance-between-starts">
1274 <xsl:value-of select="$pi-label-width"/>
1278 <xsl:apply-templates select="d:callout
1279 |comment()[preceding-sibling::d:callout]
1280 |processing-instruction()[preceding-sibling::d:callout]"/>
1285 <xsl:template match="d:calloutlist/d:title">
1288 <xsl:template match="d:callout">
1289 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
1291 <xsl:variable name="keep.together">
1292 <xsl:call-template name="pi.dbfo_keep-together"/>
1295 <fo:list-item id="{$id}" xsl:use-attribute-sets="callout.properties">
1296 <xsl:if test="$keep.together != ''">
1297 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1298 select="$keep.together"/></xsl:attribute>
1300 <fo:list-item-label end-indent="label-end()">
1302 <xsl:call-template name="callout.arearefs">
1303 <xsl:with-param name="arearefs" select="@arearefs"/>
1304 </xsl:call-template>
1306 </fo:list-item-label>
1307 <fo:list-item-body start-indent="body-start()">
1309 <xsl:apply-templates/>
1311 </fo:list-item-body>
1315 <xsl:template name="callout.arearefs">
1316 <xsl:param name="arearefs"></xsl:param>
1317 <xsl:if test="$arearefs!=''">
1319 <xsl:when test="substring-before($arearefs,' ')=''">
1320 <xsl:call-template name="callout.arearef">
1321 <xsl:with-param name="arearef" select="$arearefs"/>
1322 </xsl:call-template>
1325 <xsl:call-template name="callout.arearef">
1326 <xsl:with-param name="arearef"
1327 select="substring-before($arearefs,' ')"/>
1328 </xsl:call-template>
1331 <xsl:call-template name="callout.arearefs">
1332 <xsl:with-param name="arearefs"
1333 select="substring-after($arearefs,' ')"/>
1334 </xsl:call-template>
1338 <xsl:template name="callout.arearef">
1339 <xsl:param name="arearef"></xsl:param>
1340 <xsl:variable name="targets" select="key('id',$arearef)"/>
1341 <xsl:variable name="target" select="$targets[1]"/>
1344 <xsl:when test="count($target)=0">
1345 <xsl:value-of select="$arearef"/>
1346 <xsl:text>: ???</xsl:text>
1348 <xsl:when test="local-name($target)='co'">
1349 <fo:basic-link internal-destination="{$arearef}">
1350 <xsl:apply-templates select="$target" mode="callout-bug"/>
1353 <xsl:when test="local-name($target)='areaset'">
1354 <xsl:call-template name="callout-bug">
1355 <xsl:with-param name="conum">
1356 <xsl:apply-templates select="$target" mode="conumber"/>
1358 </xsl:call-template>
1360 <xsl:when test="local-name($target)='area'">
1362 <xsl:when test="$target/parent::d:areaset">
1363 <xsl:call-template name="callout-bug">
1364 <xsl:with-param name="conum">
1365 <xsl:apply-templates select="$target/parent::d:areaset"
1368 </xsl:call-template>
1371 <xsl:call-template name="callout-bug">
1372 <xsl:with-param name="conum">
1373 <xsl:apply-templates select="$target" mode="conumber"/>
1375 </xsl:call-template>
1380 <xsl:text>???</xsl:text>
1385 <!-- ==================================================================== -->
1387 <xsl:template name="orderedlist-starting-number">
1388 <xsl:param name="list" select="."/>
1389 <xsl:variable name="pi-start">
1390 <xsl:call-template name="pi.dbfo_start">
1391 <xsl:with-param name="node" select="$list"/>
1392 </xsl:call-template>
1394 <xsl:call-template name="output-orderedlist-starting-number">
1395 <xsl:with-param name="list" select="$list"/>
1396 <xsl:with-param name="pi-start" select="$pi-start"/>
1397 </xsl:call-template>