Reputation:
I am using xslt1 This is chunk of my xsl stylesheet now I Want to add condtion in that if value of account status is closed then change background color to red else green ? How can we achieve that here
<th>
Account Status:-
</th>
<td>
<xsl:value-of select="ACCOUNT-STATUS" />
</td>
Upvotes: 0
Views: 91
Reputation: 167581
In XSLT 1, you can use
<th>
<xsl:attribute name="style">
<xsl:text>background-color: </xsl:text>
<xsl:choose>
<xsl:when test="ACCOUNT-STATUS = 'closed'">red</xsl:when>
<xsl:otherwise>green</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="ACCOUNT-STATUS" />
</th>
Upvotes: 0
Reputation: 163360
Another option is to do something like
<th class="account-status-{ACCOUNT-STATUS}">...</th>
And then set up CSS styles named account-status-open
and account-status-closed
.
Upvotes: 1