[Top] [All Lists]

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

2019-10-03 16:17:04
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 haven’t 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.

Let’s 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 – 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);






Dynamic evaluation

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

Streaming (haven’t used it much though, same for accumulators, xsl:merge, xsl:fork)

try/catch (no one mentioned this so far)

Text value templates

Packages (I’ve actually used them), visibility, xsl:override etc.

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

fn:transform() (haven’t 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(_at_)gmail(_dot_)com wrote:

On Thu, Oct 3, 2019 at 12:59 PM Liam R. E. Quin liam(_at_)fromoldbooks(_dot_)org <mailto:liam(_at_)fromoldbooks(_dot_)org> <xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com <mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>> 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 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

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com

<Prev in Thread] Current Thread [Next in Thread>