can xquery be run practically from the CLI?

限于喜欢 提交于 2019-12-08 07:02:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!