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

Re: () eq () vs () = ()

Subject: Re: () eq () vs () = ()
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Fri, 30 Sep 2011 14:57:56 +0100
Re:  () eq () vs () = ()
>> 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

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.