text-align: center;

}

]]>

</style>

</head>

<body>

<xsl:apply-templates select="Customer"/> </body>

</html>

</xsl:template>

The style for the body of this form is clear in stylesheet part present in Example 10-6. It shows that there is a heading for the body, followed by an html form. The data is structured in table inside the form. And finally the form has a submit button. According to the form's specification, pressing the submit button, redirects the user to the doPost method of the CustomerXSLSevlet.

Example 10-6 Part of registration form stylesheet focusing on form structure

<xsl:template match="Customer"> <h1>Customer Registration Form</h1>

<form action="/Registration/CustomerXSLServlet" method="post">

<table border="0" cellpadding="2" cellspacing="0"> <xsl:apply-templates select="membership"/> <xsl:apply-templates select="firstName"/> <xsl:apply-templates select="lastName"/> <xsl:apply-templates select="email"/>

</table>

<div align="center"> <hr/>

<input type="submit" name="submitBtn" value="Submit"/>

</div>

</form>

</xsl:template>

Each of the attribute values has got its own template for representation. Example 10-7 shows the template for the membership attribute. Each of the attributes has an identical template. So each attribute is included in a table row, consisting of two columns; one for the label, and the other for the input field.

Example 10-7 Stylesheet template for presenting the membership field

<xsl:template match="membership"> <tr>

<td>Membership: </td>

234 The XML Files: Development of XML/XSL Applications Using WebSphere Studio

Page 250
Image 250
IBM Version 5 manual Form action=/Registration/CustomerXSLServlet method=post