TechniqueUse the Sablotron XSL's output buffering tie-ins to transform your output: <?php xslt_output_begintransform('tst.xsl'); $doc = new_xmldoc('1.0'); $root = $doc->add_root('sites'); $site = $root->new_child('site', ''); $site->new_child('title', 'PHP.net'); $site->new_child('url', 'http://www.php.net'); $site->new_child('description', 'The homepage of PHP'); $site->new_child('keywords', 'MySQL, PHP, Documentation, downloads, articles, books'); // XML output will be transformed by // tst.xsl print $doc->dumpmem(); xslt_output_endtransform(); ?> CommentsThe Sablotron XSL module ties in to PHP's output buffering functions and enables you to transform all output sent to stdout through an XSL stylesheet given by the first argument to the xslt_output_begintransform() function. When you want to finish the output buffering, you can use the xslt_output_endtransform() function, which transforms all the data and outputs it to stdout . |