本文整理汇总了PHP中XSLTProcessor::transformToURI方法的典型用法代码示例。如果您正苦于以下问题:PHP XSLTProcessor::transformToURI方法的具体用法?PHP XSLTProcessor::transformToURI怎么用?PHP XSLTProcessor::transformToURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XSLTProcessor
的用法示例。
在下文中一共展示了XSLTProcessor::transformToURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadRecordHTML
function loadRecordHTML($recHMLFilename, $styleFilename)
{
global $recID, $outputFilename;
$recHmlDoc = new DOMDocument();
$recHmlDoc->load($recHMLFilename);
$recHmlDoc->xinclude();
if (!$styleFilename) {
return $recHmlDoc->saveHTMLFile($outputFilename);
}
$xslDoc = DOMDocument::load($styleFilename);
$xslProc = new XSLTProcessor();
$xslProc->importStylesheet($xslDoc);
// set up common parameters for stylesheets.
// $xslProc->setParameter('','hbaseURL',HEURIST_BASE_URL);
// $xslProc->setParameter('','dbName',HEURIST_DBNAME);
// $xslProc->setParameter('','dbID',HEURIST_DBID);
$xslProc->setParameter('', 'standalone', '1');
$xslProc->transformToURI($recHmlDoc, $outputFilename);
}
示例2: _processXsltViaPhp
/**
* Apply a process (xslt stylesheet) on an input (xml file) and save output.
*
* @param string $input Path of input file.
* @param string $stylesheet Path of the stylesheet.
* @param string $output Path of the output file. If none, a temp file will
* be used.
* @param array $parameters Parameters array.
* @return string|null Path to the output file if ok, null else.
*/
private function _processXsltViaPhp($input, $stylesheet, $output = '', $parameters = array())
{
if (empty($output)) {
$output = tempnam(sys_get_temp_dir(), 'omk_');
}
try {
$domXml = $this->_domXmlLoad($input);
$domXsl = $this->_domXmlLoad($stylesheet);
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
$proc = new XSLTProcessor();
$proc->importStyleSheet($domXsl);
$proc->setParameter('', $parameters);
$result = $proc->transformToURI($domXml, $output);
@chmod($output, 0640);
// There is no specific message for error with this processor.
if ($result === false) {
$message = __('An error occurs during the xsl transformation of the file "%s" with the sheet "%s".', $input, $stylesheet);
throw new OaiPmhStaticRepository_Exception($message);
}
return $output;
}
示例3: generateExpressionProvider
/**
* Genearte expression providers
*
* @param Object $serviceInfo ServiceInfo Object
* @param String $serviceOutDir Path of output-files for current service
* @param String $serviceXslDir Path of xsl-files for generating providers
* @param String $configFile config file name
*
* @return void
*/
public function generateExpressionProvider($serviceInfo, $serviceOutDir, $serviceXslDir, $configFile)
{
//DSExpression Provider Generation.
if ($serviceInfo['queryProviderVersion'] == 2) {
$xsl_path = $serviceXslDir . "/EDMXToDSExpressionProvider.xsl";
$xslDoc = new DOMDocument();
if (file_exists($xsl_path)) {
if (!$xslDoc->load($xsl_path)) {
die("Error while loading xls file for Expression Provider.");
}
} else {
die("Error: xls file for DSExpression provider generatior not found");
}
$proc = new XSLTProcessor();
$proc->importStylesheet($xslDoc);
$proc->setParameter('', 'serviceName', $this->options['serviceName']);
$metadataDoc = new DOMDocument();
$expressionProviderPath = $serviceOutDir . "/" . $this->options['serviceName'] . "DSExpressionProvider.php";
if (file_exists($configFile)) {
if (!$metadataDoc->load($configFile)) {
die("Error while loading service.config.xml file for " . "DSExpression provider.");
}
} else {
die("Error: service.config.xml file is not found for " . "DSExpression Provider.");
}
$file = fopen($expressionProviderPath, "w");
chmod($expressionProviderPath, 0777);
$proc->transformToURI($metadataDoc, $expressionProviderPath);
unset($xslDoc);
unset($proc);
unset($metadataDoc);
system("PHP -l {$expressionProviderPath} 1> " . $serviceOutDir . "/msg.tmp 2>&1", $temp);
unlink($serviceOutDir . "/msg.tmp");
if ($temp == 0 or $temp == 127) {
echo "\nDSExpressionProvider class has generated Successfully.";
} else {
//Throw exception
$this->showUsage("Error in generation of ExpressionProvider class ... \nPlease " . "check the syntax of file:" . $expressionProviderPath);
}
}
}
示例4: DOMDocument
$xsl = <<<EOB
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl">
<xsl:output method="html" encoding="utf-8" indent="yes"/>
<xsl:template match="allusers">
<html><body>
<h2>Users</h2>
<table>
<xsl:for-each select="user">
<tr><td>
<xsl:value-of
select="php:function('ucfirst',string(uid))"/>
</td></tr>
</xsl:for-each>
</table>
</body></html>
</xsl:template>
</xsl:stylesheet>
EOB;
$xmldoc = new DOMDocument('1.0', 'utf-8');
$xmldoc->loadXML($xml);
$xsldoc = new DOMDocument('1.0', 'utf-8');
$xsldoc->loadXML($xsl);
$proc = new XSLTProcessor();
$proc->registerPHPFunctions();
$proc->importStyleSheet($xsldoc);
$uri = 'php://output';
echo $proc->transformToURI($xsldoc, $uri, 'stringValue');
开发者ID:gleamingthecube,项目名称:php,代码行数:30,代码来源:ext_xsl_tests_xsltprocessor_transformToURI_wrongparam_004.php
示例5: generateProxy
/**
* Generate the proxy class
*
*/
public function generateProxy()
{
$this->_validateAndBuidOptions();
// replace a PHP.ini requirement with a sensible alternative
$xsl_path = dirname(__FILE__);
$xslDoc = new DOMDocument();
$xslDoc->load($xsl_path . '/' . 'Common/WCFDataServices2PHPProxy.xsl');
$proc = new XSLTProcessor();
$proc->importStylesheet($xslDoc);
$proc->setParameter('', 'DefaultServiceURI', $this->_options['/uri_withoutSlash']);
$this->_metadataDoc = new DOMDocument();
if (!empty($this->_options['/metadata'])) {
$this->_metadataDoc->load($this->_options['/metadata']);
} else {
$metadata = $this->_getMetaDataOverCurl();
$this->_metadataDoc->loadXML($metadata);
}
return $proc->transformToURI($this->_metadataDoc, $this->_options['/out_dir'] . '/' . $this->_getFileName());
}
示例6: transmitCCD
public function transmitCCD($data = array())
{
$appTable = new ApplicationTable();
$ccda_combination = $data['ccda_combination'];
$recipients = $data['recipients'];
$xml_type = $data['xml_type'];
$rec_arr = explode(";", $recipients);
$d_Address = '';
foreach ($rec_arr as $recipient) {
$config_err = "Direct messaging is currently unavailable." . " EC:";
if ($GLOBALS['phimail_enable'] == false) {
return "{$config_err} 1";
}
$fp = \Application\Plugin\Phimail::phimail_connect($err);
if ($fp === false) {
return "{$config_err} {$err}";
}
$phimail_username = $GLOBALS['phimail_username'];
$phimail_password = $GLOBALS['phimail_password'];
$ret = \Application\Plugin\Phimail::phimail_write_expect_OK($fp, "AUTH {$phimail_username} {$phimail_password}\n");
if ($ret !== TRUE) {
return "{$config_err} 4";
}
$ret = \Application\Plugin\Phimail::phimail_write_expect_OK($fp, "TO {$recipient}\n");
if ($ret !== TRUE) {
//return("Delivery is not allowed to the specified Direct Address.") ;
$d_Address .= ' ' . $recipient;
continue;
}
$ret = fgets($fp, 1024);
//ignore extra server data
if ($requested_by == "patient") {
$text_out = "Delivery of the attached clinical document was requested by the patient";
} else {
if (strpos($ccda_combination, '|') !== false) {
$text_out = "Clinical documents are attached.";
} else {
$text_out = "A clinical document is attached";
}
}
$text_len = strlen($text_out);
\Application\Plugin\Phimail::phimail_write($fp, "TEXT {$text_len}\n");
$ret = @fgets($fp, 256);
if ($ret != "BEGIN\n") {
\Application\Plugin\Phimail::phimail_close($fp);
//return("$config_err 5");
$d_Address .= ' ' . $recipient;
continue;
}
$ret = \Application\Plugin\Phimail::phimail_write_expect_OK($fp, $text_out);
if ($ret !== TRUE) {
//return("$config_err 6");
$d_Address .= $recipient;
continue;
}
$elec_sent = array();
$arr = explode('|', $ccda_combination);
foreach ($arr as $value) {
$query = "SELECT id FROM ccda WHERE pid = ? ORDER BY id DESC LIMIT 1";
$result = $appTable->zQuery($query, array($value));
foreach ($result as $val) {
$ccda_id = $val['id'];
}
$refs = $appTable->zQuery("select t.id as trans_id from ccda c inner join transactions t on (t.pid = c.pid and t.date = c.updated_date) where c.pid = ? and c.emr_transfer = 1 and t.title = 'LBTref'", array($value));
if ($refs->count() == 0) {
$trans = $appTable->zQuery("select id from transactions where pid = ? and title = 'LBTref' order by id desc limit 1", array($value));
$trans_cur = $trans->current();
$trans_id = $trans_cur['id'] ? $trans_cur['id'] : 0;
} else {
foreach ($refs as $r) {
$trans_id = $r['trans_id'];
}
}
$elec_sent[] = array('pid' => $value, 'map_id' => $trans_id);
$ccda = $this->getFile($ccda_id);
$xml = simplexml_load_string($ccda);
$xsl = new \DOMDocument();
$xsl->load(dirname(__FILE__) . '/../../../../../public/xsl/ccda.xsl');
$proc = new \XSLTProcessor();
$proc->importStyleSheet($xsl);
// attach the xsl rules
$outputFile = sys_get_temp_dir() . '/out_' . time() . '.html';
$proc->transformToURI($xml, $outputFile);
$htmlContent = file_get_contents($outputFile);
if ($xml_type == 'html') {
$ccda_file = htmlspecialchars_decode($htmlContent);
} elseif ($xml_type == 'pdf') {
$dompdf = new DOMPDF();
$dompdf->load_html($htmlContent);
$dompdf->render();
//$dompdf->stream();
$ccda_file = $dompdf->output();
} elseif ($xml_type == 'xml') {
$ccda_file = $ccda;
}
//get patient name in Last_First format (used for CCDA filename)
$sql = "SELECT pid, id, lname, fname, mname, providerID, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS FROM patient_data WHERE pid = ?";
$result = $appTable->zQuery($sql, array($value));
foreach ($result as $val) {
$patientData[0] = $val;
//.........这里部分代码省略.........
示例7: DOMDocument
<?php
$xslt = 'cours_audio.xsl';
if ($_GET['in'] != null) {
$input = $_GET['in'];
} else {
$input = 'cours_audio.xml';
}
if ($_GET['out'] != null) {
$output = $_GET['out'];
} else {
$output = 'cours_audio.html';
}
// Chargement du document XML
$xml = new DOMDocument();
$xml->load('xslt/' . $input);
// Chargement de la feuille de style
$xsl = new DOMDocument();
$xsl->load('xslt/' . $xslt);
// Création du processeur XSLT
$proc = new XSLTProcessor();
//Affectation de la feuille de style
$proc->importStyleSheet($xsl);
// Transformation du document XML selon la feuille XSL
$proc->transformToURI($xml, "./" . $output);
if ($proc != FALSE) {
echo "transformation réussie.";
}
示例8: XSLTProcessor
if (!isset($pageProperties->onentry) and $pageProperties->operation == 'change') {
exit;
}
$xslt = new XSLTProcessor();
$xslDoc->load("../page/setter-pageController.xsl");
$xslt->importStylesheet($xslDoc);
$xslt->setParameter("", "onentry", json_encode($pageProperties->onentry));
$xslt->setParameter("", "newStateId", $pageProperties->uri);
$xmlDoc->load($baseDir . "data/controller-page.scxml");
if (strpos($pageProperties->operation, "insert") === 0) {
$xpath = new DOMXpath($xmlDoc);
$elements = $xpath->query("//*[@id='{$stateId}']");
if (!is_null($elements->item(0))) {
foreach ($pageProperties->onentry as $fields) {
foreach ($fields as $field) {
foreach ($field as $data) {
if (!is_file($baseDir . $data)) {
createArticle($baseDir . $data);
}
}
}
}
$xslt->setParameter("", "stateId", $elements->item(0)->parentNode->getAttribute("id"));
$xslt->setParameter("", "operation", "append");
}
} else {
$xslt->setParameter("", "operation", $pageProperties->operation);
$xslt->setParameter("", "stateId", $stateId);
}
$result = $xslt->transformToURI($xmlDoc, $baseDir . "data/controller-page.scxml");
示例9: chr
<?php
$file = '/etc/passwd' . chr(0) . 'asdf';
$doc = new DOMDocument();
$proc = new XSLTProcessor();
var_dump($proc->setProfiling($file));
var_dump($proc->transformToURI($doc, $file));
示例10: DOMDocument
<?php
// Load XSL template
$xsl = new DOMDocument();
$xsl->load(__DIR__ . '/stylesheet.xsl');
// Create new XSLTProcessor
$xslt = new XSLTProcessor();
// Load stylesheet
$xslt->importStylesheet($xsl);
// Load XML input file
$xml = new DOMDocument();
$xsl->load(__DIR__ . '/address-book.xml');
// Transform to string
$results = $xslt->transformToXML($xml);
// Transform to a file
$results = $xslt->transformToURI($xml, 'results.txt');
// Transform to DOM object
$results = $xslt->transformToDoc($xml);
示例11: realpath
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @category Application
* @author Edouard Simon <edouard.simon@zib.de>
* @copyright Copyright (c) 2014, OPUS 4 development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
* @version $Id$
*/
/**
* This script takes a doctype XML-definition as input and spills out the
* PHP instructions for use in the corresponding .phtml file.
* It requires the file doctype.xslt to be in the same directory as this script.
*/
if ($argc == 2) {
$filename = realpath($argv[1]);
if (!is_file($filename)) {
echo "Could not find file {$argv[1]} ({$filename})";
exit;
}
} else {
echo "No file supplied";
exit;
}
$xml = new DOMDocument();
$xml->load($filename);
$xslt = new DomDocument();
$xslt->load(dirname(__FILE__) . "/doctype.xslt");
$proc = new XSLTProcessor();
$proc->importStyleSheet($xslt);
$proc->transformToURI($xml, 'php://output');
示例12: generateProxy
/**
* Generate the proxy class
*
*/
public function generateProxy()
{
$this->_validateAndBuidOptions();
$xsl_path = get_cfg_var('ODataphp_path');
if (strlen($xsl_path) == 0) {
throw new Exception(self::$_messages['ServicePath_Not_Set']);
}
$xsl_path = $xsl_path . "/" . "Common/WCFDataServices2PHPProxy.xsl";
$xslDoc = new DOMDocument();
$xslDoc->load($xsl_path);
$proc = new XSLTProcessor();
$proc->importStylesheet($xslDoc);
$proc->setParameter('', 'DefaultServiceURI', $this->_options['/uri_withoutSlash']);
$this->_metadataDoc = new DOMDocument();
if (!empty($this->_options['/metadata'])) {
$this->_metadataDoc->load($this->_options['/metadata']);
} else {
$metadata = $this->_getMetaDataOverCurl();
$this->_metadataDoc->loadXML($metadata);
}
$proc->transformToURI($this->_metadataDoc, $this->_options['/out_dir'] . "/" . $this->_getFileName());
}
示例13: convertToXHTML
/**
* Converts the currently opened document to XHTML.
*
* This function does not modify the original document, but
* modifications on the document will reflect on the result of
* the conversion.
*
* You may want to call setXSLTransformation() and/or
* setXSLOption() before calling this function to optimize the
* result of the conversion for particular purposes.
*
* @param filename Filename of the resulting XHTML document.
*
* @return @c true if the document was successfully converted,
* @c false otherwise.
*
* @sa setXSLTransformation(), setXSLOption()
*/
public function convertToXHTML($filename)
{
if ($this->filename == '') {
trigger_error('No document was loaded for conversion to XHTML');
return false;
}
$xslDocument = new DOMDocument();
if ($xslDocument->load(LIBOPENDOCUMENT_PATH . "/xsl/{$this->xslTransformation}/document2xhtml.xsl") === false) {
trigger_error('Could not open the selected XSL transformation');
return false;
}
$xsltProcessor = new XSLTProcessor();
if ($xsltProcessor->hasExsltSupport() == false) {
trigger_error('EXSLT support in PHP is required for converting OpenDocument files');
return false;
}
if ($this->package == false) {
$sourceDocument = $this->metaDocument;
} else {
if ($this->xslOptions['export-objects'] == 'true') {
$this->exportObjects(dirname($filename));
}
$preprocessXSLDocument = new DOMDocument();
if (copy(LIBOPENDOCUMENT_PATH . "/xsl/package2document.xsl", "{$this->tmpdir}/package2document.xsl") === false || $preprocessXSLDocument->load("{$this->tmpdir}/package2document.xsl") === false) {
trigger_error('Could not open the XSL transformation for pre-processing');
return false;
}
$xsltProcessor->importStyleSheet($preprocessXSLDocument);
$contentDocument = new DOMDocument();
if ($contentDocument->load("{$this->tmpdir}/content.xml") == false) {
trigger_error('Could not load content XML document');
return false;
}
$xsltProcessor->setParameter('', 'mimetype', file_get_contents("{$this->tmpdir}/mimetype"));
$sourceDocument = $xsltProcessor->transformToDoc($contentDocument);
if ($sourceDocument === false) {
trigger_error('Could not open source document');
return false;
}
unlink("{$this->tmpdir}/package2document.xsl");
}
if (file_exists(LIBOPENDOCUMENT_PATH . "/xsl/{$this->xslTransformation}/document2xhtml.php") == true) {
include_once LIBOPENDOCUMENT_PATH . "/xsl/{$this->xslTransformation}/document2xhtml.php";
OpenDocument2XHTML::init($this->xslOptions);
$xsltProcessor->registerPHPFunctions();
}
$xsltProcessor->importStyleSheet($xslDocument);
foreach ($this->xslOptions as $key => $value) {
$xsltProcessor->setParameter('', $key, $value);
}
if ($xsltProcessor->transformToURI($sourceDocument, $filename) == false) {
trigger_error('XSL transformation failed to run');
return false;
}
return true;
}
示例14: _processXsltViaPhp
/**
* Apply a process (xslt stylesheet) on an input (xml file) and save output.
*
* @param string $input Path of input file.
* @param string $stylesheet Path of the stylesheet.
* @param string $output Path of the output file. If none, a temp file will
* be used.
* @param array $parameters Parameters array.
* @return string|null Path to the output file if ok, null else.
*/
private function _processXsltViaPhp($input, $stylesheet, $output = '', $parameters = array())
{
if (empty($output)) {
$output = tempnam(sys_get_temp_dir(), 'omk_');
}
try {
$domXml = $this->_domXmlLoad($input);
$domXsl = $this->_domXmlLoad($stylesheet);
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
$proc = new XSLTProcessor();
// Php functions are needed, because php doesn't use XSLT 2.0
// and because we need to check existence of a file.
if (get_plugin_ini('XmlImport', 'xml_import_allow_php_in_xsl') == 'TRUE') {
$proc->registerPHPFunctions();
}
$proc->importStyleSheet($domXsl);
$proc->setParameter('', $parameters);
$result = $proc->transformToURI($domXml, $output);
@chmod($output, 0640);
return $result === FALSE ? NULL : $output;
}
示例15: endsWith
$addNewDir = false;
}
} else {
$addNewDir = true;
}
if ($addNewDir == true) {
$baseOutputDir .= "../";
$newDir .= "/" . $uriArr[$i];
if (!is_dir($newDir)) {
mkdir($newDir);
}
}
}
$config = array("indent" => false, "output-xhtml" => true, "wrap" => 200);
$tidy = new tidy();
$tidy->parseString($html, $config, "utf8");
$tidy->cleanRepair();
$xmlDoc = new DOMDocument("1.0", "UTF-8");
$xmlDoc->loadXML(str_replace(" ", " ", $tidy->body()->value));
$xslt = new XSLTProcessor();
$xslDoc = new DOMDocument();
$xslDoc->load("filter.xsl");
$xslt->importStylesheet($xslDoc);
$xslt->setParameter("", "title", $title);
$xslt->setParameter("", "baseOutputDir", $baseOutputDir);
$xslt->transformToURI($xmlDoc, $newDir . $newFile);
function endsWith($aFullStr, $aEndStr)
{
$fullStrEnd = substr($aFullStr, strlen($aFullStr) - strlen($aEndStr));
return $fullStrEnd == $aEndStr;
}