[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: not()'ing a false variable, xalan 2.4.D1

Subject: Re: not()'ing a false variable, xalan 2.4.D1
From: David N Bertoni/Cambridge/IBM <david_n_bertoni@xxxxxxxxxx>
Date: Thu, 7 Nov 2002 16:47:05 -0800
xalan 2.4 download



Hi Elizabeth,

Elizabeth Barham <lizzy@xxxxxxxxxxxxxxxxx> wrote:
> Hi,
>
>    I am trying to make a variable that is either true or false, and
> later doing an <xsl:if> operation with the condition being not'd, but
> for some reason xalan 2.4.D1 is saying that a not("variable assigned
> as false") is not true.
>
>    Is this a bug or am I doing something wrong?

You're doing something wrong.

>     <!-- make a false variable entitled 'false-variable' -->
>     <xsl:variable name="false-variable">
>       <xsl:value-of select="false()"/>
>     </xsl:variable>

This is not a "false" variable.  It's a result tree fragment with a text
node whose content is the string "false".

This is a "false" variable, if I understand what you are trying to do:

   <xsl:variable name="false-variable" select="false()"/>

A result tree fragment variable _always_ evalutes to boolean true(),
because it is considered to be a node-set with one node in it: the root of
the tree.  Thus, the XPath expression "boolean($rtf)" is always true and
"not($rtf)" is always false.

For more information, see:

   http://www.w3.org/TR/xslt#section-Result-Tree-Fragments

Hope that helps!

Dave


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.