RE: [xsl] How do you get the most recent element?

Subject: RE: [xsl] How do you get the most recent element?
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Fri, 9 Feb 2001 21:55:42 -0000
> 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


Current Thread