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

Re: more attribute fun...

Subject: Re: more attribute fun...
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 19 Mar 2002 09:27:53 +0000
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


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.