xsl-list
[Top] [All Lists]

RE: Searching the last element

2003-04-25 10:23:22

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()]">
      <xsl:text> *</xsl:text>
      </xsl:if>
  </p>
</xsl:template>

But I get -- surprise, surprise -- a star beyond every 
paragraph. Can anybody point me in the right direction?


Since your test uses an absolute path expression (one starting with "/")
it should be pretty obviuos that it gives the same result for each "p"
element.

Try test="following-sibling::p"

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 


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



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