On 05/12/2010 23:08, Michael Kay wrote:

I am using 9.2.1.5 and patched it to use xquery functions in xpath.
Though it seems that 9.3 has not adopted the patch I sent you a few weeks ago.

Yes, that's correct - it arrived after the code freeze for 9.3. What you are trying to do here - extend the static context for XPath evaluation with XQuery functions - isn't an explicitly supported or tested facility. I need to develop some test cases and see whether this is a facility I want to support before I can incorporate the patch. Thanks for the reminder.

Michael Kay
Saxonica

I've taken a look at the patch. It's in two parts.

One part changes the code for UnboundFunctionLibrary.copy() so that it copies the "resolving" variable. This is a tricky area of the code, and it's not self-evident that the change is correct. I need to verify it with test cases.

The other part changes IndependentContext.copy(). This code has been redesigned in Saxon 9.3 so that copying an IndependentContext always constructs a DedicatedStaticContext. The difference is that we know a DedicatedStaticContext is only used by one expression and is created by the system, not by the user, so the XPath processor is free to change it during expression parsing. This fixes problems associated with serial reusability of the context object. From code inspection, I believe the new code is correct. If you have test cases that show otherwise, please let me know!

I haven't yet attempted to reproduce what you are doing, which is to make an XQuery function library accessible to free-standing XPath expressions. Doing that cleanly may, I suspect, be more difficult than you think.

Michael Kay
Saxonica