RE: XForms CR - 7.10.1 Another XPath 1.0 Conformance Question

Also, I just had a chance to read Micah's responses on xml-dev [1] that I
believe you were referring to here:

> 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. 

And after reading both John and Micah's comments,  I have to disagree. I
felt that Micah and John were talking about exactly the same thing. An
XForms Processor maintains XForms instance data models of which there will
be one per <xf:instance/> element. 

Also, I personally don't like the term "copy" (as in "copy documents")
because if a URI is specified instead of an inline document, the term "copy
document" becomes misleading. It might be easier to imagine this as their
simply being separate instance documents for each <xf:instance> element and
each of them may be initialized with either data from the source document
(inline) or from an external location (uri). 

Another possibly misleading point might be the misconception that using
<xf:instance/> element is equivalent to XIncluding an external resource into
the source document. My interpretation is that this is not the case. The
instance element simply tells the processor where to get initial data for a
certain instance document, it does not modify the source document in any
way. The reason I bring this up is that I can see where this might lead to
the idea of "copies" of instance documents. i.e. The XForms Processor runs,
expanding external instance documents into the source document and then
makes "copies" of each instance document. I don't conceptualize it this way
at all. I view it as there being multiple instance documents that are
completely separate from the source document and they may be initialized
with XML specified inline or located externally.


- Ryan

[1] http://lists.xml.org/archives/xml-dev/200211/msg00598.html

-----Original Message-----
From: John Boyer [mailto:JBoyer@PureEdge.com] 
Sent: Monday, November 18, 2002 2:27 PM
To: Tomayko, Ryan; AndrewWatt2001@aol.com
Cc: www-forms-editor@w3.org; xforms@yahoogroups.com; www-forms@w3.org
Subject: RE: XForms CR - 7.10.1 Another XPath 1.0 Conformance Question


An excellent exposition, Ryan.

In essence, XPath functions supplied by the consuming application are free
to access out of band data.  For another example of a function that does
something like this, see the here() function in the XML Signature
recommendation.

John Boyer, Ph.D.
Senior Product Architect
PureEdge Solutions Inc.
 

-----Original Message-----
From: Tomayko, Ryan [mailto:Ryan_Tomayko@stercomm.com]
Sent: Monday, November 18, 2002 11:01 AM
To: AndrewWatt2001@aol.com
Cc: www-forms-editor@w3.org; xforms@yahoogroups.com; www-forms@w3.org
Subject: 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 15:08:45 UTC