xsl-list
[Top] [All Lists]

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

2021-02-04 02:24:54

On 04.02.2021 09:07, Christophe Marchand cmarchand(_at_)oxiane(_dot_)com 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(
    map {
        'stylesheet-node' : $xslt,
        'initial-function' : QName('http://www.functx.com',
'repeat-string'),
        'function-params' : ['x', 5]
    }
)?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.
--~----------------------------------------------------------------
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>