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

Re: XPath 2.0

Subject: Re: XPath 2.0
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 8 Jan 2002 22:27:39 +0000
empty sequence xpath 2.0
David,

>> because a non-empty sequence would automatically be treated as the
>> boolean value true.
>
> somewhat regretably that has gone, as a consequence of the feature
> above that a boolean value of false() is equivalenet to a sequence
> of length one containing that value, and this is clearly non empty.

I *think* that the way XPath is designed, empty sequences still
convert to boolean false in the majority of cases. My reasoning is:

  - the contexts where they would convert to boolean false are those
    where the 'required type' is a non-optional xs:boolean, which is a
    simple type.

  - according to the "basic conversion rules", if the required type is
    a simple type and the given value does not conform to the required
    type (e.g. it's an empty sequence rather than a sequence with one
    value) then a type exception is raised.

  - XSLT is enables fallback conversions. According to the fallback
    conversions rules, if the required type is boolean and the given
    value is an empty sequence then you get boolean false.

So I think that the only things you have to worry about are node sets
(i.e. sequences) that contain a single value whose typed value is
false(), because unlike in XSLT 1.0, these will return true when
converted to a boolean.

And explicitly testing:

  $nodes = false()

which will test whether any node in $nodes has the xs:boolean value
false. But you never did that anyway.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.