<xsl:param name="nav.text.pointer"><-</xsl:param>
+<xsl:param name="toc.expand.depth" select="1"/>
+
<!-- ==================================================================== -->
<xsl:template match="toc/title|tocentry/title|titleabbrev">
select="($page/descendant-or-self::tocentry[@tocskip = '0']
|$page/following::tocentry[@tocskip='0'])[1]"/>
+ <xsl:variable name="depth" select="count(ancestor::*)-1"/>
+
<xsl:variable name="isdescendant">
<xsl:choose>
<xsl:when test="ancestor::*[@id=$pageid]">1</xsl:when>
</xsl:choose>
</xsl:variable>
+ <xsl:variable name="isopen">
+ <xsl:choose>
+ <xsl:when test="$pageid = @id
+ or $isancestor='1'
+ or $depth < $toc.expand.depth">1</xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
<!-- For any entry in the TOC:
1. It is the current page
a. it is a leaf current/leaf
</xsl:when>
<xsl:otherwise>
<xsl:choose>
- <xsl:when test="$isancestor != 0">
- <xsl:text>/other/open</xsl:text>
+ <xsl:when test="$hasdescendant = 0">
+ <xsl:text>/other/leaf</xsl:text>
</xsl:when>
- <xsl:when test="$hasdescendant != 0">
- <xsl:text>/other/closed</xsl:text>
+ <xsl:when test="$isancestor != 0 or $depth < $toc.expand.depth">
+ <xsl:text>/other/open</xsl:text>
</xsl:when>
<xsl:otherwise>
- <xsl:text>/other/leaf</xsl:text>
+ <xsl:text>/other/closed</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</span>
- <xsl:if test="$pageid = @id or $isancestor='1'">
+ <xsl:if test="$pageid = @id or $isancestor='1' or $depth < $toc.expand.depth">
<xsl:apply-templates select="tocentry">
<xsl:with-param name="pageid" select="$pageid"/>
<xsl:with-param name="relpath" select="$relpath"/>