예제 #1
0
function transform($xml, $xsl, $debug = false)
{
    $xslt = new XSLTransformer();
    $xslt->setXml($xml);
    $xslt->setXsl($xsl);
    $xslt->transform();
    $error = $xslt->getError();
    if ($error) {
        $xslt->destroy();
        die($error);
    }
    $tranformation = utf8_decode($xslt->getOutput());
    if ($debug) {
        die($tranformation);
    }
    $xslt->destroy();
    return $tranformation;
}
예제 #2
0
	$xml .= '</root>';
	if (getenv("ENV_SOCKET") == "true"){  //socket
		$xslFile = strtoupper($xslName);
		//die("socket = false");
	} else {
		$xslFile = file_get_contents($defFile->getKeyValue("PATH_XSL").$xslName.".xsl");
	}
	$xsl = $xslFile;
	if(isset($_REQUEST['debug']))
	{
		echo '<textarea cols="80" rows="10">';
		echo $xml;
		echo '</textarea>';
		echo '<textarea cols="80" rows="10">';
		echo file_get_contents($xslFile);
		echo '</textarea>';
	}
	$transformer->setXslBaseUri($defFile->getKeyValue("PATH_XSL"));
	//$transformer->setXml(utf8_encode($xml));
	$transformer->setXml($xml);
	$transformer->setXsl($xsl);
	$transformer->transform();

	$result = $transformer->getOutput();

	if($transformer->getError()){
		echo $transformer->getError();
	}
	echo $result;

?>
예제 #3
0
파일: reflinks.php 프로젝트: Ethennoob/Web
    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('&amp;', '&', $output);
$output = str_replace('&lt;', '<', $output);
$output = str_replace('&gt;', '>', $output);
$output = str_replace('&quot;', '"', $output);
$output = str_replace('<p>', ' ', $output);
$output = str_replace('</p>', ' ', $output);
echo html_entity_decode($output);
/**
 * Inclusão do arquivo gerador de log de usuários autenticados somente se o serviço estiver habilitado no scielo.def, e existir o cookie userID
 */
if ($defFile['ENABLE_AUTH_USERS_LOG'] == 1) {
    if (isset($_COOKIE['userID']) && $_COOKIE['userID'] != -2) {
        require_once dirname(__FILE__) . "/../../applications/scielo-org/ajax/authLogServicesInclude.php";
예제 #4
0
function generatePayload($ws_client_url, $service, $service_name, $parameters, $xsl)
{
    global $debug, $defFile;
    //die($service_name." - ".$service);
    switch ($service_name) {
        case "Identify":
            $response = listRecords($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false);
            break;
        case "ListMetadataFormats":
            $response = getAbstractArticle($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false);
            break;
        case "ListIdentifiers":
            $response = listRecords($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false);
            break;
        case "ListSets":
            $response = getTitles($lang = "en", $debug = false);
            break;
        case "ListRecords":
            $response = ListRecords($set = $parameters["set"], $from = $parameters["from"], $until = $parameters["until"], $control = $parameters["control"], $lang = "en", $nrm = "iso", $count = 30, $debug = false);
            break;
        case "GetRecord":
            $response = getAbstractArticle($pid = $parameters["pid"], $lang = "en", $ws = $parameters["ws_oai"], $debug = false);
            break;
    }
    // $result = "";
    if (!$debug) {
        $transform = new XSLTransformer();
        if (getenv("ENV_SOCKET") != "true") {
            //socket
            $xsl = file_get_contents($defFile["PATH_OAI"] . $xsl);
        } else {
            $xsl = str_replace('.XSL', '', strtoupper($xsl));
        }
        $transform->setXslBaseUri($defFile["PATH_OAI"]);
        $transform->setXsl($xsl);
        $transform->setXml($response);
        $transform->transform();
        if ($transform->getError()) {
            // Transformation error
            echo "XSL Transformation error\n";
            echo $transform->getError();
            $transform->destroy();
            exit;
        }
        $result = $transform->getOutput();
        $transform->destroy();
    }
    return $result;
}