[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Challenge


xforms instance src
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>
> 


  • References:

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.