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

Subject: Re: [xsl] [Xslt 3 Start] Use case for Function Call Invocation
From: "Christophe Marchand cmarchand@xxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Feb 2021 09:46:37 -0000
Ok, thanks for these explanations. I was stuck to XSL usage.

Christophe

Le 04/02/2021 C  09:52, Martin Honnen martin.honnen@xxxxxx a C)critB :
>
>
> On 04.02.2021 09:25, Martin Honnen martin.honnen@xxxxxx wrote:
>>
>>
>> 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.
>>
>
> So the general use case is being able to call public functions from 
> XSLT 3 modules or packages directly from environments like XPath 3.1, 
> XQuery 3.1 or XSLT 3, another shorter example would be to call the 
> csv:parse function in the package example of the XSLT 3 spec from pure 
> XPath 3.1
>
>
> transform(
> B B B  map {
> B B B B B B B  'stylesheet-location' : 
> 'https://github.com/w3c/xslt30-test/raw/master/tests/decl/package/package-100.xsl',
> B B B B B B B  'initial-function' : QName('http://example.com/csv', 'parse'),
> B B B B B B B  'function-params' : [data]
> B B B  }
> )?output
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2837134> 
> (by email <>)

Current Thread