RE: bind select control values to XSD

FYI, there was also a project done by Joern Turner of Chiba a few years ago called schema2xforms.
It's looking for a new maintainer so if you are interested in this area more generally, you might look there.

Personally I've started looking at WADL and XForms, as you can tell from my postings here...

Leigh.

-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On Behalf Of Erik Bruchez
Sent: Wednesday, July 25, 2007 8:34 AM
To: www-forms
Subject: Re: bind select control values to XSD


Iņaki,

If your use case meets the following conditions:

* Labels and values are the same
* The enumeration is defined in the XML schema

then you can load the schema in a separate instance and bind your
itemset to the enumeration.

For example, say you have this in your schema:

   <xs:simpleType name="state">
     <xs:restriction base="xs:string">
       <xs:enumeration value="AL"/>
       <xs:enumeration value="AK"/>
       ...

In the model, do:

   <xforms:instance id="schema-instance" src="schema.xsd"/>

and in the view, within a selection control:

   <xforms:itemset 
nodeset="instance('schema-instance')/xs:simpleType[@name = 
'state']//xs:enumeration">
     <xforms:label ref="@value"/>
     <xforms:value ref="@value"/>
   </xforms:itemset>

We do this in our Government Forms example at:

   http://www.orbeon.com/ops/forms/

-Erik

Iņaki Salinas Bueno wrote:
 > Hi,
 >
 > I want to use the select control to choose between different
 > possibilities. These possibilities are defined in a XSD document. Do I
 > have to rewrite these values in a item list inside the select element or
 > there is a way to use the defined values automatically?
 >
 > I saw the itemset element, but the examples I have seen bound the select
 > control to a list of elements inside the same document, and what I would
 > like is to avoid rewriting what is defined in the loaded XSD document.
 > Is it possible?.
 >
 >
 >
 > Iņaki

-- 
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/

Received on Thursday, 26 July 2007 17:16:21 UTC