IBM Version 5 Universal Remote User Manual


 
188 The XML Files: Development of XML/XSL Applications Using WebSphere Studio
Create an XSL from scratch
Creating an XSL from scratch is also useful. The XSL Editor provides a number
of wizards to help you create the content in your stylesheet. This section is
describing how you can create an XSL stylesheet from scratch to format the xml
data into an HTML table.
To create an HTML document, we will add a template to generate HTML header
information as well as to define the output method for the document:
1. Position the cursor to an empty line after the <xsl:stylesheet> element in
the html.xsl file.
2. In the menu bar, select XSL->HTML Template. This will create an
<xsl:output> element that will output the result in HTML, and a template that
will emit an HTML header with an <xsl:apply-templates> rule to will process
all the immediate children in the passengerList.xml file.
Next, we will create a template that will produce an HTML table:
1. Position the cursor to an empty line after the </xsl:template>.
2. In the menu bar, select XSL->HTML Table. This will bring up the XSL Table
Wizard.
3. Select the
Flight element as the context node for building the HTML table.
This implies that all the children of the Flight element will be added as
columns in the table.
4. Check the Wrap table in a template check box to indicate that we want to
wrap this table in a new template.
5. Check the Include Header check box to indicate that we want to include a
header in this table.
6. Optionally, click
Next to go to the next page to add a table border and
background color for the table.
7. Click
Finish. This will create a new Flight template in your html.xsl file that will
produce an HTML table.
Generating XSL from XHTML
This will enable you to separate out the presentation logic from the dynamic data
in an existing HTML document. It extracts the data into an XML file and the
presentation data into two XSL files. Once the separation is completed, you can
use XSLT technology to combine new data that is defined in XML format with the
generated XSL files to create new HTML Web pages. To use this technology
requires the following steps:
1. Prepare the HTML file for generation by converting it into a well-formed XML
file with a
.xhtml extension.