<row>
<cell>
<cell @start> "when row/entry/@morerows is found create the @start -
identified row, position 2 cell"
<cell>
</row>
<row>
<cell>
<cell> "first row following, position 2 cell"
<cell>
</row>
<row>
<cell>
<cell @end> "second row following, position 2 cell
<cell>
</row>
----my transform---
<xsl:template match="row">
<xsl:param name="rowPos">
<xsl:choose>
<xsl:when test=".[entry/@morerows]">
<xsl:apply-templates select="entry/@morerows"/>
</xsl:when>
</xsl:choose>
</xsl:param>
<xsl:param name="entryPos">
<xsl:for-each select="entry">
<xsl:choose>
<xsl:when test="@morerows">
<xsl:value-of select="position()"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:param>
<xsl:param name="currentRow">
<xsl:value-of select="position()"/>
</xsl:param>
<xsl:param name="endRow">
<xsl:value-of select="number($rowPos) + 1"/>
</xsl:param>
<!--
<xsl:variable name="static">
<xsl:choose>
<xsl:when test="./entry/@morerows">
<xsl:value-of
select="ancestor::tbody/row[position()]/entry/@morerows"/></xsl:when>
</xsl:choose>
</xsl:variable>
Static: <xsl:value-of select="$static"/>-->
Current Row <xsl:value-of select="number($currentRow)"/>
Entry Position: <xsl:value-of select="number($entryPos)"/>
@Morerows Value: <xsl:value-of select="number($rowPos)"/>
Where to add attribute: Row # <xsl:value-of select="number($endRow) "/>.
(Cell) Entry Position # <xsl:value-of select="number($entryPos)"/>
------end transform-----
-----start xml------------
<table-wrapper>
<table>
<tgroup cols="5">
<!--<colspec colwidth="10"
colname="col1"/>
<colspec colwidth="11"
colname="col2"/>
<colspec colwidth="12"
colname="col3"/>
<colspec colwidth="13"
colname="col4"/>
<colspec colwidth="14"
colname="col5"/>-->
<tbody>
<row>
<entry>first</entry>
<entry>second</entry>
<entry
morerows="4">first row-third entry | </entry>
<entry>3</entry>
<entry>4</entry>
</row>
<row>
<entry>1</entry>
<entry>2</entry>
<entry>second
row-third entry | </entry>
<entry>4</entry>
</row>
<row>
<entry>1</entry>
<entry>2</entry>
<entry>third
row-third entry | </entry>
<entry>4</entry>
</row>
<row>
<entry
namest="col1" nameend="col4" morerows="2">1</entry>
<entry>2</entry>
<entry>fourth
row-third entry | </entry>
</row>
<row>
<entry>1</entry>
<entry>2</entry>
<entry>fifth
row-third entry | </entry>
<entry>4</entry>
</row>
<row>
<entry
namest="col1" nameend="col4" morerows="1">1</entry>
<entry>2</entry>
<entry>sixth
row-third entry | </entry>
</row>
<row>
<entry>1</entry>
<entry>1</entry>
<entry>seventh
row-third entry | </entry>
</row>
<row>
<entry/>
<entry/>
<entry>eighth
row-third entry |</entry>
</row>
</tbody>
</tgroup>
</table>
</table-wrapper>