Transforming XML to HTML form



Is it possible to create form in HTML from XML documents?


For e.g. I have the following XML:



<record>
<IsEnrolled>Y</IsEnrolled>
<IsGraduating>N</IsGraduating>
<StudentLevel>Junior</StudentLevel>
<StudentType>InState</StudentType>
<HasScholarship>N</HasScholarship>
<Action>CodeA</Action>
</record>
<record>
<IsEnrolled>Y</IsEnrolled>
<IsGraduating>N</IsGraduating>
<StudentLevel>Sophomore</StudentLevel>
<StudentType>InState</StudentType>
<HasScholarship>Y</HasScholarship>
<Action>CodeB</Action>
</record>
<record>
<IsEnrolled>Y</IsEnrolled>
<IsGraduating>N</IsGraduating>
<StudentLevel>Freshmen</StudentLevel>
<StudentType>OutOfState</StudentType>
<HasScholarship>Y</HasScholarship>
<Action>CodeC</Action>
</record>
<record>
<IsEnrolled>Y</IsEnrolled>
<IsGraduating>Y</IsGraduating>
<StudentLevel>Senior</StudentLevel>
<StudentType>International</StudentType>
<HasScholarship>Y</HasScholarship>
<Action>CodeD</Action>
</record>


And I want to create an HTML form from the above XML:



<body>
<table>
<tr>
<td>IsEnrolled</td>
<td>
<select>
<option>Yes</option>
<option>No</option>
</select>
</td>
</tr>
<tr>
<td>IsGraduating</td>
<td>
<select>
<option>Yes</option>
<option>No</option>
</select>
</td>
</tr>
<tr>
<td>StudentLevel</td>
<td>
<select>
<option>Freshmen</option>
<option>Sophomore</option>
<option>Junior</option>
<option>Senior</option>
</select>
</td>
</tr>
<tr>
<td>StudentType</td>
<td>
<select>
<option>InState</option>
<option>OutOfState</option>
<option>International</option>
</select>
</td>
</tr>
<tr>
<td>HasScholarship</td>
<td>
<select>
<option>Yes</option>
<option>No</option>
</select>
</td>
</tr>
</table>
<span id="Action">Display the Action here based on the selected answers above</span>
</body>


The Action element in XML is the output to the questions. I want to display this output in the element based on what is selected in the HTML form.


Is this possible? If so how should I approach this?


No comments:

Post a Comment