This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23631 - [xslt 3.0] function-lookup() and XSLT extensions to the dynamic context
Summary: [xslt 3.0] function-lookup() and XSLT extensions to the dynamic context
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Working drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-25 15:37 UTC by Michael Kay
Modified: 2014-05-15 14:00 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2013-10-25 15:37:06 UTC
When function-lookup() is used to get a context-dependent function such as position() or last(), it keeps the XPath dynamic context as part of the closure, so the value of position() will be its value at the point where function-lookup() was called.

To what extent should this also apply to the XSLT extensions to the XPath dynamic context (listed in 5.4.4). The values that are accessible to functions are:


The current group and current grouping key (current-group(), current-grouping-key())

The current captured substrings (regex-group())

In addition, we have the current() function.

Some of this is fairly heavyweight stuff (non-trivial cost to compute the value and to save it just on the off-chance that it might be needed). The current() function is particularly awkward because of its effect on the ability to inline or outline variables.

Functions that depend on the static context, such as type-available() are also problematic: given that different types are available in different packages, it may be significant work to retain information about the types that were available at the point where function-available() was called.

My instinct is to say that none of these functions are "recognized" by function-lookup; any attempt to lookup a function such as regex-group returns "not found".
Comment 1 Michael Kay 2013-11-28 22:54:56 UTC
I have added text that attempts to decide these questions. Generally the XSLT dynamic context components are cleared by a dynamic function call, so you are allowed to do function-lookup("regex-group",1), for example, and the result of calling the resulting function item is as if the context is empty. The same applies to dynamic calls on fn:current and fn:key. For system-property, function-available, element-available, and system-property I've added notes suggesting what they should do, but in the end it's a bit system-dependent.

In all cases, function items returned by XPath expressions such as current#0 and function-lookup() are NOT required to retain the XSLT parts of the static/dynamic context in their closure.