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 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT 2.0 courses?, David Carlisle d.p.c | Thread | Re: [xsl] XSLT 2.0 courses?, Wendell Piez wapiez@ |
Re: [xsl] XSLT 2.0 courses?, Liam R. E. Quin liam | Date | Re: [xsl] XSLT 2.0 courses?, Wendell Piez wapiez@ |
Month |