Let's say that I have the following XML file:
<Persons>
<Person>
<Name>A</Name>
<LastName>AAA</LastName>
</Person>
<Person>
<Name>B</Name>
<LastName>BBB</LastName>
</Person>
<Person>
<Name>C</Name>
<LastName>AAA</LastName>
</Person>
<Person>
<Name>D</Name>
<LastName>AAA</LastName>
</Person>
<Person>
<Name>E</Name>
<LastName>BBB</LastName>
</Person>
</Persons>
I need to produce a table with all of the families (last names), and the number of people that has each last name. As for the example, the table should look like that:
Family - People
AAA - 3
BBB - 2
How can I make a loop that will run on every last name?