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

[xsl] identify lowest value within a range of elements


Subject: [xsl] identify lowest value within a range of elements
From: "Kevin Bird" <kevin.bird@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 26 May 2006 11:50:29 +0100

Hi

Given the following input (number of column elements is arbitrary);

<wrapper>
	<column>
		<price>111</price>
		<price>222</price>
		<price>333</price>
		<price>444</price>
		<price>555</price>
		<price>666</price>
		<price>777</price>
		<price>888</price>
		<price>999</price>
	</column>
	<column>
		<price>999</price>
		<price>888</price>
		<price>777</price>
		<price>666</price>
		<price>555</price>
		<price>444</price>
		<price>333</price>
		<price>222</price>
		<price>111</price>
	</column>
	<column>
		<price>555</price>
		<price>666</price>
		<price>777</price>
		<price>111</price>
		<price>222</price>
		<price>333</price>
		<price>444</price>
		<price>555</price>
		<price>666</price>
	</column>
</wrapper>

I need to identify the price element(s) with the lowest value within
certain position ranges.

So,	range1 --> Position() < 5
	range2 --> Position() >=5

---------------
REQUIRED OUTPUT
---------------
<wrapper>
	<column>
		<price>111</price>
		<price>222</price>
		<price>333</price>
		<price>444</price>
		<price>555</price>
		<price>666</price>
		<price>777</price>
		<price>888</price>
		<price>999</price>
	</column>
	<column>
		<price>999</price>
		<price>888</price>
		<price>777</price>
		<price>666</price>
		<price>555</price>
		<price>444</price>
		<price>333</price>
		<price>222</price>
		<price lowest="range2">111</price>
	</column>
	<column>
		<price>555</price>
		<price>666</price>
		<price>777</price>
		<price lowest="range1">111</price>
		<price>222</price>
		<price>333</price>
		<price>444</price>
		<price>555</price>
		<price>666</price>
	</column>
</wrapper>

I am able to use XSLT 2. Could someone please point me in the right
direction?

Thanks.

--
Kevin


Current Thread
Keywords