[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Return the max value of a set of nodes using FLWR


Subject: [xsl] Return the max value of a set of nodes using FLWR
From: Philip Vallone <philip.vallone@xxxxxxxxxxx>
Date: Fri, 25 May 2012 08:10:16 -0400

Hi,

How can I return the max value of a set of nodes using FLWR? In this example I
want to return:

3
2
0

input:

<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>

XSLT 2.0

<xsl:sequence select="for $x in changenumber return number(max($x))"/>

Thanks,

Phil


Current Thread
Keywords