Showing:

Documentation
Parameters
Used by
References
Included from
Source
Stylesheet labels.xsl
Included from
Template *intralabel.punctuation
Documentation
<doc:mode mode="label.markup">
<refpurpose>Provides access to element labels</refpurpose>
<refdescription id="label.markup-desc">
<para>Processing an element in the
<literal role="mode">label.markup</literal> mode produces the
element label.</para>
<para>Trailing punctuation is not added to the label.
</para>
</refdescription>
</doc:mode>

Description

 ********************************************************************
     $Id$
     ********************************************************************

     This file is part of the XSL DocBook Stylesheet distribution.
     See ../README or http://docbook.sf.net/release/xsl/current/ for
     copyright and other information.

     ******************************************************************** 
 ==================================================================== 
 label markup 
Namespace No namespace
Match *
Mode intralabel.punctuation
Import precedence 0
Source
<xsl:template match="*" mode="intralabel.punctuation">
  <xsl:text>.</xsl:text>
</xsl:template>
Template *label.markup
Namespace No namespace
Match *
Mode label.markup
Parameters
QName Namespace Select
verbose No namespace 1
Import precedence 0
Source
<xsl:template match="*" mode="label.markup">
  <xsl:param name="verbose" select="1"/>
  <xsl:if test="$verbose">
    <xsl:message>
      <xsl:text>Request for label of unexpected element: </xsl:text>
      <xsl:value-of select="local-name(.)"/>
    </xsl:message>
  </xsl:if>
</xsl:template>
Template d:set|d:booklabel.markup
Namespace No namespace
Match d:set|d:book
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:set|d:book" mode="label.markup">
  <xsl:if test="@label">
    <xsl:value-of select="@label"/>
  </xsl:if>
</xsl:template>
Template d:partlabel.markup
Namespace No namespace
Match d:part
Mode label.markup
References
Parameter part.autolabel
Template autolabel.format
Import precedence 0
Source
<xsl:template match="d:part" mode="label.markup">
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="string($part.autolabel) != 0">
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$part.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:number from="d:book" count="d:part" format="{$format}"/>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:partintrolabel.markup
Namespace No namespace
Match d:partintro
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:partintro" mode="label.markup">
  <!-- no label -->
</xsl:template>
Template d:prefacelabel.markup
Namespace No namespace
Match d:preface
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:preface" mode="label.markup">
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="string($preface.autolabel) != 0">
      <xsl:if test="$component.label.includes.part.label != 0 and                       ancestor::d:part">
        <xsl:variable name="part.label">
          <xsl:apply-templates select="ancestor::d:part" mode="label.markup"/>
        </xsl:variable>
        <xsl:if test="$part.label != ''">
          <xsl:value-of select="$part.label"/>
          <xsl:apply-templates select="ancestor::d:part" mode="intralabel.punctuation"/>
        </xsl:if>
      </xsl:if>
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$preface.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:choose>
        <xsl:when test="$label.from.part != 0 and ancestor::d:part">
          <xsl:number from="d:part" count="d:preface" format="{$format}" level="any"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:number from="d:book" count="d:preface" format="{$format}" level="any"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:chapterlabel.markup
Namespace No namespace
Match d:chapter
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:chapter" mode="label.markup">
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="string($chapter.autolabel) != 0">
      <xsl:if test="$component.label.includes.part.label != 0 and                       ancestor::d:part">
        <xsl:variable name="part.label">
          <xsl:apply-templates select="ancestor::d:part" mode="label.markup"/>
        </xsl:variable>
        <xsl:if test="$part.label != ''">
          <xsl:value-of select="$part.label"/>
          <xsl:apply-templates select="ancestor::d:part" mode="intralabel.punctuation"/>
        </xsl:if>
      </xsl:if>
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$chapter.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:choose>
        <xsl:when test="$label.from.part != 0 and ancestor::d:part">
          <xsl:number from="d:part" count="d:chapter" format="{$format}" level="any"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:number from="d:book" count="d:chapter" format="{$format}" level="any"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:appendixlabel.markup
Namespace No namespace
Match d:appendix
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:appendix" mode="label.markup">
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="string($appendix.autolabel) != 0">
      <xsl:if test="$component.label.includes.part.label != 0 and                       ancestor::d:part">
        <xsl:variable name="part.label">
          <xsl:apply-templates select="ancestor::d:part" mode="label.markup"/>
        </xsl:variable>
        <xsl:if test="$part.label != ''">
          <xsl:value-of select="$part.label"/>
          <xsl:apply-templates select="ancestor::d:part" mode="intralabel.punctuation"/>
        </xsl:if>
      </xsl:if>
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$appendix.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:choose>
        <xsl:when test="$label.from.part != 0 and ancestor::d:part">
          <xsl:number from="d:part" count="d:appendix" format="{$format}" level="any"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:number from="d:book|d:article" count="d:appendix" format="{$format}" level="any"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:articlelabel.markup
Namespace No namespace
Match d:article
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:article" mode="label.markup">
  <xsl:if test="@label">
    <xsl:value-of select="@label"/>
  </xsl:if>
</xsl:template>
Template d:dedication|d:colophonlabel.markup
Namespace No namespace
Match d:dedication|d:colophon
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:dedication|d:colophon" mode="label.markup">
  <xsl:if test="@label">
    <xsl:value-of select="@label"/>
  </xsl:if>
</xsl:template>
Template d:referencelabel.markup
Namespace No namespace
Match d:reference
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:reference" mode="label.markup">
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="string($reference.autolabel) != 0">
      <xsl:if test="$component.label.includes.part.label != 0 and                       ancestor::d:part">
        <xsl:variable name="part.label">
          <xsl:apply-templates select="ancestor::d:part" mode="label.markup"/>
        </xsl:variable>
        <xsl:if test="$part.label != ''">
          <xsl:value-of select="$part.label"/>
          <xsl:apply-templates select="ancestor::d:part" mode="intralabel.punctuation"/>
        </xsl:if>
      </xsl:if>
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$reference.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:choose>
        <xsl:when test="$label.from.part != 0 and ancestor::d:part">
          <xsl:number from="d:part" count="d:reference" format="{$format}" level="any"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:number from="d:book" count="d:reference" format="{$format}" level="any"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:refentrylabel.markup
Namespace No namespace
Match d:refentry
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:refentry" mode="label.markup">
  <xsl:if test="@label">
    <xsl:value-of select="@label"/>
  </xsl:if>
</xsl:template>
Template d:sectionlabel.markup
Namespace No namespace
Match d:section
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:section" mode="label.markup">
  <!-- if this is a nested section, label the parent -->
  <xsl:if test="local-name(..) = 'section'">
    <xsl:variable name="parent.section.label">
      <xsl:call-template name="label.this.section">
        <xsl:with-param name="section" select=".."/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:if test="$parent.section.label != '0'">
      <xsl:apply-templates select=".." mode="label.markup"/>
      <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
    </xsl:if>
  </xsl:if>
  <!-- if the parent is a component, maybe label that too -->
  <xsl:variable name="parent.is.component">
    <xsl:call-template name="is.component">
      <xsl:with-param name="node" select=".."/>
    </xsl:call-template>
  </xsl:variable>
  <!-- does this section get labelled? -->
  <xsl:variable name="label">
    <xsl:call-template name="label.this.section">
      <xsl:with-param name="section" select="."/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:if test="$section.label.includes.component.label != 0                 and $parent.is.component != 0">
    <xsl:variable name="parent.label">
      <xsl:apply-templates select=".." mode="label.markup"/>
    </xsl:variable>
    <xsl:if test="$parent.label != ''">
      <xsl:apply-templates select=".." mode="label.markup"/>
      <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
    </xsl:if>
  </xsl:if>
  <!--
  <xsl:message>
    test: <xsl:value-of select="$label"/>, <xsl:number count="d:section"/>
  </xsl:message>
-->
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="$label != 0">
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$section.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:number format="{$format}" count="d:section"/>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:sect1label.markup
Namespace No namespace
Match d:sect1
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:sect1" mode="label.markup">
  <!-- if the parent is a component, maybe label that too -->
  <xsl:variable name="parent.is.component">
    <xsl:call-template name="is.component">
      <xsl:with-param name="node" select=".."/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="component.label">
    <xsl:if test="$section.label.includes.component.label != 0                   and $parent.is.component != 0">
      <xsl:variable name="parent.label">
        <xsl:apply-templates select=".." mode="label.markup"/>
      </xsl:variable>
      <xsl:if test="$parent.label != ''">
        <xsl:apply-templates select=".." mode="label.markup"/>
        <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
      </xsl:if>
    </xsl:if>
  </xsl:variable>
  <xsl:variable name="is.numbered">
    <xsl:call-template name="label.this.section"/>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="$is.numbered != 0">
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$section.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:copy-of select="$component.label"/>
      <xsl:number format="{$format}" count="d:sect1"/>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:sect2|d:sect3|d:sect4|d:sect5label.markup
Namespace No namespace
Match d:sect2|d:sect3|d:sect4|d:sect5
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:sect2|d:sect3|d:sect4|d:sect5" mode="label.markup">
  <!-- label the parent -->
  <xsl:variable name="parent.section.label">
    <xsl:call-template name="label.this.section">
      <xsl:with-param name="section" select=".."/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:if test="$parent.section.label != '0'">
    <xsl:apply-templates select=".." mode="label.markup"/>
    <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
  </xsl:if>
  <xsl:variable name="is.numbered">
    <xsl:call-template name="label.this.section"/>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="$is.numbered != 0">
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$section.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:choose>
        <xsl:when test="local-name(.) = 'sect2'">
          <xsl:number format="{$format}" count="d:sect2"/>
        </xsl:when>
        <xsl:when test="local-name(.) = 'sect3'">
          <xsl:number format="{$format}" count="d:sect3"/>
        </xsl:when>
        <xsl:when test="local-name(.) = 'sect4'">
          <xsl:number format="{$format}" count="d:sect4"/>
        </xsl:when>
        <xsl:when test="local-name(.) = 'sect5'">
          <xsl:number format="{$format}" count="d:sect5"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:message>label.markup: this can't happen!</xsl:message>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:bridgeheadlabel.markup
Namespace No namespace
Match d:bridgehead
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:bridgehead" mode="label.markup">
  <!-- FIXME: could we do a better job here? -->
  <xsl:variable name="contsec" select="(ancestor::d:section                          |ancestor::d:simplesect                          |ancestor::d:sect1                          |ancestor::d:sect2                          |ancestor::d:sect3                          |ancestor::d:sect4                          |ancestor::d:sect5                          |ancestor::d:refsect1                          |ancestor::d:refsect2                          |ancestor::d:refsect3                          |ancestor::d:chapter                          |ancestor::d:appendix                          |ancestor::d:preface)[last()]"/>
  <xsl:apply-templates select="$contsec" mode="label.markup"/>
</xsl:template>
Template d:refsect1label.markup
Namespace No namespace
Match d:refsect1
Mode label.markup
References
Parameter section.autolabel
Template autolabel.format
Import precedence 0
Source
<xsl:template match="d:refsect1" mode="label.markup">
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="$section.autolabel != 0">
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$section.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:number count="d:refsect1" format="{$format}"/>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:refsect2|d:refsect3label.markup
Namespace No namespace
Match d:refsect2|d:refsect3
Mode label.markup
References
Parameter section.autolabel
Template autolabel.format
Import precedence 0
Source
<xsl:template match="d:refsect2|d:refsect3" mode="label.markup">
  <!-- label the parent -->
  <xsl:variable name="parent.label">
    <xsl:apply-templates select=".." mode="label.markup"/>
  </xsl:variable>
  <xsl:if test="$parent.label != ''">
    <xsl:apply-templates select=".." mode="label.markup"/>
    <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
  </xsl:if>
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="$section.autolabel != 0">
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$section.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:choose>
        <xsl:when test="local-name(.) = 'refsect2'">
          <xsl:number count="d:refsect2" format="{$format}"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:number count="d:refsect3" format="{$format}"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:simplesectlabel.markup
Namespace No namespace
Match d:simplesect
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:simplesect" mode="label.markup">
  <!-- if this is a nested section, label the parent -->
  <xsl:if test="local-name(..) = 'section'                 or local-name(..) = 'sect1'                 or local-name(..) = 'sect2'                 or local-name(..) = 'sect3'                 or local-name(..) = 'sect4'                 or local-name(..) = 'sect5'">
    <xsl:variable name="parent.section.label">
      <xsl:apply-templates select=".." mode="label.markup"/>
    </xsl:variable>
    <xsl:if test="$parent.section.label != ''">
      <xsl:apply-templates select=".." mode="label.markup"/>
      <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
    </xsl:if>
  </xsl:if>
  <!-- if the parent is a component, maybe label that too -->
  <xsl:variable name="parent.is.component">
    <xsl:call-template name="is.component">
      <xsl:with-param name="node" select=".."/>
    </xsl:call-template>
  </xsl:variable>
  <!-- does this section get labelled? -->
  <xsl:variable name="label">
    <xsl:call-template name="label.this.section">
      <xsl:with-param name="section" select="."/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:if test="$section.label.includes.component.label != 0                 and $parent.is.component != 0">
    <xsl:variable name="parent.label">
      <xsl:apply-templates select=".." mode="label.markup"/>
    </xsl:variable>
    <xsl:if test="$parent.label != ''">
      <xsl:apply-templates select=".." mode="label.markup"/>
      <xsl:apply-templates select=".." mode="intralabel.punctuation"/>
    </xsl:if>
  </xsl:if>
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="$label != 0">
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$section.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:number format="{$format}" count="d:simplesect"/>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:qandadivlabel.markup
Namespace No namespace
Match d:qandadiv
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:qandadiv" mode="label.markup">
  <xsl:variable name="lparent" select="(ancestor::d:set                                        |ancestor::d:book                                        |ancestor::d:chapter                                        |ancestor::d:appendix                                        |ancestor::d:preface                                        |ancestor::d:section                                        |ancestor::d:simplesect                                        |ancestor::d:sect1                                        |ancestor::d:sect2                                        |ancestor::d:sect3                                        |ancestor::d:sect4                                        |ancestor::d:sect5                                        |ancestor::d:refsect1                                        |ancestor::d:refsect2                                        |ancestor::d:refsect3)[last()]"/>
  <xsl:variable name="lparent.prefix">
    <xsl:apply-templates select="$lparent" mode="label.markup"/>
  </xsl:variable>
  <xsl:variable name="prefix">
    <xsl:if test="$qanda.inherit.numeration != 0">
      <xsl:if test="$lparent.prefix != ''">
        <xsl:apply-templates select="$lparent" mode="label.markup"/>
        <xsl:apply-templates select="$lparent" mode="intralabel.punctuation"/>
      </xsl:if>
    </xsl:if>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="$qandadiv.autolabel != 0">
      <xsl:variable name="format">
        <xsl:call-template name="autolabel.format">
          <xsl:with-param name="format" select="$qandadiv.autolabel"/>
        </xsl:call-template>
      </xsl:variable>
      <xsl:value-of select="$prefix"/>
      <xsl:number level="multiple" count="d:qandadiv" format="{$format}"/>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:question|d:answerlabel.markup
Namespace No namespace
Match d:question|d:answer
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:question|d:answer" mode="label.markup">
  <xsl:variable name="lparent" select="(ancestor::d:set                                        |ancestor::d:book                                        |ancestor::d:chapter                                        |ancestor::d:appendix                                        |ancestor::d:preface                                        |ancestor::d:section                                        |ancestor::d:simplesect                                        |ancestor::d:sect1                                        |ancestor::d:sect2                                        |ancestor::d:sect3                                        |ancestor::d:sect4                                        |ancestor::d:sect5                                        |ancestor::d:refsect1                                        |ancestor::d:refsect2                                        |ancestor::d:refsect3)[last()]"/>
  <xsl:variable name="lparent.prefix">
    <xsl:apply-templates select="$lparent" mode="label.markup"/>
  </xsl:variable>
  <xsl:variable name="prefix">
    <xsl:if test="$qanda.inherit.numeration != 0">
      <xsl:choose>
        <xsl:when test="ancestor::d:qandadiv">
          <xsl:variable name="div.label">
            <xsl:apply-templates select="ancestor::d:qandadiv[1]" mode="label.markup"/>
          </xsl:variable>
          <xsl:if test="string-length($div.label) != 0">
            <xsl:copy-of select="$div.label"/>
            <xsl:apply-templates select="ancestor::d:qandadiv[1]" mode="intralabel.punctuation"/>
          </xsl:if>
        </xsl:when>
        <xsl:when test="$lparent.prefix != ''">
          <xsl:apply-templates select="$lparent" mode="label.markup"/>
          <xsl:apply-templates select="$lparent" mode="intralabel.punctuation"/>
        </xsl:when>
      </xsl:choose>
    </xsl:if>
  </xsl:variable>
  <xsl:variable name="inhlabel" select="ancestor-or-self::d:qandaset/@defaultlabel[1]"/>
  <xsl:variable name="deflabel">
    <xsl:choose>
      <xsl:when test="$inhlabel != ''">
        <xsl:value-of select="$inhlabel"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$qanda.defaultlabel"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="label" select="d:label"/>
  <xsl:choose>
    <xsl:when test="count($label)>0">
      <xsl:apply-templates select="$label"/>
    </xsl:when>
    <xsl:when test="$deflabel = 'qanda' and self::d:question">
      <xsl:call-template name="gentext">
        <xsl:with-param name="key" select="'Question'"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:when test="$deflabel = 'qanda' and self::d:answer">
      <xsl:call-template name="gentext">
        <xsl:with-param name="key" select="'Answer'"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:when test="($deflabel = 'qnumber' or                      $deflabel = 'qnumberanda') and self::d:question">
      <xsl:call-template name="gentext">
        <xsl:with-param name="key" select="'Question'"/>
      </xsl:call-template>
      <xsl:text> </xsl:text>
      <xsl:value-of select="$prefix"/>
      <xsl:number level="multiple" count="d:qandaentry" format="1"/>
    </xsl:when>
    <xsl:when test="$deflabel = 'qnumberanda' and self::d:answer">
      <xsl:call-template name="gentext">
        <xsl:with-param name="key" select="'Answer'"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:when test="$deflabel = 'number' and self::d:question">
      <xsl:value-of select="$prefix"/>
      <xsl:number level="multiple" count="d:qandaentry" format="1"/>
    </xsl:when>
  </xsl:choose>
</xsl:template>
Template d:bibliography|d:glossary| d:qandaset|d:index|d:setindexlabel.markup
Namespace No namespace
Match d:bibliography|d:glossary| d:qandaset|d:index|d:setindex
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:bibliography|d:glossary|                      d:qandaset|d:index|d:setindex" mode="label.markup">
  <xsl:if test="@label">
    <xsl:value-of select="@label"/>
  </xsl:if>
</xsl:template>
Template d:figure|d:table|d:examplelabel.markup
Namespace No namespace
Match d:figure|d:table|d:example
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:figure|d:table|d:example" mode="label.markup">
  <xsl:variable name="pchap" select="(ancestor::d:chapter                         |ancestor::d:appendix                         |ancestor::d:article[ancestor::d:book])[last()]"/>
  <xsl:variable name="prefix">
    <xsl:if test="count($pchap) > 0">
      <xsl:apply-templates select="$pchap" mode="label.markup"/>
    </xsl:if>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:choose>
        <xsl:when test="$prefix != ''">
          <xsl:apply-templates select="$pchap" mode="label.markup"/>
          <xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
          <xsl:number format="1" from="d:chapter|d:appendix" level="any"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:number format="1" from="d:book|d:article" level="any"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Template d:procedurelabel.markup
Namespace No namespace
Match d:procedure
Mode label.markup
References
Parameter formal.procedures
Import precedence 0
Source
<xsl:template match="d:procedure" mode="label.markup">
  <xsl:variable name="pchap" select="ancestor::d:chapter                         |ancestor::d:appendix                         |ancestor::d:article[ancestor::d:book]"/>
  <xsl:variable name="prefix">
    <xsl:if test="count($pchap) > 0">
      <xsl:apply-templates select="$pchap" mode="label.markup"/>
    </xsl:if>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:when test="$formal.procedures = 0">
      <!-- No label -->
    </xsl:when>
    <xsl:otherwise>
      <xsl:choose>
        <xsl:when test="count($pchap)>0">
          <xsl:if test="$prefix != ''">
            <xsl:apply-templates select="$pchap" mode="label.markup"/>
            <xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
          </xsl:if>
          <xsl:number count="d:procedure[d:title]" format="1" from="d:chapter|d:appendix" level="any"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:number count="d:procedure[d:title]" format="1" from="d:book|d:article" level="any"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Template d:equationlabel.markup
Namespace No namespace
Match d:equation
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:equation" mode="label.markup">
  <xsl:variable name="pchap" select="ancestor::d:chapter                         |ancestor::d:appendix                         |ancestor::d:article[ancestor::d:book]"/>
  <xsl:variable name="prefix">
    <xsl:if test="count($pchap) > 0">
      <xsl:apply-templates select="$pchap" mode="label.markup"/>
    </xsl:if>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="@label">
      <xsl:value-of select="@label"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:choose>
        <xsl:when test="count($pchap)>0">
          <xsl:if test="$prefix != ''">
            <xsl:apply-templates select="$pchap" mode="label.markup"/>
            <xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
          </xsl:if>
          <xsl:number format="1" count="d:equation[d:title or d:info/d:title]" from="d:chapter|d:appendix" level="any"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:number format="1" count="d:equation[d:title or d:info/d:title]" from="d:book|d:article" level="any"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
Template d:orderedlist/d:listitemlabel.markup
Namespace No namespace
Match d:orderedlist/d:listitem
Mode label.markup
References
Import precedence 0
Source
<xsl:template match="d:orderedlist/d:listitem" mode="label.markup">
  <xsl:variable name="numeration">
    <xsl:call-template name="list.numeration">
      <xsl:with-param name="node" select="parent::d:orderedlist"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="type">
    <xsl:choose>
      <xsl:when test="$numeration='arabic'">1</xsl:when>
      <xsl:when test="$numeration='loweralpha'">a</xsl:when>
      <xsl:when test="$numeration='lowerroman'">i</xsl:when>
      <xsl:when test="$numeration='upperalpha'">A</xsl:when>
      <xsl:when test="$numeration='upperroman'">I</xsl:when>
      <!-- What!? This should never happen -->
      <xsl:otherwise>
        <xsl:message>
          <xsl:text>Unexpected numeration: </xsl:text>
          <xsl:value-of select="$numeration"/>
        </xsl:message>
        <xsl:value-of select="1."/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="item-number">
    <xsl:call-template name="orderedlist-item-number"/>
  </xsl:variable>
  <xsl:number value="$item-number" format="{$type}"/>
</xsl:template>
Template d:abstractlabel.markup
Namespace No namespace
Match d:abstract
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:abstract" mode="label.markup">
  <!-- nop -->
</xsl:template>
Template d:sidebarlabel.markup
Namespace No namespace
Match d:sidebar
Mode label.markup
Import precedence 0
Source
<xsl:template match="d:sidebar" mode="label.markup">
  <!-- nop -->
</xsl:template>
Template label.this.section
Documentation

Description

 ============================================================ 
Namespace No namespace
Used by
References
Parameters
QName Namespace Select
section No namespace .
Import precedence 0
Source
<xsl:template name="label.this.section">
  <xsl:param name="section" select="."/>
  <xsl:variable name="level">
    <xsl:call-template name="section.level"/>
  </xsl:variable>
  <xsl:choose>
    <xsl:when test="$level <= $section.autolabel.max.depth">
      <xsl:value-of select="$section.autolabel"/>
    </xsl:when>
    <xsl:otherwise>0</xsl:otherwise>
  </xsl:choose>
</xsl:template>
Template default.autolabel.format
Documentation
<doc:template name="label.this.section">
<refpurpose>Returns true if $section should be labelled</refpurpose>
<refdescription id="label.this.section-desc">
<para>Returns true if the specified section should be labelled.
By default, this template returns zero unless 
the section level is less than or equal to the value of the
<literal>$section.autolabel.max.depth</literal> parameter, in
which case it returns
<literal>$section.autolabel</literal>.
Custom stylesheets may override it to get more selective behavior.</para>
</refdescription>
</doc:template>

Description

 ============================================================ 
Namespace No namespace
Used by
Template autolabel.format
Parameters
QName Namespace Select
context No namespace .
Import precedence 0
Source
<xsl:template name="default.autolabel.format">
  <xsl:param name="context" select="."/>
  <xsl:choose>
    <xsl:when test="local-name($context) = 'appendix'">
      <xsl:value-of select="'A'"/>
    </xsl:when>
    <xsl:when test="local-name($context) = 'part'">
      <xsl:value-of select="'I'"/>
    </xsl:when>
    <xsl:otherwise>1</xsl:otherwise>
  </xsl:choose>
</xsl:template>
Template autolabel.format
Namespace No namespace
Used by
References
Parameters
QName Namespace Select
context No namespace .
format No namespace
Import precedence 0
Source
<xsl:template name="autolabel.format">
  <xsl:param name="context" select="."/>
  <xsl:param name="format"/>
  <xsl:choose>
    <xsl:when test="string($format) != 0">
      <xsl:choose>
        <xsl:when test="string($format)='arabic' or $format='1'">1</xsl:when>
        <xsl:when test="$format='loweralpha' or $format='a'">
          <xsl:value-of select="'a'"/>
        </xsl:when>
        <xsl:when test="$format='lowerroman' or $format='i'">
          <xsl:value-of select="'i'"/>
        </xsl:when>
        <xsl:when test="$format='upperalpha' or $format='A'">
          <xsl:value-of select="'A'"/>
        </xsl:when>
        <xsl:when test="$format='upperroman' or $format='I'">
          <xsl:value-of select="'I'"/>
        </xsl:when>
        <xsl:when test="$format='arabicindic' or $format='١'">
          <xsl:value-of select="'١'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:message>
            <xsl:text>Unexpected </xsl:text>
            <xsl:value-of select="local-name(.)"/>
            <xsl:text>.autolabel value: </xsl:text>
            <xsl:value-of select="$format"/>
            <xsl:text>; using default.</xsl:text>
          </xsl:message>
          <xsl:call-template name="default.autolabel.format"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
  </xsl:choose>
</xsl:template>