value = XMLSystemFunctions.convertToAtomicValue(value);
}
dynamicContext.setParameter(entry.getKey(), value);
}
} catch (TransformerException e) {
throw new TeiidProcessingException(e);
}
if (context != null) {
Source source = XMLSystemFunctions.convertToSource(context);
result.sources.add(source);
if (contextRoot != null) {
//create our own filter as this logic is not provided in the free saxon
ProxyReceiver filter = new PathMapFilter(contextRoot);
AugmentedSource sourceInput = AugmentedSource.makeAugmentedSource(source);
sourceInput.addFilter(filter);
source = sourceInput;
}
DocumentInfo doc;
try {
doc = config.buildDocument(source);
} catch (XPathException e) {
throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_context")); //$NON-NLS-1$
}
dynamicContext.setContextItem(doc);
}
try {
result.iter = xQuery.iterator(dynamicContext);
return result;
} catch (TransformerException e) {
throw new TeiidProcessingException(e, QueryPlugin.Util.getString("SaxonXQueryExpression.bad_xquery")); //$NON-NLS-1$
}
} finally {
if (result.iter == null) {
result.close();
}