This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: How do you get the most recent element?
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] How do you get the most recent element?
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Fri, 9 Feb 2001 21:55:42 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
> but an alternatative to
>
>
> <xsl:template match="note">
> <xsl:if test="position()=1">
> <xsl:value-of select="text"/>
> </xsl:if>
> </xsl:template>
> is
>
> <xsl:template match="note"/>
> <xsl:template match="note[1]">
> <xsl:value-of select="text"/>
> </xsl:template>
>
Wrong, David, and I nearly made the same mistake myself!
match=note[1] will match any note that is the first note child of its
parent, the test on position() will match the first note in the list being
processed by apply-templates.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list