Dear List

We are trying to display html in an iFrame.  The html is generated
from an xslt of a .xml and .xsl file. Below are the error messages
that appear in the iFrame, followed by our PHP code. Any advice is
greatly apreciated!  Thank you!


Begin iFrame error message:

"The XML page cannot be displayed

Cannot view XML input using style sheet. Please correct the error and
then click the Refresh button, or try again later.

Invalid at the top level of the document. Error processing resource
'https://192.168.99.107/xxxDevVxxx/controller.php?d...

 <!--url=/var/www/xxxDevVxxx/documents/2/hie_doc.15_converted.html-->
file_exists=1
-----------------------------..."

End iFrame error message


  if($d->get_mimetype()=='application/xml' || $d->get_mimetype()=='text/xml'){

   $convertedFile = substr(basename($url), 0, strrpos(basename($url),
'.')) . '_converted.html';
   $url = 
$GLOBALS["fileroot"].'/documents/'.$_SESSION["pid"].'/'.$convertedFile;

   echo "\n <!--url=".$url."-->";
   $contentType = "application/html";
      echo " file_exists=".file_exists($url);

   if (!file_exists($url)){

    echo "\n <!--file not exist temp_url=".$temp_url." -->";
    $xml = new DOMDocument();
    $xml->load($temp_url);

    $xslt = new XSLTProcessor();

    $ss_es = $xml->getElementsByTagName('xmlFile');
    echo '<!-- xmlFile tags count='.$ss_es->length.' -->';

    if($ss_es->length>0){
     $ss = new DOMDocument();
     $ss->load($GLOBALS["fileroot"].'/../abc/abc.xsl');

     $xslt->importStyleSheet($ss);
     $xml->loadHTML($xslt->transformToXML($xml));
     //$xml->saveHTML();


    } else {

     $ss_es = $xml->getElementsByTagName('xxxDocument');
     echo '<!-- xxxDocument tags count='.$ss_es->length.' -->';

     if($ss_es->length>0){
      $ss = new DOMDocument();
      $ss->load($GLOBALS["fileroot"].'/../aaa/bbb/CCC.xsl');
      $xslt->importStyleSheet($ss);
      $xml->loadHTML($xslt->transformToXML($xml));
      //$xml->saveHTML();

     }
    }
    if($xml->save($url)==false){
     $url = $d->get_url();
     $contentType = "application/xml";
    }
   } else {
    echo "\n <!--file exist-->";
   }

    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Disposition: " . ($as_file ? "attachment" :
"inline") . "; filename=\"" . basename($url) . "\"");
    header("Content-Type: ".$contentType);
    header("Content-Length: " . filesize($url));
    $f = fopen($url,"r");
    fpassthru($f);
    exit;
_______________________________________________
New York PHP Users Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/Show-Participation

Reply via email to