This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Determining last node
- To: "XSL List" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] Determining last node
- From: "Larry Garfield" <lgarfiel at students dot depaul dot edu>
- Date: Mon, 13 Aug 2001 15:33:15 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
I am trying to determine if a given node is the last of its kind, either
within its own siblings or in the entire document.
The document structure is:
book
chapter
sect1
sect1
chapter
sect1
sect1
sect1
chapter
sect1
I am trying
...
<xsl:when test="$chNum=$source/book/chapter[last()]">
...
when processing the chapters in a template called from inside a for-each
($chNum is the <xsl:number/> value of the chapter node, passed in from the
template call).
I am trying
...
<xsl:when test="$sectNum=count($source//sect2)">
...
when processing the sect1 nodes inside a template called from inside a
for-each that processes all sect2 nodes at once, regardless of their
chapter.
However, neither one is catching. Processing is always passing to the
<xsl:otherwise> block. What xpath statement do I need to use to determine
if the current chapter element or sect1 element is the "last of its kind"?
Thanks in advance.
--Larry Garfield
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list