[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] more attribute fun...


Subject: RE: [xsl] more attribute fun...
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Mon, 18 Mar 2002 23:37:02 -0000

Conditional expressions are available in XPath 2.0, you can try them out
with Saxon 7.0.

<path fill="{if ($fill_percentage > 90) then 'green' else 'yellow'}" />

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> bryan hansen
> Sent: 18 March 2002 23:06
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] more attribute fun...
>
>
> After some great responses from people (thank you), I
> found some great solutions for adding an offset to a
> value within an attribute. Some people suggested using
> the attribute template method. IE:
>
> <path d="M 35, {$y_offset + 25} ..."/>
>
> 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}" />
>
> so having some sort of conditional that I can use to
> check the percentage filled and output a different
> color if greater than 90 percent. Can I do something
> like this? Or am I going to have to go to the older
> method of doing things, ie:
>
> <path>
>     <xsl:attribute name="fill">
>         <xsl:choose>
>           <xsl:when test="$fill_percentage > 90">
>             <xsl:text>green</xsl:text>
>           </xsl:when>
>             .
>             .
>             .
>         </xsl:choose>
>     </xsl:attribute>
> </path>
>
> Thanks for any help or suggestions,
>
> Bryan
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - live college hoops coverage
> http://sports.yahoo.com/
>
>  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
Keywords