RE: XForms CR - 7.10.1 Another XPath 1.0 Conformance Question

Andrew,

I am in no way the authority on this but I can give you one companies
interpretation on how this should be implemented. 

There are possibly many separate documents, and/or xpath data models (I'm
using the two interchangeably) that an XForms Processor maintains. Each
<xf:instance/> element defines a separate xpath data model. i.e. When an
XForms Processor comes across an xf:instance, it creates a new xpath data
model and either a.) loads the xpath data model from the uri specified, or
b.) loads the xpath data model from XML specified inline. 

Each data model is held separately and traversal from one data model into
either the source document, or other instance xpath data models, is
impossible with the base set of XPath axes and function library. For
example, assume I have 3 instances (i1, i2, and i3). If I am evaluating the
XPath expression ".." in i1, I do not get the <xf:instance/> element back as
a result, I get an error because I'm reaching for a parent that doesn't
exist. If I evaluate the XPath expression "/" in i3, I get back the root of
i3, not the root of the source document. In other words, it is impossible to
go outside of an individual instance data model. It is also impossible to
access the source document unless it is explicitly loaded into an instance.
(e.g. <xf:instance src="./this.xfm"/>).

This is where the instance() function comes into play. It allows me to
traverse into the root of some other instance's xpath data model, which
would be absolutely impossible otherwise. So, the instance() is NOT the id()
function, which seems to be how you've interpreted it.. The instance()
function is not limited to resolution within the context xpath data model. 

How the instance() function locates the xpath data model is an
implementation detail. For example, we use a HashMap to map instance id's to
DOM Document objects. The Map may contain any number of instance id's to DOM
Document mappings. When the instance() xpath function is called, the
function simply looks up the document in the HashMap and returns it.

Hope this helps,

- Ryan

-----Original Message-----
From: AndrewWatt2001@aol.com [mailto:AndrewWatt2001@aol.com] 
Sent: Monday, November 18, 2002 8:25 AM
To: www-forms@w3.org; www-forms-editor@w3.org; xforms@yahoogroups.com
Subject: XForms CR - 7.10.1 Another XPath 1.0 Conformance Question



This question is, for a short time, posted only to the three XForms lists. I

have other concerns about 7.10.1 which I will post separately.

It seems to me that the XForms CR may be using the instance() function and 
its related location paths in a way inconsistent with XPath 1.0.

I make the point in the assumption that John Boyer's recent email gives an 
accurate description of the relationship between instance data and the 
containing document. I am assuming that there is a *copy* of part/all of the

content of an <xforms:instance> element in a separate XPath data model.

There are background uncertainties since Micah Dubinko's recent post on 
XML-Dev is by no means clearly expressing the same meaning as John Boyer's 
email. Nor has the XForms WG responded to my question regarding the precise 
meaning of "instance data" and its scope.

My concern relates to the following syntax in the CR:
ref="instance('orderform')/shipTo/firstName"

The instance() function seems to me to reference the id attribute containing

the value "orderform". As I understand the situation that id attribute only 
exists in the original/containing document or, more precisely, in the XPath 
data model which represents it. As far as I understand it a representation
of 
that <xforms:instance> and its id attribute do not exist in the *copy* XPath

data model. Therefore the instance() function in the first location step of 
the quoted location path is referencing a node in the XPath data model of
the 
original/containing document.

However, again if I am understanding correctly, the two following location 
steps  reference *the copy* XPath data model (not the XPath data model of
the 
original/containing document).

So we seem to have a single XPath 1.0 location path apparently operating on 
two separate XPath 1.0 data models.

To the best of my knowledge that is inconsistent with XPath 1.0.

Andrew Watt

Received on Monday, 18 November 2002 14:02:40 UTC