Subject: [xsl] Extracting highest values between 'found' positions From: "Kevin Bird" <kevin.bird@xxxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 18 Nov 2004 18:23:47 -0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XSL problem using sum() f, Michael Kay | Thread | [xsl] Cool: Saxon driving a GUI, in, Gunther Schadow |
RE: [xsl] Re: Problem passing node-, Evan Lenz | Date | Re: [xsl] XSL problem using sum() f, Colin Paul Adams |
Month |