W3C home > Mailing lists > Public > www-forms@w3.org > July 2007

Re: bind select control values to XSD

From: Erik Bruchez <ebruchez@orbeon.com>
Date: Wed, 25 Jul 2007 17:33:40 +0200
Message-ID: <46A76D54.4090504@orbeon.com>
To: www-forms <www-forms@w3.org>


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:

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

We do this in our Government Forms example at:



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
Received on Wednesday, 25 July 2007 15:33:55 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:20 UTC