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:
-
Download the XML file containing the list of countries from ISO (after finding it with Google). The file contains entries of the type:
<ISO_3166-1_Entry> <ISO_3166-1_Country_name>SUISSE</ISO_3166-1_Country_name> <ISO_3166-1_Alpha-2_code>CH</ISO_3166-1_Alpha-2_code> </ISO_3166-1_Entry>
-
Import the file in your XForms page with:
<xforms:instance id="countries-instance" src="iso_3166-1_list_fr.xml"/>
-
Refer to the list of country from the select1 control:
<xforms:select1 ref="country" appearance="minimal"> <xforms:label>Country</xforms:label> <xforms:itemset nodeset="instance('countries-instance')/*"> <xforms:label ref="ISO_3166-1_Country_name"/> <xforms:value ref="ISO_3166-1_Alpha-2_code"/> </xforms:itemset> </xforms:select1>
And that's it! Can you actually imagine anything simpler, in any language?
For those people that want to read that page in English, you can simply replace the 'fr' in the URL with 'en'.
ReplyDeletehttp://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html
I'm assuming that other languages are possible.
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.
ReplyDelete