This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]