• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP XSLTProcessor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中XSLTProcessor的典型用法代码示例。如果您正苦于以下问题:PHP XSLTProcessor类的具体用法?PHP XSLTProcessor怎么用?PHP XSLTProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了XSLTProcessor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getProductsReview

 /**
  * 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;
 }
开发者ID:dragonsword007008,项目名称:magento2,代码行数:32,代码来源:Feefo.php


示例2: exec

	public function exec() {
		$proc = new \XSLTProcessor; 
		$proc->importStylesheet($this->_stylesheet);
		$content = $proc->transformToXML($this->_datafile);
		
		return $content;
	}                             
开发者ID:nforgerit,项目名称:upstream,代码行数:7,代码来源:XSLT.php


示例3: display

 /**
  * 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);
 }
开发者ID:planetenkiller,项目名称:core,代码行数:36,代码来源:XsltBlock.php


示例4: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $environment = $input->getOption('env');
     try {
         $transformer = $input->getOption('xsl');
         $xsl = new \DOMDocument();
         $xsl->load($transformer);
         $xslt = new \XSLTProcessor();
         $xslt->registerPHPFunctions();
         $xslt->importStylesheet($xsl);
         $files = $input->getOption('file');
         foreach ($files as $file) {
             $output->writeln('Transforming file: ' . $file);
             $doc = new \DOMDocument();
             $doc->load($file);
             $xml = $xslt->transformToXml($doc);
             $xmlobj = new \SimpleXMLElement($xml);
             $xmlobj->asXML('output.xml');
         }
     } catch (\Exception $ex) {
         $exception = new OutputFormatterStyle('red');
         $output->getFormatter()->setStyle('exception', $exception);
         $output->writeln("\n\n");
         $output->writeln('<exception>[Exception in: ' . get_class($this) . ']</exception>');
         $output->writeln('<exception>Exception: ' . get_class($ex) . ' with message: ' . $ex->getMessage() . '</exception>');
         $output->writeln('<exception>Stack Trace:</exception>');
         $output->writeln('<exception>' . $ex->getTraceAsString() . '</exception>');
         exit(1);
     }
     exit(0);
 }
开发者ID:rhapsody-project,项目名称:commons-bundle,代码行数:34,代码来源:XslTransformCommand.php


示例5: process

 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;
     }
 }
开发者ID:nibble-arts,项目名称:oliv,代码行数:26,代码来源:postprocessor.php


示例6: process

 /**
  * Обрабатывает данные.
  * @param string $data XML-строка
  */
 public function process($data)
 {
     $errorHandler = new \WebConstructionSet\Xml\LibxmlErrorHandler();
     $xml = new \DOMDocument();
     if (!$xml->loadXML($data)) {
         throw new \ErrorException('Document parse failed. ' . $errorHandler->getErrorString(), null, null, __FILE__, __LINE__);
     }
     $xsl = new \DOMDocument();
     if ($this->xslString) {
         if (!$xsl->loadXML($this->xslString)) {
             throw new \ErrorException('XSL stylesheet load/parse failed. ' . $errorHandler->getErrorString(), null, null, __FILE__, __LINE__);
         }
     } else {
         $xslPath = $this->getXslStylesheetPath($xml);
         if (!$xslPath) {
             throw new \ErrorException('XSL stylesheet path is not found.', null, null, __FILE__, __LINE__);
         }
         if (!$xsl->load($xslPath)) {
             throw new \ErrorException('XSL stylesheet load/parse failed. ' . $errorHandler->getErrorString(), null, null, __FILE__, __LINE__);
         }
     }
     $xslt = new \XSLTProcessor();
     if (!$xslt->importStylesheet($xsl)) {
         throw new \ErrorException('Import XSL stylesheet failed. ' . $errorHandler->getErrorString(), null, null, __FILE__, __LINE__);
     }
     $this->resultDoc = $xslt->transformToDoc($xml);
     if (!$this->resultDoc) {
         throw new \ErrorException('XSLT transform failed. ' . $errorHandler->getErrorString(), null, null, __FILE__, __LINE__);
     }
     // no return
 }
开发者ID:roman-rybalko,项目名称:wcs,代码行数:35,代码来源:xslt.php


示例7: go

 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;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:33,代码来源:FOP.php


示例8: saveXML

 public function saveXML($me = true)
 {
     $xml = new XMLDom();
     if (!self::$xsl instanceof \XSLTProcessor) {
         self::$xsl = new \XSLTProcessor();
         self::$xsl->importStylesheet(XMLDom::loadXMLString('<?xml version="1.0" encoding="utf-8"?>
             <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
             <xsl:output omit-xml-declaration="yes" method="xml"/>
             <xsl:template match="node()|@*" priority="-4">
                 <xsl:copy>
                     <xsl:apply-templates  select="@*"/>
                     <xsl:apply-templates />
                 </xsl:copy>
             </xsl:template>
             <xsl:template match="/" priority="-4">
                 <xsl:apply-templates />
             </xsl:template>
         </xsl:stylesheet>'));
     }
     if ($me) {
         $xml->appendChild($xml->importNode($this, true));
         return self::$xsl->transformToXml($xml);
     } else {
         foreach ($this->childNodes as $node) {
             $xml->appendChild($xml->importNode($node, true));
         }
     }
     return self::$xsl->transformToXml($xml);
 }
开发者ID:goetas,项目名称:xmldom,代码行数:29,代码来源:XMLDomElement.php


示例9: toPO

 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;
 }
开发者ID:fkali,项目名称:yupp,代码行数:60,代码来源:core.persistent.unserialize.XML2PO.class.php


示例10: xml2html

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);
}
开发者ID:alakim,项目名称:istra,代码行数:29,代码来源:publish.php


示例11: getProcessor

 /**
  * return the xslt processor with the xsl stylesheet loaded
  * @param DOMDocument $xsl
  * @return XSLTProcessor
  */
 public static function getProcessor($xsl_dom)
 {
     // get the processor and import stylesheet xsl
     $xsl_processor = new XSLTProcessor();
     $xsl_processor->importStylesheet($xsl_dom);
     return $xsl_processor;
 }
开发者ID:nagyist,项目名称:tao-extension-tao-item,代码行数:12,代码来源:class.Xslt.php


示例12: outPut

 public function outPut()
 {
     $processor = new XSLTProcessor();
     $processor->importStyleSheet($this->apresentacao);
     $out = $processor->transformToXML($this->conteudo);
     return $out;
 }
开发者ID:DaniloEpic,项目名称:slast,代码行数:7,代码来源:Documento.php


示例13: DataAsHTML

 function DataAsHTML($xslFileName)
 {
     $xmlData = new SimpleXMLElement('<page/>');
     $this->generateXML($xmlData, $this->data);
     $xmlfilemodule = simplexml_load_file("modules/" . $this->data['name'] . "/elements.xml");
     $xmlData = dom_import_simplexml($xmlData)->ownerDocument;
     foreach (dom_import_simplexml($xmlfilemodule)->childNodes as $child) {
         $child = $xmlData->importNode($child, TRUE);
         $xmlData->documentElement->appendChild($child);
     }
     $xslfile = "templates/" . $this->template_name . "/" . $xslFileName . ".xsl";
     $xslfilemodule = "modules/" . $this->data['name'] . "/elements.xsl";
     if (in_array($this->data['name'], $this->selfPages)) {
         $xslfile = "templates/" . $this->template_name . "/" . $this->data['name'] . ".xsl";
     }
     $domXSLobj = new DOMDocument();
     $domXSLobj->load($xslfile);
     $xpath = new DomXPath($domXSLobj);
     $next = $xpath->query('//xsl:include');
     $next = $next->item(0);
     $next->setAttribute('href', $xslfilemodule);
     $next->setAttribute('xml:base', ROOT_SYSTEM);
     $xsl = new XSLTProcessor();
     $xsl->importStyleSheet($domXSLobj);
     return $xsl->transformToXml($xmlData);
 }
开发者ID:jvmxgs,项目名称:howto,代码行数:26,代码来源:Template.class.php


示例14: render

 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);
         }
     }
 }
开发者ID:JhunCabas,项目名称:pigment,代码行数:60,代码来源:Pigment.php


示例15: getProductsReview

 /**
  * 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;
 }
开发者ID:vdimitrovv,项目名称:dotmailer-magento-extension,代码行数:33,代码来源:Feefo.php


示例16: xsl_transform

function xsl_transform($filename, $xslname = null)
{
    // Get the original XML document
    $xml = new DOMDocument();
    $xml->load($filename);
    if ($xslname == null) {
        // extract bound stylesheet from embedded link
        $xp = new DOMXPath($xml);
        // use xpath to get the directive
        $pi = $xp->evaluate('/processing-instruction("xml-stylesheet")')->item(0);
        // extract the "data" part of it
        $data = $pi->data;
        // find out where the href starts
        $start = strpos($data, 'href=');
        // and extract the stylesheet name
        $xslname = XML_FOLDER . substr($data, $start + 6, -1);
    }
    // load the XSL stylesheet
    $xsl = new DOMDocument();
    $xsl->load($xslname);
    // prime the transform engine
    $xslt = new XSLTProcessor();
    $xslt->importStyleSheet($xsl);
    // and away we go!
    return $xslt->transformToXml($xml);
}
开发者ID:kptnkrnch,项目名称:COMP-4711-Final-Project,代码行数:26,代码来源:display_helper.php


示例17: params

 /**
  * 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();
 }
开发者ID:KIZI,项目名称:sewebar-cms,代码行数:35,代码来源:selector.php


示例18: process

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();
    }
}
开发者ID:haiha262,项目名称:WAD,代码行数:27,代码来源:processing.php


示例19: getImportantActs

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());
    }
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:28,代码来源:anno0Tasks.php


示例20: launch

 /**
  * Process parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $interface;
     // Retrieve the record from the index
     if (!($record = $this->db->getRecord($_GET['id']))) {
         PEAR_Singleton::raiseError(new PEAR_Error('Record Does Not Exist'));
     }
     // Send basic information to the template.
     $interface->setPageTitle(isset($record['heading']) ? $record['heading'] : 'Heading unavailable.');
     $interface->assign('record', $record);
     // Load MARC data
     require_once ROOT_DIR . '/sys/MarcLoader.php';
     $marcRecord = MarcLoader::loadMarcRecordFromRecord($record);
     if (!$marcRecord) {
         PEAR_Singleton::raiseError(new PEAR_Error('Cannot Process MARC Record'));
     }
     $xml = trim($marcRecord->toXML());
     // Transform MARCXML
     $style = new DOMDocument();
     $style->load('services/Record/xsl/record-marc.xsl');
     $xsl = new XSLTProcessor();
     $xsl->importStyleSheet($style);
     $doc = new DOMDocument();
     if ($doc->loadXML($xml)) {
         $html = $xsl->transformToXML($doc);
         $interface->assign('details', $html);
     }
     // Assign the ID of the last search so the user can return to it.
     $interface->assign('lastsearch', isset($_SESSION['lastSearchURL']) ? $_SESSION['lastSearchURL'] : false);
     // Display Page
     $interface->setTemplate('record.tpl');
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:39,代码来源:Record.php



注:本文中的XSLTProcessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP XString类代码示例发布时间:2022-05-23
下一篇:
PHP XSDType类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap