load($xml_file); // create dom object for the XSL stylesheet and configure the transformer $xsl_obj = new DomDocument(); if (!file_exists($xsl_file)) exit('Failed to open $xsl_file'); $xsl_obj->load($xsl_file); $proc = new XSLTProcessor; $proc->importStyleSheet($xsl_obj); // attach the xsl rules $html_fragment = $proc->transformToXML($dom_object); print ($html_fragment); ?>