我有note.xml
:
<?xml version="1.0"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
和note.xqy
:
let $srcDoc:="note.xml"
for $x in doc($srcDoc)/note
return (),
for $x in doc($srcDoc)/note
return ()
由于某些原因,我需要两个for
s 来处理note.xml
. 我不想把处理后的文件名写两次,所以我定义了一个变量。奇怪的是,变量没有在第二个中定义for
:
$ zorba -i -f -q note.xqy
note.xqy>:5,15: static error [err:XPST0008]: "srcDoc": undeclared variable