[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:if statement with numeric

Subject: RE: xsl:if statement with numeric
From: "Tuan Luu" <tuanluu@xxxxxx>
Date: Sun, 28 Mar 2004 12:47:18 +0200 (MEST)
tuan luu
Hallo Andreas

Thank you very much for your kind answer. 
That was a great idea and I like you're solution.  
have a nice day 

Tuan



> > -----Original Message-----
> > From: Tuan Luu [mailto:tuanluu@xxxxxx]
> >
> > somehow I  did find a solution:
> >
> 
> Hi,
> 
> Well, to add a few pointers :
> 
> > >
> > > <xsl:template match="monat">
> > >         <xsl:if test= "numeric(.) &lt; 100.00">
> 
> This should be number() instead of numeric(), but this you already
> discovered..
> 
> > >             <xsl:variable name="farbe">#00ff00</xsl:variable>
> > >         </xsl:if>
> > >     <td bgcolor="$farbe" align="right">
> 
> Then this here should become:
> 
> <td bgcolor="{$farbe}" align="right">
> 
> Notice the curly braces {} to force the processor to interpret '$farbe' as
> a
> variable name, or more generally as an XPath expression.
> 
> Somehow, I would consider putting a color-map somewhere in the source XML,
> the stylesheet or a separate XML, like:
> 
> <colormap>
>   <color min="0" color="#ff9600" />
>   <color min="98.70" color="#ff0000" />
>   <color min="100" color="#00ff00" />
> </colormap>
> 
> Then you could avoid all the xsl:choose / xsl:if logic by merely fetching
> the color value corresponding to the number value in question, like
> 
> <xsl:template match="monat">
>   <td bgcolor="{/colormap/color[@min &gt;= number(current())][1]/@color}"
>       align="right">
> ...
> 
> So, fetch the color attribute from the first color node whose min value is
> greater than or equal to the current value.
> 
> 
> Hope this helps!
> 
> Cheers,
> 
> Andreas
> 

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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.