[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

Subject: Re: Can I use a boolean variable in an xsl:if test
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 8 Feb 2005 15:47:50 GMT
xsl variable boolean
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" />

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" />

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).


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:

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.