I'm wondering if there is such as thing as being able to group XML data based on the text within elements.
I have some XML similar to the following, dumbed down for simplicity:
<person>
<name>Bob</name>
<food>Apples</food>
</person>
<person>
<name>Billy</name>
<food>Bananas</food>
</person>
<person>
<name>Bob</name>
<food>Oranges</food>
</person>
I want to display the above data in the following way:
Person's Name: Bob
Person's Food: Apples
Oranges
Person's Name: Billy
Person's Food: Bananas
I've tried multiple approaches using all the different examples but I just can't hit right right use of XPath for this one. I just can't wrap my head around being able to display only the first instance of Bob but also be able to display all of Bob's food, which is spread across multiple instances of Bob. Any suggestions as to where I could start with this?