declare variable $ext_variable as xs:string external; for $div in collection(‘waldo’)//div[@xml:id=$ext_variable]
What is output on server STDOUT if you trace the variable?..
declare variable $ext_variable as xs:string external; for $div in collection(‘waldo’)//div[@xml:id=trace($ext_variable)]
I get nothing. And yet I’ve been able to return the variable itself from the module and check its type, and use it in a let assignment. So I can see that the module is receiving the value I send, it just isn’t matching for some reason.
Bryan Cholfin
Associate Editor for Digital Projects and Metadata Harvard University Press 617.496.9116 79 Garden Street | Cambridge, MA 02138-1400 www.hup.harvard.edu
From: Etanchaud Fabrice Fabrice.Etanchaud@horanet.com Date: Tuesday, November 17, 2015 at 4:08 AM To: "Cholfin, Bryan" bryan_cholfin@harvard.edu, "basex-talk@mailman.uni-konstanz.de" basex-talk@mailman.uni-konstanz.de Subject: RE: [basex-talk] sending variables to xquery module via client api (python)
Hi Bryan,
Could http://docs.basex.org/wiki/Options#BINDINGSgive you a solution ?
Best regards,
Fabrice
De : basex-talk-bounces@mailman.uni-konstanz.de [mailto:basex-talk-bounces@mailman.uni-konstanz.de] De la part de Cholfin, Bryan Envoyé : lundi 16 novembre 2015 23:08 À : basex-talk@mailman.uni-konstanz.de Objet : [basex-talk] sending variables to xquery module via client api (python)
Hi—
Hoping someone can help me with this. I’m trying to write a python script that calls an xquery module in the database. It seems to be pretty easy to use a line such as:
session.execute(“run gettext.xqm”)
and get back the response I want. What I want to do is pass a bound variable to the module. The client api has a provision to bind a variable to a query object, but I’m not making a query object. I’m simply executing the stored query. I don’t find anything in the documentation to suggest that a variable can be added to the run command this way.
Bryan Cholfin
Associate Editor for Digital Projects and Metadata Harvard University Press 617.496.9116 79 Garden Street | Cambridge, MA 02138-1400 www.hup.harvard.edu