J
John Kooistra
Hi!
I'm looking to generate an HTML table via XSL using XML data.
Specifically, I want to arrange my data in a table with rows of 6
columns. So, I have this conditional XSL statement setup to open and
close <tr>'s when appropriate.
Unfortunately, the XSL parser doesn't like the fact that within the
<xsl:when> block there is no closing tag for <tr>. (ie. Receive the
error message: "End tag 'xsl:when' does not match the start tag
'tr'.")
<code snippet>
<xsl:for-each select="course">
<xsl:choose>
<xsl:when test="position() mod 6 = 1">
<tr> <!-- PROBLEM -->
<td>
SOME DATA
</td>
</xsl:when>
<xsl:when test="position() mod 6 = 0">
<td>
SOME DATA
</td>
</tr> <!-- PROBLEM -->
</xsl:when>
<xsltherwise>
<td>
SOME DATA
</td>
</xsltherwise>
</xsl:choose>
</xsl:for-each>
</code snippet>
Is there a way to tell the XSL parser that this is what I want and to
leave me alone? Or is there another (better?) way of doing this?
Thanks in advance,
John
P.S. I realize at this point that this code relies on a multiple of 6
<course> blocks in the XML to create well-formed HTML.
I'm looking to generate an HTML table via XSL using XML data.
Specifically, I want to arrange my data in a table with rows of 6
columns. So, I have this conditional XSL statement setup to open and
close <tr>'s when appropriate.
Unfortunately, the XSL parser doesn't like the fact that within the
<xsl:when> block there is no closing tag for <tr>. (ie. Receive the
error message: "End tag 'xsl:when' does not match the start tag
'tr'.")
<code snippet>
<xsl:for-each select="course">
<xsl:choose>
<xsl:when test="position() mod 6 = 1">
<tr> <!-- PROBLEM -->
<td>
SOME DATA
</td>
</xsl:when>
<xsl:when test="position() mod 6 = 0">
<td>
SOME DATA
</td>
</tr> <!-- PROBLEM -->
</xsl:when>
<xsltherwise>
<td>
SOME DATA
</td>
</xsltherwise>
</xsl:choose>
</xsl:for-each>
</code snippet>
Is there a way to tell the XSL parser that this is what I want and to
leave me alone? Or is there another (better?) way of doing this?
Thanks in advance,
John
P.S. I realize at this point that this code relies on a multiple of 6
<course> blocks in the XML to create well-formed HTML.