2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
6 <!-- ********************************************************************
7 $Id: lists.xsl 8761 2010-07-21 18:58:53Z mzjn $
8 ********************************************************************
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.
14 ******************************************************************** -->
16 <!-- ==================================================================== -->
18 <xsl:template match="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"/>
43 <xsl:apply-templates select="title" mode="list.title.mode"/>
46 <!-- Preserve order of PIs and comments -->
48 select="*[not(self::listitem
50 or self::titleabbrev)]
51 |comment()[not(preceding-sibling::listitem)]
52 |processing-instruction()[not(preceding-sibling::listitem)]"/>
54 <xsl:variable name="content">
57 |comment()[preceding-sibling::listitem]
58 |processing-instruction()[preceding-sibling::listitem]"/>
61 <!-- nested lists don't add extra list-block spacing -->
63 <xsl:when test="ancestor::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="itemizedlist/title|orderedlist/title">
95 <xsl:template match="variablelist/title" mode="vl.as.list">
99 <xsl:template match="variablelist/title" mode="vl.as.blocks">
103 <xsl:template match="itemizedlist/titleabbrev|orderedlist/titleabbrev">
107 <xsl:template match="procedure/titleabbrev">
111 <xsl:template match="variablelist/titleabbrev" mode="vl.as.list">
115 <xsl:template match="variablelist/titleabbrev" mode="vl.as.blocks">
119 <xsl:template match="itemizedlist/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::itemizedlist"/>
137 </fo:list-item-label>
138 <fo:list-item-body start-indent="body-start()">
140 <!-- * work around broken passivetex list-item-body rendering -->
141 <xsl:when test="$passivetex.extensions = '1'">
142 <xsl:apply-templates/>
146 <xsl:apply-templates/>
154 <xsl:when test="parent::*/@spacing = 'compact'">
155 <fo:list-item id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing">
156 <xsl:if test="$keep.together != ''">
157 <xsl:attribute name="keep-together.within-column"><xsl:value-of
158 select="$keep.together"/></xsl:attribute>
160 <xsl:copy-of select="$item.contents"/>
164 <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
165 <xsl:if test="$keep.together != ''">
166 <xsl:attribute name="keep-together.within-column"><xsl:value-of
167 select="$keep.together"/></xsl:attribute>
169 <xsl:copy-of select="$item.contents"/>
175 <xsl:template name="itemizedlist.label.markup">
176 <xsl:param name="itemsymbol" select="'disc'"/>
179 <xsl:when test="$itemsymbol='none'"></xsl:when>
180 <xsl:when test="$itemsymbol='disc'">•</xsl:when>
181 <xsl:when test="$itemsymbol='bullet'">•</xsl:when>
182 <xsl:when test="$itemsymbol='endash'">–</xsl:when>
183 <xsl:when test="$itemsymbol='emdash'">—</xsl:when>
184 <!-- Some of these may work in your XSL-FO processor and fonts -->
186 <xsl:when test="$itemsymbol='square'">■</xsl:when>
187 <xsl:when test="$itemsymbol='box'">■</xsl:when>
188 <xsl:when test="$itemsymbol='smallblacksquare'">▪</xsl:when>
189 <xsl:when test="$itemsymbol='circle'">○</xsl:when>
190 <xsl:when test="$itemsymbol='opencircle'">○</xsl:when>
191 <xsl:when test="$itemsymbol='whitesquare'">□</xsl:when>
192 <xsl:when test="$itemsymbol='smallwhitesquare'">▫</xsl:when>
193 <xsl:when test="$itemsymbol='round'">●</xsl:when>
194 <xsl:when test="$itemsymbol='blackcircle'">●</xsl:when>
195 <xsl:when test="$itemsymbol='whitebullet'">◦</xsl:when>
196 <xsl:when test="$itemsymbol='triangle'">‣</xsl:when>
197 <xsl:when test="$itemsymbol='point'">›</xsl:when>
198 <xsl:when test="$itemsymbol='hand'"><fo:inline
199 font-family="Wingdings 2">A</fo:inline></xsl:when>
201 <xsl:otherwise>•</xsl:otherwise>
205 <xsl:template match="orderedlist">
206 <xsl:variable name="id">
207 <xsl:call-template name="object.id"/>
210 <xsl:variable name="pi-label-width">
211 <xsl:call-template name="pi.dbfo_label-width"/>
214 <xsl:variable name="label-width">
216 <xsl:when test="$pi-label-width = ''">
217 <xsl:value-of select="$orderedlist.label.width"/>
220 <xsl:value-of select="$pi-label-width"/>
225 <xsl:variable name="keep.together">
226 <xsl:call-template name="pi.dbfo_keep-together"/>
229 <xsl:if test="title">
230 <xsl:apply-templates select="title" mode="list.title.mode"/>
233 <!-- Preserve order of PIs and comments -->
235 select="*[not(self::listitem
237 or self::titleabbrev)]
238 |comment()[not(preceding-sibling::listitem)]
239 |processing-instruction()[not(preceding-sibling::listitem)]"/>
241 <xsl:variable name="content">
244 |comment()[preceding-sibling::listitem]
245 |processing-instruction()[preceding-sibling::listitem]"/>
248 <!-- nested lists don't add extra list-block spacing -->
250 <xsl:when test="ancestor::listitem">
251 <fo:list-block id="{$id}" xsl:use-attribute-sets="orderedlist.properties">
252 <xsl:attribute name="provisional-distance-between-starts">
253 <xsl:value-of select="$label-width"/>
255 <xsl:if test="$keep.together != ''">
256 <xsl:attribute name="keep-together.within-column"><xsl:value-of
257 select="$keep.together"/></xsl:attribute>
259 <xsl:copy-of select="$content"/>
263 <fo:list-block id="{$id}" xsl:use-attribute-sets="list.block.spacing orderedlist.properties">
264 <xsl:attribute name="provisional-distance-between-starts">
265 <xsl:value-of select="$label-width"/>
267 <xsl:if test="$keep.together != ''">
268 <xsl:attribute name="keep-together.within-column"><xsl:value-of
269 select="$keep.together"/></xsl:attribute>
271 <xsl:copy-of select="$content"/>
277 <xsl:template match="orderedlist/listitem">
278 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
280 <xsl:variable name="keep.together">
281 <xsl:call-template name="pi.dbfo_keep-together"/>
284 <xsl:variable name="item.contents">
285 <fo:list-item-label end-indent="label-end()" xsl:use-attribute-sets="orderedlist.label.properties">
287 <xsl:apply-templates select="." mode="item-number"/>
289 </fo:list-item-label>
290 <fo:list-item-body start-indent="body-start()">
292 <xsl:apply-templates/>
298 <xsl:when test="parent::*/@spacing = 'compact'">
299 <fo:list-item id="{$id}" xsl:use-attribute-sets="compact.list.item.spacing">
300 <xsl:if test="$keep.together != ''">
301 <xsl:attribute name="keep-together.within-column"><xsl:value-of
302 select="$keep.together"/></xsl:attribute>
304 <xsl:copy-of select="$item.contents"/>
308 <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
309 <xsl:if test="$keep.together != ''">
310 <xsl:attribute name="keep-together.within-column"><xsl:value-of
311 select="$keep.together"/></xsl:attribute>
313 <xsl:copy-of select="$item.contents"/>
319 <xsl:template match="listitem/*[1][local-name()='para' or
320 local-name()='simpara' or
321 local-name()='formalpara']
322 |glossdef/*[1][local-name()='para' or
323 local-name()='simpara' or
324 local-name()='formalpara']
325 |step/*[1][local-name()='para' or
326 local-name()='simpara' or
327 local-name()='formalpara']
328 |callout/*[1][local-name()='para' or
329 local-name()='simpara' or
330 local-name()='formalpara']"
333 <xsl:call-template name="anchor"/>
334 <xsl:apply-templates/>
338 <xsl:template match="variablelist">
339 <xsl:variable name="presentation">
340 <xsl:call-template name="pi.dbfo_list-presentation"/>
344 <xsl:when test="$presentation = 'list'">
345 <xsl:apply-templates select="." mode="vl.as.list"/>
347 <xsl:when test="$presentation = 'blocks'">
348 <xsl:apply-templates select="." mode="vl.as.blocks"/>
350 <xsl:when test="$variablelist.as.blocks != 0">
351 <xsl:apply-templates select="." mode="vl.as.blocks"/>
354 <xsl:apply-templates select="." mode="vl.as.list"/>
359 <xsl:template match="variablelist" mode="vl.as.list">
360 <xsl:variable name="id">
361 <xsl:call-template name="object.id"/>
364 <xsl:variable name="keep.together">
365 <xsl:call-template name="pi.dbfo_keep-together"/>
368 <xsl:variable name="term-width">
369 <xsl:call-template name="pi.dbfo_term-width"/>
372 <xsl:variable name="termlength">
374 <xsl:when test="$term-width != ''">
375 <xsl:value-of select="$term-width"/>
377 <xsl:when test="@termlength">
378 <xsl:variable name="termlength.is.number">
379 <xsl:value-of select="@termlength + 0"/>
382 <xsl:when test="string($termlength.is.number) = 'NaN'">
383 <!-- if the term length isn't just a number, assume it's a measurement -->
384 <xsl:value-of select="@termlength"/>
387 <xsl:value-of select="@termlength"/>
389 <!-- workaround for passivetex lack of support for non-constant expressions -->
390 <xsl:when test="$passivetex.extensions != 0">
391 <xsl:text>em</xsl:text>
394 <xsl:text>em * 0.60</xsl:text>
401 <xsl:call-template name="longest.term">
402 <xsl:with-param name="terms" select="varlistentry/term"/>
403 <xsl:with-param name="maxlength" select="$variablelist.max.termlength"/>
406 <!-- workaround for passivetex lack of support for non-constant expressions -->
407 <xsl:when test="$passivetex.extensions != 0">
408 <xsl:text>em</xsl:text>
411 <xsl:text>em * 0.60</xsl:text>
420 <xsl:text>term width: </xsl:text>
421 <xsl:value-of select="$termlength"/>
425 <xsl:variable name="label-separation">1em</xsl:variable>
426 <xsl:variable name="distance-between-starts">
428 <!-- workaround for passivetex lack of support for non-constant expressions -->
429 <xsl:when test="$passivetex.extensions != 0">
430 <xsl:value-of select="$termlength"/>
433 <xsl:value-of select="$termlength"/>
434 <xsl:text>+</xsl:text>
435 <xsl:value-of select="$label-separation"/>
440 <xsl:if test="title">
441 <xsl:apply-templates select="title" mode="list.title.mode"/>
444 <!-- Preserve order of PIs and comments -->
446 select="*[not(self::varlistentry
448 or self::titleabbrev)]
449 |comment()[not(preceding-sibling::varlistentry)]
450 |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
452 <xsl:variable name="content">
453 <xsl:apply-templates mode="vl.as.list"
455 |comment()[preceding-sibling::varlistentry]
456 |processing-instruction()[preceding-sibling::varlistentry]"/>
459 <!-- nested lists don't add extra list-block spacing -->
461 <xsl:when test="ancestor::listitem">
462 <fo:list-block id="{$id}"
463 provisional-distance-between-starts=
464 "{$distance-between-starts}"
465 provisional-label-separation="{$label-separation}">
466 <xsl:if test="$keep.together != ''">
467 <xsl:attribute name="keep-together.within-column"><xsl:value-of
468 select="$keep.together"/></xsl:attribute>
470 <xsl:copy-of select="$content"/>
474 <fo:list-block id="{$id}"
475 provisional-distance-between-starts=
476 "{$distance-between-starts}"
477 provisional-label-separation="{$label-separation}"
478 xsl:use-attribute-sets="list.block.spacing">
479 <xsl:if test="$keep.together != ''">
480 <xsl:attribute name="keep-together.within-column"><xsl:value-of
481 select="$keep.together"/></xsl:attribute>
483 <xsl:copy-of select="$content"/>
489 <xsl:template name="longest.term">
490 <xsl:param name="longest" select="0"/>
491 <xsl:param name="terms" select="."/>
492 <xsl:param name="maxlength" select="-1"/>
494 <!-- Process out any indexterms in the term -->
495 <xsl:variable name="term.text">
496 <xsl:apply-templates select="$terms[1]"/>
500 <xsl:when test="$longest > $maxlength and $maxlength > 0">
501 <xsl:value-of select="$maxlength"/>
503 <xsl:when test="not($terms)">
504 <xsl:value-of select="$longest"/>
506 <xsl:when test="string-length($term.text) > $longest">
507 <xsl:call-template name="longest.term">
508 <xsl:with-param name="longest"
509 select="string-length($term.text)"/>
510 <xsl:with-param name="maxlength" select="$maxlength"/>
511 <xsl:with-param name="terms" select="$terms[position() > 1]"/>
515 <xsl:call-template name="longest.term">
516 <xsl:with-param name="longest" select="$longest"/>
517 <xsl:with-param name="maxlength" select="$maxlength"/>
518 <xsl:with-param name="terms" select="$terms[position() > 1]"/>
524 <xsl:template match="varlistentry" mode="vl.as.list">
525 <xsl:variable name="id">
526 <xsl:call-template name="object.id"/>
529 <xsl:variable name="keep.together">
530 <xsl:call-template name="pi.dbfo_keep-together"/>
533 <xsl:variable name="item.contents">
534 <fo:list-item-label end-indent="label-end()" text-align="start">
535 <fo:block xsl:use-attribute-sets="variablelist.term.properties">
536 <xsl:apply-templates select="term"/>
538 </fo:list-item-label>
539 <fo:list-item-body start-indent="body-start()">
541 <xsl:apply-templates select="listitem"/>
547 <xsl:when test="parent::*/@spacing = 'compact'">
548 <fo:list-item id="{$id}"
549 xsl:use-attribute-sets="compact.list.item.spacing">
550 <xsl:if test="$keep.together != ''">
551 <xsl:attribute name="keep-together.within-column"><xsl:value-of
552 select="$keep.together"/></xsl:attribute>
554 <xsl:copy-of select="$item.contents"/>
558 <fo:list-item id="{$id}" xsl:use-attribute-sets="list.item.spacing">
559 <xsl:if test="$keep.together != ''">
560 <xsl:attribute name="keep-together.within-column"><xsl:value-of
561 select="$keep.together"/></xsl:attribute>
563 <xsl:copy-of select="$item.contents"/>
570 <xsl:template match="variablelist" mode="vl.as.blocks">
571 <xsl:variable name="id">
572 <xsl:call-template name="object.id"/>
575 <!-- termlength is irrelevant -->
577 <xsl:if test="title">
578 <xsl:apply-templates select="title" mode="list.title.mode"/>
581 <!-- Preserve order of PIs and comments -->
583 select="*[not(self::varlistentry
585 or self::titleabbrev)]
586 |comment()[not(preceding-sibling::varlistentry)]
587 |processing-instruction()[not(preceding-sibling::varlistentry)]"/>
589 <xsl:variable name="content">
590 <xsl:apply-templates mode="vl.as.blocks"
592 |comment()[preceding-sibling::varlistentry]
593 |processing-instruction()[preceding-sibling::varlistentry]"/>
596 <!-- nested lists don't add extra list-block spacing -->
598 <xsl:when test="ancestor::listitem">
599 <fo:block id="{$id}">
600 <xsl:copy-of select="$content"/>
604 <fo:block id="{$id}" xsl:use-attribute-sets="list.block.spacing">
605 <xsl:copy-of select="$content"/>
611 <xsl:template match="varlistentry" mode="vl.as.blocks">
612 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
614 <fo:block id="{$id}" xsl:use-attribute-sets="variablelist.term.properties
616 keep-together.within-column="always"
617 keep-with-next.within-column="always">
618 <xsl:apply-templates select="term"/>
622 <xsl:attribute name="margin-{$direction.align.start}">0.25in</xsl:attribute>
623 <xsl:apply-templates select="listitem"/>
627 <xsl:template match="varlistentry/term">
629 <xsl:call-template name="simple.xlink">
630 <xsl:with-param name="content">
631 <xsl:apply-templates/>
636 <xsl:when test="not(following-sibling::term)"/> <!-- do nothing -->
638 <!-- * if we have multiple terms in the same varlistentry, generate -->
639 <!-- * a separator (", " by default) and/or an additional line -->
640 <!-- * break after each one except the last -->
641 <fo:inline><xsl:value-of select="$variablelist.term.separator"/></fo:inline>
642 <xsl:if test="not($variablelist.term.break.after = '0')">
649 <xsl:template match="varlistentry/listitem">
650 <xsl:apply-templates/>
653 <!-- ==================================================================== -->
655 <xsl:template match="title" mode="list.title.mode">
656 <xsl:call-template name="formal.object.heading">
657 <xsl:with-param name="object" select=".."/>
661 <!-- ==================================================================== -->
663 <xsl:template match="simplelist|simplelist[@type='vert']">
664 <!-- with no type specified, the default is 'vert' -->
666 <xsl:variable name="id">
667 <xsl:call-template name="object.id"/>
670 <xsl:variable name="explicit.table.width">
671 <xsl:call-template name="dbfo-attribute">
672 <xsl:with-param name="pis"
673 select="processing-instruction('dbfo')"/>
674 <xsl:with-param name="attribute" select="'list-width'"/>
678 <xsl:variable name="table.width">
680 <xsl:when test="$explicit.table.width != ''">
681 <xsl:value-of select="$explicit.table.width"/>
683 <xsl:when test="$default.table.width = ''">
684 <xsl:text>100%</xsl:text>
687 <xsl:value-of select="$default.table.width"/>
692 <fo:table id="{$id}" xsl:use-attribute-sets="normal.para.spacing">
695 <xsl:when test="$axf.extensions != 0 or $xep.extensions != 0">
696 <xsl:attribute name="table-layout">auto</xsl:attribute>
697 <xsl:if test="$explicit.table.width != ''">
698 <xsl:attribute name="width"><xsl:value-of
699 select="$explicit.table.width"/></xsl:attribute>
703 <xsl:attribute name="table-layout">fixed</xsl:attribute>
704 <xsl:attribute name="width"><xsl:value-of
705 select="$table.width"/></xsl:attribute>
709 <xsl:call-template name="simplelist.table.columns">
710 <xsl:with-param name="cols">
712 <xsl:when test="@columns">
713 <xsl:value-of select="@columns"/>
715 <xsl:otherwise>1</xsl:otherwise>
719 <fo:table-body start-indent="0pt" end-indent="0pt">
720 <xsl:call-template name="simplelist.vert">
721 <xsl:with-param name="cols">
723 <xsl:when test="@columns">
724 <xsl:value-of select="@columns"/>
726 <xsl:otherwise>1</xsl:otherwise>
734 <xsl:template match="simplelist[@type='inline']">
735 <!-- if dbchoice PI exists, use that to determine the choice separator -->
736 <!-- (that is, equivalent of "and" or "or" in current locale), or literal -->
737 <!-- value of "choice" otherwise -->
738 <xsl:variable name="id">
739 <xsl:call-template name="object.id"/>
742 <fo:inline id="{$id}"><xsl:variable name="localized-choice-separator">
744 <xsl:when test="processing-instruction('dbchoice')">
745 <xsl:call-template name="select.choice.separator"/>
753 <xsl:for-each select="member">
754 <xsl:apply-templates/>
756 <xsl:when test="position() = last()"/> <!-- do nothing -->
758 <xsl:text>, </xsl:text>
759 <xsl:if test="position() = last() - 1">
760 <xsl:if test="$localized-choice-separator != ''">
761 <xsl:value-of select="$localized-choice-separator"/>
762 <xsl:text> </xsl:text>
767 </xsl:for-each></fo:inline>
770 <xsl:template match="simplelist[@type='horiz']">
772 <xsl:variable name="id">
773 <xsl:call-template name="object.id"/>
776 <xsl:variable name="explicit.table.width">
777 <xsl:call-template name="pi.dbfo_list-width"/>
780 <xsl:variable name="table.width">
782 <xsl:when test="$explicit.table.width != ''">
783 <xsl:value-of select="$explicit.table.width"/>
785 <xsl:when test="$default.table.width = ''">
786 <xsl:text>100%</xsl:text>
789 <xsl:value-of select="$default.table.width"/>
794 <fo:table id="{$id}" xsl:use-attribute-sets="normal.para.spacing">
796 <xsl:when test="$axf.extensions != 0 or $xep.extensions != 0">
797 <xsl:attribute name="table-layout">auto</xsl:attribute>
798 <xsl:if test="$explicit.table.width != ''">
799 <xsl:attribute name="width"><xsl:value-of
800 select="$explicit.table.width"/></xsl:attribute>
804 <xsl:attribute name="table-layout">fixed</xsl:attribute>
805 <xsl:attribute name="width"><xsl:value-of
806 select="$table.width"/></xsl:attribute>
809 <xsl:call-template name="simplelist.table.columns">
810 <xsl:with-param name="cols">
812 <xsl:when test="@columns">
813 <xsl:value-of select="@columns"/>
815 <xsl:otherwise>1</xsl:otherwise>
819 <fo:table-body start-indent="0pt" end-indent="0pt">
820 <xsl:call-template name="simplelist.horiz">
821 <xsl:with-param name="cols">
823 <xsl:when test="@columns">
824 <xsl:value-of select="@columns"/>
826 <xsl:otherwise>1</xsl:otherwise>
834 <xsl:template name="simplelist.table.columns">
835 <xsl:param name="cols" select="1"/>
836 <xsl:param name="curcol" select="1"/>
837 <fo:table-column column-number="{$curcol}"
838 column-width="proportional-column-width(1)"/>
839 <xsl:if test="$curcol < $cols">
840 <xsl:call-template name="simplelist.table.columns">
841 <xsl:with-param name="cols" select="$cols"/>
842 <xsl:with-param name="curcol" select="$curcol + 1"/>
847 <xsl:template name="simplelist.horiz">
848 <xsl:param name="cols">1</xsl:param>
849 <xsl:param name="cell">1</xsl:param>
850 <xsl:param name="members" select="./member"/>
852 <xsl:if test="$cell <= count($members)">
854 <xsl:call-template name="simplelist.horiz.row">
855 <xsl:with-param name="cols" select="$cols"/>
856 <xsl:with-param name="cell" select="$cell"/>
857 <xsl:with-param name="members" select="$members"/>
860 <xsl:call-template name="simplelist.horiz">
861 <xsl:with-param name="cols" select="$cols"/>
862 <xsl:with-param name="cell" select="$cell + $cols"/>
863 <xsl:with-param name="members" select="$members"/>
868 <xsl:template name="simplelist.horiz.row">
869 <xsl:param name="cols">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>
874 <xsl:if test="$curcol <= $cols">
877 <xsl:if test="$members[position()=$cell]">
878 <xsl:apply-templates select="$members[position()=$cell]"/>
882 <xsl:call-template name="simplelist.horiz.row">
883 <xsl:with-param name="cols" select="$cols"/>
884 <xsl:with-param name="cell" select="$cell+1"/>
885 <xsl:with-param name="members" select="$members"/>
886 <xsl:with-param name="curcol" select="$curcol+1"/>
891 <xsl:template name="simplelist.vert">
892 <xsl:param name="cols">1</xsl:param>
893 <xsl:param name="cell">1</xsl:param>
894 <xsl:param name="members" select="./member"/>
895 <xsl:param name="rows"
896 select="floor((count($members)+$cols - 1) div $cols)"/>
898 <xsl:if test="$cell <= $rows">
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"/>
904 <xsl:with-param name="members" select="$members"/>
907 <xsl:call-template name="simplelist.vert">
908 <xsl:with-param name="cols" select="$cols"/>
909 <xsl:with-param name="cell" select="$cell+1"/>
910 <xsl:with-param name="members" select="$members"/>
911 <xsl:with-param name="rows" select="$rows"/>
916 <xsl:template name="simplelist.vert.row">
917 <xsl:param name="cols">1</xsl:param>
918 <xsl:param name="rows">1</xsl:param>
919 <xsl:param name="cell">1</xsl:param>
920 <xsl:param name="members" select="./member"/>
921 <xsl:param name="curcol">1</xsl:param>
923 <xsl:if test="$curcol <= $cols">
926 <xsl:if test="$members[position()=$cell]">
927 <xsl:apply-templates select="$members[position()=$cell]"/>
931 <xsl:call-template name="simplelist.vert.row">
932 <xsl:with-param name="cols" select="$cols"/>
933 <xsl:with-param name="rows" select="$rows"/>
934 <xsl:with-param name="cell" select="$cell+$rows"/>
935 <xsl:with-param name="members" select="$members"/>
936 <xsl:with-param name="curcol" select="$curcol+1"/>
941 <xsl:template match="member">
942 <xsl:call-template name="simple.xlink">
943 <xsl:with-param name="content">
944 <xsl:apply-templates/>
949 <!-- ==================================================================== -->
951 <xsl:template match="procedure">
952 <xsl:variable name="id">
953 <xsl:call-template name="object.id"/>
956 <xsl:variable name="param.placement"
957 select="substring-after(normalize-space($formal.title.placement),
958 concat(local-name(.), ' '))"/>
960 <xsl:variable name="placement">
962 <xsl:when test="contains($param.placement, ' ')">
963 <xsl:value-of select="substring-before($param.placement, ' ')"/>
965 <xsl:when test="$param.placement = ''">before</xsl:when>
967 <xsl:value-of select="$param.placement"/>
972 <!-- Preserve order of PIs and comments -->
973 <xsl:variable name="preamble"
974 select="*[not(self::step
976 or self::titleabbrev)]
977 |comment()[not(preceding-sibling::step)]
978 |processing-instruction()[not(preceding-sibling::step)]"/>
980 <xsl:variable name="steps"
982 |comment()[preceding-sibling::step]
983 |processing-instruction()[preceding-sibling::step]"/>
985 <fo:block id="{$id}" xsl:use-attribute-sets="procedure.properties list.block.spacing">
986 <xsl:if test="./title and $placement = 'before'">
987 <!-- n.b. gentext code tests for $formal.procedures and may make an "informal" -->
988 <!-- heading even though we called formal.object.heading. odd but true. -->
989 <xsl:call-template name="formal.object.heading"/>
992 <xsl:apply-templates select="$preamble"/>
994 <fo:list-block xsl:use-attribute-sets="list.block.spacing"
995 provisional-distance-between-starts="2em"
996 provisional-label-separation="0.2em">
997 <xsl:apply-templates select="$steps"/>
1000 <xsl:if test="./title and $placement != 'before'">
1001 <!-- n.b. gentext code tests for $formal.procedures and may make an "informal" -->
1002 <!-- heading even though we called formal.object.heading. odd but true. -->
1003 <xsl:call-template name="formal.object.heading"/>
1008 <xsl:template match="procedure/title">
1011 <xsl:template match="substeps">
1012 <fo:list-block xsl:use-attribute-sets="list.block.spacing"
1013 provisional-distance-between-starts="2em"
1014 provisional-label-separation="0.2em">
1015 <xsl:apply-templates/>
1019 <xsl:template match="procedure/step|substeps/step">
1020 <xsl:variable name="id">
1021 <xsl:call-template name="object.id"/>
1024 <xsl:variable name="keep.together">
1025 <xsl:call-template name="pi.dbfo_keep-together"/>
1028 <fo:list-item xsl:use-attribute-sets="list.item.spacing">
1029 <xsl:if test="$keep.together != ''">
1030 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1031 select="$keep.together"/></xsl:attribute>
1033 <fo:list-item-label end-indent="label-end()">
1034 <fo:block id="{$id}">
1035 <!-- dwc: fix for one step procedures. Use a bullet if there's no step 2 -->
1037 <xsl:when test="count(../step) = 1">
1038 <xsl:text>•</xsl:text>
1041 <xsl:apply-templates select="." mode="number">
1042 <xsl:with-param name="recursive" select="0"/>
1043 </xsl:apply-templates>.
1047 </fo:list-item-label>
1048 <fo:list-item-body start-indent="body-start()">
1050 <xsl:apply-templates/>
1052 </fo:list-item-body>
1056 <xsl:template match="stepalternatives">
1057 <fo:list-block provisional-distance-between-starts="2em"
1058 provisional-label-separation="0.2em">
1059 <xsl:apply-templates select="step"/>
1063 <xsl:template match="stepalternatives/step">
1064 <xsl:variable name="id">
1065 <xsl:call-template name="object.id"/>
1068 <xsl:variable name="keep.together">
1069 <xsl:call-template name="pi.dbfo_keep-together"/>
1072 <fo:list-item xsl:use-attribute-sets="list.item.spacing">
1073 <xsl:if test="$keep.together != ''">
1074 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1075 select="$keep.together"/></xsl:attribute>
1077 <fo:list-item-label end-indent="label-end()">
1078 <fo:block id="{$id}">
1079 <xsl:text>•</xsl:text>
1081 </fo:list-item-label>
1082 <fo:list-item-body start-indent="body-start()">
1084 <xsl:apply-templates/>
1086 </fo:list-item-body>
1090 <xsl:template match="step/title">
1091 <fo:block font-weight="bold"
1092 keep-together.within-column="always"
1093 keep-with-next.within-column="always">
1094 <xsl:apply-templates/>
1098 <!-- ==================================================================== -->
1100 <xsl:template match="segmentedlist">
1101 <xsl:variable name="presentation">
1102 <xsl:call-template name="pi.dbfo_list-presentation"/>
1105 <xsl:variable name="keep.together">
1106 <xsl:call-template name="pi.dbfo_keep-together"/>
1109 <xsl:variable name="id">
1110 <xsl:call-template name="object.id"/>
1114 <xsl:when test="$presentation = 'table'">
1115 <fo:block id="{$id}">
1116 <xsl:if test="$keep.together != ''">
1117 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1118 select="$keep.together"/></xsl:attribute>
1120 <xsl:apply-templates select="." mode="seglist-table"/>
1123 <xsl:when test="$presentation = 'list'">
1124 <fo:block id="{$id}">
1125 <xsl:if test="$keep.together != ''">
1126 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1127 select="$keep.together"/></xsl:attribute>
1129 <xsl:apply-templates/>
1132 <xsl:when test="$segmentedlist.as.table != 0">
1133 <fo:block id="{$id}">
1134 <xsl:if test="$keep.together != ''">
1135 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1136 select="$keep.together"/></xsl:attribute>
1138 <xsl:apply-templates select="." mode="seglist-table"/>
1142 <fo:block id="{$id}">
1143 <xsl:if test="$keep.together != ''">
1144 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1145 select="$keep.together"/></xsl:attribute>
1148 <xsl:apply-templates/>
1154 <xsl:template match="segmentedlist/title">
1155 <xsl:apply-templates select="." mode="list.title.mode" />
1158 <xsl:template match="segtitle">
1161 <xsl:template match="segtitle" mode="segtitle-in-seg">
1162 <xsl:apply-templates/>
1165 <xsl:template match="seglistitem">
1166 <xsl:variable name="id">
1167 <xsl:call-template name="object.id"/>
1169 <fo:block id="{$id}">
1170 <xsl:apply-templates/>
1174 <xsl:template match="seg">
1175 <xsl:variable name="segnum" select="count(preceding-sibling::seg)+1"/>
1176 <xsl:variable name="seglist" select="ancestor::segmentedlist"/>
1177 <xsl:variable name="segtitles" select="$seglist/segtitle"/>
1180 Note: segtitle is only going to be the right thing in a well formed
1181 SegmentedList. If there are too many Segs or too few SegTitles,
1182 you'll get something odd...maybe an error
1186 <fo:inline font-weight="bold">
1187 <xsl:apply-templates select="$segtitles[$segnum=position()]"
1188 mode="segtitle-in-seg"/>
1189 <xsl:text>: </xsl:text>
1191 <xsl:apply-templates/>
1195 <xsl:template match="segmentedlist" mode="seglist-table">
1196 <xsl:apply-templates select="title" mode="list.title.mode" />
1197 <fo:table table-layout="fixed">
1198 <fo:table-column column-number="1" column-width="proportional-column-width(1)"/>
1199 <fo:table-column column-number="2" column-width="proportional-column-width(1)"/>
1200 <fo:table-header start-indent="0pt" end-indent="0pt">
1202 <xsl:apply-templates select="segtitle" mode="seglist-table"/>
1205 <fo:table-body start-indent="0pt" end-indent="0pt">
1206 <xsl:apply-templates select="seglistitem" mode="seglist-table"/>
1211 <xsl:template match="segtitle" mode="seglist-table">
1213 <fo:block font-weight="bold">
1214 <xsl:apply-templates/>
1219 <xsl:template match="seglistitem" mode="seglist-table">
1220 <xsl:variable name="id">
1221 <xsl:call-template name="object.id"/>
1223 <fo:table-row id="{$id}">
1224 <xsl:apply-templates mode="seglist-table"/>
1228 <xsl:template match="seg" mode="seglist-table">
1231 <xsl:apply-templates/>
1236 <!-- ==================================================================== -->
1238 <xsl:template match="calloutlist">
1239 <xsl:variable name="id">
1240 <xsl:call-template name="object.id"/>
1243 <xsl:variable name="pi-label-width">
1244 <xsl:call-template name="pi.dbfo_label-width"/>
1247 <fo:block id="{$id}"
1248 text-align="{$alignment}">
1249 <!-- The above restores alignment altered by image align attribute -->
1250 <xsl:if test="title|info/title">
1251 <xsl:apply-templates select="(title|info/title)[1]"
1252 mode="list.title.mode"/>
1255 <!-- Preserve order of PIs and comments -->
1256 <xsl:apply-templates
1257 select="*[not(self::callout or self::title or self::titleabbrev)]
1258 |comment()[not(preceding-sibling::callout)]
1259 |processing-instruction()[not(preceding-sibling::callout)]"/>
1261 <fo:list-block space-before.optimum="1em"
1262 space-before.minimum="0.8em"
1263 space-before.maximum="1.2em"
1264 provisional-distance-between-starts="2.2em"
1265 provisional-label-separation="0.2em">
1267 <xsl:if test="$pi-label-width != ''">
1268 <xsl:attribute name="provisional-distance-between-starts">
1269 <xsl:value-of select="$pi-label-width"/>
1273 <xsl:apply-templates select="callout
1274 |comment()[preceding-sibling::callout]
1275 |processing-instruction()[preceding-sibling::callout]"/>
1280 <xsl:template match="calloutlist/title">
1283 <xsl:template match="callout">
1284 <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
1286 <xsl:variable name="keep.together">
1287 <xsl:call-template name="pi.dbfo_keep-together"/>
1290 <fo:list-item id="{$id}">
1291 <xsl:if test="$keep.together != ''">
1292 <xsl:attribute name="keep-together.within-column"><xsl:value-of
1293 select="$keep.together"/></xsl:attribute>
1295 <fo:list-item-label end-indent="label-end()">
1297 <xsl:call-template name="callout.arearefs">
1298 <xsl:with-param name="arearefs" select="@arearefs"/>
1299 </xsl:call-template>
1301 </fo:list-item-label>
1302 <fo:list-item-body start-indent="body-start()">
1304 <xsl:apply-templates/>
1306 </fo:list-item-body>
1310 <xsl:template name="callout.arearefs">
1311 <xsl:param name="arearefs"></xsl:param>
1312 <xsl:if test="$arearefs!=''">
1314 <xsl:when test="substring-before($arearefs,' ')=''">
1315 <xsl:call-template name="callout.arearef">
1316 <xsl:with-param name="arearef" select="$arearefs"/>
1317 </xsl:call-template>
1320 <xsl:call-template name="callout.arearef">
1321 <xsl:with-param name="arearef"
1322 select="substring-before($arearefs,' ')"/>
1323 </xsl:call-template>
1326 <xsl:call-template name="callout.arearefs">
1327 <xsl:with-param name="arearefs"
1328 select="substring-after($arearefs,' ')"/>
1329 </xsl:call-template>
1333 <xsl:template name="callout.arearef">
1334 <xsl:param name="arearef"></xsl:param>
1335 <xsl:variable name="targets" select="key('id',$arearef)"/>
1336 <xsl:variable name="target" select="$targets[1]"/>
1339 <xsl:when test="count($target)=0">
1340 <xsl:value-of select="$arearef"/>
1341 <xsl:text>: ???</xsl:text>
1343 <xsl:when test="local-name($target)='co'">
1344 <xsl:apply-templates select="$target" mode="callout-bug"/>
1346 <xsl:when test="local-name($target)='areaset'">
1347 <xsl:call-template name="callout-bug">
1348 <xsl:with-param name="conum">
1349 <xsl:apply-templates select="$target" mode="conumber"/>
1351 </xsl:call-template>
1353 <xsl:when test="local-name($target)='area'">
1355 <xsl:when test="$target/parent::areaset">
1356 <xsl:call-template name="callout-bug">
1357 <xsl:with-param name="conum">
1358 <xsl:apply-templates select="$target/parent::areaset"
1361 </xsl:call-template>
1364 <xsl:call-template name="callout-bug">
1365 <xsl:with-param name="conum">
1366 <xsl:apply-templates select="$target" mode="conumber"/>
1368 </xsl:call-template>
1373 <xsl:text>???</xsl:text>
1378 <!-- ==================================================================== -->
1380 <xsl:template name="orderedlist-starting-number">
1381 <xsl:param name="list" select="."/>
1382 <xsl:variable name="pi-start">
1383 <xsl:call-template name="pi.dbfo_start">
1384 <xsl:with-param name="node" select="$list"/>
1385 </xsl:call-template>
1387 <xsl:call-template name="output-orderedlist-starting-number">
1388 <xsl:with-param name="list" select="$list"/>
1389 <xsl:with-param name="pi-start" select="$pi-start"/>
1390 </xsl:call-template>