>> So, now that () and () are the same, why does () eq () not return true?
>
> Because eq is in the set of "value comparisons" and there are no values to
> operate on, thus, no items in either sequence are equal. Functions 3.5.1
> says "Value comparisons are used for comparing single values".
Ok, that makes sense. Like =, there is no value in either sequence to
compare, so you cant return true.
> Note that you ask "why not true()?", but the return from eq with an empty
> sequence operand isn't false(). Rather it is () as if to say "there are no
> comparisons returned from this expression".
So for me that would be more helpful/consistent if it returned false.
Do you know of a use-case where returning () is needed?
> Converting that to Boolean is
> false(), but the return itself isn't false().
Only using boolean(), using xs:boolean() is an error.
> With either operand as
> the empty set you are getting a value comparison response of "no response"
> with (). An empty response.
Yeah, again, I can't see why anyone would want that instead of false.
> I think David said it the best and wish I'd thought of saying it that way
> myself!
This is all good stuff... I'm actually in the middle of writing
something xslt related and this will feature in the gotchas section.
I promise to give credits (at the back, in a very small font). Time
for a pint in the sun.
--
Andrew Welch
http://andrewjwelch.com
| Current Thread |
|
Michael Kay - 30 Sep 2011 12:30:53 -0000
|
|