$xmlFile = file_get_contents($serviceUrl); $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $xml .= '<root>'; $xml .= '<vars> <lang>' . $lang . '</lang> <applserver>' . $applServer . '</applserver> </vars>'; $xml .= str_replace('<?xml version="1.0" encoding="ISO-8859-1" ?>', '', $xmlFile); $xml .= '</root>'; if ($_REQUEST['debug'] == 'xml') { die($xml); } $transformer = new XSLTransformer(); $transformer->setXslBaseUri($defFile["PATH_XSL"]); $transformer->setXml($xml); $transformer->setXslFile($defFile["PATH_XSL"] . "datasus.xsl"); $transformer->transform(); $output = $transformer->getOutput(); $output = str_replace('&', '&', $output); $output = str_replace('<', '<', $output); $output = str_replace('>', '>', $output); $output = str_replace('"', '"', $output); $output = str_replace('<p>', ' ', $output); $output = str_replace('</p>', ' ', $output); echo $output; ?> </div> </TD> </TR> </TABLE>
} // XML Final que contem os dados que precisamos do XML1 e XML2 $xmlFinal = '<?xml version="1.0" encoding="ISO-8859-1"?>'; $xmlFinal .= substr($xml2, strpos($xml2, "<root>"), strpos($xml2, "<ref_TITLE>") - strpos($xml2, "<root>")) . '<vars><refid>' . $_REQUEST['refid'] . '</refid><htdocs>' . $pathHtdocs . '</htdocs><service_log>' . $flagLog . '</service_log></vars>'; $xmlFinal .= " <ref_TITLE><![CDATA[" . $fullTitle . "]]></ref_TITLE>"; $xmlFinal .= substr($xml2, strpos($xml2, "<TITLE>")); if ($_REQUEST['debug2'] == 'on') { die($xmlFinal); } // Transformação Final, página de links de referencia $transformerFinal = new XSLTransformer(); $xslFinal = $pathHtdocs . "xsl/sci_reflinks.xsl"; //die("socket = true"); $transformerFinal->setXslBaseUri($pathHtdocs . "xsl"); $transformerFinal->setXml($xmlFinal); $transformerFinal->setXslFile($xslFinal); $transformerFinal->transform(); $output = $transformerFinal->getOutput(); if ($transformer->transformedBy == "PHP") { //PHP $output = utf8_decode($output); } if ($transformerFinal->getError()) { echo $transformerFinal->getError(); } $output = str_replace('&', '&', $output); $output = str_replace('<', '<', $output); $output = str_replace('>', '>', $output); $output = str_replace('"', '"', $output); $output = str_replace('<p>', ' ', $output); $output = str_replace('</p>', ' ', $output);
} if ($_REQUEST["debug"] == "xml") { echo $output; exit; } // ******************************************************************** // ********** Aplica XSl no arquivo gerado pelo programa ************* // ******************************************************************** $xsl = $defFile["PATH"]["PATH_XSL"] . "/sciofi_artmonthyearstat.xsl"; if ($_REQUEST["debug"] == "xsl") { echo file_get_contents($xsl); } $transformer = new XSLTransformer(); $transformer->setXslBaseUri($defFile["PATH"]["PATH_XSL"]); $transformer->setXml($output); $transformer->setXslFile($xsl); $transformer->transform(); $output = $transformer->getOutput(); $output = str_replace('&', '&', $output); $output = str_replace('<', '<', $output); $output = str_replace('>', '>', $output); $output = str_replace('"', '"', $output); $output = str_replace('<p>', ' ', $output); $output = str_replace('</p>', ' ', $output); echo $output; exec('rm -f $db_tmp_tab.*'); exec('rm -f $db_tmp_tab02.*'); ?> <hr>
$url = "http://" . $_SERVER['HTTP_HOST'] . "/cgi-bin/wxis.exe/?IsisScript=ScieloXML/sci_issues.xis&def=scielo.def.php&sln={$lang}&script=sci_issues&pid={$pid}&lng={$lang}&nrm=iso"; $xml = file_get_contents($url); $cortado = strstr($xml, '<CURRENT PID="'); if ($cortado != "") { $posInicio = strpos($cortado, "\""); $posFim = strpos($cortado, "\"", $posInicio + 1); $pid = substr($cortado, $posInicio + 1, $posFim - $posInicio - 1); } } /* CHANGE: alterado em 20080314 para utilização do script sci_issuerss.xis (adiconado abstract ao XML) no lugar de sci_issuetoc.xis */ $url = "http://" . $_SERVER['HTTP_HOST'] . "/cgi-bin/wxis.exe/?IsisScript=ScieloXML/sci_issuerss.xis&def=scielo.def.php&sln=en&script=sci_issuetoc&pid={$pid}&lng={$lang}&nrm=iso"; $xml = file_get_contents($url); $xsl = dirname(__FILE__) . "/xsl/createRSS.xsl"; if (isset($debug)) { echo '<h1>XML</h1>'; echo '<textarea cols="120" rows="18">' . "\n"; echo $xml; echo '</textarea>'; echo '<h1>XSL</h1>'; echo '<textarea cols="120" rows="18">' . "\n"; echo $xsl; echo '</textarea>'; die; } $t = new XSLTransformer(); $t->setXml($xml); $t->setXslFile($xsl); $t->transform(); $result = $t->getOutput(); echo $result; ob_flush();