This appears to be a reflexive extension function, and these have no access to information about the static context. For that you will have to use a integrated extension function.

I'm afraid this is one of the more challenging extension functions to write. Are you sure it isn't easier to write a stylesheet function that invokes the XSLT 3.0 xsl:evaluate instruction?

Michael Kay

On 7 Feb 2014, at 16:38, sky Chen <> wrote:

Hi, I want to evaluate XPath string supplied through element attribute in extension instruction(Java). How can I pass current context(e.g. static|dynamic context, namespace) to XPathEvaluator? I'm new to Saxon and XSLT, probably this is just a silly question. Currently my code looks like:
private static doSelect(
XPathContext context,
String selectStr)
String nodeText = "";
XPathEvaluator evaluator = new XPathEvaluator();
nodeText = evaluator.evaluate(selectStr, context.getContextItem);
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
saxon-help mailing list archived at