Re: [xsl] XPath 2.0

Subject: Re: [xsl] XPath 2.0
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 8 Jan 2002 22:27:39 +0000

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



Jeni Tennison

 XSL-List info and archive:

Current Thread