Re: [xsl] [Xslt 3 Start] Use case for Function Call Invocation

Subject: Re: [xsl] [Xslt 3 Start] Use case for Function Call Invocation
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Feb 2021 08:24:48 -0000
On 04.02.2021 09:07, Christophe Marchand cmarchand@xxxxxxxxxx wrote:
>
> Hello !
>
> Reading the recommandation, I was not able to imagine a use-case for
> Function Call Invocation
> <https://www.w3.org/TR/xslt-30/#invoking-initial-function>[1].
>
> Recommandation only speeks of raw result, and 2.3.5 section does not
> mention a "starting environment".
>
> Saxon implementation does not provide a command-line way to start a
> XSL with a function call invocation ; there is only an API method to
> do so. And in this case, a XDM value is return.
>
> Could W3C Xslt group members explain the motivation of such a starting
> way ?
>
> Does someone has a real use-case of this invocation ?
>
> Best regards,
> Christophe
>
> [1] : https://www.w3.org/TR/xslt-30/#invoking-initial-function
>

If you have a module/a function library you can use a function of it
with e.g.

let $xslt := <xsl:package
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="3.0">
<xsl:import href="http://www.xsltfunctions.com/xsl/functx-1.0.1-nodoc.xsl"/>
<xsl:expose component="function" names="*" visibility="public"/>
</xsl:package>
return
transform(
 B B B  map {
 B B B B B B B  'stylesheet-node' : $xslt,
 B B B B B B B  'initial-function' : QName('http://www.functx.com',
'repeat-string'),
 B B B B B B B  'function-params' : ['x', 5]
 B B B  }
)?output


The XQuery part to first construct an XSLT 3 package importing the XSLT
2 functx library is only necessary as the XSLT 2 functions are otherwise
not public. If you had an XSLT 3 version of functx with public functions
you would just use the module with e.g. the transform function.

Current Thread