[Bug 9139] [XPath 2.1] Dynamic function calls and context

http://www.w3.org/Bugs/Public/show_bug.cgi?id=9139





--- Comment #14 from John Snelson <john.snelson@oracle.com>  2010-03-24 12:25:22 ---
I propose that we resolve this bug by adding the following paragraphs to
section 3.1.6 "Literal Function Items":

<new>
The static context for evaluation of the function item is inherited from the
location of the literal function item expression, with the exception of the
static type of the context item which is undefined.

Literal function items cannot access the focus (context item, context position,
and context size), which is undefined when they are invoked. It is an error to
create a function item for a function which accesses the focus [err:XPDY0002].

Note:

User-declared functions cannot access the focus, so this error only applies to
built-in functions like:

fn:position#0
fn:last#0
fn:name#0
fn:namespace-uri#0
fn:local-name#0
fn:number#0
fn:string#0
fn:string-length#0
fn:normalize-space#0
fn:root#0
fn:id#1
fn:idref#1
fn:lang#1
fn:base-uri#1
fn:resolve-uri#1
</new>

This leaves open the XSLT 2.1 question of current-group(), regex-group() etc.,
which I imagine should be similarly restricted. I lack the words to express
this adequately, since a blanket ban on all functions that access the dynamic
context disallows functions like current-time(), which should be perfectly
reasonable.

PS - Why does an undefined context item raise a dynamic error, rather than a
type error?


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 24 March 2010 12:25:26 UTC