This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: weird behavior with last()
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] weird behavior with last()
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Wed, 25 Jul 2001 08:52:25 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> <xsl:template match="MainMenuItem">
> <b><a href="{@URL}"><xsl:apply-templates
> /></a></b><xsl:if
> test="position()!=last()"> | </xsl:if>
> </xsl:template>
>
> If I transform it like it is, I get an end "|" after
> the last <MainMenuItem> (not correct behavior)
You can't tell whether a MainMenuItem is the last() by looking at the source
XML or by looking at this template rule. You can only tell by looking at how
the template rule is invoked. The last() item is the last one in the set of
nodes selected by the <xsl:apply-templates/> instruction that caused this
template to be invoked - which you haven't shown us.
Mike Kay
Software AG
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list