XPath filter by attribute and return distinct values

Created on 15 March 2019, over 5 years ago
Updated 4 November 2024, 17 days ago

Is it possible to specify an xpath selector to filter by attribute and return distinct values?

From the following:

<root>
    <classifications>
        <classification name="Category">Category One</classification>
        <classification name="Sub-Category">Sub-Category One</classification>
    </classifications>
    <classifications>
        <classification name="Category">Category Two</classification>
        <classification name="Sub-Category">Sub-Category One</classification>
    </classifications>
    <classifications>
        <classification name="Category">Category One</classification>
        <classification name="Sub-Category">Sub-Category Two</classification>
    </classifications>
    <classifications>
        <classification name="Category">Category Three</classification>
        <classification name="Sub-Category">Sub-Category One</classification>
    </classifications>
    <classifications>
        <classification name="Category">Category One</classification>
        <classification name="Sub-Category">Sub-Category Two</classification>
    </classifications>
    <classifications>
        <classification name="Category">Category Two</classification>
        <classification name="Sub-Category">Sub-Category One</classification>
    </classifications>
</root>

classifications/classification[@name="Category"] returns:
Category One
Category Two
Category One
Category Three
Category One
Category Two

What I'm after is:
Category One
Category Two
Category Three

💬 Support request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

🇦🇺Australia syawillim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024