December 28, 2001 - On-the-Fly XML to HTML Conversion | WebReference

December 28, 2001 - On-the-Fly XML to HTML Conversion

Yehuda Shiran December 28, 2001
On-the-Fly XML to HTML Conversion
Tips: December 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

You can convert an XML file to HTML on the fly, instead of building DOMDocument objects and running a conversion utility between them. You just load the XML file in your browser, and out will come the desired HTML. In order to do this conversion on the fly, you need to specify the XSLT file (formatting directives) in the body of the XML file. The top two lines of the XML file should be as follows:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="transform.xsl"?>
where transform.xsl is the name of the formatting utility.