Rather than using grouping for this, because there is a one-to-one correspondence between input rows and output rows, I think it might be easier to use logic of the form:
Code:
<xsl:template match="name1">
<cell>
<xsl:value-of select="
if(. eq ../preceding-sibling::row[1]/name1)
then ''
else ."/>
</cell>
</xsl:template>
<xsl:template match="name2">
<cell>
<xsl:value-of select="
if(deep-equal(../(name1, name2), ../preceding-sibling::row[1]/(name1, name2))
then ''
else ."/>
</cell>
</xsl:template>
That's for rows with fixed column names. But I think you can generalize it to:
Code:
<xsl:template match="row/*">
<xsl:variable name="col" select="1+count(preceding-sibling::*)"/>
<cell>
<xsl:value-of select="
if(deep-equal(../*[position() le $col], ../preceding-sibling::row[1]/*[position() le $col]))
then ''
else ."/>
</cell>
</xsl:template>
Not tested.