Re: [xsl] How to call an XSLT function whose name isn't known till run-time?

Subject: Re: [xsl] How to call an XSLT function whose name isn't known till run-time?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 6 Dec 2019 20:13:15 -0000
On Fri, 2019-12-06 at 17:21 +0000, Costello, Roger L.
costello@xxxxxxxxx wrote:
> . For example, if $function-to-invoke
> holds the string "move" then I  want my XSLT program to invoke the
> function with that name, i.e., invoke f:move(...). 

let $f := function-lookup(QName($fn, $name. 1))
return $f("hello")

where $fn is the Functions and Operators namespace,
http://www.w3.org/2005/xpath
and 1 is the number of arguments (arity) the function takes.

You do need to know the namespace URI.

Liam

-- 
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

Current Thread