Re: XForms 1.2: XPath 2.0 Module update

Hi Nick,

I can't think of a reason to attach a MIP to atomic values, assuming I 
understand you correctly that these atomic items are orphaned objects and 
not part of an instance.  The point of MIP binding is to attach metadata 
to nodes so that other parts of the XForms ecosystem can gain a benefit 
from the metadata by virtue of binding to the same node. 

However, saying 'no' to attaching a MIP to context item produced by a bind 
nodeset attr (or whatever we call it, e.g. ref), is not the same as saying 
that the bind nodeset/ref cannot produce atomic item results.  One 
possible use of this is when the xforms bind is essentially acting like a 
model-level repeat, i.e. the bind has a nodeset/ref binding attribute but 
not a MIP attribute.  Such a bind could provide atomic value context items 
to a repeated set of inner binds, and those inner binds could consume the 
context items by using the context() function within an absolute xpath 
expression that starts with instance().

If the instance function has an ID, then all is good, but if it doesn't, 
then, this leads a bit to your second question.  I think the answer there 
is that the instance() function does not depend on the context, except for 
determining the model.  It just returns the root element of the default 
instance.  So, if a context item has no identified model, then we should 
just say to use the default model.  I would also say we should enhance 
instance() to say that if it is given the ID of a model element, then it 
should know to produce the default instance of that model.

John M. Boyer, Ph.D.
Distinguished Engineer, IBM Forms and Smarter Web Applications
IBM Canada Software Lab, Victoria

Blog RSS feed:

From:   Nick Van den Bleeken <>
To:     Public Forms <>
Date:   06/09/2011 08:38 AM
Subject:        XForms 1.2: XPath 2.0 Module update
Sent by:


I've been working on the XForms 1.2: XPath 2.0 Module[1] and have a couple 
additional questions:

1. XPath expression evaluation
XPath 2.0  can raise a dynamic error or a type error during the dynamic 
evaluation phase this will cause an xforms-compute-exception or xforms
-binding-exception, are we going to standardize the event context to 
access the XPath error information?

2. Context item related questions
In XPath 2.0 you have a context item. With item (see [Data Model]) either 
an atomic value (such as an integer, date, or string), or a node. Opposed 
to a context node in XPath 1.0.

An example could be of a context item that isn't a node is:

<xforms:repeat ref="(1 to 10)">
    <xforms:output value="."/>

In this example the context item to evaluate the value attribute of the 
output is an integer (1 to 10).

I updated the XPath 2.0 support Module to support the notion of context 
item. Most work was done in section ' Maintaining Position: the 

There are a couple implications worth mentioning:
* I don't think that we should support attaching MIPs to atomic values, is 
there even a use case to support atomic values in bind statements?
* An implementation now also needs access to more information then 
strictly the 'evaluation context' to implement the instance() if the 
context item isn't a node and no instance id is specified (but the same is 
true for our context() function). Please read section 3.10.1 The 
instance() Function (should we raise an error if the id is omitted and the 
context item isn't a node)
* id() What do we do when the node-set is ommitted and the context item 
isn't a node -> send xforms-compute-exception event (XPath 2.0 raises an 

I vaguely recall the addition of an other attribute then nodeset on repeat 
(I think we settled for ref) that supports a sequence of items, but I 
can't find it on our wiki. The next thing I should do is go through the 
spec and see where it makes sense to support sequences of items instead of 
node sets (I think it would make sense to allow it everywhere in the UI, 
where we now support nodeset, but we probably want to add the same 
attribute as on repeat for that (which allows a sequence of items). 

Kind regards,

Nick Van den Bleeken
R&D Manager

Phone: +32 3 821 01 70
Office fax: +32 3 821 01 71


Inventive Designers' Email Disclaimer:

Received on Thursday, 9 June 2011 18:08:35 UTC