(to nie moje i kompletnie się na tym nie znam)
W każdym razie wywala błąd parsowania bo php5 nie ma obsługi xslt_create
Wygląda to tak:
function GetHtml($xsl_path , $xml , $params = array(), $encoding="UTF-8") { // PRZETWARZANIE XML'A //////////////////// $arg = array("/_xml" => $xml); ob_start(); $xh = xslt_create(); //////////////////TU JEST BŁĄD PARSOWANIA xslt_set_encoding($xh,$encoding); eval("?>".xslt_process($xh, "arg:/_xml", $xsl_path, NULL, $arg, $params)."<?php "); $result = ob_get_contents(); xslt_free($xh); ob_end_clean(); //echo $xml; if ($result) { $result = str_replace("<br/>","<br>",$result); $result = str_replace("<br />","<br>",$result); $result = str_replace('alt="" />','alt="" >',$result); return $result; } else { /* echo "There was an error that occurred in the XSL transformation...\n"; echo "\tError number: " .$xsl_path." ". xslt_errno($xh) . "\n"; echo "\tError string: " . xslt_error($xh) . "\n"; */ return -1; } }
Znalazłem takie rozwiązanie problemu
This is more usefull, no files needed, it just takes XML and XSL strings as input parameters and returns transformed XML <?php /** * @param $xml * @param $xsl * @return string xml */ function transform($xml, $xsl) { $xslt = new XSLTProcessor(); $xslt->importStylesheet(new SimpleXMLElement($xsl)); return $xslt->transformToXml(new SimpleXMLElement($xml)); } ?>
ale nie wiem jak połączyć jedno z drugim.
Uprzejmie proszę o pomoc
Nikt nie pomoże
