[
Lists Home |
Date Index |
Thread Index
]
Hi Mark,
The good point about your post and the challenge is that it made me
re-discover XForm. IN fact I re-discovered why I need XForm instead of
simply the XML document, an XSLT stylesheet and a bit of prototype based
programming (ref: http://en.wikipedia.org/wiki/Prototype_based). In fact the
problem occurred when I tried to bind a particular element from the source
XML document to an XHTML element; I am not able with XSLT 1.0 to obtain the
XPath expression of a node. So it seems that I need to do it by hand and
define it somewhere. This is precisely the kind of functionality offered by
XForms :-)
By the way, I may be wrong but in the XForms example you provided could the
binding be as follows:
<xforms:model>
<xforms:submission id="submit"
xforms:replace="all"
xforms:action="http://mydomain.com/MyStorage"
xforms:method="PUT"/>
<xforms:instance id="theChallenge">
<demo xmlns="">
<version/>
<author>
<name/>
<email/>
</author>
<description/>
</demo>
</xforms:instance>
<xforms:bind id="version" nodeset="//version" constraint=". = '1.0'"/>
<xforms:bind id="name" nodeset="//author/name"/>
<xforms:bind id="email" nodeset="//author/email"/>
<xforms:bind id="description" nodeset="//description"/>
</xforms:model>
In which each XML element is referred by an XPath 1.0 expression and I need
to include a "bind" attribute to each XHTML element used to input data. For
instance, the XHTML element used to input the <version> element will include
the "bind" attribute as follow:
<input bind="version" type="text" name="version" size="20"/>
(no <label> element, this is an XHTML element)
In this last case, the "bind" is redundant with the "name" attribute and I
guess that the "bind" attribute can be omitted and replaced by the
functionally equivalent "name" attribute. Anyway, it could be useful to
trace back the binding "explicitely".
I can write this whole XForms definition differently as follow:
xforms:model>
<xforms:submission id="submit"
xforms:replace="all"
xforms:action="http://mydomain.com/MyStorage"
xforms:method="PUT"/>
<xforms:instance src=http://myDomain.com/theChallenge.xml" />
.....
.....
<input ref="//version" type="text" name="version" size="20"/>
Cheers
Didier PH Martin
http://didier-martin.com
|