daniel1982Au Posted November 2, 2006 Share Posted November 2, 2006 I'm attemption to build a Word document with php. An xml file is been populated with data. I then want to use an XSL(not xslt, if its possible) file to style the XML file (possibly in wordml) and then spit out a word document. What I am having trouble with is the XSL stylesheet itself, does anyone know if its actually possible to do it this way? Does anyone have an example of an similar XSL file? My example is not complete and I have omitted alot of error checking and some other stuff to keep it simple. //Transformt the xml doc. $xml = new DOMDocument; $xml->load('project.xml'); $xsl = new DOMDocument; $xsl->load('projectStyle.xsl'); $proc = new XSLTProcessor; $proc->importStyleSheet($xsl); $output = $proc->transformToXML($xml); //fire it off to the clients browser so it can be ready for automatic download. header("Content-Type: application/msword"); header("Content-Disposition: attachment; filename = ".$attributeType.".doc"); header("Content-Transfer-Encoding: binary"); //Spit out the word file. readfile($output); Thanks. Link to comment https://forums.phpfreaks.com/topic/25885-using-php-to-output-word-using-xsl/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.