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

Re: XSLT repetition constructs

Subject: Re: XSLT repetition constructs
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Mar 2019 09:02:30 -0000
Re:  XSLT repetition constructs
> On 8 Mar 2019, at 08:44, Dave Pawson dave.pawson@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, 8 Mar 2019 at 08:40, Michael Kay mike@xxxxxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>> Because if $a is an empty sequence (which is the situation on the first
call), then $a[last()] is an empty sequence, and ($x + ()) returns an empty
sequence, not $x.
> I'm sure I'm not the only one thinking that sounds illogical Mike? (DC?)
> I'd appreciated the 'logic' behind that decision (maths?)

The design intent was that () should have similar behaviour to null in SQL; in
SQL (simplifying greatly), any operation that has null as an operand produces
null as a result. The idea is that if you do a query

//customer[location = 'UK']

then a customer whose location is absent (null) does not get selected; you
don't have to treat an absent location as some kind of exception condition.

Similarly //customer[abs(amount-outstanding) > 10000] selects nothing if
amount-outstanding is absent/null, because abs(()) is ().

There's one significant difference between the way SQL does it and the way
XPath does it; SQL has full three-valued logic in which not(null) is null,
whereas in XPath, not(()) is true.

It's all about making it convenient to handle datasets in which some of the
values are not always present.

There is of course a logic behind this, but it's not the classical two-valued
logic that they teach in elementary school.

Michael Kay

Current Thread


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.
First Name
Last Name
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.