I have an XML file with the following elements and attributes:
<element>
<unit id="1" color="blue"/>
<unit id="2" color="blue"/>
<unit id="3" color="red"/>
</element>
How do I get the count of 1) distinct occurrences of each attribute color and 2) count for each distinct occurrence?
So far, I've tried both distinct-values() and count() and their combinations, with no luck, ending with either the number of distinct attributes or the number of them, although I'd like to get both.
The list of results that I'd like to get would look like this:
Blue 2
Red 1