Hi Fabrice,
due to the ambiguities that would be caused by executing all command scripts as XQuery, we decided to close Issue 929 [1]. However, some good news: if you experience a little with the existing features of BaseX, you will see that command scripts can easily be created via XQuery and executed on the fly. An example:
Command-line call:
basex -b max=3 create-bxs.xq.xq | basex -c -
File create-bxs.xq:
declare variable $max external; <commands>{ for $n in 1 to $max return <create-db name='db{ $n }'/> }</commands>
Hope this helps, Christian
[1] https://github.com/BaseXdb/basex/issues/929
On Wed, May 7, 2014 at 11:49 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Fabrice,
In order to allow for parameters, do you think one could declare external variables before the commands element ? Is it to say that a command file could be any xquery script generateding xml ?
Exactly; your command file will be evaluated the same as any other XQuery expression.
The main challenge will be to detect if the command script contains command strings or an XQuery expression. In some cases, there is no unique way to do that. For example, the following script...
"info"
is both a valid BaseX command and an XQuery expression. Currently, the input is evaluated as XML command script when the input starts with "<".
Cheers, Christian