xsl-list
[Top] [All Lists]

RE: Searching the last element

2003-04-25 03:00:37
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



<Prev in Thread] Current Thread [Next in Thread>