I was wondering if there is a XPath query that would prevent iterating
through all element to find the latest revision??
<RESPONSE templateid="E28A9E58-ACCF-40B9-9CEE-8D99D53152D0"
revisionnumber="2" uniqueid="" value="26/02/2007 11:32:43" />
<RESPONSE templateid="E28A9E58-ACCF-40B9-9CEE-8D99D53152D0"
revisionnumber="1" uniqueid="" value="22/02/2007 14:49:21" />
<RESPONSE templateid="E6F4CAC9-C6F8-4F8E-8D49-F860D00E5DE8"
revisionnumber="1" uniqueid="" value="22/02/2007 14:49:21" />
<RESPONSE templateid="E6F4CAC9-C6F8-4F8E-8D49-F860D00E5DE8"
revisionnumber="2" uniqueid="" value="26/02/2007 11:32:43" />
I want the latest revision for (say)
templateid='E28A9E58-ACCF-40B9-9CEE-8D99D53152D0'.
At the moment the only way I know of doing this is to iterate through all
elements where templateid='E28A9E58-ACCF-40B9-9CEE-8D99D53152D0' and finding
the one with the highest revision number.
any help appreciated.
Wozza
For example:
<xsl:template match="foo">
<xsl:variable name="tmpltId">E6F4CAC9-C6F8-4F8E-8D49-
F860D00E5DE8</xsl:variable>
<xsl:variable name="maxRevision"
select="max(RESPONSE[@templateid='E6F4CAC9-C6F8-4F8E-8D49-
F860D00E5DE8']/@revisionnumber"/>
<xsl:for-each select="RESPONSE[@templateid = $tmpltId and
revisionnumber = $maxRevision]">
</xsl:for-each>
</xsl:template>
"There is a typo in the example above, you need to close the opening
( character on the max function:
select="max(RESPONSE[@templateid='E6F4CAC9-C6F8-4F8E-8D49-
F860D00E5DE8']/@revisionnumber)"
<stephen...@pfizer.com> wrote in message
news:1172498092.3...@s48g2000cws.googlegroups.com...