On 18/12/2012 13:19, Michael Sokolov wrote:
> Ah, hm thanks. So my function call could be copied during optimization,
> and I need to provide a hook to bring the data along. If I grab the
> NamespaceResolver from the static context, I believe that's immutable
> (has a copy of the static context's in-scope namespaces) and wouldn't
> need to be deep-copied - is that right?
There's no guarantee that the NamespaceResolver you get from the static
context is immutable; my recommendation would be for your
supplyStaticContext() method to make an immutable copy by doing
new SavedNamespaceContext(nsResolver)
As well as protecting against mutability, this also gives you a
representation that doesn't lock the stylesheet tree into memory.
Michael Kay
Saxonica
>
> -Mike Sokolov
>
> On 12/18/2012 3:50 AM, Michael Kay wrote:
>> One other point you need to remember (which I often forget) is that
>> you need to implement copyLocalData() if your ExtensionFunctionCall
>> maintains local data.
>>
>> Michael Kay
>> Saxonica
>>
>> On 17/12/2012 22:21, Michael Sokolov wrote:
>>> Ah, marvelous, that's just what I was looking for.
>>>
>>> -Mike Sokolov
>>>
>>> On 12/17/2012 10:32 AM, Michael Kay wrote:
>>>> Yes, this is possible. If you use the integrated extension function
>>>> mechanism. Create the function as an instance of
>>>> ExtensionFunctionDefinition:
>>>>
>>>> http://www.saxonica.com/documentation/javadoc/index.html?net/sf/saxon/lib/ExtensionFunctionDefinition.html
>>>>
>>>>
>>>> with a corresponding implementation of ExtensionFunctionCall. Saxon,
>>>> during compilation, calls
>>>> ExtensionFunctionCall.supplyStaticContext() to
>>>> supply the static context information.
>>>>
>>>> The ExtensionFunctionDefinition needs to be registered with the
>>>> Configuration, either using the API
>>>> (Configuration.registerExtensionFunction) or using a configuration
>>>> file.
>>>>
>>>> Michael Kay
>>>> Saxonica
>>>>
>>>>
>>>>
>>>> On 16/12/2012 20:49, Michael Sokolov wrote:
>>>>> Is it possible to write a user-defined function registered w/Saxon
>>>>> (say
>>>>> an extension function written in Java) that has access to the static
>>>>> context in which it was called? I'd like to be able to process
>>>>> namespace
>>>>> prefixes in content passed in as an argument. For example, if I had
>>>>> in-scope-prefixes() and namespace-uri-for-prefix(xs:string) defined in
>>>>> such a way that they accessed namespace bindings in scope in the
>>>>> function call's static context, that would imply the existence of some
>>>>> such feature. Of course that doesn't actually exist, so I suspect the
>>>>> answer to this question is: no.
>>>>>
>>>>> For example:
>>>>>
>>>>> declare namespace foo="http://foo";
>>>>> namespace-uri-for-prefix("foo")
>>>>>
>>>>> would return "http://foo"
>>>>>
>>>>> -Mike
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>
>>>>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>>>>> Remotely access PCs and mobile devices and provide instant support
>>>>> Improve your efficiency, and focus on delivering more value-add
>>>>> services
>>>>> Discover what IT Professionals Know. Rescue delivers
>>>>> http://p.sf.net/sfu/logmein_12329d2d
>>>>> _______________________________________________
>>>>> saxon-help mailing list archived at http://saxon.markmail.org/
>>>>> saxon-help@...
>>>>> https://lists.sourceforge.net/lists/listinfo/saxon-help
>>>>>
>>>> ------------------------------------------------------------------------------
>>>>
>>>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>>>> Remotely access PCs and mobile devices and provide instant support
>>>> Improve your efficiency, and focus on delivering more value-add
>>>> services
>>>> Discover what IT Professionals Know. Rescue delivers
>>>> http://p.sf.net/sfu/logmein_12329d2d
>>>> _______________________________________________
>>>> saxon-help mailing list archived at http://saxon.markmail.org/
>>>> saxon-help@...
>>>> https://lists.sourceforge.net/lists/listinfo/saxon-help
>>>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> saxon-help@...
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
|