How to get this output with XQuery? [closed]

MetalGear

New Member
\[quote\] Possible Duplicate:
XQuery returning an error..? \[/quote\]Below is the XML file -\[code\]<Continents> <Continent name="Asia"> <Country name="Japan"> <City name="Tokyo"><Desc>Tokoyo is a most populated City</Desc></City> <City name="Horishima"><Desc>What to say.. Faced the destruction due to Atom Bomb</Desc></City> </Country> <Country name="India"> <City name="New Delhi"><Desc>Capital of India</Desc></City> <City name="Mumbai"><Desc>Financial Capital of India</Desc></City> <City name="Lucknow"><Desc>City of Nawabs</Desc></City> </Country> </Continent> </Continents>\[/code\]I want to list Cities for Country=\[code\]"India"\[/code\]My XQuery FLWOR code is -\[code\]for $x in doc("Continent")/Continents/Continent where $x/Country/@name='India' return $x/Country/City/@name\[/code\]I am wishing output as - \[code\] name="New Delhi" name="Mumbai" name="Lucknow"\[/code\]but getting output as -\[code\] name="Tokyo" name="Horishima" name="New Delhi" name="Mumbai" name="Lucknow"\[/code\]Can anybody help me to get correct output? Also how to get it on separate line?
 
Back
Top