Solutions


XSLT 1.0: Based on the Muenchian method.
<xsl:for-each select="cities/city[not(@country = preceding::*/@country)]">
<tr>
<td><xsl:value-of select="@country"/></td>
<td>
<xsl:for-each select="../city[@country = current()/@country]">
<xsl:value-of select="@name"/>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</td>
<td><xsl:value-of select="sum(../city[@country = current()/@country]/@pop)"/></td>
</tr>
</xsl:for-each>

XSLT 2.0:

<xsl:for-each-group select="cities/city" group-by="@country">
<tr>
<td><xsl:value-of select="@country"/></td>
<td>
<xsl:value-of select="current-group()/@name" separator=", "/>
</td>
<td><xsl:value-of select="sum(current-group()/@pop)"/></td>
</tr>
</xsl:for-each-group>