Yes, you can use any of the bindXXX methods in the XQDynamicContext interface, which is implemented by XQExpression and XQPreparedExpression. For example
 
XQPreparedExpression exp = ...
 
exp.bindString(new QName("user"), "myusername", null);
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Peter
Sent: 11 December 2007 12:00
To: saxon-help@lists.sourceforge.net
Subject: [saxon] XQuery XQJ and Java objects as external variables

Hello,

 

I am trying to use XQJ to pass in a Java object as an external variable

 

E.g. this could be the query

 

declare namespace u="java:package.User";

declare variable $user external;

u:getName($user)

 

I have a way of doing this using Saxon’s “proprietary” API, but can this be done using XQJ?

 

Any guidance warmly welcomed,

 

Peter