|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: more attribute fun...
Hi Bryan,
> This worked great, but now I was wondering about calculating
> something in an attribute and then outputing the result. What I mean
> by this is something to the effect of:
>
> <path d="M 35... fill="{fill_percentage > 90 ? green :
> yellow}" />
If you were after something short and incomprehensible, you could use:
<path fill="{substring('yellow green',
(fill_percentage > 90) * 7 + 1, 6)}" />
if fill_percentage > 90 is true (1), then multiplying by 7 gives you 7,
plus 1 is 8, so you get the substring of 'yellow green' starting at
the 8th character ('g') and 6 characters long (the rest of the
string). If fill_percentage > 90 is false (0), then multiplying by 7
gives you 0, plus 1 is 1, so you get the substring of 'yellow green'
starting at the 1st character ('y') and 6 characters long (the string
'yellow').
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
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








