问题
How is this sample xquery
executed from the CLI?
xquery version "1.0";
let $message := 'Hello World!'
return
<results>
<message>{$message}</message>
</results>
Inspired from zx485's answer:
Check the separate libxslt page
XSL Transformations, is a language for transforming XML documents into other XML documents (or HTML/textual output).
A separate library called libxslt is available implementing XSLT-1.0 for libxml2. This module "libxslt" too can be found in the Gnome SVN base.
You can check the progresses on the libxslt Changelog.
Daniel Veillard
http://xmlsoft.org/XSLT.html
回答1:
You can do it with Saxon like in this extensive tutorial.
To summarize it, copy the XQuery code to a file (here named test.xq
) and then execute it with (the current version of) Saxon:
java -cp saxon9he.jar net.sf.saxon.Query test.xq
The output in your sample case would be
<results>
<message>Hello World!</message>
</results>
as desired.
来源:https://stackoverflow.com/questions/53991205/can-xquery-be-run-practically-from-the-cli