Subject: Re: [xsl] more attribute fun... From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 19 Mar 2002 09:27:53 +0000 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] more attribute fun..., David Carlisle | Thread | RE: [xsl] more attribute fun..., Dion Houston |
[xsl] parent and .., Matts Isuls | Date | RE: [xsl] Normalize-space does not , Oliver Becker |
Month |