This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Determining last node
- To: XSL List <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Determining last node
- From: Joerg Pietschmann <joerg dot pietschmann at zkb dot ch>
- Date: Tue, 14 Aug 2001 22:44:30 +0200
- Organization: ZKB
- Reply-To: xsl-list at lists dot mulberrytech dot com
Send button pressed too early: add "[1]" after all *::chapter.
Also another minor syntax error fixed:
<xsl:template match="call:insert[@id='NavbarDesktop']">
<xsl:param name="chapter"/>
<xsl:param name="chNum"/>
<xsl:text>[ </xsl:text>
<xsl:if test="$chapter/preceding::chapter[1]">
<a href="chap{$chNum-1}.html">
<xsl:value-of select="$chapter/preceding::chapter[1]/title"/>
</a>
<xsl:text> | </xsl:text>
</xsl:if>
<a href="index.html">Table of Contents</a>
<xsl:if test="$chapter/following::chapter[1]">
<xsl:text> | </xsl:text>
<a href="chap{$chNum+1}.html">
<xsl:value-of select="$chapter/following::chapter[1]/title"/>
</a>
</xsl:if>
<xsl:text> ]</xsl:text>
</xsl:template>
Still untested.
Further notes: If you aim for purity, replace the chNum parameter
by count(chapter::preceding::chapter)+1, this may degrade performance,
however.
If your chapters are actually all siblings (as they are in the DocBook
DTD) and not nested somewhere else, replacing preceding::chapter by
preceding-sibling may increase performance a bit. Assigning
$chapter/preceding::chapter[1] etc. to a variable might help improving
performance for processors which are bad at CSE.
J.Pietschmann
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list