当前位置: 首页>>代码示例>>PHP>>正文


PHP XSLTProcessor::setParameter方法代码示例

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


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

示例1: transform

 /**
  * @param string $xslFile
  * @param array  $xsltParameters
  * @param Element|Tag|Field|Set $element
  * @param string $ns namespace
  *
  * @return \DOMDocument
  */
 public function transform($xslFile, $xsltParameters = array(), &$element, $ns = '')
 {
     $this->load($xslFile, LIBXML_NOCDATA, $result);
     if (!$result) {
         return $element;
     }
     foreach ($xsltParameters as $name => $value) {
         $this->processor->setParameter($ns, $name, $value);
     }
     if ($element instanceof Set) {
         $processor = $this->processor;
         $element->each(function (Element $el) use($processor, $xslFile) {
             $result = $processor->transformToDoc($el);
             if (!$result) {
                 $el->after($el->ownerDocument->createComment('not transformed with ' . $xslFile));
             } else {
                 $el->replace($result->documentElement, $el);
             }
         });
         return $element;
     }
     $result = $this->processor->transformToDoc($element);
     if (!$result) {
         $element->after($element->ownerDocument->createComment('not transformed with ' . $xslFile));
     }
     $element->replace($result->documentElement, $element);
     return $element;
 }
开发者ID:volux,项目名称:dom,代码行数:36,代码来源:Xslt.php

示例2: xmltransform

function xmltransform($xml_f, $xslt_f)
{
    $xslt = new XSLTProcessor();
    $xmldoc = DomDocument::load($xml_f);
    $xsltdoc = DomDocument::load($xslt_f);
    $xslt->importStylesheet($xsltdoc);
    if (isset($_SESSION['user'])) {
        $xslt->setParameter("", "login", $_SESSION['user']);
    } else {
        $xslt->setParameter("", "login", "_nobody");
    }
    return $xslt->transformToXML($xmldoc);
}
开发者ID:zcsevcik,项目名称:edu,代码行数:13,代码来源:config.php

示例3: doAction

 public function doAction(Zend_Controller_Action $action)
 {
     $entryId = $action->getRequest()->getParam('entry-id');
     $xslt = $action->getRequest()->getParam('xslt');
     $this->client = Infra_ClientHelper::getClient();
     $xml = $this->client->media->getMrss($entryId);
     $xslParams = array();
     $xslParams['entryDistributionId'] = '';
     $xslParams['distributionProfileId'] = '';
     ob_start();
     $xmlDoc = new DOMDocument();
     $xmlDoc->loadXML($xml);
     $xsltDoc = new DOMDocument();
     $xsltDoc->loadXML($xslt);
     $xslt = new XSLTProcessor();
     $xslt->registerPHPFunctions();
     // it is safe to register all php fuctions here
     $xslt->setParameter('', $xslParams);
     $xslt->importStyleSheet($xsltDoc);
     $ob = ob_get_clean();
     ob_end_clean();
     if ($ob) {
         $action->getHelper('json')->direct(array('error' => $ob));
     }
     $obj = array('result' => $xslt->transformToXml($xmlDoc));
     $action->getHelper('json')->direct($obj);
 }
开发者ID:DBezemer,项目名称:server,代码行数:27,代码来源:XsltTesterApiAction.php

示例4: parseContent

 public function parseContent()
 {
     $xml = new \DOMDocument();
     $xml->load($this->filename);
     $xsl = new \DOMDocument();
     $xsl->load('./sheet.xsl');
     $proc = new \XSLTProcessor();
     $proc->importStyleSheet($xsl);
     $proc->setParameter('', 'base_url', $this->config['base_url']);
     $proc->setParameter('', 'images_url', $this->config['base_url'] . '/images/sheets/' . $this->id . '/');
     $proc->registerPHPFunctions(['OverDocs\\SheetParser::canonicalize', 'OverDocs\\SheetParser::parseAbbreviation']);
     $output = $proc->transformToXML($xml);
     if (!$this->debug) {
         $output = $this->minify($output);
     }
     return $output;
 }
开发者ID:Comandeer,项目名称:overdocs,代码行数:17,代码来源:SheetParser.php

示例5: uisubject_getInterface_xslParameters

/**
 * @desc Definition des paramètres passés à l'XSL de rendu du formulaire
 * @param XSLTProcessor $xslProc Processeur XSL  
 * @return XSLTProcessor HTML à afficher
 * @author WLT
 * @history le 17/02/2011 par WLT : suppression du filtre investigateur pour la liste des centres  
 **/
function uisubject_getInterface_xslParameters($FormOID, $xslProc, $uisubject)
{
    //Paramètres passés au StudyEventForm pour permettre d'afficher les codelistes en liste déroulantes
    if ($FormOID == "") {
        $xslProc->setParameter('', 'CodeListForceSelect', 'CL.$YN CL.$SYMB');
        //valeurs séparées par un espace
    }
    switch ($FormOID) {
        case 'FORM.ENROL':
            //Liste des centres où l'utilisateur connecté est investigateur
            $profiles = $uisubject->m_ctrl->boacl()->getUserProfiles();
            $sitesList = "<select name='text_string_ENROL@SITEID_0'>";
            foreach ($profiles as $profile) {
                $sitesList .= "<option value='{$profile['siteId']}'>{$profile['siteName']}</option>";
            }
            $sitesList .= "</select>";
            $xslProc->setParameter('', 'sitesList', $sitesList);
            $xslProc->setParameter('', 'SubjectKey', $_GET['SubjectKey']);
            break;
        case 'FORM.SV':
            $xslProc->setParameter('', 'StudyEventOID', $_GET['StudyEventOID']);
            break;
        case 'FORM.HE':
            $xslProc->setParameter('', 'BRTHDTC', $uisubject->m_ctrl->bocdiscoo()->getValue($_GET['SubjectKey'], "1", "0", "FORM.IC", "0", "DM", "0", "DM.BRTHDTC"));
            break;
        case 'FORM.ASS':
            $xslProc->setParameter('', 'StudyEventOID', $_GET['StudyEventOID']);
            break;
        case 'FORM.AE':
            $xslProc->setParameter('', 'FormRepeatKey', $_GET['FormRepeatKey']);
            break;
    }
}
开发者ID:bluedrone,项目名称:ALIX-EDC-SOLUTIONS,代码行数:40,代码来源:hookFunctions.php

示例6: convert

 private function convert($tableName, \DOMDocument $schemaDocument, $resourcesPath)
 {
     $template = new \DOMDocument('1.0', 'UTF-8');
     $template->load($resourcesPath . '/mysql-schema.xsl');
     $xslt = new \XSLTProcessor();
     $xslt->importStylesheet($template);
     $xslt->setParameter('', 'tableName', $tableName);
     $conversionResult = $this->xslt->transformToXml($schemaDocument);
     return $conversionResult;
 }
开发者ID:aktuba,项目名称:address-db-converter,代码行数:10,代码来源:TableSchema.php

示例7: execute

 /**
  * Transform the XML/XSL documents into an XML (probably XHTML) document
  * @return string
  */
 public function execute($parameters = array())
 {
     $xslt = new XSLTProcessor();
     $xslt->importStylesheet($this->xsl);
     $xslt->setParameter(null, $parameters);
     //unfortunately this doesn't capture any warnings generated whilst transforming
     $transformation = $xslt->transformToXml($this->xml);
     if ($transformation === false) {
         throw new MalformedPage("There was an error tranforming the page");
     }
     return $transformation;
 }
开发者ID:Acidburn0zzz,项目名称:xframe-legacy,代码行数:16,代码来源:Transformation.php

示例8: process

 public function process()
 {
     $xslt = new XSLTProcessor();
     $xslt->registerPHPFunctions();
     $baseExt = 'Base';
     $xslt->setParameter('', 'ext', $baseExt);
     $xslt->importStylesheet($this->stylesheet);
     $baseTypes = $xslt->transformToXml($this->schema);
     $fp = fopen('BaseTypes.php', 'w');
     fwrite($fp, $baseTypes);
     fclose($fp);
 }
开发者ID:kasyaar,项目名称:pws,代码行数:12,代码来源:PWS_BaseTypesGenerator.php

示例9: runXSLT

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);
}
开发者ID:emylonas,项目名称:Decameron,代码行数:12,代码来源:functions.php

示例10: applyXsltTemplateToXml

 public static function applyXsltTemplateToXml($sXmlFileRealPath, $sXslFileRealPath, array $aParameterList = array())
 {
     $xsldoc = new DOMDocument();
     $xsldoc->load($sXslFileRealPath);
     $xmldoc = new DOMDocument();
     $xmldoc->load($sXmlFileRealPath);
     $xsl = new XSLTProcessor();
     $xsl->importStyleSheet($xsldoc);
     foreach ($aParameterList as $sName => $uValue) {
         $xsl->setParameter(null, $sName, $uValue);
     }
     return $xsl->transformToXML($xmldoc);
 }
开发者ID:rali-udem,项目名称:JSrealB,代码行数:13,代码来源:Xslt.php

示例11: generateFiles

  /**
   * Generate the documentation pages for the given files.
   *
   * @param string[] $files
   * @param DOMDocument $xml
   *
   * @return void
   */
  protected function generateFiles($files, $xml)
  {
    $this->log('Started generating the static HTML files');

    // prepare the xsl document
    $xsl = new DOMDocument();
    $xsl->load($this->getThemePath() . '/file.xsl');

    // configure the transformer
    $proc = new XSLTProcessor();
    $proc->importStyleSheet($xsl); // attach the xsl rules
    $proc->setParameter('', 'search_template', ($this->getSearchObject() !== false) ? $this->getSearchObject()->getXslTemplateName() : 'none');

    $file_count = count($files);
    foreach ($files as $key => $file)
    {
      $this->log('Processing file #' . str_pad(($key + 1), strlen($file_count), ' ', STR_PAD_LEFT) . ' of ' . $file_count . ': ' . $file);
      $proc->setParameter('', 'file', $file);
      $proc->setParameter('', 'title', $file);
      $this->transformTemplateToFile($xml, $proc, $this->generateFilename($file));
    }
    $this->log('Finished generating the static HTML files');
  }
开发者ID:namesco,项目名称:Docblox,代码行数:31,代码来源:Xslt.php

示例12: convert

 /**
  * Convert documents between two formats
  *
  * Convert documents of the given type to the requested type.
  *
  * @param ezcDocumentXmlBase $doc
  * @return ezcDocumentXmlBase
  */
 public function convert($doc)
 {
     // Create XSLT processor, if not yet initialized
     if ($this->xsltProcessor === null) {
         $stylesheet = new DOMDocument();
         $stylesheet->load($this->options->xslt);
         $this->xsltProcessor = new XSLTProcessor();
         $this->xsltProcessor->importStyleSheet($stylesheet);
     }
     // Set provided parameters.
     foreach ($this->options->parameters as $namespace => $parameters) {
         foreach ($parameters as $option => $value) {
             $this->xsltProcessor->setParameter($namespace, $option, $value);
         }
     }
     // We want to handle the occured errors ourselves.
     $oldErrorHandling = libxml_use_internal_errors(true);
     // Transform input document
     $dom = $this->xsltProcessor->transformToDoc($doc->getDomDocument());
     $errors = $this->options->failOnError ? libxml_get_errors() : null;
     libxml_clear_errors();
     libxml_use_internal_errors($oldErrorHandling);
     // If there are errors and the error handling is activated throw an
     // exception with the occured errors.
     if ($errors) {
         throw new ezcDocumentErroneousXmlException($errors);
     }
     // Reset parameters, so they are not automatically applied to the next
     // traansformation.
     foreach ($this->options->parameters as $namespace => $parameters) {
         foreach ($parameters as $option => $value) {
             $this->xsltProcessor->removeParameter($namespace, $option);
         }
     }
     // Build document from transformation and return that.
     return $this->buildDocument($dom);
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:45,代码来源:xslt.php

示例13: zetaprints_get_html_from_xml

/**
 * Transform template details xml to html form.
 *
 * Param template_xml - string contains template details xml
 * Returns string contains html form
 */
function zetaprints_get_html_from_xml($xml, $xslt, $params)
{
    if (is_string($xml)) {
        $xml_dom = new DOMDocument();
        $xml_dom->loadXML($xml);
    } else {
        $xml_dom = $xml;
    }
    $xslt_dom = new DOMDocument();
    $xslt_dom->load(dirname(__FILE__) . '/xslt/' . $xslt . '.xslt');
    $proc = new XSLTProcessor();
    $proc->importStylesheet($xslt_dom);
    $proc->setParameter('', $params);
    return $proc->transformToXML($xml_dom);
}
开发者ID:priyankagarg8,项目名称:magento-w2p,代码行数:21,代码来源:zetaprints-api.php

示例14: transform

 function transform()
 {
     $dir = new PhingFile($this->toDir);
     if (!$dir->exists()) {
         throw new BuildException("Directory '" . $this->toDir . "' does not exist");
     }
     $xslfile = $this->getStyleSheet();
     $xsl = new DOMDocument();
     $xsl->load($xslfile->getAbsolutePath());
     $proc = new XSLTProcessor();
     $proc->importStyleSheet($xsl);
     ExtendedFileStream::registerStream();
     // no output for the framed report
     // it's all done by extension...
     $proc->setParameter('', 'output.dir', $dir->getAbsolutePath());
     $proc->transformToXML($this->document);
 }
开发者ID:andrew-ejov,项目名称:start-template,代码行数:17,代码来源:CoverageReportTransformer.php

示例15: xsltTransform

function xsltTransform($xmlString, $xsltPath, $xsltArguments = null)
{
    if (!file_exists($xsltPath)) {
        webserviceError('&error-xslt-path-not-found;', 500, array('path' => $xsltPath));
    }
    $result = null;
    $xsltEnabledStatus = getXsltEnabledStatus();
    switch ($xsltEnabledStatus) {
        case 'php5':
            $xslt = new XSLTProcessor();
            $xsltDocument = new DOMDocument();
            $xsltDocument->load($xsltPath);
            $xslt->importStyleSheet($xsltDocument);
            if (is_array($xsltArguments)) {
                foreach ($xsltArguments as $key => $value) {
                    $xslt->setParameter('', $key, $value);
                }
            }
            $errorLevelToDescribeMerelyDeprecatedWarnings = 999999;
            $xmlDocument = new DOMDocument();
            $xmlDocument->loadXML($xmlString);
            $result = $xslt->transformToXML($xmlDocument);
            break;
        case 'php4':
            $xsltproc = xslt_create();
            $xmlString = array('/_xml' => $xmlString);
            $xsltPath = 'file://' . $xsltPath;
            $result = @xslt_process($xsltproc, 'arg:/_xml', $xsltPath, NULL, $xmlString, $xsltArguments) or webServiceError('&error-xslt-processor-error;', 500, array('path' => $xsltPath, 'errorMessage' => xslt_error($xsltproc)));
            if (empty($result) or xslt_error($xsltproc) != null) {
                webServiceError('&error-xslt-processor-error;', 500, array('path' => $xsltPath, 'errorMessage' => xslt_error($xsltproc)));
            }
            xslt_free($xsltproc);
            break;
        default:
            $commandLineMessage = '';
            $phpVersion = getPhpVersion();
            if ($phpVersion >= 5) {
                webServiceError('&error-xslt-not-available;');
            } else {
                webServiceError('&error-php5-required;', 500, array('phpVersion' => $phpVersion));
            }
    }
    return $result;
}
开发者ID:Nolfneo,项目名称:docvert,代码行数:44,代码来源:xslt.php


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