How do I print output of this html transformed by xsl in another php script in some div section
I need to print the html transformed output of my php script in a div element at another php script. How do I do. I tried to do it by include but it raises xml parser error. The error it raises if I include any echo statement in the file. Here is a test file that raises error:
<?php
include "callHier.php";
echo'test';
print $xslt->transformToXML($save);
?>
erro
XML Parsing 开发者_如何转开发Error: not well-formed Location: http://127.0.0.1/test.php
Line Number 1, Column 5:
Here is my output code:
$xslt = new XSLTProcessor();
$XSL = new DOMDocument();
$XSL->load( 'msg.xsl');
$xslt->importStylesheet( $XSL );
header('Content-Type: application/xml');
//print $xslt->transformToXML($save);
?>
It builds an unordered list which I need to display in a dive in another php script.
You need to include
this script to the page you want it to appear. Then you can echo the results at any location in the page you want.
<?php include "yourXslSriptHere.php"; ?>
...
<div id="theDivYouWantToWriteItTo">
<?php echo $xslt->transformToXML($save); ?>
</div>
精彩评论