Ok... Here is a small demo that shows you a way how to calculate the rowspan.
contacts.xml will be the starting point for this exercise.
In a first step we do a little xml to xhtml conversion in order to view our data in a table.
The result is the following:
Now suppose we want to merge cell's in the city column.
The final output looks like this:
This demo shows you it's quite easy to calculate the rowspan using the 'deep-equal' function recursively.