</fo:block>
</xsl:template>
+<!-- ==================================================================== -->
+<xsl:template name="qandaset.toc">
+ <xsl:param name="toc-context" select="."/>
+ <xsl:param name="toc.title.p" select="true()"/>
+
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+
+ <xsl:variable name="cid">
+ <xsl:call-template name="object.id">
+ <xsl:with-param name="object" select="$toc-context"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="nodes" select="qandadiv|qandaentry"/>
+
+ <xsl:if test="$nodes">
+ <fo:block id="toc...{$id}"
+ xsl:use-attribute-sets="toc.margin.properties">
+ <xsl:if test="$toc.title.p">
+ <xsl:call-template name="table.of.contents.titlepage"/>
+ </xsl:if>
+ <xsl:apply-templates select="$nodes" mode="toc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ </xsl:apply-templates>
+ </fo:block>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template name="qandaset.toc.separator">
+ <!-- Customize to output something between
+ qandaset.toc and first output -->
+</xsl:template>
+
+<xsl:template match="qandadiv" mode="toc">
+ <xsl:param name="toc-context" select="."/>
+
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+
+ <xsl:variable name="cid">
+ <xsl:call-template name="object.id">
+ <xsl:with-param name="object" select="$toc-context"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:call-template name="toc.line"/>
+
+ <xsl:variable name="nodes" select="qandadiv|qandaentry"/>
+
+ <xsl:if test="$nodes">
+ <fo:block id="toc.{$cid}.{$id}">
+ <xsl:attribute name="margin-left">
+ <xsl:call-template name="set.toc.indent"/>
+ </xsl:attribute>
+
+ <xsl:apply-templates select="$nodes" mode="toc">
+ <xsl:with-param name="toc-context" select="$toc-context"/>
+ </xsl:apply-templates>
+ </fo:block>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="qandaentry" mode="toc">
+ <xsl:apply-templates select="question" mode="toc"/>
+</xsl:template>
+
+<xsl:template match="question" mode="toc">
+ <xsl:variable name="firstchunk">
+ <xsl:apply-templates select="(*[name(.)!='label'])[1]/node()"/>
+ </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:variable>
+
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+
+ <xsl:variable name="label">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ </xsl:variable>
+
+ <fo:block xsl:use-attribute-sets="toc.line.properties"
+ margin-left="3em"
+ text-indent="-3em"
+ end-indent="{$toc.indent.width}pt"
+ last-line-end-indent="-{$toc.indent.width}pt">
+ <fo:inline keep-with-next.within-line="always">
+ <fo:basic-link internal-destination="{$id}">
+ <xsl:if test="$label != ''">
+ <xsl:copy-of select="$label"/>
+ <xsl:if test="$deflabel = 'number' and not(label)">
+ <xsl:value-of select="$autotoc.label.separator"/>
+ </xsl:if>
+ <xsl:text> </xsl:text>
+ </xsl:if>
+ <xsl:copy-of select="$firstchunk"/>
+ </fo:basic-link>
+ </fo:inline>
+ <fo:inline keep-together.within-line="always">
+ <xsl:text> </xsl:text>
+ <fo:leader leader-pattern="dots"
+ leader-pattern-width="3pt"
+ leader-alignment="reference-area"
+ keep-with-next.within-line="always"/>
+ <xsl:text> </xsl:text>
+ <fo:basic-link internal-destination="{$id}">
+ <fo:page-number-citation ref-id="{$id}"/>
+ </fo:basic-link>
+ </fo:inline>
+ </fo:block>
+
+</xsl:template>
+
<!-- ==================================================================== -->
<xsl:template match="book|setindex" mode="toc">
</xsl:choose>
</xsl:variable>
+ <xsl:variable name="toc">
+ <xsl:call-template name="dbfo-attribute">
+ <xsl:with-param name="pis"
+ select="processing-instruction('dbfo')"/>
+ <xsl:with-param name="attribute" select="'toc'"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="toc.params">
+ <xsl:call-template name="find.path.params">
+ <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
<xsl:variable name="content">
<fo:block id="{$id}">
<xsl:choose>
</xsl:otherwise>
</xsl:choose>
+ <xsl:if test="(contains($toc.params, 'toc') and $toc != '0')
+ or $toc = '1'">
+ <xsl:call-template name="qandaset.toc">
+ <xsl:with-param name="toc.title.p"
+ select="contains($toc.params, 'title')"/>
+ </xsl:call-template>
+ </xsl:if>
+
+ <xsl:call-template name="qandaset.toc.separator"/>
+
<xsl:apply-templates select="*[name(.) != 'title'
and name(.) != 'titleabbrev'
and name(.) != 'qandadiv'
<xsl:if test="qandaentry">
<fo:list-block xsl:use-attribute-sets="list.block.spacing"
provisional-label-separation="0.2em">
- <xsl:attribute name="provisional-distance-between-starts">
- <xsl:choose>
- <xsl:when test="$label-length != ''">
- <xsl:value-of select="$label-length"/>
- </xsl:when>
- <xsl:otherwise>2.5em</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
+ <xsl:attribute name="provisional-distance-between-starts">
+ <xsl:choose>
+ <xsl:when test="$label-length != ''">
+ <xsl:value-of select="$label-length"/>
+ </xsl:when>
+ <xsl:otherwise>2.5em</xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
<xsl:apply-templates select="qandaentry"/>
</fo:list-block>
</xsl:if>
<xsl:apply-templates select="parent::qandadiv" mode="label.markup"/>
<xsl:if test="$qandadiv.autolabel != 0">
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
- <xsl:text> </xsl:text>
+ <xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates/>
</xsl:with-param>
<xsl:otherwise>
<fo:block>
<xsl:apply-templates select="." mode="label.markup"/>
- <xsl:if test="$deflabel = 'number' and not(label)">
+ <xsl:if test="$deflabel = 'number' and not(label)">
<xsl:apply-templates select="." mode="intralabel.punctuation"/>
- </xsl:if>
+ </xsl:if>
</fo:block>
</xsl:otherwise>
</xsl:choose>