See Also: Home Links Personal Site Blogroll  FriendFeed CV

Tags:

Formgen

This is a simple XSLT transform (source) to take an XML file (sample) marked up in a simple question/answer format and generate an HTML file (sample) containing form elements and their possible answers.

The questions are simple text phrases with one or more possible answers and can be grouped into sections. Each section is displayed as a separate page of questions with Java Script actions to flick forward and backwards through the sets.

The answers may be of a radio, checkbox, select, textarea or text type which are rendered into the associated html form. A DTD provided can be used in an XML editor to ensure the questionnaire XML is well-formed before transforming.

Unique values are generated for id's of each radio and checkbox type so that the label-for actions don't collide where two questions may share an answer. Clicking a "Next" or "Previous" button simply hides and shows divs that contain question sections so the values you enter on a section aren't lost as you navigate about.


See Also: Web Projects | Notes Index