xsl-list
[Top] [All Lists]

Re: [xsl] () eq () vs () = ()

2011-09-30 08:58:06
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>