This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PHP integration with XSLT


Processing with PHP files generated by Cocoon is not very easy.
Here is the way I do it :
access from a php script the xml file (including the xslt stylesheet 
declaration to transform it) thru an http fopen():

$fp = fopen("http://yourserverpath/yourfile.xml";, "r");

read it :

while(!feof($fp)) $content .= fgets($fp, 1024);

1024 is an arbitrary buffer size (NB: you can't use sizeof("yourfile.xml") 
with a remote access)

save it as a php file :

$fp = fopen("yourtransformedfile.php", "w");
fwrite($fp);
fclose($fp);

and load that file :

header("Location: http://yourserverpath/yourtransformedfile.php";);

It's not simple but it works.
Every attempt I made to redirect immediatly after getting the transformed 
content failed, even with ob_start()...

Daniel Fournier



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]