RE: [xsl] weird behavior with last()

Subject: RE: [xsl] weird behavior with last()
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 25 Jul 2001 08:52:25 +0100
> <xsl:template match="MainMenuItem">
> <b><a href="{@URL}"><xsl:apply-templates
> /></a></b><xsl:if
> test="position()!=last()">&#32;|&#32;</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:

Current Thread