Chapter 7. Generators 157
Figure 7-9 Customer.html
7.6.1 Preparing the HTML file for generation
There are several steps to get the HTML file ready to generate XSL and XML file.
The first step is to rename
customer.html to customero.xhtml, since the generator
is only available to files with this extension.
Open the renamed file and follow the next steps:
1. Delete any DOCTYPE declaration.
2. Remove any entity references. For example, substitute &nbsol with a blank.
3. Fix up any missing tags. For example, change <br> to </br>
.
Adding annotation tags
The second step is to create a template file that contains the annotation tags, to
mark the section that contains data that needs to be extracted into the XML
document. To do this follow the next steps:
1. Copy customer.xhtml into a new file, for example, cus-template.xhtml.
2. Open cus_template.xhtml file and add the tag <?HTMLTemplate
version=”0.1”?> at the top to indicate that it is a template file.
3. Add the tag <TemplateRegion name=”nodeName”> around the data that you
want to convert.The nodeName name will be the node name in the resulting
XML file.