Recursion
Hi, I am running Windows8, Net 2.0 and XML version 1.0. I've done a bit of programming thus far with help from this forum, so once again Thanks to all who share their talent/knowledge with others. In my past conventional programming, you could save much time in repeating common code by writing a separate function and simply referring to it when needed. It does not seem that simple here with XSLT...
Specifically, I have repeating background formatting code to grade flight performance: Excellent = Green, Poor = Red, etc.
I set my flight performance variable like:
<xsl:variable name="ASIMaxNumber"
select="$PointsA[not (. < $PointsA)]" />
I evaluate the variable like:
<tr>
<td><xsl:text>Air Speed Maximum = </xsl:text></td>
<td><xsl:value-of select ="format-number($ASIMaxNumber,'#.00')"/>
<xsl:text> Knots</xsl:text></td>
<xsl:if test= "$ASIMaxNumber > 130">
<td bgcolor="#ff0000">
<xsl:text>Fail</xsl:text>
</td>
</xsl:if>
</tr>
There would be similar code to evaluate $ASIMaxNumber < 110 and for 110 - 130. Understand too that this same evaluation will be performed on other data such as Altitude, Distance, etc.
So for 3 variables, I end up performing the SAME 3 "if test" and applying the SAME background formatting...the only thing changing is the node and its value.
Question: Is there a more efficient way to perform these repetitive tasks than simply repeating the "if:test"? If so, would you show me an example? Thanks so much for any help or reference.
Jake
|