This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: PHP integration with XSLT
- To: xsl-list-digest at lists dot mulberrytech dot com
- Subject: [xsl] Re: PHP integration with XSLT
- From: dfour <dfour at noos dot fr>
- Date: Fri, 9 Nov 2001 10:25:02 -0500
- References: <200111090207.VAA21292@biglist.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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