hello,
May I know how to select distinct items from a XML file? For example, I have a XML file contains the list of hotels in different countries, how do I select the distinct country from XML just like 'select distinct country from tblhotel' in SQL using ASP?
I've found the code select the distinct country using XSLT with 'preceding-sibling', but it just doesn't work with ASP...any idea?
my example XML file:
<hotels>
<hotel id="1">
<hotelname>Hotel 1</hotelname>
<country>USA</country>
<state>state1</state>
</hotel>
<hotel id="2">
<hotelname>Hotel 2</hotelname>
<country>UK</country>
<state>state2</state>
</hotel>
<hotel id="3">
<hotelname>Hotel 3</hotelname>
<country>USA</country>
<state>state3</state>
</hotel>
<hotel id="4">
<hotelname>Hotel 4</hotelname>
<country>China</country>
<state>state4</state>
</hotel>
<hotel id="5">
<hotelname>Hotel 5</hotelname>
<country>UK</country>
<state>state5</state>
</hotel>
<hotel id="6">
<hotelname>Hotel 6</hotelname>
<country>Japan</country>
<state>state6</state>
</hotel>
</hotels>
and the result I desire is: USA, UK, China, Japan
Thanks for help...
May I know how to select distinct items from a XML file? For example, I have a XML file contains the list of hotels in different countries, how do I select the distinct country from XML just like 'select distinct country from tblhotel' in SQL using ASP?
I've found the code select the distinct country using XSLT with 'preceding-sibling', but it just doesn't work with ASP...any idea?
my example XML file:
<hotels>
<hotel id="1">
<hotelname>Hotel 1</hotelname>
<country>USA</country>
<state>state1</state>
</hotel>
<hotel id="2">
<hotelname>Hotel 2</hotelname>
<country>UK</country>
<state>state2</state>
</hotel>
<hotel id="3">
<hotelname>Hotel 3</hotelname>
<country>USA</country>
<state>state3</state>
</hotel>
<hotel id="4">
<hotelname>Hotel 4</hotelname>
<country>China</country>
<state>state4</state>
</hotel>
<hotel id="5">
<hotelname>Hotel 5</hotelname>
<country>UK</country>
<state>state5</state>
</hotel>
<hotel id="6">
<hotelname>Hotel 6</hotelname>
<country>Japan</country>
<state>state6</state>
</hotel>
</hotels>
and the result I desire is: USA, UK, China, Japan
Thanks for help...