<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23631</bug_id>
          
          <creation_ts>2013-10-25 15:37:06 +0000</creation_ts>
          <short_desc>[xslt 3.0] function-lookup() and XSLT extensions to the dynamic context</short_desc>
          <delta_ts>2014-05-15 14:00:46 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XSLT 3.0</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>95351</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-10-25 15:37:06 +0000</bug_when>
    <thetext>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 &quot;recognized&quot; by function-lookup; any attempt to lookup a function such as regex-group returns &quot;not found&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96923</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2013-11-28 22:54:56 +0000</bug_when>
    <thetext>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(&quot;regex-group&quot;,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&apos;ve added notes suggesting what they should do, but in the end it&apos;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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>