Im having some troubles in creating a table where the Rowspan of one column needs to be specified. I have this xml
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<artist>
<name>artist1</name>
<cd>cd1</cd>
<cd>cd2</cd>
<cd>cd3</cd>
</artist>
<artist>
<name>artist2</name>
<cd>cd2</cd>
<cd>cd4</cd>
</artist>
<artist>
<name>artist3</name>
<cd>cd5</cd>
<cd>cd4</cd>
</artist>
</catalog>
And this XSL
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th style="text-align:left">Artist</th>
<th style="text-align:left">CD</th>
</tr>
<xsl:for-each select="catalog/artist">
<tr>
<td rowspan="{count(cd)}">
<xsl:value-of select="count(cd)"/>
<xsl:value-of select="name"/>
</td>
<xsl:for-each select="cd">
<tr>
<td><xsl:value-of select="."/></td>
</tr>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The problem is the follows: When the rowspan is count(cd), it does not display properly as you can see in the figure enter image description here But, if I put count(cd)+1 instead of count(cd) (which does not make sense since I want the rowspan the same size as count(cd) it displays correctly, but when I generate the HTML, if the window is smaller, it creates an extra line. Due to having an extra row. enter image description here
Do you have any ideas?