Zorba (XQuery) - 使用打印功能

发布于 2024-07-28 22:46:15 字数 462 浏览 4 评论 0原文

我将 Eclipse 的 XQDT 与 Zorba 0.9.5 一起使用。 我试图从 FLWOR 表达式中调用 Zorba 内部函数 zorba:print(...),但它被忽略了。

具体来说,我正在做类似以下的事情,

import module namespace zorba =
      "http://www.zorba-xquery.com/zorba/internal-functions";

for $l in list 
  let $bar := <hello />
  let $foo := zorba:print($bar)
  return (<nothing/>)

我无法将 print 语句单独放置,因为 FLWOR 表达式中不允许使用顺序语句。

知道如何让 print 调用正常工作吗?

I'm using Eclipse's XQDT with Zorba 0.9.5. I'm trying to call the Zorba internal function zorba:print(...) from within a FLWOR expression, but it gets ignored.

Specifically, I'm doing something like the following

import module namespace zorba =
      "http://www.zorba-xquery.com/zorba/internal-functions";

for $l in list 
  let $bar := <hello />
  let $foo := zorba:print($bar)
  return (<nothing/>)

I can't put the print statement on its own because sequential statements aren't allowed in FLWOR exressions.

Any idea how I can get print calls to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

め可乐爱微笑 2024-08-04 22:46:15

这里的问题如下:

您使用 flwor 表达式来调用 zorba:print。 在 flwor 中,您有惰性求值,并且由于您不使用 $foo,因此 zorba:print 不会被执行。

因此,为了执行 zorba:print,您必须在 flwor 中使用 $foo。

在 zorba 的下一个版本中,将对新的 XQuery 脚本扩展 然后就很容易强制执行副作用函数。

The problem here is the following:

You use a flwor-expression to call zorba:print. In a flwor you have lazy evalution and since you don't use $foo, zorba:print gets not executed.

So in order to get zorba:print executed, you have to use $foo in your flwor.

In the next release of zorba will be much better support for the new XQuery Scripting Extension and then it will be easy to enforce the execution of side effect functions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文