«^»
6.1. Producing HTML from consumables.xml and consumables.xsl

Instead of running a tool to transform an XML document into HTML, you could get a webserver to run a program that does the transformation. This can be done in many ways, including the use of a CGI script, a PHP script, a servlet using SAX, or by using a JavaServer page.

For example, we could have the following file of PHP code.

<%
   $xsltproc = xslt_create();
   $html = xslt_process($xsltproc,"consumables.xml","consumables.xsl");
   if (!$html) {
      die("XSLT processing error:" . xslt_error($xsltproc));
   }
   xslt_free($xsltproc);
   echo $html;
%> 

If this file is put into a public_html directory, we are providing a PHP script that automatically generates HTML from an XML document.

http://webster.dur.ac.uk/barry.cornelius/myphp/xslt/small.php.