2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:d="http://docbook.org/ns/docbook"
4 xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
5 exclude-result-prefixes="doc d"
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 <!-- ==================================================================== -->
20 <doc:mode mode="label.markup" xmlns="">
21 <refpurpose>Provides access to element labels</refpurpose>
22 <refdescription id="label.markup-desc">
23 <para>Processing an element in the
24 <literal role="mode">label.markup</literal> mode produces the
26 <para>Trailing punctuation is not added to the label.
32 Note that this template is applied to parent of the object being
33 referenced, and that object is passed via parameter.
35 <xsl:template match="*" mode="intralabel.punctuation">
36 <xsl:param name="object" select="."/>
38 <xsl:text>.</xsl:text>
41 <xsl:template match="*" mode="label.markup">
42 <xsl:param name="verbose" select="1"/>
43 <xsl:if test="$verbose">
45 <xsl:text>Request for label of unexpected element: </xsl:text>
46 <xsl:value-of select="local-name(.)"/>
51 <xsl:template match="d:set|d:book" mode="label.markup">
52 <xsl:if test="@label">
53 <xsl:value-of select="@label"/>
57 <xsl:template match="d:part" mode="label.markup">
59 <xsl:when test="@label">
60 <xsl:value-of select="@label"/>
62 <xsl:when test="string($part.autolabel) != 0">
63 <xsl:variable name="format">
64 <xsl:call-template name="autolabel.format">
65 <xsl:with-param name="format" select="$part.autolabel"/>
68 <xsl:number from="d:book" count="d:part" format="{$format}"/>
73 <xsl:template match="d:partintro" mode="label.markup">
77 <xsl:template match="d:preface" mode="label.markup">
79 <xsl:when test="@label">
80 <xsl:value-of select="@label"/>
82 <xsl:when test="string($preface.autolabel) != 0">
83 <xsl:if test="$component.label.includes.part.label != 0 and
85 <xsl:variable name="part.label">
86 <xsl:apply-templates select="ancestor::d:part"
89 <xsl:if test="$part.label != ''">
90 <xsl:value-of select="$part.label"/>
91 <xsl:apply-templates select="ancestor::d:part"
92 mode="intralabel.punctuation">
93 <xsl:with-param name="object" select="."/>
94 </xsl:apply-templates>
97 <xsl:variable name="format">
98 <xsl:call-template name="autolabel.format">
99 <xsl:with-param name="format" select="$preface.autolabel"/>
103 <xsl:when test="$label.from.part != 0 and ancestor::d:part">
104 <xsl:number from="d:part" count="d:preface" format="{$format}" level="any"/>
107 <xsl:number from="d:book" count="d:preface" format="{$format}" level="any"/>
114 <xsl:template match="d:chapter" mode="label.markup">
116 <xsl:when test="@label">
117 <xsl:value-of select="@label"/>
119 <xsl:when test="string($chapter.autolabel) != 0">
120 <xsl:if test="$component.label.includes.part.label != 0 and
122 <xsl:variable name="part.label">
123 <xsl:apply-templates select="ancestor::d:part"
124 mode="label.markup"/>
126 <xsl:if test="$part.label != ''">
127 <xsl:value-of select="$part.label"/>
128 <xsl:apply-templates select="ancestor::d:part"
129 mode="intralabel.punctuation">
130 <xsl:with-param name="object" select="."/>
131 </xsl:apply-templates>
134 <xsl:variable name="format">
135 <xsl:call-template name="autolabel.format">
136 <xsl:with-param name="format" select="$chapter.autolabel"/>
140 <xsl:when test="$label.from.part != 0 and ancestor::d:part">
141 <xsl:number from="d:part" count="d:chapter" format="{$format}" level="any"/>
144 <xsl:number from="d:book" count="d:chapter" format="{$format}" level="any"/>
151 <xsl:template match="d:appendix" mode="label.markup">
153 <xsl:when test="@label">
154 <xsl:value-of select="@label"/>
156 <xsl:when test="string($appendix.autolabel) != 0">
157 <xsl:if test="$component.label.includes.part.label != 0 and
159 <xsl:variable name="part.label">
160 <xsl:apply-templates select="ancestor::d:part"
161 mode="label.markup"/>
163 <xsl:if test="$part.label != ''">
164 <xsl:value-of select="$part.label"/>
165 <xsl:apply-templates select="ancestor::d:part"
166 mode="intralabel.punctuation">
167 <xsl:with-param name="object" select="."/>
168 </xsl:apply-templates>
171 <xsl:variable name="format">
172 <xsl:call-template name="autolabel.format">
173 <xsl:with-param name="format" select="$appendix.autolabel"/>
177 <xsl:when test="$label.from.part != 0 and ancestor::d:part">
178 <xsl:number from="d:part" count="d:appendix" format="{$format}" level="any"/>
181 <xsl:number from="d:book|d:article"
182 count="d:appendix" format="{$format}" level="any"/>
189 <xsl:template match="d:article" mode="label.markup">
190 <xsl:if test="@label">
191 <xsl:value-of select="@label"/>
195 <xsl:template match="d:dedication|d:colophon" mode="label.markup">
196 <xsl:if test="@label">
197 <xsl:value-of select="@label"/>
201 <xsl:template match="d:reference" mode="label.markup">
203 <xsl:when test="@label">
204 <xsl:value-of select="@label"/>
206 <xsl:when test="string($reference.autolabel) != 0">
207 <xsl:if test="$component.label.includes.part.label != 0 and
209 <xsl:variable name="part.label">
210 <xsl:apply-templates select="ancestor::d:part"
211 mode="label.markup"/>
213 <xsl:if test="$part.label != ''">
214 <xsl:value-of select="$part.label"/>
215 <xsl:apply-templates select="ancestor::d:part"
216 mode="intralabel.punctuation">
217 <xsl:with-param name="object" select="."/>
218 </xsl:apply-templates>
221 <xsl:variable name="format">
222 <xsl:call-template name="autolabel.format">
223 <xsl:with-param name="format" select="$reference.autolabel"/>
227 <xsl:when test="$label.from.part != 0 and ancestor::d:part">
228 <xsl:number from="d:part" count="d:reference" format="{$format}" level="any"/>
231 <xsl:number from="d:book" count="d:reference" format="{$format}" level="any"/>
238 <xsl:template match="d:refentry" mode="label.markup">
239 <xsl:if test="@label">
240 <xsl:value-of select="@label"/>
244 <xsl:template match="d:section" mode="label.markup">
245 <!-- if this is a nested section, label the parent -->
246 <xsl:if test="local-name(..) = 'section'">
247 <xsl:variable name="parent.section.label">
248 <xsl:call-template name="label.this.section">
249 <xsl:with-param name="section" select=".."/>
252 <xsl:if test="$parent.section.label != '0'">
253 <xsl:apply-templates select=".." mode="label.markup"/>
254 <xsl:apply-templates select=".." mode="intralabel.punctuation">
255 <xsl:with-param name="object" select="."/>
256 </xsl:apply-templates>
260 <!-- if the parent is a component, maybe label that too -->
261 <xsl:variable name="parent.is.component">
262 <xsl:call-template name="is.component">
263 <xsl:with-param name="node" select=".."/>
267 <!-- does this section get labelled? -->
268 <xsl:variable name="label">
269 <xsl:call-template name="label.this.section">
270 <xsl:with-param name="section" select="."/>
274 <xsl:if test="$section.label.includes.component.label != 0
275 and $parent.is.component != 0">
276 <xsl:variable name="parent.label">
277 <xsl:apply-templates select=".." mode="label.markup"/>
279 <xsl:if test="$parent.label != ''">
280 <xsl:apply-templates select=".." mode="label.markup"/>
281 <xsl:apply-templates select=".." mode="intralabel.punctuation">
282 <xsl:with-param name="object" select="."/>
283 </xsl:apply-templates>
289 test: <xsl:value-of select="$label"/>, <xsl:number count="d:section"/>
294 <xsl:when test="@label">
295 <xsl:value-of select="@label"/>
297 <xsl:when test="$label != 0">
298 <xsl:variable name="format">
299 <xsl:call-template name="autolabel.format">
300 <xsl:with-param name="format" select="$section.autolabel"/>
303 <xsl:number format="{$format}" count="d:section"/>
308 <xsl:template match="d:sect1" mode="label.markup">
309 <!-- if the parent is a component, maybe label that too -->
310 <xsl:variable name="parent.is.component">
311 <xsl:call-template name="is.component">
312 <xsl:with-param name="node" select=".."/>
316 <xsl:variable name="component.label">
317 <xsl:if test="$section.label.includes.component.label != 0
318 and $parent.is.component != 0">
319 <xsl:variable name="parent.label">
320 <xsl:apply-templates select=".." mode="label.markup"/>
322 <xsl:if test="$parent.label != ''">
323 <xsl:apply-templates select=".." mode="label.markup"/>
324 <xsl:apply-templates select=".." mode="intralabel.punctuation">
325 <xsl:with-param name="object" select="."/>
326 </xsl:apply-templates>
332 <xsl:variable name="is.numbered">
333 <xsl:call-template name="label.this.section"/>
337 <xsl:when test="@label">
338 <xsl:value-of select="@label"/>
340 <xsl:when test="$is.numbered != 0">
341 <xsl:variable name="format">
342 <xsl:call-template name="autolabel.format">
343 <xsl:with-param name="format" select="$section.autolabel"/>
346 <xsl:copy-of select="$component.label"/>
347 <xsl:number format="{$format}" count="d:sect1"/>
352 <xsl:template match="d:sect2|d:sect3|d:sect4|d:sect5" mode="label.markup">
353 <!-- label the parent -->
354 <xsl:variable name="parent.section.label">
355 <xsl:call-template name="label.this.section">
356 <xsl:with-param name="section" select=".."/>
359 <xsl:if test="$parent.section.label != '0'">
360 <xsl:apply-templates select=".." mode="label.markup"/>
361 <xsl:apply-templates select=".." mode="intralabel.punctuation">
362 <xsl:with-param name="object" select="."/>
363 </xsl:apply-templates>
366 <xsl:variable name="is.numbered">
367 <xsl:call-template name="label.this.section"/>
371 <xsl:when test="@label">
372 <xsl:value-of select="@label"/>
374 <xsl:when test="$is.numbered != 0">
375 <xsl:variable name="format">
376 <xsl:call-template name="autolabel.format">
377 <xsl:with-param name="format" select="$section.autolabel"/>
381 <xsl:when test="local-name(.) = 'sect2'">
382 <xsl:number format="{$format}" count="d:sect2"/>
384 <xsl:when test="local-name(.) = 'sect3'">
385 <xsl:number format="{$format}" count="d:sect3"/>
387 <xsl:when test="local-name(.) = 'sect4'">
388 <xsl:number format="{$format}" count="d:sect4"/>
390 <xsl:when test="local-name(.) = 'sect5'">
391 <xsl:number format="{$format}" count="d:sect5"/>
394 <xsl:message>label.markup: this can't happen!</xsl:message>
401 <xsl:template match="d:bridgehead" mode="label.markup">
402 <!-- bridgeheads are not normally numbered -->
405 <xsl:template match="d:refsect1" mode="label.markup">
407 <xsl:when test="@label">
408 <xsl:value-of select="@label"/>
410 <xsl:when test="$section.autolabel != 0">
411 <xsl:variable name="format">
412 <xsl:call-template name="autolabel.format">
413 <xsl:with-param name="format" select="$section.autolabel"/>
416 <xsl:number count="d:refsect1" format="{$format}"/>
421 <xsl:template match="d:refsect2|d:refsect3" mode="label.markup">
422 <!-- label the parent -->
423 <xsl:variable name="parent.label">
424 <xsl:apply-templates select=".." mode="label.markup"/>
426 <xsl:if test="$parent.label != ''">
427 <xsl:apply-templates select=".." mode="label.markup"/>
428 <xsl:apply-templates select=".." mode="intralabel.punctuation">
429 <xsl:with-param name="object" select="."/>
430 </xsl:apply-templates>
434 <xsl:when test="@label">
435 <xsl:value-of select="@label"/>
437 <xsl:when test="$section.autolabel != 0">
438 <xsl:variable name="format">
439 <xsl:call-template name="autolabel.format">
440 <xsl:with-param name="format" select="$section.autolabel"/>
444 <xsl:when test="local-name(.) = 'refsect2'">
445 <xsl:number count="d:refsect2" format="{$format}"/>
448 <xsl:number count="d:refsect3" format="{$format}"/>
455 <xsl:template match="d:simplesect" mode="label.markup">
456 <!-- if this is a nested section, label the parent -->
457 <xsl:if test="local-name(..) = 'section'
458 or local-name(..) = 'sect1'
459 or local-name(..) = 'sect2'
460 or local-name(..) = 'sect3'
461 or local-name(..) = 'sect4'
462 or local-name(..) = 'sect5'">
463 <xsl:variable name="parent.section.label">
464 <xsl:apply-templates select=".." mode="label.markup"/>
466 <xsl:if test="$parent.section.label != ''">
467 <xsl:apply-templates select=".." mode="label.markup"/>
468 <xsl:apply-templates select=".." mode="intralabel.punctuation">
469 <xsl:with-param name="object" select="."/>
470 </xsl:apply-templates>
474 <!-- if the parent is a component, maybe label that too -->
475 <xsl:variable name="parent.is.component">
476 <xsl:call-template name="is.component">
477 <xsl:with-param name="node" select=".."/>
481 <!-- does this section get labelled? -->
482 <xsl:variable name="label">
483 <xsl:call-template name="label.this.section">
484 <xsl:with-param name="section" select="."/>
488 <xsl:if test="$section.label.includes.component.label != 0
489 and $parent.is.component != 0">
490 <xsl:variable name="parent.label">
491 <xsl:apply-templates select=".." mode="label.markup"/>
493 <xsl:if test="$parent.label != ''">
494 <xsl:apply-templates select=".." mode="label.markup"/>
495 <xsl:apply-templates select=".." mode="intralabel.punctuation">
496 <xsl:with-param name="object" select="."/>
497 </xsl:apply-templates>
502 <xsl:when test="@label">
503 <xsl:value-of select="@label"/>
505 <xsl:when test="$label != 0">
506 <xsl:variable name="format">
507 <xsl:call-template name="autolabel.format">
508 <xsl:with-param name="format" select="$section.autolabel"/>
511 <xsl:number format="{$format}" count="d:simplesect"/>
516 <xsl:template match="d:topic" mode="label.markup">
517 <!-- topics are not numbered by default -->
520 <xsl:template match="d:qandadiv" mode="label.markup">
521 <xsl:variable name="lparent" select="(ancestor::d:set
524 |ancestor::d:appendix
527 |ancestor::d:simplesect
533 |ancestor::d:refsect1
534 |ancestor::d:refsect2
535 |ancestor::d:refsect3)[last()]"/>
537 <xsl:variable name="lparent.prefix">
538 <xsl:apply-templates select="$lparent" mode="label.markup"/>
541 <xsl:variable name="prefix">
542 <xsl:if test="$qanda.inherit.numeration != 0">
543 <xsl:if test="$lparent.prefix != ''">
544 <xsl:apply-templates select="$lparent" mode="label.markup"/>
545 <xsl:apply-templates select="$lparent" mode="intralabel.punctuation">
546 <xsl:with-param name="object" select="."/>
547 </xsl:apply-templates>
553 <xsl:when test="$qandadiv.autolabel != 0">
554 <xsl:variable name="format">
555 <xsl:call-template name="autolabel.format">
556 <xsl:with-param name="format" select="$qandadiv.autolabel"/>
559 <xsl:value-of select="$prefix"/>
560 <xsl:number level="multiple" count="d:qandadiv" format="{$format}"/>
565 <xsl:template match="d:question|d:answer" mode="label.markup">
566 <xsl:variable name="lparent" select="(ancestor::d:set
569 |ancestor::d:appendix
572 |ancestor::d:simplesect
578 |ancestor::d:refsect1
579 |ancestor::d:refsect2
580 |ancestor::d:refsect3)[last()]"/>
582 <xsl:variable name="lparent.prefix">
583 <xsl:apply-templates select="$lparent" mode="label.markup"/>
586 <xsl:variable name="prefix">
587 <xsl:if test="$qanda.inherit.numeration != 0">
589 <xsl:when test="ancestor::d:qandadiv">
590 <xsl:variable name="div.label">
591 <xsl:apply-templates select="ancestor::d:qandadiv[1]" mode="label.markup"/>
593 <xsl:if test="string-length($div.label) != 0">
594 <xsl:copy-of select="$div.label"/>
595 <xsl:apply-templates select="ancestor::d:qandadiv[1]"
596 mode="intralabel.punctuation">
597 <xsl:with-param name="object" select="."/>
598 </xsl:apply-templates>
601 <xsl:when test="$lparent.prefix != ''">
602 <xsl:apply-templates select="$lparent" mode="label.markup"/>
603 <xsl:apply-templates select="$lparent" mode="intralabel.punctuation">
604 <xsl:with-param name="object" select="."/>
605 </xsl:apply-templates>
611 <xsl:variable name="inhlabel"
612 select="ancestor-or-self::d:qandaset/@defaultlabel[1]"/>
614 <xsl:variable name="deflabel">
616 <xsl:when test="$inhlabel != ''">
617 <xsl:value-of select="$inhlabel"/>
620 <xsl:value-of select="$qanda.defaultlabel"/>
625 <xsl:variable name="label" select="d:label"/>
628 <xsl:when test="count($label)>0">
629 <xsl:apply-templates select="$label"/>
632 <xsl:when test="$deflabel = 'qanda' and self::d:question">
633 <xsl:call-template name="gentext">
634 <xsl:with-param name="key" select="'Question'"/>
638 <xsl:when test="$deflabel = 'qanda' and self::d:answer">
639 <xsl:call-template name="gentext">
640 <xsl:with-param name="key" select="'Answer'"/>
644 <xsl:when test="($deflabel = 'qnumber' or
645 $deflabel = 'qnumberanda') and self::d:question">
646 <xsl:call-template name="gentext">
647 <xsl:with-param name="key" select="'Question'"/>
649 <xsl:text> </xsl:text>
650 <xsl:value-of select="$prefix"/>
651 <xsl:number level="multiple" count="d:qandaentry" format="1"/>
654 <xsl:when test="$deflabel = 'qnumberanda' and self::d:answer">
655 <xsl:call-template name="gentext">
656 <xsl:with-param name="key" select="'Answer'"/>
660 <xsl:when test="$deflabel = 'number' and self::d:question">
661 <xsl:value-of select="$prefix"/>
662 <xsl:number level="multiple" count="d:qandaentry" format="1"/>
667 <xsl:template match="d:bibliography|d:glossary|
668 d:qandaset|d:index|d:setindex" mode="label.markup">
669 <xsl:if test="@label">
670 <xsl:value-of select="@label"/>
674 <xsl:template match="d:figure|d:table|d:example" mode="label.markup">
675 <xsl:variable name="pchap"
676 select="(ancestor::d:chapter
677 |ancestor::d:appendix
678 |ancestor::d:article[ancestor::d:book])[last()]"/>
680 <xsl:variable name="prefix">
681 <xsl:if test="count($pchap) > 0">
682 <xsl:apply-templates select="$pchap" mode="label.markup"/>
687 <xsl:when test="@label">
688 <xsl:value-of select="@label"/>
692 <xsl:when test="$prefix != ''">
693 <xsl:apply-templates select="$pchap" mode="label.markup"/>
694 <xsl:apply-templates select="$pchap" mode="intralabel.punctuation">
695 <xsl:with-param name="object" select="."/>
696 </xsl:apply-templates>
697 <xsl:number format="1" from="d:chapter|d:appendix" level="any"/>
700 <xsl:number format="1" from="d:book|d:article" level="any"/>
707 <xsl:template match="d:procedure" mode="label.markup">
708 <xsl:variable name="pchap"
709 select="ancestor::d:chapter
710 |ancestor::d:appendix
711 |ancestor::d:article[ancestor::d:book]"/>
713 <xsl:variable name="prefix">
714 <xsl:if test="count($pchap) > 0">
715 <xsl:apply-templates select="$pchap" mode="label.markup"/>
720 <xsl:when test="@label">
721 <xsl:value-of select="@label"/>
723 <xsl:when test="$formal.procedures = 0">
728 <xsl:when test="count($pchap)>0">
729 <xsl:if test="$prefix != ''">
730 <xsl:apply-templates select="$pchap" mode="label.markup"/>
731 <xsl:apply-templates select="$pchap" mode="intralabel.punctuation">
732 <xsl:with-param name="object" select="."/>
733 </xsl:apply-templates>
735 <xsl:number count="d:procedure[d:title|d:blockinfo/d:title|d:info/d:title]" format="1"
736 from="d:chapter|d:appendix" level="any"/>
739 <xsl:number count="d:procedure[d:title|d:blockinfo/d:title|d:info/d:title]" format="1"
740 from="d:book|d:article" level="any"/>
747 <xsl:template match="d:equation" mode="label.markup">
748 <xsl:variable name="pchap"
749 select="ancestor::d:chapter
750 |ancestor::d:appendix
751 |ancestor::d:article[ancestor::d:book]"/>
753 <xsl:variable name="prefix">
754 <xsl:if test="count($pchap) > 0">
755 <xsl:apply-templates select="$pchap" mode="label.markup"/>
760 <xsl:when test="@label">
761 <xsl:value-of select="@label"/>
765 <xsl:when test="count($pchap)>0">
766 <xsl:if test="$prefix != ''">
767 <xsl:apply-templates select="$pchap" mode="label.markup"/>
768 <xsl:apply-templates select="$pchap" mode="intralabel.punctuation">
769 <xsl:with-param name="object" select="."/>
770 </xsl:apply-templates>
772 <xsl:number format="1" count="d:equation"
773 from="d:chapter|d:appendix" level="any"/>
776 <xsl:number format="1" count="d:equation"
777 from="d:book|d:article" level="any"/>
784 <xsl:template match="d:orderedlist/d:listitem" mode="label.markup">
785 <xsl:variable name="numeration">
786 <xsl:call-template name="list.numeration">
787 <xsl:with-param name="node" select="parent::d:orderedlist"/>
791 <xsl:variable name="type">
793 <xsl:when test="$numeration='arabic'">1</xsl:when>
794 <xsl:when test="$numeration='loweralpha'">a</xsl:when>
795 <xsl:when test="$numeration='lowerroman'">i</xsl:when>
796 <xsl:when test="$numeration='upperalpha'">A</xsl:when>
797 <xsl:when test="$numeration='upperroman'">I</xsl:when>
798 <!-- What!? This should never happen -->
801 <xsl:text>Unexpected numeration: </xsl:text>
802 <xsl:value-of select="$numeration"/>
804 <xsl:value-of select="1."/>
809 <xsl:variable name="item-number">
810 <xsl:call-template name="orderedlist-item-number"/>
813 <xsl:number value="$item-number" format="{$type}"/>
816 <xsl:template match="d:production" mode="label.markup">
817 <xsl:number count="d:production" level="any"/>
820 <xsl:template match="d:abstract" mode="label.markup">
824 <xsl:template match="d:sidebar" mode="label.markup">
828 <xsl:template match="d:glossdiv|d:glosslist" mode="label.markup">
832 <xsl:template match="d:glossentry" mode="label.markup">
836 <!-- ============================================================ -->
838 <xsl:template name="label.this.section">
839 <xsl:param name="section" select="."/>
841 <xsl:variable name="level">
842 <xsl:call-template name="section.level"/>
846 <!-- bridgeheads are not numbered -->
847 <xsl:when test="$section/self::d:bridgehead">0</xsl:when>
848 <xsl:when test="$level <= $section.autolabel.max.depth">
849 <xsl:value-of select="$section.autolabel"/>
851 <xsl:otherwise>0</xsl:otherwise>
855 <doc:template name="label.this.section" xmlns="">
856 <refpurpose>Returns true if $section should be labelled</refpurpose>
857 <refdescription id="label.this.section-desc">
858 <para>Returns true if the specified section should be labelled.
859 By default, this template returns zero unless
860 the section level is less than or equal to the value of the
861 <literal>$section.autolabel.max.depth</literal> parameter, in
862 which case it returns
863 <literal>$section.autolabel</literal>.
864 Custom stylesheets may override it to get more selective behavior.</para>
868 <!-- ============================================================ -->
870 <xsl:template name="default.autolabel.format">
871 <xsl:param name="context" select="."/>
873 <xsl:when test="local-name($context) = 'appendix'">
874 <xsl:value-of select="'A'"/>
876 <xsl:when test="local-name($context) = 'part'">
877 <xsl:value-of select="'I'"/>
879 <xsl:otherwise>1</xsl:otherwise>
883 <xsl:template name="autolabel.format">
884 <xsl:param name="context" select="."/>
885 <xsl:param name="format"/>
888 <xsl:when test="string($format) != 0">
890 <xsl:when test="string($format)='arabic' or $format='1'">1</xsl:when>
891 <xsl:when test="$format='loweralpha' or $format='a'">
892 <xsl:value-of select="'a'"/>
894 <xsl:when test="$format='lowerroman' or $format='i'">
895 <xsl:value-of select="'i'"/>
897 <xsl:when test="$format='upperalpha' or $format='A'">
898 <xsl:value-of select="'A'"/>
900 <xsl:when test="$format='upperroman' or $format='I'">
901 <xsl:value-of select="'I'"/>
903 <xsl:when test="$format='arabicindic' or $format='١'">
904 <xsl:value-of select="'١'"/>
908 <xsl:text>Unexpected </xsl:text><xsl:value-of select="local-name(.)"/><xsl:text>.autolabel value: </xsl:text>
909 <xsl:value-of select="$format"/><xsl:text>; using default.</xsl:text>
911 <xsl:call-template name="default.autolabel.format"/>
918 <doc:template name="autolabel.format" xmlns="">
919 <refpurpose>Returns format for autolabel parameters</refpurpose>
920 <refdescription id="autolabel.format-desc">
921 <para>Returns format passed as parameter if non zero. Supported
922 format are 'arabic' or '1', 'loweralpha' or 'a', 'lowerroman' or 'i',
923 'upperlapha' or 'A', 'upperroman' or 'I', 'arabicindic' or '١'.
924 If its not one of these then
925 returns the default format.</para>
929 <!-- ============================================================ -->