引用节点名直接输入例如:greeting 或者 greetings就可以
ex:>doc("greetings.xml")//greeting/@from
re:>from="weiqi" from="brian" from="luc"
ex:>doc("greetings.xml")//greeting[1]
re:><greeting from="weiqi>Nihao!</greeting>
说明:使用"节点名"[n]表示输出第几个节点内容
待查:
let $a := 3,4 --错误
let $b := ($a, $a)
let $c := 99
let $d := ()
return (count($a), count($b), count($c), count($d))
evaluates to (2, 4, 1, 0) because $b is the same as (3,4,3,4).
待查:
children(<p>This is <em>very</em> cool.</p>)
returns this sequence of 3 values:
"This is ", <em>very</em>, " cool."
================以下为未整理部分=============
[Modules]
You can put functions and variables declarations into library modules. A library module is a file that starts with a module namespace declaration and contains declarations of functions, variables, etc., but does not contain an expression at the end. A main module contains an expression at the end. Both library modules and main modules can import other library modules to access variables and functions declared in the imported module.
(: libfib.xq :)
module namespace jnb = "http://ociweb.com/jnb";
declare function jnb:fib($i as xs:integer) as xs:integer {