At 2012-05-25 08:10 -0400, Philip Vallone wrote:
How can I return the max value of a set of nodes using FLWR? In this
example I want to return:
...
<xsl:sequence select="for $x in changenumber return number(max($x))"/>
You've gone too deep ... you want to stop one level "up" and get the
maximum of each of the sets.
I hope this helps.
. . . . . . Ken
T:\ftemp>type philip.xml
<data>
<set>
<changenumber>0</changenumber>
<changenumber>3</changenumber>
<changenumber>0</changenumber>
</set>
<set>
<changenumber>0</changenumber>
<changenumber>2</changenumber>
<changenumber>1</changenumber>
</set>
<set>
<changenumber>0</changenumber>
</set>
</data>
T:\ftemp>xslt2 philip.xml philip.xsl
<?xml version="1.0" encoding="UTF-8"?>3 2 0
T:\ftemp>type philip.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="/">
<xsl:sequence select="for $s in /data/set return max($s/changenumber)"/>
</xsl:template>
</xsl:stylesheet>
T:\ftemp>
--
Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--