Subject: RE: <xsl:choose> From: Kay Michael <Michael.Kay@xxxxxxx> Date: Thu, 7 Oct 1999 11:08:17 +0100 |
You don't say what product you are using. The XPath rules for converting strings to numbers (see 4.4) allow a leading "-" sign but not a "+" sign. These rules are used in all cases where conversion is required (with the exception of xsl:sort data-type="numeric", which for some reason specifies different and less prescriptive rules). > -----Original Message----- > From: Zvi Avraham [mailto:zvia@xxxxxxxxxxxxxxx] > Sent: 06 October 1999 02:10 > To: xsl-list@xxxxxxxxxxxxxxxx > Subject: <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 > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: <xsl:choose>, Garriss Jr.,James P. | Thread | Re: <xsl:choose>, Zvi Avraham |
RE: Iterative XML Handling, Kay Michael | Date | Re: Q: XML+XSL transforms to a prin, Sebastian Rahtz |
Month |