</xsl:if>
</xsl:template>
+<xsl:template name="section.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:variable name="nodes"
+ select="section|sect1|sect2|sect3|sect4|sect5|refentry
+ |bridgehead[$bridgehead.in.toc != 0]"/>
+
+ <xsl:variable name="level">
+ <xsl:call-template name="section.level"/>
+ </xsl:variable>
+
+ <xsl:if test="$nodes">
+ <fo:block id="toc...{$id}"
+ xsl:use-attribute-sets="toc.margin.properties">
+
+ <xsl:call-template name="section.heading">
+ <xsl:with-param name="level" select="$level + 1"/>
+ <xsl:with-param name="title">
+ <fo:block space-after="0.5em">
+ <xsl:call-template name="gentext">
+ <xsl:with-param name="key" select="'TableofContents'"/>
+ </xsl:call-template>
+ </fo:block>
+ </xsl:with-param>
+ </xsl:call-template>
+
+ <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="toc.line">
<xsl:call-template name="toc.line"/>
+ <xsl:variable name="reldepth"
+ select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
<xsl:if test="$toc.section.depth > 2 and sect3">
<fo:block id="toc.{$cid}.{$id}"
- start-indent="{count(ancestor::*)*$toc.indent.width}pt">
+ start-indent="{$reldepth*$toc.indent.width}pt">
<xsl:apply-templates select="sect3" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
<xsl:call-template name="toc.line"/>
+ <xsl:variable name="reldepth"
+ select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
<xsl:if test="$toc.section.depth > 3 and sect4">
<fo:block id="toc.{$cid}.{$id}"
- start-indent="{count(ancestor::*)*$toc.indent.width}pt">
+ start-indent="{$reldepth*$toc.indent.width}pt">
<xsl:apply-templates select="sect4" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
<xsl:call-template name="toc.line"/>
+ <xsl:variable name="reldepth"
+ select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
<xsl:if test="$toc.section.depth > 4 and sect5">
<fo:block id="toc.{$cid}.{$id}"
- start-indent="{count(ancestor::*)*$toc.indent.width}pt">
+ start-indent="{$reldepth*$toc.indent.width}pt">
<xsl:apply-templates select="sect5" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
</xsl:variable>
<xsl:variable name="depth" select="count(ancestor::section) + 1"/>
+ <xsl:variable name="reldepth"
+ select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
<xsl:if test="$toc.section.depth >= $depth">
<xsl:call-template name="toc.line"/>
<xsl:if test="$toc.section.depth > $depth and section">
<fo:block id="toc.{$cid}.{$id}"
- start-indent="{count(ancestor::*)*$toc.indent.width}pt">
+ start-indent="{$reldepth*$toc.indent.width}pt">
<xsl:apply-templates select="section" mode="toc">
<xsl:with-param name="toc-context" select="$toc-context"/>
</xsl:apply-templates>
<fo:block id="{$id}">
<xsl:call-template name="section.titlepage"/>
+
+ <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:if test="(contains($toc.params, 'toc')
+ and (count(ancestor::section)+1) <= $generate.section.toc.level)
+ or refentry">
+ <xsl:call-template name="section.toc"/>
+ </xsl:if>
+
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<fo:flow flow-name="xsl-region-body">
<xsl:call-template name="section.titlepage"/>
+
+ <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:if test="(contains($toc.params, 'toc')
+ and (count(ancestor::section)+1) <= $generate.section.toc.level)
+ or refentry">
+ <xsl:call-template name="section.toc"/>
+ </xsl:if>
+
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
<fo:block id="{$id}">
<xsl:call-template name="sect1.titlepage"/>
+
+ <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:if test="(contains($toc.params, 'toc')
+ and ($generate.section.toc.level >= 1))
+ or refentry">
+ <xsl:call-template name="section.toc"/>
+ </xsl:if>
+
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<fo:flow flow-name="xsl-region-body">
<xsl:call-template name="sect1.titlepage"/>
+
+ <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:if test="(contains($toc.params, 'toc')
+ and ($generate.section.toc.level >= 1))
+ or refentry">
+ <xsl:call-template name="section.toc"/>
+ </xsl:if>
+
<xsl:apply-templates/>
</fo:flow>
</fo:page-sequence>
<fo:block id="{$id}">
<xsl:call-template name="sect2.titlepage"/>
+
+ <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:if test="(contains($toc.params, 'toc')
+ and ($generate.section.toc.level >= 2))
+ or refentry">
+ <xsl:call-template name="section.toc"/>
+ </xsl:if>
+
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<fo:block id="{$id}">
<xsl:call-template name="sect3.titlepage"/>
+
+ <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:if test="(contains($toc.params, 'toc')
+ and ($generate.section.toc.level >= 3))
+ or refentry">
+ <xsl:call-template name="section.toc"/>
+ </xsl:if>
+
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<fo:block id="{$id}">
<xsl:call-template name="sect4.titlepage"/>
+
+ <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:if test="(contains($toc.params, 'toc')
+ and ($generate.section.toc.level >= 4))
+ or refentry">
+ <xsl:call-template name="section.toc"/>
+ </xsl:if>
+
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<fo:block id="{$id}">
<xsl:call-template name="sect5.titlepage"/>
+
+ <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:if test="(contains($toc.params, 'toc')
+ and ($generate.section.toc.level >= 5))
+ or refentry">
+ <xsl:call-template name="section.toc"/>
+ </xsl:if>
+
<xsl:apply-templates/>
</fo:block>
</xsl:template>