I started looking into XML/XSL when one of my clients had no database support at all, but wanted a quick and easy way to hold data such as support group entries.
XML/XSL alone would work great, except I would have two problems that I know of.
1) XML/XSL on the client side is browser dependant most work ok, but not all , and the differences might appear. 2) I need the content of the transformed XML inside of another document, somewhat like a PHP include.
For understanding sakes here is a layout of an .xml document and it's corresponding .xsl document.
<? $xh = xslt_create(); //Creates an XSLT transform object $myResult = xslt_process( $xh, 'support.xml', 'support.xsl' ); echo $myResult; //Sends the to the browser the transformed XML into HTML appearance. xslt_free($xh); // Free's the object from memory. ?>
If the simple lines of code above does not work (ie: I just had problems getting it to run on my windows version of PHP with the php_xslt.dll extension loaded) Use this code sniplet for the PHP.
// Xml and XSL files $xml_file = "complex.xml"; $xsl_file = "complex.xsl";