如何将map变量传递给外部函数(如eval)并在marklogic xquery中调用 [英] How to pass the map variable to the external function like eval and invoke in marklogic xquery

查看:62
本文介绍了如何将map变量传递给外部函数(如eval)并在marklogic xquery中调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

xdmp:eval($ s,(),"world"))

我想将map作为参数传递给外部函数,而不是上面代码中的默认值作为第二个参数.

Instead of default value as second parameter from the above code, i want to pass map as the parameter to the external function.

推荐答案

如果 $ s 具有在序言中声明变量$ v1 external; ,然后我认为您可以使用 xdmp:eval($ s,map:new(map:entry('{} v1',some-expression))),或者如注释中所指出的,甚至 xdmp:eval($ s,map:new(map:entry('v1',some-expression)))到将评估 some-expression 的结果作为变量 $ v1 的值传递,例如 xdmp:eval($ s,map:new(map:entry('v1','foo')))传递字符串值 foo .

If $s has e.g. declare variable $v1 external; in the prolog then I think you can use xdmp:eval($s, map:new(map:entry('{}v1', some-expression))), or, as pointed out in a comment, even xdmp:eval($s, map:new(map:entry('v1', some-expression))) to pass the result of evaluating some-expression as the value of the variable $v1 e.g. xdmp:eval($s, map:new(map:entry('v1', 'foo'))) passes in the string value foo.

这篇关于如何将map变量传递给外部函数(如eval)并在marklogic xquery中调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆