I want to sort below xml, Based on the Adult and child ( i need to take Adult and child as constant):
<HotelDetails>
<hotel>
<rooms>
<room>
<roomname>Single</roomname>
<Price>100</Price>
<Adult>1</Adult>
<child>0</child>
</room>
</rooms>
<rooms>
<room>
<roomname>Single</roomname>
<Price>150</Price>
<Adult>1</Adult>
<child>0</child>
</room>
</rooms>
<rooms>
<room>
<roomname>Double</roomname>
<Price>200</Price>
<Adult>2</Adult>
<child>1</child>
</room>
</rooms>
</hotel>
</HotelDetails>
to give:
Hotel : Single-100, Double-200, Total 300 Single-150, Double-200, Total 350
I try to sort with below code, but it comes like constant (distinct data). Anyone have an idea to sort above XML use something like below code?
<%@ Language="VBScript" CodePage="65001"%>
<%
Response.ContentType = "text/plain; charset=UTF-8"
Dim doc
Set doc = Server.CreateObject("Msxml2.DOMDocument.3.0")
doc.async = False
If doc.load(Server.MapPath("ee.xml")) Then
doc.setProperty "SelectionLanguage", "XPath"
Dim xpath
xpath = "HotelDetails/hotel/rooms[not(room/Adult= preceding-sibling::rooms/room/Adult)]/room/Adult"
For Each Adult in doc.selectNodes(xpath)
Response.Write "Hotel" & VbCrLf
Response.Write Adult.ChildNodes.Item(0).Text & VbCrLf
Next
Else
Response.Write doc.parseError.reason
End If
%>
How can I do this?