<xsl:variable name="nodes" select="glossary|bibliography|preface|chapter
|reference|part|article|appendix|index"/>
- <xsl:if test="$toc.section.depth > 0 and $nodes">
+ <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+ <xsl:if test="$toc.section.depth > 0
+ and $toc.max.depth > $depth.from.context
+ and $nodes">
<fo:block id="toc.{$cid}.{$id}"
start-indent="{count(ancestor::*)*$toc.indent.width}pt">
<xsl:apply-templates select="$nodes" mode="toc">
refentry|article|index|glossary|
bibliography"/>
- <xsl:if test="$toc.section.depth > 0 and $nodes">
+ <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+ <xsl:if test="$toc.section.depth > 0
+ and $toc.max.depth > $depth.from.context
+ and $nodes">
<fo:block id="toc.{$cid}.{$id}"
start-indent="{count(ancestor::*)*$toc.indent.width}pt">
<xsl:apply-templates select="$nodes" mode="toc">
</xsl:call-template>
</xsl:variable>
+ <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
<xsl:call-template name="toc.line"/>
- <xsl:if test="$toc.section.depth > 0 and refentry">
+ <xsl:if test="$toc.section.depth > 0
+ and $toc.max.depth > $depth.from.context
+ and refentry">
<fo:block id="toc.{$cid}.{$id}"
start-indent="{count(ancestor::*)*$toc.indent.width}pt">
<xsl:apply-templates select="refentry" mode="toc">
|simplesect[$simplesect.in.toc != 0]
|refentry"/>
- <xsl:if test="$toc.section.depth > 0 and $nodes">
+ <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+ <xsl:if test="$toc.section.depth > 0
+ and $toc.max.depth > $depth.from.context
+ and $nodes">
<fo:block id="toc.{$cid}.{$id}"
start-indent="{count(ancestor::*)*$toc.indent.width}pt">
<xsl:apply-templates select="$nodes" mode="toc">
<xsl:call-template name="toc.line"/>
- <xsl:if test="$toc.section.depth > 1 and sect2">
+ <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+ <xsl:if test="$toc.section.depth > 1
+ and $toc.max.depth > $depth.from.context
+ and sect2">
<fo:block id="toc.{$cid}.{$id}"
start-indent="{count(ancestor::*)*$toc.indent.width}pt">
<xsl:apply-templates select="sect2" mode="toc">
<xsl:variable name="reldepth"
select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
- <xsl:if test="$toc.section.depth > 2 and sect3">
+ <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+ <xsl:if test="$toc.section.depth > 2
+ and $toc.max.depth > $depth.from.context
+ and sect3">
<fo:block id="toc.{$cid}.{$id}"
start-indent="{$reldepth*$toc.indent.width}pt">
<xsl:apply-templates select="sect3" mode="toc">
<xsl:variable name="reldepth"
select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
- <xsl:if test="$toc.section.depth > 3 and sect4">
+ <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+ <xsl:if test="$toc.section.depth > 3
+ and $toc.max.depth > $depth.from.context
+ and sect4">
<fo:block id="toc.{$cid}.{$id}"
start-indent="{$reldepth*$toc.indent.width}pt">
<xsl:apply-templates select="sect4" mode="toc">
<xsl:variable name="reldepth"
select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
- <xsl:if test="$toc.section.depth > 4 and sect5">
+ <xsl:variable name="depth.from.context" select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+
+ <xsl:if test="$toc.section.depth > 4
+ and $toc.max.depth > $depth.from.context
+ and sect5">
<fo:block id="toc.{$cid}.{$id}"
start-indent="{$reldepth*$toc.indent.width}pt">
<xsl:apply-templates select="sect5" mode="toc">
<xsl:variable name="reldepth"
select="count(ancestor::*)-count($toc-context/ancestor::*)"/>
+ <xsl:variable name="depth.from.context" 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">
+ <xsl:if test="$toc.section.depth > $depth
+ and $toc.max.depth > $depth.from.context
+ and section">
<fo:block id="toc.{$cid}.{$id}"
start-indent="{$reldepth*$toc.indent.width}pt">
<xsl:apply-templates select="section" mode="toc">