- From: Norman Walsh <ndw@nwalsh.com>
- Date: Fri, 06 Jul 2007 07:38:10 -0400
- To: public-xml-processing-model-wg@w3.org
- Message-ID: <87tzsh2259.fsf@nwalsh.com>
/ Alessandro Vernet <avernet@orbeon.com> was heard to say: | On 7/5/07, Norman Walsh <ndw@nwalsh.com> wrote: |> It seems to me that requiring a context for an expression like "$foo" |> is even more problematic for users than requiring implementors to |> deal with not having a context in that case. | | I agree, but my point is that: | | 1) The XPath specification requires a context node for an expression | to be evaluated. And this even if the expression does not use the | context node. If you have no context node, you can't evaluate the | expression. I think you're taking a remarkably literal view of the XPath specification. I hate arguments that boil down to "lawyers" reviewing specs, so I'll grant that the XPath spec can be read the way you read it. However: 1. I don't think it's unreasonable to set the context node to "undefined" or "null" in an XPath 1.0 context. 2. The JAXP API explicitly allows this. 3. If you start an XSLT stylesheet with a named template, I believe th XPath context node is undefined. But maybe that's not true in XSLT 1.0, I'd have to check. 4. Certainly in XSLT 2.0, there are places (like XSLT functions) where the context node is explicitly undefined. | 2) Pragmatically, some implementations (e.g. Saxon) do require a | context node to evaluate an XPath expression. You could decide to pass | some type of "dummy" context node if you don't have a "real" context | node, but if the expression uses that node, you will have some | unexpected result, not an error. I don't think we want that to happen. Right. The implementor can't do that. Either the implementor has to set the context node to some value that he or she knows will cause the XPath evaluator to raise an error, or he or she has to check that the expression doesn't refer to the context. I'm with Henry on this one. Be seeing you, norm -- Norman Walsh <ndw@nwalsh.com> | To enjoy yourself and make others enjoy http://nwalsh.com/ | themselves, without harming yourself or | any other; that, to my mind, is the | whole of ethics.-- Chamfort
Received on Friday, 6 July 2007 11:38:22 UTC