Hi,
XPath is one of the flexible standard for querying an xml document.
Let us consider the following CD xml as example:-
Empire Burlesque Bob Dylan 10.90 Hide your heart Bonnie Tyler 9.90 Greatest Hits Dolly Parton 9.90 Hide your heart Bonnie Tyler 9.90In the above xml, if we would like to get distinct country names, then we can make use of the preceding-sibling property to check for any
existence of the country name so as to filter and show only distinct country names.
/catalog/cd[not(@country=preceding-sibling::cd/@country)]/@country
The above expression would select only distinct country names i.e. UK and USA only once each.
Cheers.
