> Following is to set attribute as yellow if severity<3
> <xsl:for-each select="severity">
> <xsl:if expr="(this.nodeTypedValue < 3)">
> <xsl:attribute name="class">yellow</xsl:attribute>
> But how to do if I want to severity<3, and finished="N"
I don't know what flavor of XSLT you're using. In XSLT 1.0, the xsl:if
element has a test attribute, but not an expr attribute.
Under XSLT 1.0, you'd construct the xsl:if like this:
<xsl:if test="severity < 3 and finished='N'">
If this "if-test" is to be merged with the one you quoted in full,
above, you might want to put them both inside an xsl:choose block like this:
<xsl:when test="this.nodeTypedValue < 3">
<xsl:when test="severity < 3 and finished='N'">
<!-- ...as many xsl:when's as you need :)... -->
<!-- xsl:otherwise is optional, provides fallback -->
The xsl:when's are mutually exclusive: The first xsl:when for which the
value of the test attribute is true is the "winner," thus the order in
which you place them within the xsl:choose is significant. Leaving them
as separate xsl:if's allows for the possibility that more than one might
be true, with perhaps unexpected results.
First thing I'd straighten out, though, is the XSLT processor question.
If you're still using the MSXML processor which was built into Internet
Explorer 5.0 and earlier, you should know that it implements a 2- or
3-year out-of-date version of the XSLT spec. No one -- not even
Microsoft -- recommends its continued use. There's an XSLT 1.0-compliant
version of MSXML available from the Microsoft Web site; the best source
of information about this is Joshua Allen's Unofficial MSXML XSLT FAQ, at:
John E. Simpson | "When I was a little kid we had a sand
http://www.flixml.org | box. It was a quicksand box. I was an
XML Q&A: www.xml.com | only child... eventually." (Steven Wright)