distinct in Xpath ?

Posted by Antoine on Stack Overflow See other posts from Stack Overflow or by Antoine
Published on 2010-05-11T15:45:59Z Indexed on 2010/05/11 17:04 UTC
Read the original article Hit count: 388

Filed under:
|
|

Hi,

I have this XML file, from which I'd like to count the number of users referenced in it. But they can appear in more than one category, and I'd like these duplicates not to be taken into account.
In the example below, the query should return 3 and not 4. Is there a way in XPath to do so? Users are not sorted at all.

<list>
  <group name='QA'>
    <user name='name1'>name1@email</user>
    <user name='name2'>name2@email</user>
  </group>
  <group name='DEV'>
    <user name='name3'>name3@email</user>
    <user name='name2'>name2@email</user>
  </group>
</list>

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xpath