Subject: <xsl:choose>
From: Zvi Avraham <zvia@xxxxxxxxxxxxxxx>
Date: Wed, 06 Oct 1999 03:10:06 +0200
|
Hi People,
I have stock database in my XML source:
<stocks>
<stock symbol="PHCM" price="$142.75" change="+7.75"
volume="2,000,000"/>
<stock symbol="ALA" price="$29.12" change="-1.25" volume="345,000"/>
<stock symbol="ERICY" price="$31.00" change="+5.12" volume="990,000"/>
<stock symbol="NOK" price="$87.06" change="+3.92" volume="1,234,000"/>
<stock symbol="MOT" price="$91.00" change="-1.00" volume="1,000,000"/>
<stock symbol="IRIQE" price="$4.25" change="0.00" volume="0"/>
</stocks>
I want to render it in table, when earning change will be green, and
looses will be red...
I using next XSLT fragment, but seems, that no mutter whats change is,
XSLT always render
<xsl:otherwise> part ...
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.1">
[snip]
<xsl:choose>
<xsl:when test="number(@change) > 0">
<font face="Arial,Helvetica" size="1" color="green">
<xsl:value-of select="@change"/>
</font>
</xsl:when>
<xsl:when test="number(@change) < 0">
<font face="Arial,Helvetica" size="1" color="red">
<xsl:value-of select="@change"/>
</font>
</xsl:when>
<xsl:otherwise>
<font face="Arial,Helvetica" size="1">
<xsl:value-of select="@change"/>
</font>
</xsl:otherwise>
</xsl:choose>
[snip]
I tried so many things, with/out number() function, using xsl:variable
etc ...
Any ideas ?
Thanks in advance
Zvi
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
- <xsl:choose>
- Zvi Avraham - Wed, 06 Oct 1999 03:10:06 +0200 <=
- <Possible follow-ups>
- Kay Michael - Thu, 7 Oct 1999 11:08:17 +0100
|
|