Re: [xsl] XSLT 4: map serialization

Subject: Re: [xsl] XSLT 4: map serialization
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 25 Nov 2020 10:07:09 -0000
I've recently proposed that we should have a library of XPath functions for
constructing nodes: see https://www.saxonica.com/~mike/builder.html This was
motivated by this kind of use case, and I'm now wondering whether such
functions should go into the core (though there's an interesting question
about how they should be named). It seems XForms has also extended the
function library with node-building functions.

> Allowing XQuery anonymous functions would be a large change, but at least in
the map serialization case[1] I have trouble thinking of a better option.
XQuery functions are at least already well-defined.

There are far too many things that can currently be done only using custom
syntax rather than using functions. That's true across XPath, XSLT, and
XQuery. Higher-order functions give us the opportunity to do many things such
as grouping without custom syntax. In fact there are plenty of things that
should have been functions in the first place: for example array{$x} is
ridiculous, it could easily have been array($x). Providing new functionality
by adding to the function library should definitely be the aim, because it's
easier to implement and more versatile for users.
>
> [1] I cannot tell you how much I want to be able to pass parameters to a
functioned returned from a map of function items and have that function return
elements for applying-a-style purposes, e.g.
>
> <xsl:sequence
select="$stylesMap($styleTypeName)($stylePropertiesMap($styleName))" />
>
Not sure what there is here that doesn't already work?

Michael Kay
Saxonica

Current Thread