Using XSLT 1.0, how do I obtain the maximum number of distinct <info>
elements that are children of the same <container>
element in a structure like the following (if at all possible)?
<root>
<container>
<subelem sometimes_empty='yes'/>
<subelem>
<info>A</info>
</subelem>
<subelem>
<info>B</info>
<irrelevant>meh</irrelevant>
</subelem>
...
</container>
<container>
<subelem>
<info>C</info>
</subelem>
<subelem>
<info>C</info>
</subelem>
...
</container>
...
</root>
Using the distinct grouping solution offered here
, I am able to get the number of distinct entries overall, but I'm actually interested on this number per <container>
node, which will be lower. I've being trying to apply the functions count() and max() to this end, but my limited experience with XSLT/XPath hasn't allowed me to do so successfully. Any help would be much appreciated.