Re: [xsl] XSLT 2.0 courses?

Subject: Re: [xsl] XSLT 2.0 courses?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Sep 2020 18:06:18 -0000
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
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: B

Current Thread