Re: Reusable form controls

Ray,

We removed re-usable form controls from the XForms 1.0 draft because it is
not possible to specify an XML Schema content model for 'defComponent' that
assures that uses of the corresponding element 'component' will result in a
valid XForms document according to the XForms Schema.  

Using PCDATA as the content model for 'defComponent' would allow the
'defComponent' itself to validate, but it would not be possible for a client
to validate the resulting substituted document without performing a Schema
validation on the transformed document, in effect putting the burden of
Schema validation on the users of 'component'.

Given that our XForms Basic conformance level does not require full Schema
structure support in the client, we would have had to remove 'defComponent'
and 'component' from the Basic conformance level.  XSLT is an existing
standard for doing transformations such as variable substitutions. Since any
XForms user agent sufficiently advanced to perform Schema validation at
runtime also has the computing capacity to perform XSLT transformations, we
removed the feature from XForms 1.0 in favor of allowing authors to use
existing XML mechanisms.  Below is a seed idea from our working group about
how one might achieve reusable form controls in a user agent that supports
both XForms and XSLT.

Your comment about WML and VoiceXML supporting similar mechanisms is
interesting.  We'd be happy to study a last call comment from you on this
issue, perhaps spelling out these similarities in a chart, with some
exposition of requirements.  

Thank you,
Leigh.

Sample use of XSLT with XForms:

<xsl:template name="AddressWidget">
  <xsl:param name="streetPrompt"/>
  <xsl:param name="zipPrompt"/>
  <group ref="address">
    <input ref="street">
      <caption><xsl:value-of select="$streetPrompt"/></caption>
    </input>
    <input ref="zip">
      <caption><xsl:value-of select="$zipPrompt"/></caption>
    </input>
  </group>
</xsl:template>


and then

<component ref="path-to-instance-data">
  <xsl:call-template name="AddressWidget">
  <xsl:with-param name="streetPrompt" select="Shipping Street Address"/>
  <xsl:with-param name="zipPrompt" select="Zip Code for shipping state"/>
  </xsl:call-template>
</component>
----------------------------------------------------------------------------
From: Ray Cromwell [mailto:ray_cromwell@yahoo.com]
Sent: Thursday, January 03, 2002 2:22 PM
To: www-forms@w3.org
Subject: Reusable form controls
  
Now that they have been removed from the spec, is
there an alternative mechanism for achieving the same
thing? Why were they removed? They don't seem hard to
support, both WML and VoiceXML support similar
mechanisms in their forms, and they are downright
incredibly useful.

Received on Tuesday, 15 January 2002 15:07:57 UTC