W3C home > Mailing lists > Public > www-ql@w3.org > July to September 2002

context across function calls

From: Damien Fisher <damien@sodatech.com>
Date: Thu, 15 Aug 2002 00:48:25 +1000
To: www-ql@w3.org
Message-ID: <20020814144825.GF1680@DAMIEN>

I refer to a previous post by Per Bothner to www-xml-query-comments:

http://lists.w3.org/Archives/Public/www-xml-query-comments/2002Apr/0023.html

I'd love some clarification on this issue.

To summarize the question, consider the following code fragment (taken
from the above post):

define function is-mid() {
   return position() == last() / 2
}

document("foo.xml")/book/chapter[is-mid()]

When is-mid() is called, and it evaluates position() and last(), do
these return values with respect to the context in the main expression?
Or does the context "reset" when you enter a function call, so that the
above would (possibly) return an error?

A *quick* scan of the use cases found none which define functions that
access an "external" context.  However, the draft standard is very
ambiguous on this point.

This is quite an important issue (in terms of its possible effect on the
current formal semantics).  It would be wonderful to get some idea as to
the current intentions of the working group, even if the issue is not
yet finalized.

Thanks,
Damien Fisher
Received on Wednesday, 14 August 2002 10:49:44 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:17:15 UTC