eXist Xquery Examples
以下ex:>代表输入表达式 re:>表示输出结果
--插入[使用exist的xquery数据库检索工具]说明--
[基础操作]
1 条件表达式
ex:>if (3 < 4) then "yes!" else "no!"
re:>yes!
ex:>
for $x in (-1.5, 0.4, 1.7)
return <amount>
{
if ($x < 0)
then concat("(", -$x, ")")
else $x
} </amount>
re:>
<amount>(1.5)</amount>
<amount>0.4</amount>
<amount>1.7</amount>
说明:注意第一行的输出和其它两行有所不同
-$x对$x取反
2 定义本地变量