This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: How do you get the most recent element?


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]