UBL in XForms, a worked example

About XForms

XForms is a W3C vocabulary that provides a mapping from a user interface to XML. It originated as an effort to update the aging forms component of HTML, but has found strong support in other areas as well, including document processing.

For further information:

About UBL

UBL, the Universal Business Language, has an ambitious goal: to develop a standard vocabulary for XML business documents everywhere. As you might imagine, even staple documents like purchase orders exhibit quite a bit of variability when considered on a global basis. Different currencies, address formats, and even ways of representing people's names all contribute to the challenge. UBL is being developed through an OASIS technical committee.

This example is based on the 0p70 draft release of UBL.

For further information:

About this example

The example files below are explained in detail in chapter 2 of "XForms Essentials", available online at this very web site. The example involves creating a UBL purchase order, and demonstrates calculations, repeating line items, using a temporary instance, saving XML locally, and several other features of XForms.

Get to the code already!




The main XForms document, delivered as text/html


The main XForms document, delivered as application/xhtml+xml


The template for a blank purchase order, used as initial instance data


A more complete example of the purchase order XML


The style sheet applied to the XForms documents above

Notes: the above links use the final namespace for the XForms Recommendation. If your engine doesn't support this, it doesn't support XForms! When you click the save button, your browser might produce a security warning or ask permission to write to your disk, currently the /tmp directory. You may wish to experiment with saving the document and running it locally.


Please send comments, corrections, or suggestions to mdubinko -at- yahoo d.o.t com. You may also find updates and commentary on my blog.

This document is http://dubinko.info/writing/xforms/ubl/