You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Alfredas Chmieliauskas <al...@node.lt> on 2002/04/08 21:29:20 UTC

XPath query: all different attribute values in a collection

Hello,
I guess this is an off-topic, and should be directed to some XPath-specific list, but I guess the questions might be interesting and common to many xml-db applications.
I want to select all different attribute values from a collection of resources, eg:
xml document
<node1 attr="one"/>
<node2 attr="two"/>
<node3 attr="three"/>
<node4 attr="one"/>

the query should return only the different values: attr=one, attr=two, attr=three; instead of //*/@attr, which would include the values that repeat.
This problem could be met in case when f.ex. there is a collection of documents defining products. Each docuemtnt/product has a brand attribute/element. If one would like to have a list of all brands of the products on sale, naturally without the duplicates.
Well, I hope you see my point here.
Thanks in advance.

Alfredas