[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: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Sep 2020 13:40:29 -0000
Re:  XSLT 2.0 courses?
On Mon, 21 Sep 2020 at 11:53, Michael Kay mike@xxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Well, I thought about using EBV, so it means (if ($a) then $a else $b),
> but zero is falsey, so you get surprises with, for example
>
> @price * (1 + (@VAT_Rate otherwise 0.2))
>
> which potentially gives the wrong answer if @VAT_Rate is present but zero.
> And it also gets complicated with atomization: if the attribute is present
> but set to a zero length string, which way do you go?
>
> Michael Kay
> Saxonica
>
>
Just to give a slightly dissenting voice....

The trouble with any such definition  especially given the "interesting"
details around EBV and emptiness, is that it ends up being like != which
looks like a useful syntactic shorthand but is actually a massive trap for
the unwary.

$a zzz $b

meaning more or less $a  unless it's empty (or has false Effective boolean
value or ...) else $b  will never be clear to anyone who hasn't read every
line of the spec, even if it _looks_ clear, and that isn't clearly an
advantage over

($a,$b[empty($a)])

or

or (if $a and $b have length at most one, like the VAT example)

($a,$b)[1]

or for the EBV version, as you said

(if($a) then $a else $b)

These may all look "less readable" to the man in the street not used to
reading xpath, but such people don't need to read this anyway. I'd say they
are all more readable to anyone used to xpath at all, especially the common
($a,$b)[1] idiom where that is applicable.

David







> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (by
> email <>)

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.