
</html>
Generate an XSL file
As we mentioned, we need to have an XSL file to transform. To do this we need design the way that the XML data is going to be mapped to the HTML tags. For this example, we are going to do it,as shown in figure Figure
|
| <html> | |
Flight |
| <body> | |
| <h2> | ||
|
| ||
@flightNo |
| <CENTER></CENTER> | |
@departure |
| <CENTER></CENTER> | |
| </h2> | ||
|
| ||
Customer | XSLT | <hr></hr> | |
<table> | |||
| |||
name |
| <tr> | |
membership |
| <td valign="" width=""></td> | |
| <td valign="" width=""></td> | ||
|
| ||
|
| </tr> | |
|
| </table> | |
|
| </body> | |
|
| </html> | |
| XSL |
| |
| XML to XML |
| |
| mapping |
|
Figure 9-7 XML to HTML mapping
Steps to create the XSL file:
1.Switch to XML Perspective if necessary.
2.Start XML to XML Mapping wizard.
3.Select the folder where it is going to be located.
4.Enter a name for the mapping file passengerList.xmx, click Next.
5.Add source XML Schema file passengerList.xsd, click Next.
6.Select target html.xml, click Next.
7.Select root element, must be HTML. Click Finish.
Figure 9-8 shows the XML to XML mapping editor.
186 The XML Files: Development of XML/XSL Applications Using WebSphere Studio