Chris Pollett > Students >
Madhuri

    ( Print View )

    [Bio]

    [CS297Proposal]

    [Del1]

    [Del2]

    [Del3and4]

    [CS297Report-PDF]

    [CS298Proposal]

    [Final Code]

    [CS298 Presentation-PDF]

    [CS298 Report-PDF]

                          

























XML Schema to describe the data associated with the forms

Description: Given below are XML Schema, XForm documents and an XSLT stylesheet to transform the xform document. The XSLT stylesheet(formstylesheet.xsl) described below can be used to transform any type of XForm document(form2.xml, form3.xml) that contain textfields, radio buttons and submit button. XML Schema (form.xsd) describes the data associated with the forms, any type of forms with the following layout.

<!-- form2.xml XForms document with stylesheet
and schema associated with it -->
<?xml-stylesheet type="text/xsl" href="formstylesheet.xsl"?>

<form1 xmlns:form2="form2"
xmlns:xform="http://www.w3.org/2002/01/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="form.xsd">

<layout>
	<inputbox>
		ul {
        background: green;
        margin: 16px 660px 16px 20px;
        padding: 0px 1px 1px 0px;}
		li {
        color: black;
        background: gray;
        margin: 12px 12px 12px 12px;
        padding: 12px 0px 12px 12px;
        list-style: none}
      	li.withborder {
        border-style: dashed;
        border-width: medium;
        border-color: black;}
	</inputbox>
	<fontsize>
		h1 {color: blue ; font-family: "Arial", serif;
		font-style:italic, oblique; font-size:15px; }
	</fontsize>
</layout>

<personinfo>
	<department/>
	<id/>
</personinfo>

<formdocument>
	<model>
		<instance>
			<title/>
			<FirstName/>
			<LastName/>
			<ID/>
			<Email/>
			<Term/>
			<gender/>
			<DateofBirth/>
			<Address/>
			<city/>
			<state/>
			<zip/>
			<Submit/>
		</instance>
	</model>
	<controlgroup>
		<title>COMPUTER LAB ACCOUNT REQUEST FORM</title>
		<input ref="FirstName">
			<caption>First Name</caption>
		</input>
		<input ref="LastName">
			<caption>Last Name</caption>
		</input>
		<input value="ID">
			<caption>ID</caption>
		</input>
		<input value="Email">
			<caption>Email</caption>
		</input>
		<input value="Term">
			<caption>Term</caption>
		</input>
		<selectOne value="gender">
			<caption>Sex</caption>
			<choices>
				<item value="male">
					<caption>Male</caption>
				</item>
				<item value="female">
					<caption>Female</caption>
				</item>
			</choices>
		</selectOne>
		<input value="DateofBirth">
			<caption>Date of Birth (mm-dd-yy)</caption>
		</input>
		<input value="Address">
			<caption>Address</caption>
		</input>
		<input value="city">
			<caption>City</caption>
		</input>
		<input value="state">
			<caption>State</caption>
		</input>
		<input ref="zip">
			<caption>Zip</caption>
		</input>
		<submit>
			<caption>Submit</caption>
		</submit>
	</controlgroup>
</formdocument>
</form1>

<!-- form.xsd xml schema that describes the data
associated with the XForm document,
here form2.xml and form3.xml -->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             targetNamespace="form"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:exschema=
	"http://www.w3.org/MarkUp/Forms/2002/XForms-Schema">

  <xsd:element name="form1" type="formType"/>
  <xsd:complexType name="formType" >
    <xsd:sequence minOccurs="0" maxOccurs="unbounded">

      <xsd:element name="layout" type="layoutType"/>
	  <xsd:element name="personinfo" type="personinfoType"/>
	  <xsd:element name="formdocument" type="formdocumentType"/>

    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="layoutType">
    <xsd:sequence>
      <xsd:element name="inputbox" type="xsd:string"/>
	  <xsd:element name="fontsize" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="personinfoType">
    <xsd:sequence>
      <xsd:element name="department" type="xsd:string"/>
      <xsd:element name="id" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="formdocumentType">
    <xsd:sequence>
	  <xsd:element name="model" type="modelType"/>
	  <xsd:element ref="controlgroup" type="controlgroupType"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="modelType">
    <xsd:sequence>
      <xsd:element ref="exschema:model" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="controlgroupType">
    <xsd:sequence>
      <xsd:element ref="exschema:Form.Controls" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>

<!-- formstylesheet.xsl an xslt stylesheet
that transforms the xforms document,
form2.xml and form3.xml -->

<?xml version="1.0"?><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<html>

<style type="text/css">
	<xsl:value-of select="form1/layout/inputbox"/>
</style>
<style type="text/css" MEDIA="screen, print">
	<xsl:value-of select="form1/layout/fontsize"/>
</style>

<body>

<xsl:for-each select="form1/formdocument/controlgroup">

	<h2>
		<xsl:value-of select="title"/>
	</h2>

	<xsl:for-each select="input">
		<h1><xsl:value-of select="."/></h1>
		<ul><p> <input type="text" size="10"
		/> </p></ul>

	</xsl:for-each>

	<xsl:for-each select="selectOne">
		<h1><xsl:value-of select="."/></h1>
		<xsl:for-each select="choices/item">
			<p> <input type="radio" />
			<xsl:value-of select="."/></p>
		</xsl:for-each>
	</xsl:for-each>

	<h1><xsl:value-of select="submit"/></h1>
	<input type="submit" />

</xsl:for-each>

</body>
</html>
</xsl:template>
</xsl:stylesheet>

<!-- form3.xml XForms document with stylesheet and schema
associated with it -->
<?xml-stylesheet type="text/xsl" href="formstylesheet.xsl"?>

<form1 xmlns:form3="form3"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="form.xsd">

<layout>
	<inputbox>
		ul {
    	background: black;
    	margin: 16px 660px 16px 20px;
    	padding: 0px 1px 1px 0px;}
    	li {
    	color: black;
    	background: gray;
    	margin: 12px 12px 12px 12px;
    	padding: 12px 0px 12px 12px;
    	list-style: none}
    	li.withborder {
    	border-style: dashed;
    	border-width: medium;
    	border-color: black;}
	</inputbox>
	<fontsize>
	h1 {color: red ; font-family: "Arial", serif;
	font-style:italic, oblique; font-size:15px; }
	</fontsize>
</layout>

<personinfo>
	<department/>
	<id/>
</personinfo>

<formdocument>
	<model>
		<instance>
			<title/>
			<FirstName/>
			<LastName/>
			<date/>
			<gender/>
			<CoursestobeTransfered/>
			<DatesTaken/>
			<CollegeTaken/>
			<DateofBirth/>
			<EducationLevel/>
			<Address/>
			<city/>
			<state/>
			<zip/>
			<Submit/>
		</instance>
	</model>
	<controlgroup>
		<title>COURSES TRANSFER FORM</title>
		<input ref="FirstName">
			<caption>First Name</caption>
		</input>
		<input ref="LastName">
			<caption>Last Name</caption>
		</input>
		<input ref="date">
			<caption>Date</caption>
		</input>
		<selectOne ref="gender">
			<caption>Sex</caption>
			<choices>
				<item value="male">
					<caption>Male</caption>
				</item>
				<item value="female">
					<caption>Female</caption>
				</item>
			</choices>
		</selectOne>
		<input ref="CoursestobeTransfered">
			<caption>Courses to be Transfered</caption>
		</input>
		<input ref="DatesTaken">
			<caption>Dates Taken</caption>
		</input>
		<input ref="CollegeTaken">
			<caption>College Taken</caption>
		</input>
		<input ref="DateofBirth">
			<caption>Date of Birth (mm-dd-yy)</caption>
		</input>
		<selectOne ref="EducationLevel">
			<caption>Education Level</caption>
			<choices>
				<item ref="Graduate">
					<caption>USA</caption>
				</item>
				<item ref="Undergraduate">
					<caption>Foreign</caption>
				</item>
			</choices>
		</selectOne>
		<input ref="Address">
			<caption>Address</caption>
		</input>
		<input ref="city">
			<caption>City</caption>
		</input>
		<input ref="state">
			<caption>State</caption>
		</input>
		<input ref="zip">
			<caption>Zip</caption>
		</input>
		<submit>
			<caption>Submit</caption>
		</submit>
	</controlgroup>
</formdocument>
</form1>