|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Can I use a boolean variable in an xsl:if test
Jay,
At 03:11 PM 2/8/2005, you wrote: > My guess is that newbies imagine xsl:value-of to be > some kind of "evaluate" function. Of course what it > really is, is an instruction to write a string to a > result tree (to "the" result tree or to a > result-tree-fragment, as the case may be). Since this > is generally what we want to have happen to our > results, there seems to be nothing to get confused > about. > > Until it breaks, that is, because we're not writing it > out, but doing something else with it instead. Like > testing whether it's true, while imagining we're > testing the expression that was evaluated for it. Yes, my wetware XSLT processor works the same way. Of course, the string "" returns false() as a Boolean, whereas a result-tree-fragment with a root but nothing in it returns true(), so an extra refinement is required to keep the story really straight -- xsl:variable xsl:value-of select="''" and xsl:variable select="''" are coerced to true() and false() respectively, when we test them. The first adds the empty string to the root of an RTF bound to a variable; the second binds the string itself. Cheers, Wendell
|
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








