如何通过简单的查询将结果反馈回basex:
<new_catalog>{
let $db := db:open("books")
for $x in $db/catalog/book
return <new_book>{$x/title,$x/author}</new_book>
}</new_catalog>
结果:
thufir@dur:~/basex/microsoft$
thufir@dur:~/basex/microsoft$ basex new_catalog.xq
<new_catalog>
<new_book>
<title>XML Developer's Guide</title>
<author>Gambardella, Matthew</author>
</new_book>
<new_book>
<title>Midnight Rain</title>
<author>Ralls, Kim</author>
</new_book>
<new_book>
<title>Maeve Ascendant</title>
<author>Corets, Eva</author>
</new_book>
<new_book>
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
</new_book>
<new_book>
<title>The Sundered Grail</title>
<author>Corets, Eva</author>
</new_book>
<new_book>
<title>Lover Birds</title>
<author>Randall, Cynthia</author>
</new_book>
<new_book>
<title>Splish Splash</title>
<author>Thurman, Paula</author>
</new_book>
<new_book>
<title>Creepy Crawlies</title>
<author>Knorr, Stefan</author>
</new_book>
<new_book>
<title>Paradox Lost</title>
<author>Kress, Peter</author>
</new_book>
<new_book>
<title>Microsoft .NET: The Programming Bible</title>
<author>O'Brien, Tim</author>
</new_book>
<new_book>
<title>MSXML3: A Comprehensive Guide</title>
<author>O'Brien, Tim</author>
</new_book>
<new_book>
<title>Visual Studio 7: A Comprehensive Guide</title>
<author>Galos, Mike</author>
</new_book>
</new_catalog>thufir@dur:~/basex/microsoft$
thufir@dur:~/basex/microsoft$
来自: