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

RE: Re: XPath 2.0: Problems with the two boolean const

Subject: RE: Re: XPath 2.0: Problems with the two boolean constants true and false
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 8 Oct 2003 21:40:39 +0100
xsl operands
> > Yes, this is a bug (or at any rate, it's a XSLT 2.0 feature that I 
> > haven't implemented yet but that isn't on my published list of 
> > features that I haven't implemented yet - there are 
> probably quite a 
> > few of these, and for the time being I am treating them as 
> bugs in the 
> > documentation rather than bugs in the code).
> >
> > What's actually happening is that no type checking or conversion of 
> > parameters is being done on the apply-templates call, but the code 
> > that references the parameters is assuming they are of the declared 
> > type. The net result is that the "A and B" is taking the effective 
> > boolean value of the value actually passed in the 
> parameters, and the 
> > effective boolean value of the string 'false' is true.
> 
> Actually, the parameters are converted to booleans but not 
> using the cast
>    xs:boolean($arg).
> 
> In reality the convertion is done using the EBV of the 
> supplied arguments.

The values aren't being converted at the point where the template is
called, they are being converted at the point where they are used as
operands to "and".
> 
> This makes 'false' into true

If she be false, O, then heaven mocks itself!
    Othello III 3

Yes. This is what the EBV rule does, and it is compatible with XPath
1.0. There are good reasons for retaining this rule. For example,
recursive templates that break text into words often test to see if the
supplied string is empty as their terminating condition, with a test
such as <xsl:if test="$param">. If "false" converted to false, then the
seven lines in Othello that end in the word "false" would be handled
incorrectly. 

> 
> So what is the benefit of typing? In this case it simply does 
> not work and I have to do it myself in code -- I am forced to 
> produce ugly code because the so advertised typing does not work.

There's a bug in the Saxon implementation, I don't see how that enables
you to draw conclusions about the usefulness of facilities in the
language?

Michael Kay


 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.