XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
john jenkinsonSubject: XSLT sorting parent nodes by multiple child nodes
Author: john jenkinson
Date: 08 May 2007 03:55 PM
Hi

I am trying to sort a xml file using xslt in order to display the lowest RoomPrice for each Hotel node in order i.e if a Hotel has a RoomPrice of 49 and another RoomPrice of 59 (same Hotel) it should then put the one with 49 first. There are also mulitple Hotels and these should be sorted on lowest RoomPrice within each Hotel.
If anyone could help it would be of great benefit to me.

Here is my XML :

<Hotel h="1">
<HotelCode>LGWARO</HotelCode>
<HotelName>Arora International</HotelName>
<StarRating>4</StarRating>
<OnAirport>N</OnAirport>
<NonSmokingRooms>N</NonSmokingRooms>
<Transfer24Hour>N</Transfer24Hour>
<CarParkOnSite>Y</CarParkOnSite>
<RequestFlags>
<Registration>N</Registration>
<CarMake>N</CarMake>
<CarModel>N</CarModel>
<CarColour>N</CarColour>
<CarPickupDate>N</CarPickupDate>
<CarDropoffTime>N</CarDropoffTime>
<CarPickupTime>N</CarPickupTime>
<CreditCard>N</CreditCard>
<ReturnFlight>N</ReturnFlight>
<Terminal>N</Terminal>
</RequestFlags>
<RoomType t="1">
<Room r="1">
<RoomCode>DBL</RoomCode>
<BoardBasis>RO</BoardBasis>
<Upgrade>N</Upgrade>
<Price p="1">
<ParkingDays>0</ParkingDays>
<RoomPrice>354.00</RoomPrice>
</Price>
<Price p="2">
<ParkingDays>8</ParkingDays>
<RoomPrice>384.00</RoomPrice>
</Price>
<Price p="3">
<ParkingDays>15</ParkingDays>
<RoomPrice>410.00</RoomPrice>
</Price>
</Room>
<Room r="2">
<RoomCode>TWN</RoomCode>
<BoardBasis>RO</BoardBasis>
<Upgrade>N</Upgrade>
<Price p="1">
<ParkingDays>0</ParkingDays>
<RoomPrice>354.00</RoomPrice>
</Price>
<Price p="2">
<ParkingDays>8</ParkingDays>
<RoomPrice>384.00</RoomPrice>
</Price>
<Price p="3">
<ParkingDays>15</ParkingDays>
<RoomPrice>410.00</RoomPrice>
</Price>
</Room>
</RoomType>
</Hotel>
<Hotel h="2">
<HotelCode>LGWARP</HotelCode>
<HotelName>Arora International (Sec-Pkg)</HotelName>
<StarRating>4</StarRating>
<OnAirport>N</OnAirport>
<NonSmokingRooms>N</NonSmokingRooms>
<Transfer24Hour>N</Transfer24Hour>
<CarParkOnSite>N</CarParkOnSite>
<RequestFlags>
<Registration>N</Registration>
<CarMake>N</CarMake>
<CarModel>N</CarModel>
<CarColour>N</CarColour>
<CarPickupDate>N</CarPickupDate>
<CarDropoffTime>N</CarDropoffTime>
<CarPickupTime>N</CarPickupTime>
<CreditCard>N</CreditCard>
<ReturnFlight>N</ReturnFlight>
<Terminal>N</Terminal>
</RequestFlags>
<RoomType t="1">
<Room r="1">
<RoomCode>DBL</RoomCode>
<BoardBasis>RO</BoardBasis>
<Upgrade>N</Upgrade>
<Price p="1">
<ParkingDays>8</ParkingDays>
<RoomPrice>630.00</RoomPrice>
</Price>
<Price p="2">
<ParkingDays>15</ParkingDays>
<RoomPrice>654.00</RoomPrice>
</Price>
</Room>
<Room r="2">
<RoomCode>TWN</RoomCode>
<BoardBasis>RO</BoardBasis>
<Upgrade>N</Upgrade>
<Price p="1">
<ParkingDays>8</ParkingDays>
<RoomPrice>630.00</RoomPrice>
</Price>
<Price p="2">
<ParkingDays>15</ParkingDays>
<RoomPrice>654.00</RoomPrice>
</Price>
</Room>
</RoomType>
</Hotel>
<Hotel h="3">
<HotelCode>LGWHIL</HotelCode>
<HotelName>Hilton</HotelName>
<StarRating>4</StarRating>
<OnAirport>Y</OnAirport>
<NonSmokingRooms>N</NonSmokingRooms>
<Transfer24Hour>Y</Transfer24Hour>
<CarParkOnSite>N</CarParkOnSite>
<RequestFlags>
<Registration>Y</Registration>
<CarMake>N</CarMake>
<CarModel>N</CarModel>
<CarColour>N</CarColour>
<CarPickupDate>Y</CarPickupDate>
<CarDropoffTime>Y</CarDropoffTime>
<CarPickupTime>Y</CarPickupTime>
<CreditCard>N</CreditCard>
<ReturnFlight>N</ReturnFlight>
<Terminal>Y</Terminal>
</RequestFlags>
<RoomType t="1">
<Room r="1">
<RoomCode>DBL</RoomCode>
<BoardBasis>RO</BoardBasis>
<Upgrade>Y</Upgrade>
<Price p="1">
<ParkingDays>0</ParkingDays>
<RoomPrice>810.78</RoomPrice>
</Price>
<Price p="2">
<ParkingDays>8</ParkingDays>
<RoomPrice>834.65</RoomPrice>
</Price>
<Price p="3">
<ParkingDays>15</ParkingDays>
<RoomPrice>864.65</RoomPrice>
</Price>
</Room>
<Room r="2">
<RoomCode>TWN</RoomCode>
<BoardBasis>RO</BoardBasis>
<Upgrade>Y</Upgrade>
<Price p="1">
<ParkingDays>0</ParkingDays>
<RoomPrice>810.78</RoomPrice>
</Price>
<Price p="2">
<ParkingDays>8</ParkingDays>
<RoomPrice>834.65</RoomPrice>
</Price>
<Price p="3">
<ParkingDays>15</ParkingDays>
<RoomPrice>864.65</RoomPrice>
</Price>
</Room>
</RoomType>
</Hotel>

Cheers

John

Posttop
Tony LavinioSubject: XSLT sorting parent nodes by multiple child nodes
Author: Tony Lavinio
Date: 09 May 2007 09:10 AM
1. Please post in only one forum.

2. Please don't post XSLT questions in the XQuery forum.

3. Remember that this is the free support forum for Stylus Studio
users. If you use the same email address to register here that you
did to register Stylus Studio, you are automatically recognized.
But since you did not, we do got give priority to your requests. If
you are a current user, when you make your request please state the
specific build of Stylus Studio that you are using.

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.