Does XSLTProcessor transformToXML do something fancy with buffers

Hello,

I’m trying to use the buffering system of php to save the output of XSLT transform, e.g.

[php]
ob_start(); //Turn on output buffering,
$output = $proc->transformToXML($xmldoc);
echo $output;
$cache_output = ob_get_contents();
ob_end_flush(); //Flush and turn off output buffering
[/php]

So the idea is I write $cache_output to a file for use later, but when I look into $cache_output it is always empty.

ob_end_flush(); does however lead to the contents of $output being output to the browser.

Any ideas?

Thanks.

OK so I’ve figured this out, the problem was that I had used ‘ob_gzhandler’ callback in the ob_start call.

[php]ob_start(‘ob_gzhandler’); [/php]

I didn’t include this in my example as I was trying to simplify, but I hadn’t compiled php using --with-zlib and therefore ob_start complained ob_gzhandler wasn’t present.

When I did re-compile with zlib it was OK.

Sponsor our Newsletter | Privacy Policy | Terms of Service