xsl-list
[Top] [All Lists]

Re: xsl:if statement with numeric

2004-03-28 00:34:47
somehow I  did find a solution: 

        <xsl:choose>
            <xsl:when test= "number(.) = 100.00">
                <td bgcolor="#00ff00" align="right">
                    <xsl:apply-templates/>
                </td>
            </xsl:when>
            <xsl:when test= "number(.) &gt; 98.70">
                <td bgcolor="#ff0000" align="right">
                    <xsl:apply-templates/>
                </td>
            </xsl:when>
            <xsl:otherwise>
                <td bgcolor="#ff9600" align="right">
                    <xsl:apply-templates/>
                </td>
            </xsl:otherwise>
        </xsl:choose>


hello 
I'm very new to this. 
I have an xml returned that looks like this: 

<td>100</td>
<td>98.00</td>
<td>100</td>

now I'd like to give the td tags different colors, depending on the value.
What I did so far ist that: 

<xsl:template match="monat">
        <xsl:if test= "numeric(.) &lt; 100.00">     
            <xsl:variable name="farbe">#00ff00</xsl:variable>
        </xsl:if>
    <td bgcolor="$farbe" align="right">
        <xsl:apply-templates/>
    </td>
</xsl:template>

My problem is, I think he doesn't make a difference with the value, all
columns get the same color. 
What have I done wrong here?
Thanks for any answers.

-- 
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz
+++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


-- 
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz



<Prev in Thread] Current Thread [Next in Thread>