xsl-list
[Top] [All Lists]

Comparing element values

2004-10-04 06:19:24
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>



<Prev in Thread] Current Thread [Next in Thread>