Hello Olivier, in fact, binding global variables is supported only in local mode, not in the server REST API.
The idea is that since the query is sent by the client, the values of global variables can be specified in the query itself. On the other hand, the XQS (XQuery Services) mechanism allows passing parameters to queries stored on the server side. Now, I agree that it should be documented somewhere, and perhaps display an error message. On Fri, 09 Dec 2011 19:01:44 +0100, Olivier JEULIN <[email protected]> wrote: > Hello, > > I have a problem when I want to query an instance of qizx server from the > command line, with a parameter. > > My library "sandbox" contains this file : > > $ cat test.xml > <?xml version='1.0' encoding='UTF-8'?> > <test id="1234"> > this is a test > </test> > > When I run: > qizx -login xxx:yyy -group http://localhost:18080/qizx/api -library > sandbox -q > test.xq > > I get: > <?xml version='1.0' encoding='UTF-8'?> > <test id="1234"> > this is a test > </test> > > where: > $ cat test.xq > declare boundary-space preserve; > > (: request parameters :) > declare variable $p-id as xs:string external := "1234"; > > if ($p-id) > then > collection("/test")//test[@id = $p-id] > else > "variable $p-id undefined > " > > That's OK. > > Now, if I remove the default value for $p-id, and try to pass it as a > parameter: > qizx -login xxx:yyy -group http://localhost:18080/qizx/api -library > sandbox -q > test.xq -Dp-id='1234' > > I get: > variable $p-id undefined > > $ cat test.xq > declare boundary-space preserve; > > (: request parameters :) > declare variable $p-id as xs:string external := ""; > > if ($p-id) > then > collection("/test")//test[@id = $p-id] > else > "variable $p-id undefined > " > > If I remove the default value of $p-id, I have this error: > *** RESTException: Evaluation: XPDY0002 variable $p-id has no specified > value > at line 4 column 8 > > > If I stop the qizx server, and use the library path (-group > /.../.../...), the > command returns the XML. > > So, what's wrong when the group is a URL? > -- Xavier Franc Qizx design and development -- Qizx Support List [email protected] http://www.xmlmind.com/mailman/listinfo/qizx-support

