Creating your XML stylesheet

First, convert the HTML.

Now, edit the file that contains the HTML for what will be the first page of your new XML site.

1. Save the file with an .xsl extension instead of .html
2. Delete any reference to a <!DOCTYPE ... and all references to <meta data. The DOCTYPE will be changed to XML later in the XML file itself. Meta data is not needed for this file.
3. Add the following code at the very top of the document, above the <html> tag:

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template match="/">


4. At the end of the file, after the closing </html> tag, add the following code:

</xsl:template>
</xsl:stylesheet>

Load the xsl file into IE5 and prepare for lots of errors! Even the best HTML pages will fail once parsed by XML. Take note of each error and check the XML syntax page at CodeHelp. Or keep reading and check out the test files at the end of this section.

If you come across errors that just don't seem to go away, try removing that section of HTML. Better to get a partial but working page displayed than a series of errors. Once the page is correct, IE5 will display the .xsl data in a tree like structure (hence the need for those closing tags) with all the data contained within the next layer of the tree.



This is part of www.codehelp.co.uk Copyright © 1998-2004 Neil Williams
See the file about.html for copying conditions.