Binding variables in scripts (bxs)
Hi Wendell,
http://docs.basex.org/wiki/XQuery_3.0#External_Variables says you need "external" between the variable name and ":=".
Regards,
Ben
Quoted text · Wendell Piez · 43 lines
On 11 June 2013 23:31, Wendell Piez <wapiez at wendellpiez.com> wrote: > Hi, > > I'm sure you will forgive me if this is as dumb as I'm afraid it might > be ... trying to cover all possibilities here. > > We recently upgraded (now on 7.7beta) and external scripts stopped > working as expected -- variable bindings of the form > > SET BINDINGS $db=my-db,$start=20001,$count=10000 > > no longer had any effect. Instead, the logic fell back to use values > declared for the variables in the XQuery, which had: > > declare variable $db := 'your-db'; > declare variable $start := 1; > declare variable $count := 1000; > > etc. > > When we removed the declarations from the XQuery, things started > working again. (Note that my assumption of a causal relation here > could be wrong.) > > Should I never have put those declarations in to begin with (even as > defaults, a la XSLT parameter declarations)? > > Is this a BaseX question or an XQuery question? I would like to become > enlightened. > > Thanks as ever, > Wendell > > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^ > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hi,
I'm sure you will forgive me if this is as dumb as I'm afraid it might be ... trying to cover all possibilities here.
We recently upgraded (now on 7.7beta) and external scripts stopped working as expected -- variable bindings of the form
SET BINDINGS $db=my-db,$start=20001,$count=10000no longer had any effect. Instead, the logic fell back to use values declared for the variables in the XQuery, which had:
declare variable $db := 'your-db';
declare variable $start := 1;
declare variable $count := 1000;etc.
When we removed the declarations from the XQuery, things started working again. (Note that my assumption of a causal relation here could be wrong.)
Should I never have put those declarations in to begin with (even as defaults, a la XSLT parameter declarations)?
Is this a BaseX question or an XQuery question? I would like to become enlightened.
Thanks as ever, Wendell
Hi Wendell,
could you provide me with a little example that demonstrates the behavior? I tried the following:
– example.bxs: <xquery>$a</xquery> – command-line: basex -c"set bindings $a=1" example.bxs
…and I got "1" as correct result. I assume your scenario differs a little?
Best, Christian ___________________________
2013/6/11 Wendell Piez <wapiez at wendellpiez.com>:
Quoted text · Wendell Piez · 42 lines
> Hi, > > I'm sure you will forgive me if this is as dumb as I'm afraid it might > be ... trying to cover all possibilities here. > > We recently upgraded (now on 7.7beta) and external scripts stopped > working as expected -- variable bindings of the form > > SET BINDINGS $db=my-db,$start=20001,$count=10000 > > no longer had any effect. Instead, the logic fell back to use values > declared for the variables in the XQuery, which had: > > declare variable $db := 'your-db'; > declare variable $start := 1; > declare variable $count := 1000; > > etc. > > When we removed the declarations from the XQuery, things started > working again. (Note that my assumption of a causal relation here > could be wrong.) > > Should I never have put those declarations in to begin with (even as > defaults, a la XSLT parameter declarations)? > > Is this a BaseX question or an XQuery question? I would like to become > enlightened. > > Thanks as ever, > Wendell > > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^ > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Written for BaseX 7.6. BaseX may have changed since: please check the current documentation.