How to do sorting by groupwise in xsl?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Below xml based on this result
**total 2 rooms<br/>
1st room, 1 adult , 0 child<br/>
2nd room, 2 adults , 0 child**
In this cause xml is like this :
<pre class="prettyprint <HotelInfo>
<Service>
<HotelCode>1001</HotelCode>

<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>1</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>ROOM ONLY</Board>
<RoomType>SINGLE WITH NO TOILET</RoomType>
<Price>
<Amount>19.840</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>1</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>BED AND BREAKFAST</Board>
<RoomType>SINGLE WITH NO TOILET</RoomType>
<Price>
<Amount>19.840</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>1</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>ROOM ONLY</Board>
<RoomType>SINGLE WITH BATHROOM</RoomType>
<Price>
<Amount>25.790</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>1</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>BED AND BREAKFAST</Board>
<RoomType>SINGLE WITH BATHROOM</RoomType>
<Price>
<Amount>25.790</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>1</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>HALF BOARD</Board>
<RoomType>SINGLE WITH NO TOILET</RoomType>
<Price>
<Amount>25.790</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>1</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>HALF BOARD</Board>
<RoomType>SINGLE WITH BATHROOM</RoomType>
<Price>
<Amount>31.740</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>1</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>FULL BOARD</Board>
<RoomType>SINGLE WITH NO TOILET</RoomType>
<Price>
<Amount>31.740</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>2</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>ROOM ONLY</Board>
<RoomType>DOUBLE WITH NO TOILET</RoomType>
<Price>
<Amount>33.730</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>2</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>BED AND BREAKFAST</Board>
<RoomType>DOUBLE WITH NO TOILET</RoomType>
<Price>
<Amount>33.730</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>1</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>FULL BOARD</Board>
<RoomType>SINGLE WITH BATHROOM</RoomType>
<Price>
<Amount>37.690</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>2</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>ROOM ONLY</Board>
<RoomType>DOUBLE WITH BATHROOM</RoomType>
<Price>
<Amount>41.670</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>2</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>BED AND BREAKFAST</Board>
<RoomType>DOUBLE WITH BATHROOM</RoomType>
<Price>
<Amount>41.670</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>2</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>HALF BOARD</Board>
<RoomType>DOUBLE WITH NO TOILET</RoomType>
<Price>
<Amount>45.630</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>2</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>HALF BOARD</Board>
<RoomType>DOUBLE WITH BATHROOM</RoomType>
<Price>
<Amount>53.570</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>2</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>FULL BOARD</Board>
<RoomType>DOUBLE WITH NO TOILET</RoomType>
<Price>
<Amount>57.530</Amount>
</Price>

</AvailableRoom>
<AvailableRoom>
<HotelOccupancy>
<RoomCount>1</RoomCount>
<Occupancy>
<AdultCount>2</AdultCount>
<ChildCount>0</ChildCount>
</Occupancy>
</HotelOccupancy>

<Board>FULL BOARD</Board>
<RoomType>DOUBLE WITH BATHROOM</RoomType>
<Price>
<Amount>65.470</Amount>
</Price>

</AvailableRoom>


</Service>

<Service>
<HotelCode>1002</HotelCode>





</Service>

</HotelInfo>[/code]
1. I Need to filter above xml by xslt 1.0<br/>
2. Filter(group) by board <br/>
3. Each board need two rooms <br/>
(1st room with 1 adult, 0 child and <br/>
2nd room with 2 adult, 0 child)<br/>
4. if rooms not enough in the board. avoid that boards from the result<br/>
5. take the minimum price of room to the board (i mean any room type with less price)<br/>
6. i need result like below<br/>
<br/>
Rooms<br/>
Total 2 rooms<br/>
1st room, 1 adult , 0 child<br/>
2nd room, 2 adults , 0 child <br/>
<br/>
Service Node 1<br/>
<br/>
Room type, Board RoomCount, AdultCount, ChildCount Price<br/>
<br/>
SINGLE WITH NO TOILET, ROOM ONLY 1, 1, 0 19.840<br/>
DOUBLE WITH NO TOILET, ROOM ONLY 1, 2, 0 33.730<br/>

Total Price: 53.570<br/>
<br/>
SINGLE WITH NO TOILET, BED AND BREAKFAST 1, 1, 0 19.840<br/>
DOUBLE WITH NO TOILET, BED AND BREAKFAST 1, 2, 0 33.730<br/>

Total Price: 53.570<br/>
<br/>
SINGLE WITH NO TOILET, HALF BOARD 1, 1, 0 25.790<br/>
DOUBLE WITH NO TOILET, HALF BOARD 1, 2, 0 45.630<br/>

Total Price: 71.420<br/>
<br/>
SINGLE WITH NO TOILET, FULL BOARD 1, 1, 0 31.740<br/>
DOUBLE WITH NO TOILET, FULL BOARD 1, 2, 0 57.530<br/>

Total Price: 89.270<br/>
<br/>




View the full article
 
Back
Top