Re: Can I use a boolean variable in an xsl:if test
The answer to the question in the subject line is "yes" but there is a but.... <xsl:variable name="show"> <xsl:value-of select = "$time != 60000" /> </xsl:variable> as stated on this list most days, don't use xsl:variable with content and no select attribute unless that's what you really want. <xsl:variable name="show" select = "$time != 60000" /> would make show into a boolean valued variable, $show would have value true() or false() depending. <xsl:variable name="show"> <xsl:value-of select = "$time != 60000" /> </xsl:variable> makes show into a result tree fragment corresponding to a node set that has a root node with single child a text node with string value "truee" or "false" depending. So getting this is more to type and a _lot_ more data stored in the machine (nodes are expensive thins to construct compared to ataomic values). Often efficiency is the only difference but here the other difference is that if used in a boolean context a result tree fragment acts like the corresponding node set so is true just if teh node set is non empty which is always the case as all result tree fragments correspond to a node set with exactly one node (a root node). David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
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