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

Extracting highest values between 'found' positions

Subject: Extracting highest values between 'found' positions
From: "Kevin Bird" <kevin.bird@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 18 Nov 2004 18:23:47 -0000
highest values
Hi

I have the following XML structure:

<panel>
	<rowdates>
		<date id="1">
			<start>051005</start>
			<end>051006</end>
		</date>
		<date id="2">
			<start>051007</start>
			<end>051115</end>
		</date>
		<date id="3">
			<start>051116</start>
			<end>051201</end>
		</date>
		<date id="4">
			<start>051202</start>
			<end>051231</end>
		</date>
		<date id="5">
			<start>060101</start>
			<end>060120</end>
		</date>
		<date id="6">
			<start>060121</start>
			<end>060131</end>
		</date>
	</rowdates>
	<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>
			</holidays>
			<holidays>
				<nights>14</nights>
				<price>304</price>
				<price>374</price>
				<price>-</price>
				<price>-</price>
				<price>-</price>
				<price>-</price>
			</holidays>
		</accommodation>
	</property>
	<property>
		<accommodation person="adult">
			<holidays>
				<nights>7</nights>
				<price>669</price>
				<price>789</price>
				<price>809</price>
				<price>959</price>
				<price>3299</price>
				<price>2929</price>
			</holidays>
			<holidays>
				<nights>14</nights>
				<price>3104</price>
				<price>7374</price>
				<price>999</price>
				<price>-</price>
				<price>99</price>
				<price>129</price>
			</holidays>
		</accommodation>
	</property>
</panel>

I need to match <date> elements within <rowdates> (which would be held
as parameters within the stylesheet), find their positions, then extract
the highest <price> element within those positions.

E.g..	Parameter1 '051005' matches the <start> child of <date id="1">
	Parameter2 '051201' matches the <end> child of <date id="3">
	So I need to compare <price> elements 1-3

	Parameter3 '060101' matches the <start> child of <date id="5">
	Parameter4 '060131' matches the <end> child of <date id="6">
	So I need to compare <price> elements 5-6

	.. and so on.

	Note that position 4 is unmatched and passes through 'as is'.

The result would look like:

<panel>
	<rowdates>
		<date id="1">
			<start>051005</start>
			<end>051201</end>
		</date>
		<date id="2">
			<start>051202</start>
			<end>051231</end>
		</date>
		<date id="3">
			<start>060101</start>
			<end>060131</end>
		</date>
	</rowdates>
	<property>
		<accommodation person="adult">
			<holidays>
				<nights>7</nights>
				<price>309</price>
				<price>359</price>
				<price>329</price>
			</holidays>
			<holidays>
				<nights>14</nights>
				<price>374</price>
				<price>-</price>
				<price>-</price>
			</holidays>
		</accommodation>
	</property>
	<property>
		<accommodation person="adult">
			<holidays>
				<nights>7</nights>
				<price>809</price>
				<price>959</price>
				<price>3299</price>
			</holidays>
			<holidays>
				<nights>14</nights>
				<price>7374</price>
				<price>-</price>
				<price>129</price>
			</holidays>
		</accommodation>
	</property>
</panel>

The added complication is that some of the input files may match some,
but not all the dates being searched. How do I cope with that?

Any suggestions greatly appreciated.

--
Kevin

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.