[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Searching the last element


Subject: RE: [xsl] Searching the last element
From: Jarno.Elovirta@xxxxxxxxx
Date: Fri, 25 Apr 2003 13:00:37 +0300

Hi,

> <text>
> <p>First paragraph.</p>
> <p>Next paragraph.</p>
> <p>Last paragraph.</p>
> </text>
> 
> I tried the followoing to add a star "*" at the end of the 
> text from the
> last p-element:
> 
> <xsl:template match="p">
>   <p><xsl:apply-templates/>
> 	<xsl:if test="/text/p[position()=last()]">

This tests if there is a last "p" in the whole document and will return true every time. You want

  <xsl:if test="position() = last()">

Cheers,

Jarno - Grendel: End of Ages (Genocide Remix by God Module)

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



Current Thread