On 6/11/03 18:43, "Didier PH Martin" <martind@n...> wrote: Hi Didier, > 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 :-) I think a lot of people have reached the same conclusions as yourself :-) > 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> Why use //description, etc rather than /demo/description? > 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". XHTML1 form elements don't work with XForms binding and XHTML2 form elements are XForms controls (or at least will be), so what you suggest, neat as it is, wouldn't actually work. > 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"/> More or less, yes. The XML instance you are populating can be referenced, which is clearly a good, if not essential thing, and you can use ref on form controls to "bind" directly to the instance using an XPath 1.0 expression. Indirection via a bind element is quite a nice feature though. All the best Mark > Cheers > Didier PH Martin > http://didier-martin.com > > > > > ----------------------------------------------------------------- > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an > initiative of OASIS <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://lists.xml.org/ob/adm.pl> >
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format