On 30/08/2011 14:59, Norman Walsh wrote:
Hi Michael,

I've got an extension function from which I want to return a XdmNode.
The extension function mechanism isn't particularly s9api-friendly. This will change in 9.4. It's a hangover of the days when s9api was supported only inder JDK 1.5 but everything else ran under 1.4, so dependencies from the main Saxon code to s9api code weren't allowed.

I thought I could do that by getting a DocumentBuilder from the
Processor from the Configuration from the XPathContext.

Except that the processor is null. Meh.
You mean config.getProcessor() returns null? How did you create the Configuration/Processor?

So I thought maybe I could get it from the Processor from the
Configuration from the StaticContext.

I implemented

        public void supplyStaticContext(StaticContext context, int locationId,
                                        Expression[] arguments) throws XPathException

in my ExtensionFunctionCall (PrettyCall) but to my surprise here's
what I see:

1. A PrettyCall is instantiated.
2. Its supplyStaticContext() is called.
3. A new PrettyCall is instantiated
4. Its call() is called.

So even though I save the supplied static context, I can't actually
see it in the object that gets call()d.

Is that what you'd expect?
Has the copyLocalData() method been called in the meantime? Saxon may attempt to copy the PrettyCall object, in which case you must implement this method to ensure that any data retained from the static context is retained in the copy.

Michael Kay

How can I get a DocumentBuilder in my extension function?

                                        Be seeing you,

Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!

saxon-help mailing list archived at http://saxon.markmail.org/