|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: A newbie question in XSL - Using variables
At 2005-01-25 18:28 -0800, prasannap@xxxxxx wrote:
I have a simple question that Im trying to solve: This is a FAQ
Put the conditional around the value assigned, not around the assignment: <xsl:variable name="use-color">
<xsl:choose>
<xsl:when test="some condition">red</xsl:when>
<xsl:when test="other condition">blue</xsl:when>
<xsl:otherwise>green</xsl:otherwise>
</xsl:choose>
</xsl:variable>
...
<font color="$use-color">Hello</font>Some caveats when testing result-tree-fragment variables, they always test true() until you cast them to the data type that you need. I hope this helps. ......................... Ken -- World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
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








