Conditional Formatting Internals
The inner workings of Conditional Formatting are actually pretty straightforward. The key construct that makes the feature possible is a tag called <xsl:if>, which is used to conditionally add content to the HTML output of the transform.
It's easiest to grok xsl:if with the "show content" type of CondF. Basically, the content you want conditional shown is wrapped in a xsl:if tag, where the test attribute of the tag defines the "condition" to be evaluated. If the condition is true, the content contained within the xsl:if gets output into the resulting HTML. If not true, nothing gets output.
<xsl:if test="@Units >= '500'"><img src="Dc39.jpg" width="33" height="29" /></xsl:if>
For "apply formatting" CondF, the markup is only slightly more complicated. In this case, the xsl:if part remains the same - the only trickiness is that in tis case we want to affect an attribute (style on the parent <td> container), not another tag. One does this by wrapping the xsl:if tag with an xsl:attribute tag. Using the name attribute on the xsl:attribute tag, we can define which attribute the optional content gets added to. In this case, it's the "style" attribute.
<xsl:if test="@Units >= '500'">background-color: #FFFF00;</xsl:if>
That's pretty much all there is to Conditional Formatting. One of the nice things about understanding the markup is that you can exact "formatting" you desire. Next time, I'll show you how how you can do some more advanced conditional formatting by manually editing the XSLT.