This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: more attribute fun...
- From: "Dion Houston" <dionh at microsoft dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 18 Mar 2002 15:25:25 -0800
- Subject: RE: [xsl] more attribute fun...
- Reply-to: xsl-list at lists dot mulberrytech dot com
Well, a conditional function has been proposed for XPath >v1, but in the
mean time you can shorten that a bit by taking advantage of multiple
attributes overwriting themselves... i.e..
<path fill="default">
<xsl:if test="$fill_percentage > 90">
<xsl:attribute name="fill">
<xsl:text>green</xsl:text>
</xsl:attribute>
</xsl:if>
</path>
That's untested, but I'd think that'd work... if not, having two
explicit <xsl:attribute>'s will definitely work...
-----Original Message-----
From: bryan hansen [mailto:bh5k@yahoo.com]
Sent: Monday, March 18, 2002 3:06 PM
To: xsl-list@lists.mulberrytech.com
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