RE: [xsl] xpath satisfying two conditions where one is position()=last()

Subject: RE: [xsl] xpath satisfying two conditions where one is position()=last()
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 29 Oct 2004 15:09:29 +0100
> I tried this, but didn't work.
> <xsl:value-of select="/Result/Monthly/MonthUltimo[@year=2000 
> and position()=
> last()]/@index"/>

Nearly right:

 <xsl:value-of select="/Result/Monthly/
         MonthUltimo[@year=2000][position()=last()]/@index"/>

The difference is that position()=last() is true for the last item in the
sequence qualified by the predicate. This means you need to form your
sequence first, then find its last item.

Michael Kay
http://www.saxonica.com/

Current Thread