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

RE: xpath2 functions returning ()

Subject: RE: xpath2 functions returning ()
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 4 Jan 2002 17:08:34 -0000
xpath2 concat
> > Xpath 2 seems to want to treat () special in many contexts. Most of
> > which seem unfortunate:-)

Most of this came from a desire to do something akin to null values in SQL.
In fact, until quite a late stage before publication, XPath 2.0 had SQL-like
3-valued-logic, so that if @a was an absent attribute, @a = 3 and not(@a =
3) would both return "null" (represented as (), the empty sequence), which
would be treated in a predicate as false. 3-valued logic has gone from the
current draft, but there's still a general rule that operators and function
which get () as one of their arguments produce () as the result, unless
something else makes sense.

> > The example above is one, sum() returning
> > the empty sequence instead of 0 is another (that seems to be much
> > worse, and will mean that you will almost always have to special
> > case any value returned from sum() to check if it is empty and if so
> > replace it with 0)

This is flagged in the draft as an open issue (I personally regard it as a
bug, but not everyone agrees). It got in there because people wanted it to
behave the same way as in SQL: apparently in SQL the sum of an empty set is
null. Why SQL defines it that way is anyone's guess.

I think the general principle of using () for a non-value is OK, despite the
problem that it can't exist as an item within a sequence; we just need to
look in more detail at the cases where it causes compatibility problems.
Some of these have already been fixed, for example () is now treated as ""
when used as an argument to concat().

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.