|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: Capturing/testing results of a boolean express
Ed,
At 05:59 PM 8/2/2002, you wrote: Maybe details are called for, because as I gnaw at this problem and read archives I realize the trick might be to establish an expression which returns a "boolean" as opposed to an expression which returns a "results-tree-fragment". Quite right. This is a tricky subtlety in declaring variables, that these aren't the same thing. I have a variable which will have a string value. I wish to compare that string value to another string value (which happens to be a literal value). I've done this directly in a xsl:if or xsl:when before, but now I'm trying to capture the results of the expression in a variable. The way you gave should do precisely that. The select="$X = 'literal-string-value'" will return a Boolean and bind it to the variable. Whereas <xsl:variable name="flag"> <xsl:value-of select="$X = 'literal-string-value'" /> </xsl:variable> will take the Boolean, turn it into a string, and put it into an RTF. Is there a way to take a 'results-tree-fragment' which has the value "true" or "false" and turn it back into the equivalent 'boolean' value? Sure: <xsl:variable name="flag" select="$rtf = 'true'"/> will bind $flag to Boolean true() only if the string value of $rtf is 'true'; otherwise it'll be false(). (true() and false() are functions that will return the Boolean true and false values respectively. They too may be useful to you.) But any time you do <xsl:value-of select="$flag"/> you are coercing the Boolean back into a string, since that's what value-of does. Cheers, Wendell
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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








