I have an xml file where I picked out several matching nodes and I want to count the matching nodes I find so I can put the items I test for from my xml file into a 4 column table. If there is another alternative please let me know.
Example of part of xsl so far...
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<xsl:if test="price=10 or price=20 or price= 30">
<tr>
<td><xsl:value-of select="title"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
But I want the output to be in a table in 4 columns showing
the matching titles to the price I am looking for. I think if I can count the nodes that match, I could be able to do this, but above only puts it in 1 column where I would like 4 columns.
Output I want should look like below:
<tr>
<td>Empire Burlesque</td>
<td>Romanza</td>
<td>Black Angel</td>
<td>1999 grammee nominees</td></tr>
tr>
<td>Long Road</td>
<td>White Stripes</td>
<td>Black Album</td>
<td>Where is it?</td></tr>
Example of part of xsl so far...
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<xsl:if test="price=10 or price=20 or price= 30">
<tr>
<td><xsl:value-of select="title"/></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
But I want the output to be in a table in 4 columns showing
the matching titles to the price I am looking for. I think if I can count the nodes that match, I could be able to do this, but above only puts it in 1 column where I would like 4 columns.
Output I want should look like below:
<tr>
<td>Empire Burlesque</td>
<td>Romanza</td>
<td>Black Angel</td>
<td>1999 grammee nominees</td></tr>
tr>
<td>Long Road</td>
<td>White Stripes</td>
<td>Black Album</td>
<td>Where is it?</td></tr>