I'm trying to apply XSL to XML stored in a MySQL database with PHP. How do I
go about doing this? I've tried following the example on php.net but I seem
to run into a lot of trouble. Here's how the code looks like (BTW aml is XML
stored in the argument Table):

if (! empty($searchword ))

   $query = "SELECT aml FROM arguments WHERE aml LIKE '%$searchword%'";
   $result = mysql_query($query) or die ("Query failed");
   $line = mysql_fetch_array($result, MYSQL_ASSOC);

// Create an array
$arguments = array('/_xml'=> $line);

//XSL file
$xsl = "./sheet1.xsl"; 

// Create an XSLT processor
$xslthandler = xslt_create();

// Perform the transformation
$html = xslt_process( $xslthandler, 'arg:/_xml', $xsl, NULL, $arguments);

// Detect errors
if (!$html) die ('XSLT processing error: '.xslt_error($xslthandler));

// Destroy the XSLT processor

// Output the resulting HTML
print $html;    

What I get on the screen is:

Array ( [0] => "With the contents of my variable...")


Warning: Sablotron error on line 1: XML parser error 2: syntax error in
/home/httpd/html/ctan/resultworkingcopy2.php on line 93 XSLT processing
error: XML parser error 2: syntax error

What gives? I really need to solve this urgent. Thanks...


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to