Re: [xsl] Last Position Check

Subject: Re: [xsl] Last Position Check
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 18 Jul 2001 17:28:35 +0100
Hi Nathan,

> I am currently running a check to see if an element is in the last
> position, but it does not seem to be working.
>
> <xsl:if test="not(position()='last')">&#32;|&#32;</xsl:if>

You're testing whether the position() of the current node is equal to
the string 'last'. You want to test whether the position() of the
current node is equal to the length of the current node list, which
you can get with a call to the function last():

  <xsl:if test="not(position() = last())">&#32;|&#32;</xsl:if>

or:
  
  <xsl:if test="position() != last()"> | </xsl:if>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread