本文整理汇总了PHP中XSLTProcessor::registerPhpFunctions方法的典型用法代码示例。如果您正苦于以下问题:PHP XSLTProcessor::registerPhpFunctions方法的具体用法?PHP XSLTProcessor::registerPhpFunctions怎么用?PHP XSLTProcessor::registerPhpFunctions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XSLTProcessor
的用法示例。
在下文中一共展示了XSLTProcessor::registerPhpFunctions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DOMDocument
* LICENCE
* OPUS is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the Licence, or any later version.
* OPUS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @category Application
* @author Ralf Claussnitzer <ralf.claussnitzer@slub-dresden.de>
* @copyright Copyright (c) 2009, OPUS 4 development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
* @version $Id$
*/
$args = $GLOBALS['argv'];
if (count($args) < 3) {
echo 'Usage: ' . $args[0] . ' PathToXsl PathToXml' . "\n";
exit;
}
$xslt = new DOMDocument();
$xslt->load($args[1]);
$xml = new DOMDocument();
$xml->load($args[2]);
$proc = new XSLTProcessor();
$proc->registerPhpFunctions();
$proc->importStyleSheet($xslt);
error_reporting(0);
echo $proc->transformToXml($xml);
示例2: start
/**
* Public Method for import of Institutes
*
* @param void
* @return void
*
*/
public function start()
{
$role = Opus_CollectionRole::fetchByName('institutes');
$xml = new DomDocument();
$xslt = new DomDocument();
$xslt->load($this->_stylesheetPath);
$proc = new XSLTProcessor();
$proc->registerPhpFunctions();
$proc->importStyleSheet($xslt);
$xml->loadXML($proc->transformToXml($this->_data));
$doclist = $xml->getElementsByTagName('table_data');
foreach ($doclist as $document) {
if ($document->getAttribute('name') === 'university_de') {
$this->importUniversities($document);
}
if ($document->getAttribute('name') === 'faculty_de') {
$facNumbers = $this->importFaculties($document, $role);
}
if ($document->getAttribute('name') === 'institute_de') {
$instNumbers = $this->importInstitutes($document, $facNumbers);
}
}
}
示例3: reader
<?php
// Page header
echo "<html><head>\n";
echo "<title>ATOM reader (PHP + XSLT)</title>\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>\n";
echo "<head><body>\n";
echo "This ATOM reader is coded in PHP5+XSLT, using libxslt.<br/>\n";
// Get parameters
$url = $_GET['url'];
$xsl = $_GET['xsl'];
// Load ATOM file
$xmldoc = new DOMDocument();
$xmldoc->load($url);
// Load XSLT file
$xsldoc = new DOMDocument();
$xsldoc->load($xsl);
// Register PHP functions as XSLT extensions
$xslt = new XSLTProcessor();
$xslt->registerPhpFunctions();
// Import the stylesheet
$xslt->importStylesheet($xsldoc);
// Transform and print
print $xslt->transformToXML($xmldoc);