Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
让我们以我能想到的用 xquery 编写的最简单的函数为例:
declare function local:identityFunction($v as xs:integer) { return ($v) };
我在哪里申报?
我正在尝试exist-db和basex,但是如果我在查询处理器窗口中编写它,它们会给我一些错误(尽管正常的xqueries可以工作)。
例如 basex 抱怨以下消息:“期望表达式”。
您可以在正常表达式之前插入它们。
你的错误是使用'return',这既不需要也不允许,因为xquery函数总是返回最后一个(也是唯一的)值。
分号后面应该跟另一个表达式。
因此这将起作用:
declare function local:identityFunction($v as xs:integer) { $v }; local:identityFunction(17)