function getXMLSing($xmlHon,$priv_key){
		//Carga Certificado
		$xml = new DomDocument();
		$xml->loadXML($xmlHon);
		//Carga prosedimiento de proceso de cadena original
		$xsl = new DomDocument;
		$xsl->load("ostring.xsl");
		$proc = new xsltprocessor();
		$proc->importStyleSheet($xsl);
		$original =$proc->transformToXML($xml);
		//firma la cadena original
		
		//$fp = $cert[0]['certificates']['key'];
		//$priv_key = $f['key'];
		//die($f['key']);
		//fclose($fp);
		$pkeyid = openssl_get_privatekey($priv_key);
		openssl_sign($original, $signature, $pkeyid,OPENSSL_ALGO_MD5);
		openssl_free_key($pkeyid);
		//coloca el sello en xml
		$esqueletonew=$xmlHon;
		$esqueletonew=str_replace("#1#",base64_encode($signature),$esqueletonew);
		$xmlReturn[1]=$esqueletonew;
		$xmlReturn[2]=$original;
		$xmlReturn[3]=base64_encode($signature);
		return $xmlReturn;
	}
 /**
  * render the product finder using an XSL stylesheet
  *
  * @access   public
  * @param    string      xsl stylesheet
  * @return   string      result of the transformation
  */
 public function render($xsl = null)
 {
     if (is_string($xsl)) {
         $xsl = DomDocument::loadXML($xsl);
     }
     $proc = new xsltprocessor();
     $proc->importStyleSheet($xsl);
     return $proc->transformToXML($this->dom);
 }
Beispiel #3
0
 function render($controller_name, $layout_template = false)
 {
     parent::parse($controller_name, $layout_template);
     $xsl = new DomDocument();
     $xsl->load($this->template);
     $proc = new xsltprocessor();
     $proc->importStyleSheet($xsl);
     echo $proc->transformToXML($this->props_to_xml());
 }
Beispiel #4
0
 private function _xsltProcess($sVml, $sXslFilePath)
 {
     $oProcessor = new xsltprocessor();
     $oXml = new DomDocument();
     $oXml->loadXML($sVml);
     $oXsl = new DomDocument();
     $oXsl->load($sXslFilePath);
     $oProcessor->importStyleSheet($oXsl);
     return $oProcessor->transformToXML($oXml);
 }
	</item>
	<item date="3247283732">
		<caption>Testing...</caption>
		<content>
		<![CDATA[
		dies ist ein zweiter test...
		]]>
		</content>
	</item>
</news>';
$xsl2str = '<xsl:stylesheet version = "1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
	<xsl:apply-templates />
</xsl:template>

<xsl:template match="content">
	<b><xsl:value-of select="." /></b>
</xsl:template>
';
$xml = new DomDocument();
$xml->loadxml($xmlstr);
$xsl = new DomDocument();
$xsl->load("test1.xsl");
$xsl2 = new DomDocument();
$xsl2->load("test1-2.xsl");
$proc = new xsltprocessor();
$proc->importStyleSheet($xsl2);
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
echo '<br><br>';
printf("%s<br>Count: %d", md5("29o3_DEFAULT_THEME"), strlen(md5("test")));
Beispiel #6
0
 function _generateRDF()
 {
     $model = new MemModel();
     $model->setBaseURI($this->doclink);
     $proc = new xsltprocessor();
     include_once RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF;
     $pars = new RdfParser();
     foreach ($this->stylelink as $key => $value) {
         $xsl = new DomDocument();
         $xsl->load($value);
         $proc->importStyleSheet($xsl);
         $model->addModel($pars->generateModel($proc->transformToXML($this->domdoc), $this->doclink));
     }
     return $model;
 }
Beispiel #7
0
<?php

$xslDom = new domdocument();
$xslDom->load('rss.xsl');
$xmlDom = new domdocument();
$xmlDom->load('data.rss');
$xsl = new xsltprocessor();
$xsl->importStylesheet($xslDom);
print $xsl->transformToXML($xmlDom);
 public function applyTransform()
 {
     preg_match('#(</OTA_[^>]*>)#', $this->_response, $matches);
     $xmlString = explode($matches[1], $this->_response);
     $xmlString = $xmlString[0];
     $xmlString .= $this->_getAdministrativeFeeXMLVersion();
     $xmlString .= $matches[1];
     $xml = new DOMDocument();
     $xml->loadXML($xmlString);
     $path = JPATH_SITE . DS . 'plugins' . DS . 'amadeus' . DS . 'administrativefee' . DS . 'transform.xslt';
     if (!JFile::exists($path)) {
         throw new Exception(JText::_('PLG_AAWS_TEMPLATE_DOES_NOT_EXIST'));
     }
     $xsl = new DOMDocument();
     $xsl->load($path);
     $proc = new xsltprocessor();
     $proc->importStyleSheet($xsl);
     $this->_response = substr($proc->transformToXML($xml), 22);
     return true;
 }
	$fp = fopen($file, "r");
	$return = fread($fp, filesize($file));
	fclose($fp);
	echo $return;*/
$xmlfilename = $toolchain_name;
$xsltfilename = "config.xsl";
$xml = new DomDocument();
$xml->load($xmlfilename);
## Tag renaming
$mapping = array('target_options' => 'Target Options', 'target_arch' => 'Target Architecture', 'target_variant' => 'Target Variant', 'abi' => 'ABI', 'float' => 'FPU', 'endiannes' => 'Endianness', 'toolchain_options' => 'Toolchain Options', 'build_shared_lib' => 'Build Shared Libraries', 'manufacturer' => 'Manufacturer', 'sysroot' => 'Sysroot', 'os' => 'Operating System', 'target_os' => 'Type', 'kernel_version' => 'Kernel Version', 'gmp_mpfr' => 'GMP-MPFR', 'use_gmp_mpfr' => 'Build GMP-MPFR', 'gmp_version' => 'GMP Version', 'mpfr_version' => 'MPFR Version', 'debug' => 'Debugging', 'gdb' => 'GDB', 'duma' => 'Duma', 'dmalloc' => 'Dmalloc', 'ltrace' => 'Ltrace', 'strace' => 'Strace', 'clib' => 'C Library', 'libc' => 'LIBC', 'clib_version' => 'Version', 'threading_lib' => 'Thread Model', 'cc' => 'C Compiler', 'gcc_version' => 'GCC Version', 'cpp' => 'CPP', 'fortran' => 'FORTRAN', 'java' => 'JAVA', 'binutils' => 'Binutils', 'libbfd' => 'Libbfd', 'libiberty' => 'Libiberty', 'binutils_version' => 'Version', 'tools' => 'Tools', 'libelf' => 'Libelf', 'sstrip' => 'Sstrip');
foreach ($mapping as $key => $value) {
    foreach ($xml->getElementsByTagName($key) as $node) {
        $node->setAttribute("name", $value);
    }
}
$xsl = new DomDocument();
$xsl->load($xsltfilename);
$proc = new xsltprocessor();
$proc->importStyleSheet($xsl);
$result = $proc->transformToXML($xml);
?>
	<DIV>
		<H2>Configuration de la chaîne :<BR /><?php 
echo $_GET['toolchain'];
?>
</H2>
	<?php 
print "{$result}";
return;
?>
	</DIV>
 /**
  * Render the page - this is ran automaticly
  *
  * @return Boolean
  */
 public function render()
 {
     /**
      * Must be a logged in user with admin role to access the admin pages
      */
     $user = User::instance();
     if ((!$user->logged_in() || !array_intersect($user->get_role(), User::get_roles())) && $this->request->controller() != 'login') {
         $this->redirect('admin/login');
     }
     if ($this->transform === TRUE || $this->transform === FALSE || $this->transform == 'auto') {
         $this->dom->insertBefore($this->dom->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="' . $this->xslt_path . $this->xslt_stylesheet . '.xsl"'), $this->xml);
         // If the stylesheet name includes an additional path, we need to extract it
         $extra_xslt_path = '';
         $extra_path_parts = explode('/', $this->xslt_stylesheet);
         foreach ($extra_path_parts as $nr => $extra_path_part) {
             if ($nr < count($extra_path_parts) - 1) {
                 $extra_xslt_path .= $extra_path_part . '/';
             }
         }
         // See if we have a user agent that triggers the server side HTML generation
         $user_agent_trigger = FALSE;
         foreach (Kohana::$config->load('xslt.user_agents') as $user_agent) {
             if (strpos($_SERVER['HTTP_USER_AGENT'], $user_agent)) {
                 $user_agent_trigger = TRUE;
             }
         }
         if ($this->transform === TRUE || $this->transform == 'auto' && $user_agent_trigger == TRUE) {
             $xslt = new DOMDocument();
             if (file_exists(getenv('DOCUMENT_ROOT') . $this->xslt_path . $this->xslt_stylesheet . '.xsl')) {
                 // If the stylesheet exists in the specified path, load it directly
                 $xslt->load(getenv('DOCUMENT_ROOT') . $this->xslt_path . $this->xslt_stylesheet . '.xsl');
             } else {
                 // Else make a search for it
                 // We need to load all theme modules
                 foreach (scandir(MODPATH) as $modulePath) {
                     if (substr($modulePath, 0, 5) == 'theme') {
                         Kohana::modules(array($modulePath => MODPATH . $modulePath) + Kohana::modules());
                     }
                 }
                 $xslt->load(Kohana::find_file(rtrim(preg_replace('/^' . str_replace('/', '\\/', Kohana::$base_url) . '/', '', $this->xslt_path), '/'), $this->xslt_stylesheet, 'xsl'));
             }
             // We need to update paths to included XSL elements
             $XPath = new DOMXPath($xslt);
             $include_nodes = $XPath->query('//xsl:include');
             foreach ($include_nodes as $include_node) {
                 foreach ($include_node->attributes as $attribute_node) {
                     $new_filename = Kohana::find_file(rtrim(preg_replace('/^' . str_replace('/', '\\/', Kohana::$base_url) . '/', '', $this->xslt_path . $extra_xslt_path), '/'), substr($attribute_node->nodeValue, 0, strlen($attribute_node->nodeValue) - 4), 'xsl');
                     $include_node->removeAttribute('href');
                     $include_node->setAttribute('href', $new_filename);
                 }
             }
             // Done updating paths
             $proc = new xsltprocessor();
             $proc->importStyleSheet($xslt);
             echo $proc->transformToXML($this->dom);
         } else {
             $this->response->headers('Content-Type', 'application/xml; encoding=' . Kohana::$charset . ';');
             echo $this->dom->saveXML();
         }
     } elseif ($this->transform == 'XML') {
         $this->response->headers('Content-Type', 'application/xml; encoding=' . Kohana::$charset . ';');
         echo $this->dom->saveXML();
     } elseif ($this->transform == 'JSON') {
         $this->response->headers('Content-type: application/json; encoding=' . Kohana::$charset . ';');
         echo json_encode(new SimpleXMLElement($this->dom->saveXML(), LIBXML_NOCDATA));
     }
     return TRUE;
 }
 /**
  * Transforms the DB4 schema to a Propel one.
  */
 function doConvertSchema()
 {
     // XML
     $xml = new DomDocument();
     $xml->loadXML(file_get_contents($this->file_path));
     // DB4 xsl
     $db4_transformation_file = dirname(__FILE__) . '/../vendor/db2/dbd2propel.xsl';
     $xsl = new DomDocument();
     $xsl->load($db4_transformation_file);
     // Attach the xsl rules
     $proc = new xsltprocessor();
     $proc->importStyleSheet($xsl);
     $xmlstr = $proc->transformToXML($xml);
     // Automatised i18n
     $i18nlist = array();
     preg_match_all('#\\<table name=\\"(.+)_i18n\\"#', $xmlstr, $i18nlist);
     if (is_array($i18nlist) && isset($i18nlist[1]) && is_array($i18nlist[1])) {
         foreach ($i18nlist[1] as $tableName) {
             $xmlstr = str_replace('<table name="' . $tableName . '"', '<table name="' . $tableName . '" isI18N="true" i18nTable="' . $tableName . '_i18n"', $xmlstr);
         }
     }
     // Others replacments
     $xmlstr = str_replace(array('name="culture"', 'package="lib.model"'), array('name="culture" isCulture="true"', sprintf('package="%s"', $this->package)), $xmlstr);
     // Delete external tables
     if (!empty($this->external_tables)) {
         $this->external_tables_array = explode(',', $this->external_tables);
         $this->log(' - Removing external tables');
         foreach ($this->external_tables_array as $external_table) {
             $this->log('   > ' . $external_table);
             $reg_exp = '/(<table name="' . trim($external_table) . ')(((.)*(\\s)*)*?)(<\\/table>)/';
             $xmlstr = preg_replace($reg_exp, '', $xmlstr);
         }
     }
     // Xml file save
     $this->xmlstr = $xmlstr;
     $this->output_path = sfConfig::get('sf_root_dir') . $this->output_dir . '/' . $this->output . '.xml';
 }