The code injector mechanism in the Saxon expression parser is intended to allow injection of code that can be used for tracing and debugging, or perhaps for performance instrumentation. From your description it's not at all clear to me what you are trying to achieve or why you think this API might be an appropriate way of achieving it. Apart from anything else, you are calling inject() to modify the compiled XPath expression after the expression has already been executed, which will obviously have no effect.

I think you need to step back and explain more carefully what you are trying to achieve.

Michael Kay

On 09/08/2012 05:09, Paul Ryan wrote:
I have an XPathContext that points to a location in the model XML and InstructionInfo that tells about a trace listener instruction in the trace listener. I'm trying to construct a node in memory to put in the XML but am not having luck.

I've tried:

XSLTTraceCodeInjector injector = (XSLTTraceCodeInjector)this.getCodeInjector();
StructuredQName qname = new StructuredQName("trace", "http://anamespace/extension/trace", "trace");
        StaticContext staticContext = new JAXPXPathStaticContext(currentItem.getConfiguration());
        ContextItemExpression expression = new ContextItemExpression();

        catch (XPathException e)
            // TODO Auto-generated catch block
injector.inject(expression, staticContext, StandardNames.XS_ELEMENT, qname);

which just injects the document as a whole into the context point. I'm not having any luck understanding the expression syntax in this user story I've tried to construct other contexts without a result. Any help would be appreciated.


-- Paul Ryan

Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 

saxon-help mailing list archived at