The s9api XQueryCompiler has always had a declareNamespace() method that allows you to predeclare namespaces to be in-scope within the query. But it has never had the equivalent of the method setExternalNamespaceResolver() available in the lower-level StaticQueryContext interface. As you correctly observe, 9.2 allowed the s9api user to drill down from the XQueryCompiler to the underlying StaticQueryContext; earlier releases did not.


Michael Kay

From: Steve Carton []
Sent: 01 February 2010 14:49
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: [saxon] StaticContext from XQuery via the s9API

I'm trying to write some java code that will automagically resolve the namespace bindings for some java extension functions. I''m doing that in a java program that processes XPath expressions by setting a nameSpaceContext on the static context. Is there some similar method within the XQuery interface? I'm using Saxon 9.1. I see in the 92 API docs that there is a similar getStaticContext accessor, but not in the 9.1?

xpathEvaluator.getStaticContext().setNamespaceContext(new MyNamespaceContext());