function process() { if (parent::isError($process = parent::process())) { return $process; } // Prepare the params for passing to the stylesheet $params = array('filter' => $this->filter, 'browser' => $this->browser, 'comment' => $this->comment, 'output' => $this->output); // Run the transformation and return the result (empty if stream is file) $result = $this->stylesheetDoc->process($this->CSSMLDoc, $params); // If stream is STDOUT then create string and return if ($this->output == 'STDOUT') { $resultData = $result->document_element(); $output = $resultData->get_content(); } return isset($output) ? $output : true; }
function process() { if (parent::isError($process = parent::process())) { return $process; } // Prepare the params for passing to the stylesheet $params = array('filter' => $this->filter, 'browser' => $this->browser, 'comment' => $this->comment); $xh = xslt_create(); $result = xslt_process($xh, $this->CSSMLDoc, $this->stylesheetDoc, null, $this->arguments, $params); if ($this->output != 'STDOUT') { $fp = fopen($this->output, 'w'); fwrite($fp, $result); fclose($fp); $result = true; } return $result; }
<?php require_once '../CSSML.php'; error_reporting(E_ALL); $cssml = '<cssml:CSSML xmlns:cssml="http://pear.php.net/cssml/1.0"> <style browserInclude="not(gecko)" filterInclude="admin"> <selector>p</selector> <declaration property="color">text</declaration> </style> </cssml:CSSML>'; $cssml = new XML_CSSML('libxslt', $cssml, 'string', array('browser' => 'ns4', 'filter' => 'admin', 'comment' => 'hello there!', 'output' => 'foo.css')); //print_r($cssml); //echo $cssml->process(); $cssml->process();