xsl-list
[Top] [All Lists]

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

2019-12-06 14:13:19
On Fri, 2019-12-06 at 17:21 +0000, Costello, Roger L.
costello(_at_)mitre(_dot_)org 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
--~----------------------------------------------------------------
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>