Re: [xsl] What's the best feature in XSLT 3?

Subject: Re: [xsl] What's the best feature in XSLT 3?
From: "Imsieke, Gerrit, le-tex gerrit.imsieke@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 3 Oct 2019 21:16:58 -0000
My unpopular take is that maps are not my favorite feature within XSLT 3.0.

One reason is that I found it hard to process maps in an XSLT-idiomatic way. But I guess I havenbt done enough research yet because, as I found out just now, I can actually write template rules like this:

<xsl:template match=".[. instance of map(xs:anyAtomicType, item()*)]">

Constructing (nested, in particular) maps tends also to be more verbose than just constructing an XML structure. (Imagine, an XSLT guy complaining about verbosity!)

But I seem to be the guy whose natural instinct is to put every transient data structure into a document-node(element(*)), on which I can use the key() function, anyway. Call me old-fashioned.

Letbs rank what other people have liked so far and add some more.

XPath 3.1 language, functions and operators, including:

conversion from/to JSON;

syntactic shortcuts such as !, ||, and =>;

single-argument fn:tokenize() and fn:string-join()

trigonometric functions;

maps+arrays (yes, maps&arrays rank top, but only as part of the overall XPath 3.1 package);

higher-order functions (a pity they are not available in Saxon HE b we would use them frequently in our open-source XProc/XSLT offerings; we aren't using them in closed source projects either because they often rely on our open-source libraries);

fn:parse-xml();

fn:serialize();

fn:sort()

let;

etc.


Dynamic evaluation


XSLT and XQuery Serialization 3.1 support, including easy JSON and HTML5 document writing

Streaming (havenbt used it much though, same for accumulators, xsl:merge, xsl:fork)

try/catch (no one mentioned this so far)

Text value templates

Packages (Ibve actually used them), visibility, xsl:override etc.

xsl:context-item (a valuable debugging aid), no experience with xsl:assert so far though

fn:transform() (havenbt used it much though, being an XProc orchestrator most of the time; the only place I'd really like to use it is Saxon-JS, which doesn't support it)

mode declarations (using it, but it can get more verbose than declaring an identity template for many modes at once)

xsl:iterate (using it rarely)

xsl:where-populated, xsl:on-empty (not using it, but I have seen non-streaming people adopting it as syntactic sugar)



On 03.10.2019 21:31, David Rudel fwqhgads@xxxxxxxxx wrote:
Maps.


On Thu, Oct 3, 2019 at 12:59 PM Liam R. E. Quin liam@xxxxxxxxxxxxxxxx <mailto:liam@xxxxxxxxxxxxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx <mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>> wrote:


    While i was preparing for a course on XSLT 3 later this month, i
    wondered whether other people would have favourite features that were
    introduced in XSLT 3. I know i do.

What do you find most useful? Or like the best?

Liam


-- Liam Quin, 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: http://www.fromoldbooks.org

Current Thread