|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] <xsl:choose>
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








