Thursday, April 6, 2006

XML and XForms Can Really be More Productive

Country List

I just hit a really telling example of how XML and XForms can deliver incredible productivity. The requirement: creating a dropdown menu displaying the list of all the world's countries in French, using ISO names and codes. Here is how you do it with XForms:

  1. Download the XML file containing the list of countries from ISO (after finding it with Google). The file contains entries of the type:

  2. Import the file in your XForms page with:

    <xforms:instance id="countries-instance" src="iso_3166-1_list_fr.xml"/>
  3. Refer to the list of country from the select1 control:

    <xforms:select1 ref="country" appearance="minimal">
        <xforms:itemset nodeset="instance('countries-instance')/*">
            <xforms:label ref="ISO_3166-1_Country_name"/>
            <xforms:value ref="ISO_3166-1_Alpha-2_code"/>

And that's it! Can you actually imagine anything simpler, in any language?


  1. For those people that want to read that page in English, you can simply replace the 'fr' in the URL with 'en'.

    I'm assuming that other languages are possible.

  2. Anyone has any ideas on how to read this from DB? I have been trying to make a sql processor to read this but without success. Thanks.