我希望执行以下操作:
let $foo :=
if (5 = 5)
then
return <bye/>
else
return <hi/>
但不幸的是,上述方法不起作用。
let 语句的 if 语句我该怎么做。
我希望执行以下操作:
let $foo :=
if (5 = 5)
then
return <bye/>
else
return <hi/>
但不幸的是,上述方法不起作用。
let 语句的 if 语句我该怎么做。
你想做这样的事情:
let $foo :=
if (5 = 5) then
<bye/>
else
<hi/>
然后你可以返回结果
return
$foo
我建议您从http://files.basex.org/releases/latest/下载 basex 编辑器,以便测试任何 xquery。它速度很快,并且可以为您突出显示错误。
另请查看http://xqdoc.org/xquery-style.html以获取有关编写干净 xquery 代码的示例。