Note that there are some explanatory texts on larger screens.

plurals
  1. POSort XML data in classic ASP
    primarykey
    data
    text
    <p>I want to sort below xml, Based on the Adult and child ( i need to take Adult and child as constant):</p> <pre><code>&lt;HotelDetails&gt; &lt;hotel&gt; &lt;rooms&gt; &lt;room&gt; &lt;roomname&gt;Single&lt;/roomname&gt; &lt;Price&gt;100&lt;/Price&gt; &lt;Adult&gt;1&lt;/Adult&gt; &lt;child&gt;0&lt;/child&gt; &lt;/room&gt; &lt;/rooms&gt; &lt;rooms&gt; &lt;room&gt; &lt;roomname&gt;Single&lt;/roomname&gt; &lt;Price&gt;150&lt;/Price&gt; &lt;Adult&gt;1&lt;/Adult&gt; &lt;child&gt;0&lt;/child&gt; &lt;/room&gt; &lt;/rooms&gt; &lt;rooms&gt; &lt;room&gt; &lt;roomname&gt;Double&lt;/roomname&gt; &lt;Price&gt;200&lt;/Price&gt; &lt;Adult&gt;2&lt;/Adult&gt; &lt;child&gt;1&lt;/child&gt; &lt;/room&gt; &lt;/rooms&gt; &lt;/hotel&gt; &lt;/HotelDetails&gt; </code></pre> <p>to give:</p> <pre> Hotel : Single-100, Double-200, <b>Total 300</b> Single-150, Double-200, <b>Total 350</b> </pre> <p>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?</p> <pre><code>&lt;%@ Language="VBScript" CodePage="65001"%&gt; &lt;% 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" &amp; VbCrLf Response.Write Adult.ChildNodes.Item(0).Text &amp; VbCrLf Next Else Response.Write doc.parseError.reason End If %&gt; </code></pre> <p>How can I do this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload