As a complete beginner in this field, I am currently working on a simple xslt presentation file that includes a table. I want to customize the background color of either a cell or an entire row based on its content.
For example, if the rating is "GOOD", "MEDIUM" or "BAD", I would like the background color to be green, yellow, or red respectively.
This is my current table code:
<table width="1000" border="0" cellspacing="0" cellpadding="0" class="table-fill">
<thead>
<tr>
<th scope="col">NAME</th>
<th scope="col">VALUE</th>
<th scope="col">RATING</th>
<th scope="col">DESCRIPTION</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="test/criteria">
<tr>
<td><xsl:value-of select="@nom" /></td>
<td><xsl:value-of select="value" /></td>
<td><xsl:value-of select="rating" /></td>
<td><xsl:value-of select="descr" /></td>
</tr>
</xsl:for-each>
</tbody>
</table>
Your help is greatly appreciated.
--UPDATE-- Special thanks to @Yaakov Ainspan for answering my question, and @Ruud for providing the necessary code snippets.
This is not a duplicate of "Is there a CSS selector for elements containing certain text?" because I was focused on creating classes with names matching the content of a specific cell, rather than isolating elements from strings with multiple contents.