[plug] XSL question

Shayne O'Neill shayneo at bestflights.com.au
Wed Oct 25 14:21:28 WST 2006


Fun bit of code for y'all I thought I'd share. Doesn't work on Php5.
Putting this more out there for google.

//
// Displays data from a database passed thru a XSLT template
// (PD) Shayne O'Neill
//
//Change the last to lines to just "print $xml" if you want that in xml
format (handy for creating the xslt 
// template).

include 'sql2xml.php';

$sqlclass = new xml_sql2xml('mysql://user:pass@host/db');
$xml =  array ($sqlclass->getxml('select * database where ra=rara'));
$xh = xslt_create ();
print xslt_process ($xh,'arg:/_xml','template.xsl',NULL,$xml);



Requires the pear sql2xml libs and the xmldom php4 extension.

It wont run on php5 without some massaging however.



More information about the plug mailing list