[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: "Pieter Lamers pieter.lamers@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Sep 2020 01:33:55 -0000
Re:  XSLT 2.0 courses?
Hi,

An avid user of ($a, $b)[1] myself, which winks at TransactSQL 
ISNULL($a, $b) and MySQL IFNULL($a, $b), I do have to remind myself that 
$a has to be a single item for the /if/else /shortcut to work.

So, in

let $a := ('one','two','three')
let $b := ('none')

return ($a, $b)[1] will return just the first item in the sequence, 
'one', and not 'one','two','three', which might be what you want to 
achieve in this quasi shorthanded /if/else /construction.

Not that you wouldn't know, Liam, just as a heads up to some others in 
this audience who might not.

Best,
Pieter

On 19/09/2020 01:54, Liam R. E. Quin liam@xxxxxxxxxxxxxxxx wrote:
> On Fri, 2020-09-18 at 19:31 +0000, Wendell Piez wapiez@xxxxxxxxxxxxxxx
> wrote:
>> Hi,
>>
>> In addition to Liam's list I think there are a couple more vital
>> features
>> one needs to get a taste of in XSLT 2.0 or XSLT 3.0, if one has been
>> subsisting on an XSLT 1.0 diet:
>>
>> * <xsl:for-each-group> and its uses
>> * temporary trees -
>> * regex support in functions and xsl:analyze-string
>> * tunnel parameters?
> Yeah, those are all huge, although i think easier to learn than things
> like ($a, 'none')[1], which are startling because XSLT 1 didn't have
> sequences.
>
> For those wondering, ($a, $b, $c, ...)[1] returns the first non-empty
> non-false item out of $a, $b and $c, so it's a shortcut for
>      <xsl:sequence select="if ($a) then $a else $b" />
>
>
> On regular expressions - it's huge, but it's also dangerous, as e.g.
> replace(price div 100, '\.\d*$', '') is not a good way to write
> math:floor().
>
> An XSLT-3-from-scratch course could easily take a full week and be
> woefully incomplete. Or totally overwhelming. Or both.
>
> On the other hand, i try & include "don't be afraid of the specs" in
> the courses i teach, and then not cover every detail. So maybe it's
> possible.
>
> Liam
>
-- 
Pieter Lamers
John Benjamins Publishing Company
Postal Address: P.O. Box 36224, 1020 ME AMSTERDAM, The Netherlands
Visiting Address: Klaprozenweg 75G, 1033 NN AMSTERDAM, The Netherlands
Warehouse: Kelvinstraat 11-13, 1446 TK PURMEREND, The Netherlands
tel: +31 20 630 4747
web: www.benjamins.com

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.