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

Re: XSLT 2.0 courses?

Subject: Re: XSLT 2.0 courses?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Sep 2020 18:06:18 -0000
Re:  XSLT 2.0 courses?
On Mon, 2020-09-21 at 13:47 +0000, Chris Papademetrious
christopher.papademetrious@xxxxxxxxxxxx wrote:
> I suppose it depends on your background. I use other languages that
> chain equal-precedence operators in this fashion. Perl's logical OR
> operator comes to mind first - "$a or $b or $c", with short-
> circuiting evaluation.B 

Or, $a || $b || $c in Perl, which returns the first non-false value.

They do not have to be singletons, although the "effective boolean
value" of an array/sequence in Perl is its length, which often confuses
people. So you can put @a for a sequence; sequences do get flattened
but in this case you'd get the whole thing.

Perl also has an "unless" construct,
  statement unless (expr)

which is perhaps a little like Mike Kay's "otherwise".

I'd wanted something similar to short-circuiting-or when the XQuery WG
was mired in discussion about "scripting" and ";" committing a
transaction, an awful that design that was thankfully abandonded but
that cost us two years.

Overall, first-not-false($seq as item*) is clearer to me than chaining
otherwise, but i'd prolly write
   ( ($a otherwise $b) otherwise $c)
to avoid precedence mistakes, especially when it's really
   entry[@id = current()/@id] otherwise 1 + $notfound otherwise 0
(to use 0 if $notfound is empty).

-- 
Liam Quin,B https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org

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.