<xsl:if test="$qanda.inherit.numeration != 0">
<xsl:choose>
<xsl:when test="ancestor::qandadiv">
- <xsl:apply-templates select="ancestor::qandadiv[1]" mode="label.markup"/>
- <xsl:apply-templates select="ancestor::qandadiv[1]"
- mode="intralabel.punctuation"/>
+ <xsl:variable name="div.label">
+ <xsl:apply-templates select="ancestor::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::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="$label"/>
</xsl:when>
- <xsl:when test="$deflabel = 'qanda' and local-name(.) = 'question'">
+ <xsl:when test="$deflabel = 'qanda' and self::question">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Question'"/>
</xsl:call-template>
</xsl:when>
- <xsl:when test="$deflabel = 'qanda' and local-name(.) = 'answer'">
+ <xsl:when test="$deflabel = 'qanda' and self::answer">
<xsl:call-template name="gentext">
<xsl:with-param name="key" select="'Answer'"/>
</xsl:call-template>
</xsl:when>
- <xsl:when test="$deflabel = 'number' and local-name(.) = 'question'">
+ <xsl:when test="($deflabel = 'qnumber' or
+ $deflabel = 'qnumberanda') and self::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="qandaentry" format="1"/>
+ </xsl:when>
+
+ <xsl:when test="$deflabel = 'qnumberanda' and self::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::question">
<xsl:value-of select="$prefix"/>
<xsl:number level="multiple" count="qandaentry" format="1"/>
</xsl:when>
<xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/>
</xsl:if>
<xsl:number format="1" count="equation[title or info/title]"
- from="chapter|appendix" level="any"/>
+ from="chapter|appendix" level="any"/>
</xsl:when>
<xsl:otherwise>
<xsl:number format="1" count="equation[title or info/title]"
- from="book|article" level="any"/>
+ from="book|article" level="any"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
<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: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:call-template name="object.id"/>
</xsl:variable>
- <xsl:variable name="label-width">
- <xsl:call-template name="pi.dbfo_label-width"/>
- </xsl:variable>
-
<xsl:variable name="label-length">
- <xsl:choose>
- <xsl:when test="$label-width != ''">
- <xsl:value-of select="$label-width"/>
- </xsl:when>
- <xsl:when test="descendant::label">
- <xsl:call-template name="longest.term">
- <xsl:with-param name="terms" select="descendant::label"/>
- <xsl:with-param name="maxlength" select="20"/>
- </xsl:call-template>
- <xsl:text>em * 0.50</xsl:text>
- </xsl:when>
- <xsl:otherwise>2.5em</xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="qandaset.label.length"/>
</xsl:variable>
<xsl:variable name="toc">
</xsl:template>
+<xsl:template name="qandaset.label.length">
+ <xsl:param name="deflabel">
+ <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
+ </xsl:param>
+
+ <xsl:variable name="label-width">
+ <xsl:call-template name="pi.dbfo_label-width"/>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$label-width != ''">
+ <xsl:value-of select="$label-width"/>
+ </xsl:when>
+ <xsl:when test="descendant::label">
+ <xsl:call-template name="longest.term">
+ <xsl:with-param name="terms" select="descendant::label"/>
+ <xsl:with-param name="maxlength" select="20"/>
+ </xsl:call-template>
+ <xsl:text>em * 0.50</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($deflabel, 'qnumber') and
+ $qandadiv.autolabel != 0 and
+ $qanda.inherit.numeration != 0">
+ <xsl:text>5em</xsl:text>
+ </xsl:when>
+ <xsl:when test="$deflabel ='qnumber' and
+ $qandadiv.autolabel != 0 and
+ $qanda.inherit.numeration != 0">
+ <xsl:text>4em</xsl:text>
+ </xsl:when>
+ <xsl:when test="$deflabel = 'number'">
+ <xsl:text>3em</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>2.5em</xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<xsl:template match="qandaset/blockinfo/title|qandset/info/title|qandaset/title">
<xsl:variable name="enclsect" select="(ancestor::section
| ancestor::simplesect
<xsl:template match="qandadiv">
<xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
- <xsl:variable name="label-width">
- <xsl:call-template name="pi.dbfo_label-width"/>
- </xsl:variable>
<xsl:variable name="label-length">
- <xsl:choose>
- <xsl:when test="$label-width != ''">
- <xsl:value-of select="$label-width"/>
- </xsl:when>
- <xsl:when test="descendant::label">
- <xsl:call-template name="longest.term">
- <xsl:with-param name="terms" select="descendant::label"/>
- <xsl:with-param name="maxlength" select="20"/>
- </xsl:call-template>
- <xsl:text>*0.6em</xsl:text>
- </xsl:when>
- <xsl:otherwise>2.5em</xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="qandaset.label.length"/>
</xsl:variable>
-
+
<fo:block id="{$id}">
<xsl:apply-templates select="(blockinfo/title|info/title|title)[1]"/>
<xsl:apply-templates select="*[local-name(.) != 'title'
</xsl:variable>
<xsl:variable name="deflabel">
- <xsl:choose>
- <xsl:when test="ancestor-or-self::*[@defaultlabel]">
- <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
- /@defaultlabel"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$qanda.defaultlabel"/>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
- <xsl:variable name="label.content">
- <xsl:apply-templates select="." mode="label.markup"/>
- <xsl:if test="$deflabel = 'number' and not(label)">
- <xsl:apply-templates select="." mode="intralabel.punctuation"/>
- </xsl:if>
- </xsl:variable>
+ <xsl:variable name="label.content">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ <xsl:if test="contains($deflabel, 'number') and not(label)">
+ <xsl:apply-templates select="." mode="intralabel.punctuation"/>
+ </xsl:if>
+ </xsl:variable>
<fo:list-item id="{$entry.id}" xsl:use-attribute-sets="list.item.spacing">
<fo:list-item-label id="{$id}" end-indent="label-end()">
</xsl:variable>
<xsl:variable name="deflabel">
- <xsl:choose>
- <xsl:when test="ancestor-or-self::*[@defaultlabel]">
- <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
- /@defaultlabel"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$qanda.defaultlabel"/>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<xsl:variable name="answer.label">
</fo:list-item>
</xsl:template>
+<xsl:template match="*" mode="qanda.defaultlabel">
+ <xsl:choose>
+ <xsl:when test="ancestor-or-self::*[@defaultlabel]">
+ <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]
+ /@defaultlabel"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$qanda.defaultlabel"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<xsl:template match="label">
<xsl:apply-templates/>
</xsl:template>
<xsl:apply-templates select="." mode="qanda.defaultlabel"/>
</xsl:variable>
<xsl:apply-templates select="." mode="label.markup"/>
- <xsl:if test="$deflabel = 'number' and not(label)">
+ <xsl:if test="contains($deflabel, 'number') and not(label)">
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
</xsl:if>
</xsl:template>
</xsl:call-template>
</xsl:variable>
- <xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
- <xsl:value-of select="$autotoc.label.separator"/>
+ <xsl:variable name="div.label">
+ <xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
+ </xsl:variable>
+ <xsl:if test="string-length($div.label) != 0">
+ <xsl:copy-of select="$div.label"/>
+ <xsl:value-of select="$autotoc.label.separator"/>
+ </xsl:if>
<xsl:text> </xsl:text>
<a>
<xsl:attribute name="href">
<dt>
<xsl:apply-templates select="." mode="label.markup"/>
- <xsl:if test="$deflabel = 'number' and not(label)">
+ <xsl:if test="contains($deflabel,'number') and not(label)">
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:template name="process.qandaset">
+ <xsl:variable name="deflabel">
+ <xsl:apply-templates select="." mode="qanda.defaultlabel"/>
+ </xsl:variable>
+
<xsl:variable name="label-width">
<xsl:call-template name="pi.dbhtml_label-width"/>
</xsl:variable>
<xsl:call-template name="pi.dbhtml_cellspacing"/>
</xsl:variable>
- <table border="0" summary="Q and A Set">
+ <table border="0" width="100%" summary="Q and A Set">
<xsl:if test="$table-summary != ''">
<xsl:attribute name="summary">
<xsl:value-of select="$table-summary"/>
<xsl:when test="$label-width != ''">
<xsl:value-of select="$label-width"/>
</xsl:when>
- <xsl:otherwise>1%</xsl:otherwise>
+ <xsl:otherwise>
+ <xsl:text>1%</xsl:text>
+ </xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</col>
+ <col/>
<tbody>
<xsl:apply-templates select="qandaentry|qandadiv"/>
</tbody>
<refsection><info><title>Description</title></info>
<para>If no <literal>defaultlabel</literal> attribute is specified on
-a <tag>qandaset</tag>, this value is used. It must be one of the legal
-values for the defaultlabel attribute, one from none, number or
-qanda. The default value is 'number'.
+a <tag>qandaset</tag>, this value is used. It is generally one of the legal
+values for the defaultlabel attribute (<literal>none</literal>,
+<literal>number</literal> or
+<literal>qanda</literal>), or one of the additional stylesheet-specific values
+(<literal>qnumber</literal> or <literal>qnumberanda</literal>).
+The default value is 'number'.
</para>
-<para>Meaning</para>
-<para>qanda - <tag>question</tag>s are labeled “Q:” and <tag>answer</tag>s are labeled “A:”. </para>
-<para>number - The entries are enumerated. </para>
-<para>none - No distinguishing label precedes Questions or Answers.
+<para>The values are rendered as follows:</para>
+<variablelist>
+<varlistentry><term><literal>qanda</literal></term>
+<listitem>
+<para><tag>question</tag>s are labeled "Q:" and
+<tag>answer</tag>s are labeled "A:". </para>
+</listitem>
+</varlistentry>
+<variablelist>
+<varlistentry><term><literal>number</literal></term>
+<listitem>
+<para>The questions are enumerated and the answers
+are not labeled. </para>
+</listitem>
+</varlistentry>
+<variablelist>
+<varlistentry><term><literal>qnumber</literal></term>
+<listitem>
+<para>The questions are labeled "Q:" followed by a number, and answers are not
+labeled.
+When sections are numbered, adding a label
+to the number distinguishes the question numbers
+from the section numbers.
+This value is not allowed in the
+<tag class="attribute">defaultlabel</tag> attribute
+of a <tag>qandaset</tag> element.</para>
+</listitem>
+</varlistentry>
+<variablelist>
+<varlistentry><term><literal>qnumberanda</literal></term>
+<listitem>
+<para>The questions are labeled "Q:" followed by a number, and
+the answers are labeled "A:".
+When sections are numbered, adding a label
+to the number distinguishes the question numbers
+from the section numbers.
+This value is not allowed in the
+<tag class="attribute">defaultlabel</tag> attribute
+of a <tag>qandaset</tag> element.</para>
+</listitem>
+</varlistentry>
+<variablelist>
+<varlistentry><term><literal>none</literal></term>
+<listitem>
+<para>No distinguishing label precedes Questions or Answers.
</para>
-
-
-
-
+</listitem>
+</varlistentry>
+</variablelist>
</refsection>
</refentry>