[xsl] Question about HTML tags

Subject: [xsl] Question about HTML tags
From: "Chaudhary, Harsh" <HCHAUDHA@xxxxxxxxx>
Date: Wed, 3 Oct 2007 15:47:35 -0500
Hi,

I am using XSLT to transfor an XML file to an HTML file. The HTML will
have a table with certain rows having a gray background and the other
rows a white background.

For example, the HTML would look like;

<html>
	<body>
		<table>
			<tr><td>AAA</td></tr>
			<tr style='background: gray;'><td>BBB</td></tr>
			<tr><td>AAA</td></tr>
			<tr><td>AAA</td></tr>
			<tr><td>AAA</td></tr>
			<tr style='background: gray;'><td>BBB</td></tr>
			<tr style='background: gray;'><td>BBB</td></tr>
			<tr><td>AAA</td></tr>
		</table>
	</body>
</html>

Meaning, I am trying to use choose-when in my XSLT to render either <tr>
or <tr style='background: gray;'>

My code looks like:

<xsl:choose>
    <xsl:when test="sometest">
        <tr>
    </xsl:when>
    <xsl:otherwise>
        <tr style='background: gray;'>
    </xsl:otherwise>
</xsl:choose>

The problem is that XSLT expects the <tr>'s to have an ending tag befor
the when or otherwise tags end. How should I go about implementing this?

Is there any other way to accomplish what I am trying to do?

Thanks,
HC.

Current Thread