Example #1
0
 /**
  * get product reviews from feefo
  *
  * @return array
  */
 public function getProductsReview()
 {
     $check = true;
     $reviews = array();
     $feefoDir = BP . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'Dotdigitalgroup' . DIRECTORY_SEPARATOR . 'Email' . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'feefo';
     $logon = $this->helper->getFeefoLogon();
     $limit = $this->helper->getFeefoReviewsPerProduct();
     $products = $this->getQuoteProducts();
     foreach ($products as $sku => $name) {
         $url = "http://www.feefo.com/feefo/xmlfeed.jsp?logon=" . $logon . "&limit=" . $limit . "&vendorref=" . $sku . "&mode=productonly";
         $doc = new \DOMDocument();
         $xsl = new \XSLTProcessor();
         if ($check) {
             $doc->load($feefoDir . DIRECTORY_SEPARATOR . "feedback.xsl");
         } else {
             $doc->load($feefoDir . DIRECTORY_SEPARATOR . "feedback-no-th.xsl");
         }
         $xsl->importStyleSheet($doc);
         $doc->loadXML(file_get_contents($url));
         $productReview = $xsl->transformToXML($doc);
         if (strpos($productReview, '<td') !== false) {
             $reviews[$name] = $xsl->transformToXML($doc);
         }
         $check = false;
     }
     return $reviews;
 }
Example #2
0
	public function exec() {
		$proc = new \XSLTProcessor; 
		$proc->importStylesheet($this->_stylesheet);
		$content = $proc->transformToXML($this->_datafile);
		
		return $content;
	}                             
 /**
  * get product reviews from feefo
  *
  * @return array
  */
 public function getProductsReview()
 {
     $check = true;
     $reviews = array();
     $feefo_dir = Mage::getModel('core/config_options')->getLibDir() . DS . 'connector' . DS . 'feefo';
     $helper = Mage::helper('ddg');
     $logon = $helper->getFeefoLogon();
     $limit = $helper->getFeefoReviewsPerProduct();
     $products = $this->getQuoteProducts();
     foreach ($products as $sku => $name) {
         $url = "http://www.feefo.com/feefo/xmlfeed.jsp?logon=" . $logon . "&limit=" . $limit . "&vendorref=" . $sku . "&mode=productonly";
         $doc = new DOMDocument();
         $xsl = new XSLTProcessor();
         if ($check) {
             $doc->load($feefo_dir . DS . "feedback.xsl");
         } else {
             $doc->load($feefo_dir . DS . "feedback-no-th.xsl");
         }
         $xsl->importStyleSheet($doc);
         $doc->load($url);
         $productReview = $xsl->transformToXML($doc);
         if (strpos($productReview, '<td')) {
             $reviews[$name] = $xsl->transformToXML($doc);
         }
         $check = false;
     }
     return $reviews;
 }
Example #4
0
 /**
  * Executes Params XSLT (transformation to be used to convert parameters into query) for given query.
  */
 function params()
 {
     $document =& JFactory::getDocument();
     $viewName = JRequest::getVar('view', 'params');
     $viewType = $document->getType();
     $view =& $this->getView($viewName, $viewType);
     $data = JRequest::getVar('data', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $query_id = JRequest::getInt('id_query', NULL);
     $result = $data;
     if ($query_id != NULL && !empty($data)) {
         $model_queries =& $this->getModel('queries');
         $query = $model_queries->getQuery($query_id);
         if ($query != NULL && !empty($query->paramsxsl)) {
             $xml = new DOMDocument();
             if ($xml->loadXML($data)) {
                 // start xslt
                 $xslt = new XSLTProcessor();
                 $xsl = new DOMDocument();
                 $xsl->loadXML($query->paramsxsl);
                 $xslt->importStylesheet($xsl);
                 $paramset = $xslt->transformToDoc($xml);
                 $result = $xslt->transformToXML($xml);
                 if ($result === false) {
                     // TODO: any joomla function for this?
                     header('HTTP/1.1 500 Internal Server Error');
                 }
             }
         }
     }
     $view->assign('value', $result);
     $view->display();
 }
Example #5
0
 public function render()
 {
     eval("\$this->content = \$this->parse{$this->requesttype}();");
     $this->checkFor404();
     if ($this->format === 'object') {
         $this->printObject($this);
     } else {
         ob_start();
         $file = $this->root . '/lib/xml/pigment.xml';
         echo '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n";
         if (is_file($file)) {
             include $file;
         }
         $xml = ob_get_contents();
         ob_end_clean();
     }
     if ($this->format === 'xml') {
         $type = $this->getHeader('xml');
         header("Content-Type: {$type}");
         echo $xml;
     } else {
         if ($this->format === 'default') {
             if ($this->requesttype === 'Content') {
                 $type = $this->getHeader('xml');
                 $file = "{$this->root}/lib/xsl/{$this->version}.xsl";
                 if (!is_file($file)) {
                     $file = "{$this->root}/lib/xsl/default.xsl";
                 }
                 $xmldoc = DOMDocument::loadXML($xml);
                 $xsldoc = new DomDocument();
                 $xsldoc->load($file);
                 $proc = new XSLTProcessor();
                 $proc->registerPHPFunctions();
                 $proc->importStyleSheet($xsldoc);
                 $output = $proc->transformToXML($xmldoc);
                 $selector = '</html>';
                 if (strstr($output, $selector)) {
                     $exp = explode($selector, $output);
                     $uri = $_SERVER['REQUEST_URI'];
                     $delim = strstr($uri, '?') ? '&' : '?';
                     $track = '<object type="text/html" width="1" height="1" data="' . $uri . $delim . 'log"></object>';
                     $output = implode($track . '</html>', $exp);
                 }
             } else {
                 $output = $this->content;
             }
         }
     }
     if (isset($output)) {
         if (isset($this->is404) && $this->is404 === true) {
             header(' ', true, 404);
         } else {
             header("Content-Type: {$this->header}");
         }
         echo $output;
         if ($this->preferences['cache'] && !isset($this->querystring) && !isset($this->is404)) {
             $this->cache($output);
         }
     }
 }
Example #6
0
function process($xml)
{
    /* load xsl*/
    $filter = true;
    //remember edit on js file
    if ($filter) {
        $xmlSession = $_SESSION["process"];
        //$xmlSession = simplexml_load_string($xmlSession);
        $xml = new DOMDocument();
        $xml->loadXML($xmlSession);
        $fileXSLPath = $GLOBALS["fileXSL_process"];
        $xslDoc = new DomDocument();
        $xslDoc->load($fileXSLPath);
        //combine xsl into xml
        $proc = new XSLTProcessor();
        $proc->importStyleSheet($xslDoc);
        $xmlTrans = $proc->transformToXML($xml);
        $xmlTrans = simplexml_load_string($xmlTrans);
        $resultXml = $xmlTrans->saveXML();
        processFile($xml);
        echo $resultXml;
    } else {
        echo $xml->saveXML();
        //way 2
        //echo $xml->asXML();
    }
}
Example #7
0
 public function go()
 {
     $fopcfg = dirname(__FILE__) . '/fop_config.xml';
     $tmppdf = tempnam('/tmp', 'FOP');
     if (!extension_loaded('java')) {
         $tmpxml = tempnam('/tmp', 'FOP');
         $tmpxsl = tempnam('/tmp', 'FOP');
         file_put_contents($tmpxml, $this->xml);
         file_put_contents($tmpxsl, $this->xsl);
         exec("fop -xml {$tmpxml} -xsl {$tmpxsl} -pdf {$tmppdf} 2>&1");
         @unlink($tmpxml);
         @unlink($tmpxsl);
     } else {
         $xml = new DOMDocument();
         $xml->loadXML($this->xml);
         $xsl = new DOMDocument();
         $xsl->loadXML($this->xsl);
         $proc = new XSLTProcessor();
         $proc->importStyleSheet($xsl);
         $java_library_path = 'file:/usr/share/fop/lib/fop.jar;file:/usr/share/fop/lib/FOPWrapper.jar';
         try {
             java_require($java_library_path);
             $j_fwc = new JavaClass("FOPWrapper");
             $j_fw = $j_fwc->getInstance($fopcfg);
             $j_fw->run($proc->transformToXML($xml), $tmppdf);
         } catch (JavaException $ex) {
             $trace = new Java("java.io.ByteArrayOutputStream");
             $ex->printStackTrace(new Java("java.io.PrintStream", $trace));
             print "java stack trace: {$trace}\n";
         }
     }
     return $tmppdf;
 }
Example #8
0
 public function process($page)
 {
     global $_PLUGIN;
     //echoall($page);
     // call plugins
     //		$pageXml = olivxml_create($page,"page");
     if ($page) {
         $pageXml = OLIVPlugin::call(new simpleXmlElement($page), "render");
         //------------------------------------------------------------------------------
         // convert page xml to html
         if (sessionfile_exists(system::OLIV_TEMPLATE_PATH() . "post.xslt")) {
             $postStylesheet = sessionxml_load_file(system::OLIV_TEMPLATE_PATH() . "post.xslt");
         } else {
             OLIVError::fire("postprocessor.php::process - post.xslt file not found");
             die;
         }
         $htmlProcessor = new XSLTProcessor();
         $htmlProcessor->importStylesheet($postStylesheet);
         $pageString = $htmlProcessor->transformToXML($pageXml);
         //echoall($pageXml->asXML());
         //------------------------------------------------------------------------------
         // run markup parser
         $pageString = $this->markup($pageString);
         return $pageString;
     }
 }
Example #9
0
function xml2html($xmlcontent, $xsl, $settings)
{
    global $debugMode;
    global $Settings;
    $xmlDoc = new DOMDocument();
    $xmlDoc->load($xmlcontent);
    if ($debugMode) {
        $root = $xmlDoc->documentElement;
        $root->setAttribute("debug", "true");
    }
    foreach (array_keys($settings) as $k) {
        $v = $settings[$k];
        $root = $xmlDoc->documentElement;
        $root->setAttribute($k, $v);
    }
    $xslDoc = new DOMDocument();
    $xslDoc->load($xsl);
    // подменить пути overrides
    $xpath = new DOMXpath($xslDoc);
    $includes = $xpath->query("//xsl:include");
    foreach ($includes as $inc) {
        $ref = $inc->getAttribute("href");
        $newRef = preg_replace('/overrides/i', '../' . $Settings["ThisFolder"] . '/' . $Settings["OverridesFolder"], $ref);
        $inc->setAttribute("href", $newRef);
    }
    $proc = new XSLTProcessor();
    $proc->importStylesheet($xslDoc);
    return $proc->transformToXML($xmlDoc);
}
Example #10
0
 public function outPut()
 {
     $processor = new XSLTProcessor();
     $processor->importStyleSheet($this->apresentacao);
     $out = $processor->transformToXML($this->conteudo);
     return $out;
 }
 public static function toPO($xmlstr, XSLTProcessor $xslt = NULL)
 {
     if ($xslt != NULL) {
         //$doc = DOMDocument::loadXML($xmlstr);
         $doc = new DOMDocument();
         $doc->loadXML($xmlstr, LIBXML_NOCDATA);
         // TEST: hay 252
         $xpath = new DOMXPath($doc);
         $nodelist = $xpath->query('//cuerpo/personas/persona');
         echo 'Hay ' . $nodelist->length . ' nodos persona<br/>';
         $xmlstr = $xslt->transformToXML($doc);
     }
     if ($xmlstr === NULL) {
         echo 'la transformacion retorna NULL<br/>';
         return null;
     }
     // DEBUG
     //FileSystem::write('archivo_transformado_alta_pac.xml', $xmlstr);
     // Tengo que cargar todas las clases de la aplicacion actual porque
     // se como se llaman, pero no se donde estan.
     YuppLoader::forceReload();
     YuppLoader::loadModel();
     // FIXME: no carga las clases del imp!
     //print_r(YuppLoader::getLoadedClasses());
     // Parseo el XML (deberia tener el formato de toXML)
     $xml = simplexml_load_string($xmlstr);
     // TEST: hay 252!
     $arr = $xml->xpath('//IMPPersona ');
     echo "En el transformado hay " . count($arr) . " personas<br/>";
     // Referencias a paths con objetos para resolver referencias por loops
     $pathObj = new ArrayObject();
     // ***
     // TODO: ver si el nodo raiz es un objeto simple o una coleccion.
     // <personas type="collection" of="IMPPersona">
     if (!empty($xml['type']) && $xml['type'] == 'collection') {
         // TEST:
         // 252 nodos!
         echo count($xml->children()) . "<br/>";
         // nodes, parentAttr, path, pathObj
         $list_po = self::toPOCollection($xml->children(), '/' . $xml->getName(), $pathObj);
         // TEST: error hay 381 personas!
         echo "Hay " . count($list_po) . " en la lista de PO<br/>";
         return $list_po;
     }
     // Para el primer nodo, la clase es el nombre del elemento
     $class = $xml->getName();
     $po = self::toPOSingle($class, $xml, '', -1, $pathObj);
     // TODO: no necesito loop detection para no entrar en loops infinitos,
     // lo necesito para resolver referencias a nodos, y reflejarlo en el PO que estoy creando.
     //$loopDetection = new ArrayObject();
     //self::toXMLSingle( $po, $xml_dom, $xml_dom, $recursive, $loopDetection );
     /*
     if ($xslt === NULL)
        return $xml_dom->saveXML();
     else
        return $xslt->transformToXML( $xml_dom );
     */
     //print_r($pathObj);
     return $po;
 }
 /**
  * Main entry point
  * Perform the XSLT transformation on the found sas.xml files to transform the xml content to the wiki format
  * Create an output.xml file containing the export 
  * @return boolean
  */
 public function transform()
 {
     $this->log('Sas 2 Wiki', true);
     $sasFiles = $this->getSasFiles();
     $doc = new DOMDocument();
     $doc->load($this->xslFile);
     $xsl = new XSLTProcessor();
     $xsl->importStyleSheet($doc);
     $buffer = '';
     foreach ($sasFiles as $sasFile) {
         $this->log('perform transformation on ' . $sasFile);
         $doc->load($sasFile);
         $buffer .= $xsl->transformToXML($doc);
     }
     if (!empty($buffer)) {
         $content = "====== List of services ======\nThe sections below give us the list of all available services in the process authoring tool. \nSo you can use each of these TAO's chunk to build your services.";
         $content .= "\n{$buffer}\n";
         $content .= "''Generated by wfEngine/scripts/wikiSas.php : SaSWiki::transform on " . date('Y-m-d') . "''";
     }
     if (file_put_contents($this->outputFile, $content)) {
         $this->log($this->outputFile . " created");
         return true;
     }
     return false;
 }
Example #13
0
 /**
  * display block
  *
  * @param        array       $blockinfo     a blockinfo structure
  * @return       output      the rendered bock
  */
 public function display($blockinfo)
 {
     if (!SecurityUtil::checkPermission('xsltblock::', "{$blockinfo['title']}::", ACCESS_OVERVIEW)) {
         return;
     }
     // Get our block vars
     $vars = BlockUtil::varsFromContent($blockinfo['content']);
     if ((!isset($vars['docurl']) || !isset($vars['styleurl'])) && (!isset($vars['doccontents']) || !isset($vars['stylecontents']))) {
         return;
     }
     // create new objects
     $doc = new \DOMDocument();
     $xsl = new \XSLTProcessor();
     // load stylesheet
     if (isset($vars['styleurl']) && !empty($vars['styleurl'])) {
         $doc->load($vars['styleurl']);
     } else {
         $doc->loadXML($vars['stylecontents']);
     }
     $xsl->importStyleSheet($doc);
     // load xml source
     if (isset($vars['docurl']) && !empty($vars['docurl'])) {
         $doc->load($vars['docurl']);
     } else {
         $doc->loadXML($vars['doccontents']);
     }
     // apply stylesheet and return output
     $blockinfo['content'] = $xsl->transformToXML($doc);
     return BlockUtil::themeBlock($blockinfo);
 }
 /**
  * @see OAIMetadataFormat#toXml
  */
 function toXml(&$oaiRecord, $format = null)
 {
     $record =& $oaiRecord->getData('record');
     switch ($format) {
         case 'oai_dc':
             static $xslDoc, $proc;
             if (!isset($xslDoc) || !isset($proc)) {
                 // Cache the XSL
                 $xslDoc = new DOMDocument();
                 $xslDoc->load('http://www.loc.gov/standards/marcxml/xslt/MARC21slim2OAIDC.xsl');
                 $proc = new XSLTProcessor();
                 $proc->importStylesheet($xslDoc);
             }
             $xmlDoc = new DOMDocument();
             $xmlDoc->loadXML($record->getContents());
             $xml = $proc->transformToXML($xmlDoc);
             // Cheesy: strip the XML header
             if (($pos = strpos($xml, '<oai_dc:dc')) > 0) {
                 $xml = substr($xml, $pos);
             }
             return $xml;
         case 'oai_marc':
         case 'marcxml':
             return $record->getContents();
         default:
             fatalError("Unable to convert MARC to {$format}!\n");
     }
 }
function getImportantActs($xml_url, $xsl_filename, $n_nodes)
{
    try {
        // read the xml from url
        $xmldoc = new DomDocument();
        $xmldoc->load($xml_url);
        // read xslt file
        $xsldoc = new DomDocument();
        $xsldoc->load($xsl_filename);
        $xsl = new XSLTProcessor();
        $xsl->importStyleSheet($xsldoc);
        // trasforma XML secondo l'XSLT ed estrae il contenuto del div
        $transformed_xml = new SimpleXMLElement($xsl->transformToXML($xmldoc));
        $nodes = $transformed_xml->children();
        // write values to screen
        $cnt = 0;
        foreach ($nodes as $node) {
            $cnt++;
            $atto = OppAttoPeer::retrieveByPK($node['atto_id']);
            printf("\t%d. %s => %f\n", $cnt, $atto->getTitoloCompleto(), $node['totale']);
            if ($cnt >= $n_nodes) {
                break;
            }
        }
    } catch (Exception $e) {
        printf("Errore durante la scrittura del file: %s\n", $e->getMessage());
    }
}
Example #16
0
function xmltransform($xml, $xslt_f)
{
    $xslt = new XSLTProcessor();
    $xmldoc = DomDocument::loadXML($xml, LIBXML_COMPACT);
    $xsltdoc = DomDocument::load($xslt_f, LIBXML_COMPACT);
    $xslt->importStylesheet($xsltdoc);
    return $xslt->transformToXML($xmldoc);
}
Example #17
0
function outdom($xmldom)
{
    $xsl = new XSLTProcessor();
    $xsldom = new DOMDocument();
    $xsldom->load("convert-remove-namespace.xslt");
    $xsl->importStyleSheet($xsldom);
    echo $xsl->transformToXML($xmldom);
}
Example #18
0
/**
 * write_xml_file
 */
function write_xml_file()
{
    // grab data
    $dataSource = $_SERVER["REQUEST_METHOD"] == "GET" ? $_GET : $_POST;
    // init attribute values
    $errors = 0;
    $failures = 0;
    $tests = 0;
    $time = 0;
    $tables = array();
    // grab key values of interest
    foreach ($dataSource as $key => $value) {
        switch ($key) {
            case "numCommandErrors":
                $errors = $value;
                break;
            case "numTestFailures":
                $failures = $value;
                break;
            case "numTestTotal":
                $tests = $value;
                break;
            case "totalTime":
                $time = $value;
                break;
            default:
                // Unescape double-quotes and replace nbsp entities with spaces
                if (preg_match('/^testTable_\\d+$/', $key)) {
                    $no_quotes = str_replace('\\"', '"', $value);
                    $no_entities = str_replace('&nbsp;', " ", $no_quotes);
                    array_push($tables, $no_entities);
                }
                break;
        }
    }
    // emit JUnit-style XML file
    $handle = fopen("test-result.xml", "w");
    // build XML text
    array_unshift($tables, "<testsuite errors=\"{$errors}\" failures=\"{$failures}\" tests=\"{$tests}\" time=\"{$time}\">");
    array_push($tables, "</testsuite>");
    $xml = join($tables, "\r\n");
    // load XML
    $doc = new DOMDocument();
    $doc->loadXML($xml);
    // load XSLT
    $xsl = new DOMDocument();
    $xsl->load("results-to-junit.xslt");
    // create XSLT processor
    $proc = new XSLTProcessor();
    $proc->importStyleSheet($xsl);
    // transform XML
    $result = $proc->transformToXML($doc);
    // write result
    fwrite($handle, $result);
    // we're done, so close the file
    fclose($handle);
}
Example #19
0
 function transform($xml_data)
 {
     if ($this->de() && ($xml = $this->getXML($xml_data))) {
         $proc = new XSLTProcessor();
         $proc->importStyleSheet($this->dd());
         return $proc->transformToXML($xml->dd());
     }
     throw new Exception('Template not found');
 }
Example #20
0
 function getFormattedXML($item)
 {
     $xml = @simplexml_load_string($item, 'SimpleXMLElement', LIBXML_NOWARNING);
     // create the XSLTProcessor object
     $proc = new XSLTProcessor();
     // attach the XSL
     $proc->importStyleSheet($this->mXsl);
     // apply the transformation and return formatted data as XML string
     return $proc->transformToXML($xml);
 }
function xslt($xmlFile, $xslFile)
{
    $xslDoc = new DOMDocument();
    $xslDoc->load($xslFile);
    $xmlDoc = new DOMDocument();
    $xmlDoc->load($xmlFile);
    $proc = new XSLTProcessor();
    $proc->importStylesheet($xslDoc);
    return $proc->transformToXML($xmlDoc);
}
Example #22
0
function xml2html($xmldata, $xsl)
{
    $xmlDoc = new DOMDocument();
    $xmlDoc->load($xmldata);
    $xslDoc = new DOMDocument();
    $xslDoc->load($xsl);
    $proc = new XSLTProcessor();
    $proc->importStylesheet($xslDoc);
    return $proc->transformToXML($xmlDoc);
}
Example #23
0
function xsl_transform_feed($feedUrl, $xslPath)
{
    $doc = new DOMDocument();
    $xsl = new XSLTProcessor();
    $doc->load(parse_path($xslPath));
    $xsl->importStyleSheet($doc);
    $doc->loadXML(file_get_contents(parse_path($feedUrl)));
    $xsl->registerPHPFunctions(array('xsl_counter'));
    return $xsl->transformToXML($doc);
}
 /**
  * Output a html view of the given wsdl
  *
  * @param string $wsdl_uri https://example.com/plugins/statistics/soap/?wsdl
  */
 public function render($wsdl_uri)
 {
     $proc = new XSLTProcessor();
     $xslDoc = new DOMDocument();
     $xslDoc->load(Config::get('codendi_dir') . "/src/www/soap/wsdl-viewer.xsl");
     $proc->importStylesheet($xslDoc);
     $xmlDoc = new DOMDocument();
     $xmlDoc->loadXML(file_get_contents($wsdl_uri));
     echo $proc->transformToXML($xmlDoc);
 }
Example #25
0
 public function printStatus()
 {
     if ($this->isRunning) {
         $xsl = new XSLTProcessor();
         $xsl->importStyleSheet(DOMDocument::load(FILE_FC_STATUS_XSL));
         $output = $xsl->transformToXML($this->domdoc);
         return $output;
     } else {
         return NULL;
     }
 }
 public function xslTransform($xhtml, $xsl_file)
 {
     $xml = new \DOMDocument();
     @$xml->loadXML($xhtml);
     $xsl = new \DOMDocument();
     $xsl->load($xsl_file);
     $proc = new \XSLTProcessor();
     $proc->importStyleSheet($xsl);
     // attach the xsl rules
     return $proc->transformToXML($xml);
 }
Example #27
0
	public function render() {
		try {
			$xsltproc = new XSLTProcessor;
			$xsltproc->importStylesheet($this->_styleSheet);
			$this->_outputData = $xsltproc->transformToXML($this->_inputData);
			
			return $this->_outputData;
		} catch (Exception $e) {
			print "Could not process the Datafile with the given Stylesheet: " . $e->getMessage();
		}
	}
function generate($inputTransformation, $outputFile)
{
    $xml = new DOMDocument();
    $xml->load('../universal.xml');
    $xsl = new DOMDocument();
    $xsl->load($inputTransformation);
    $proc = new XSLTProcessor();
    $proc->importStylesheet($xsl);
    $newXml = $proc->transformToXML($xml);
    file_put_contents($outputFile, $newXml);
}
Example #29
0
function runXSLT($xml, $xsl, $params)
{
    $loadfile = new DOMDocument();
    $processor = new XSLTProcessor();
    $loadfile->load($xsl);
    $processor->importStyleSheet($loadfile);
    foreach ($params as $key => $value) {
        $processor->setParameter('', $key, $value);
    }
    $loadfile->load($xml);
    return $processor->transformToXML($loadfile);
}
function xsl_transform($xml)
{
    // load XML file
    $XML = new DOMDocument();
    $XML->loadXML($xml);
    // XSL transform
    $xslt = new XSLTProcessor();
    $XSL = new DOMDocument();
    $XSL->load('tumblr-dashboard-rss.xsl', LIBXML_NOCDATA);
    $xslt->importStylesheet($XSL);
    echo $xslt->transformToXML($XML);
}