[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Comparing element values

Subject: Comparing element values
From: "Kevin Bird" <kevin.bird@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 4 Oct 2004 14:19:24 +0100
element values
Hi

Within the following structure I need to compare the value of two
<price> elements and output the one with the highest value only. In the
example below, the 3rd and 4th <price> elements are being compared.

Any help would be greatly appreciated.

--
Kevin

PS: At a later date I would like to be able to compare a range of
<price> elements. Better learn to walk first!


--SNIPPET--
<property>
	<accommodation person="adult">
		<holidays>
			<nights>7</nights>
			<price>269</price>
			<price>289</price>
			<price>309</price>
			<price>359</price>
			<price>319</price>
			<price>329</price>
			<price>299</price>
		</holidays>
		<holidays>
			<nights>14</nights>
			<price>304</price>
			<price>324</price>
			<price>344</price>
			<price>384</price>
			<price>364</price>
			<price>374</price>
			<price>-</price>
		</holidays>
	</accommodation>
	<accommodation person="child">
		<holidays>
			<nights>7</nights>
			<price>269</price>
			<price>289</price>
			<price>409</price>
			<price>359</price>
			<price>319</price>
			<price>329</price>
			<price>299</price>
		</holidays>
		<holidays>
			<nights>14</nights>
			<price>304</price>
			<price>324</price>
			<price>344</price>
			<price>384</price>
			<price>364</price>
			<price>374</price>
			<price>-</price>
		</holidays>
	</accommodation>
</property>

--REQUIRED OUTPUT --

<property>
	<accommodation person="adult">
		<holidays>
			<nights>7</nights>
			<price>269</price>
			<price>289</price>
			<price>359</price>	<!-- 4th was the highest
-->
			<price>319</price>
			<price>329</price>
			<price>299</price>
		</holidays>
		<holidays>
			<nights>14</nights>
			<price>304</price>
			<price>324</price>
			<price>384</price>	<!-- 4th was the highest
-->
			<price>364</price>
			<price>374</price>
			<price>-</price>
		</holidays>
	</accommodation>
	<accommodation person="child">
		<holidays>
			<nights>7</nights>
			<price>269</price>
			<price>289</price>
			<price>409</price>	<!-- 3rd was the highest
-->
			<price>319</price>
			<price>329</price>
			<price>299</price>
		</holidays>
		<holidays>
			<nights>14</nights>
			<price>304</price>
			<price>324</price>
			<price>384</price>	<!-- 4th was the highest
-->
			<price>364</price>
			<price>374</price>
			<price>-</price>
		</holidays>
	</accommodation>
</property>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.