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

RE: Challenge


xforms replace
Here are some random comments:

  -----Original Message-----
  From: Mark Seaborne [mailto:m_seaborne@m...] 
  Sent: Thursday, November 06, 2003 12:17 PM
  To: Didier PH Martin; xml-dev@l...
  Subject: Re:  Challenge


  On 6/11/03 18:43, "Didier PH Martin" <martind@n...> wrote:
  Hi Didier,

  <!-- snip -->

  > 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?

Actually, since XForms sets the XPath context node to be the document
element, you can jus tsay
       <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"/>

  <!-- snip -->

  > 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"/>

Since XML doesn't use prefixes on attributes that match the namespace of the
element,
replace="all" is the default, and the methods are required to be lowercase,
(at the request of the HTML WG since all their elements and attributes and
attribute value are lowercase),
it would be like this:
        <xforms:submission id="submit"
                            action="http://mydomain.com/MyStorage"
                            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.

Actually it would be
    <xforms:input
ref="version"><xforms:label>Version</xforms:label></xforms:input>

Note that the context node being "/data" means that you can just use the ref
to ne the immediate child name of the toplevel element,
so it looks a lot like what XHTML 1 does with <input name="version"/>.  In
fact, if you omit the <instance> from a model entirely,
XForms will notice that and make one up for you populated by elements with
names taken from the form controls bound to the model.
It's a good transition step from XHTML 1 to XHTML 2 or other XForms host
languages.


  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>
  > 


  -----------------------------------------------------------------
  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>

  • Follow-Ups:

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.