This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Determining last node


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]