XiX: Details about XForms in XQuery
I was asked offline for more details about what I have in mind around XiX.
Take a simple piece of XML, like this:
An XForms Model can be applied, in an out-of-line fashion, to that instance. This is done through a
bind element, with XPath to identify the nodes in question, plus other “model item properties” to annotate the instance. The
calculate property is a good one:
<bind nodeset="total" calculate="../a + ../b"/>. When called upon to refresh the instance, as you would expect, the result contains the node
Like lots of algorithms, though, XForms is defined in a thoroughly procedural manner. Functional programming has a stricture against assignment operators, like setting the value “7” into the calculated node above. So the challenge is coming up with an implementation that works within these bounds. For example, perhaps a function that takes an original instance as input, and returns a newly-created updated instance. Simple enough for the example here, but in more complex cases with different and interacting model item properties, regenerating the entire instance frequently has performance penalties.
So, I’m trying to find the right expression of the XForms Model in a functional guise. (As with RDFa). I’m curious about what anyone else has come up with in this area. -m