Lists Home |
Date Index |
So, I'm answering with an XForms hat on (though still personal opinion). I
realize there are broader issues in the over XPath-NG arena, but I'm just
focusing on the XForms-specific ones here.
Uche Ogbuji wrote:
>In the general case, we seem to have two candidates: accessor functions and
>special axes. Which one would you think works best with the XForms model
Well, the hard part about planning for the future is that you don't know how
it will turn out!
One thing that would be desirable is backward compatibility, or at least
graceful failure, when XForms-NG documents hit an XForms 1.0 processor.
XForms does have a function called property(), which is extremely limited in
XForms 1.0, but will likely be expanded upon in a later version.
There's also a function if(test,tval,fval) (yes, a function, because adding
a statement on top of XPath 1.0 wouldn't fly). Because of not having side
effects, there's no short-circuit evaluation for if().
So a form could have an expression like this:
if( property('relevant'), property('relevant'), value_for_false )
which would return the value of the property 'relevant' on the context node,
or value_for_false in XForms 1.0. Hmm, for better future compatibility,
maybe property() should accept an optional node to get properties against...
But something like this wouldn't work:
if ( a/b/c/property::relevant, ...
Because it would be a syntax error to XPath 1.0 and foul up form processing.
Anyway, I do think an axis-based solution might be a little cleaner. Would
you see any problems if XForms-NG mapped the axis traversal to the
>My question above is more, if backward compat wasn't an issue, which way
would you lean?
I decline to directly answer, because I think backwards compatibility will
be important enough to affect the decision. :-)
From: Uche Ogbuji [mailto:email@example.com]
Sent: Wednesday, October 09, 2002 2:50 PM
To: Micah Dubinko
Cc: Jeni Tennison; Eric van der Vlist; firstname.lastname@example.org
Subject: Re: [xml-dev] XForms Annotations (was Annotations in XPath-NG?)
> I've been meaning to post something like this to xml-dev for awhile, now.
> XForms is probably a good data point to look at for XPath annotations, if
> I'm not misunderstanding the discussion.
> XForms is fully an XPath spec; brethren to XSLT and XPointer. As for
> annotations, XForms defines "model item properties" , such as
> "relevant", "readonly", etc., which attach to the XPath 1.0 data model on
> per-node basis. Form controls, which also attach to a particular node,
> their behavior based on the model item properties (which so far can all be
> represented as strings) at that node.
> >From an implementation standpoint, it would be nice to have a way to
> these extra properties to nodes.
The idea itself is similar to what we've been discussing here. I don't
the binding mechanism defined in XForms is really suitable, since a general
XPath processor would not add anything to the source document, nor is there
really any place in the dat model for the bind elements themselves.
I also don't see in th XForms spec a mechanism for accessing bound
Perhaps this is what leads to your next para...
> >From a standardization standpoint, it would be nice if XPath 2.0 included
> way to access these properties. (We avoided defining accessor functions in
> XForms 1.0 because there are some non-trivial complications that can crop
> up, related to self-referential calculations, but that's firmly an XForms
> problem to solve)
In the general case, we seem to have two candidates: accessor functions and
special axes. Which one would you think works best with the XForms model
> We were mainly looking a function-based access, though I suspect that's
> because extension functions are easier to plug into an existing
> implementation (compared to, say, a new axis)
Yes. My question above is more, if backward compat wasn't an issue, which
would you lean?
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Apache 2.0 API -
Python&XML column: Tour of Python/XML -
Python/Web Services column: xmlrpclib -