public List execQuery(Object node, Map variableBindings)
{
try {
Node context_node = (Node) node;
DynamicQueryContext dynamicContext =
new DynamicQueryContext(config);
dynamicContext.setContextNode(_stcContext.
buildDocument(new DOMSource(context_node)));
dynamicContext.setParameter(_contextVar,
dynamicContext.getContextItem());
// Set the other variables
if (variableBindings != null)
for (Iterator it = variableBindings.entrySet().iterator();
it.hasNext(); )
{
Map.Entry entry = (Map.Entry) it.next();
if (entry.getValue() instanceof XmlTokenSource)
{
Object paramObject;
// Saxon 8.6.1 requires that the Node be wrapped
// into a DOMSource, while later versions require that
// it not be
if (needsDomSourceWrapping)
paramObject = new DOMSource(((XmlTokenSource)
entry.getValue()).getDomNode());
else
paramObject = ((XmlTokenSource) entry.getValue()).
getDomNode();
dynamicContext.setParameter((String) entry.getKey(),
paramObject);
}
else if (entry.getValue() instanceof String)
dynamicContext.setParameter((String) entry.getKey(),
entry.getValue());
}
// After 8.3(?) Saxon nodes no longer implement Dom.
// The client needs saxon8-dom.jar, and the code needs