protected function renderXSLT($response, $template)
 {
     if ($template == '') {
         throw new Exception(JText::_('COM_AAWS_TEMPLATE_DOES_NOT_EXIST'));
     }
     $type = strtolower(substr(get_class($this), strlen('AawsController')));
     $path = JPATH_COMPONENT . DS . 'xslt' . DS . $type . DS . $template . '.xslt';
     if (!JFile::exists($path)) {
         throw new Exception(JText::_('COM_AAWS_TEMPLATE_DOES_NOT_EXIST'));
     }
     $xml = new DOMDocument();
     $xml->loadXML($response);
     $xsl = new DOMDocument();
     $xsl->load($path);
     $proc = new xsltprocessor();
     $proc->importStyleSheet($xsl);
     $proc->setParameter('', 'language', 'es-ES');
     if (method_exists($this, '_setVariablesTo')) {
         $this->_setVariablesTo($proc, $template);
     }
     echo $proc->transformToXML($xml);
 }
Beispiel #2
0
[expect php]
[file]
<?php 
require 'Phalanger.inc';
echo "Test 12: Using Associative Array of Parameters";
$dom = new domDocument();
$dom->load(dirname(__FILE__) . "/xslt.xml");
if (!$dom) {
    echo "Error while parsing the document\n";
    exit;
}
$xsl = new domDocument();
$xsl->load(dirname(__FILE__) . "/xslt012.xsl");
if (!$xsl) {
    echo "Error while parsing the document\n";
    exit;
}
$proc = new xsltprocessor();
if ($proc === false) {
    echo "Error while making xsltprocessor object\n";
    exit;
}
$proc->importStylesheet($xsl);
$parameters = array('foo' => 'barbar', 'foo1' => 'test');
$proc->setParameter("", $parameters);
print "\n";
print __xml_norm($proc->transformToXml($dom));
print "\n";
Beispiel #3
0
    $type = $doc->createElement("type");
    $type = $content->appendChild($type);
    $htext = $doc->createTextNode($list['type']);
    $htext = $type->appendChild($htext);
    //create date
    $date = $doc->createElement("date");
    $date = $content->appendChild($date);
    $htext = $doc->createTextNode($list['date']);
    $htext = $date->appendChild($htext);
}
//write to the file
$filename = "xml/sitemap.xml";
$doc->save($filename);
if ($_GET['sortby']) {
    $sortingrule = $_GET['sortby'];
} else {
    $sortingrule = "headline";
}
/* NOW WE CAN GET BUSY! */
$xml = new DomDocument();
// from /ext/dom
$xml->load('xml/sitemap.xml');
$xsl = new DomDocument();
$xsl->load('xslt/sitemap.xsl');
/* Configure the transformer */
$proc = new xsltprocessor();
$proc->importStyleSheet($xsl);
// attach the xsl rules
$proc->setParameter("", "SORT", "{$sortingrule}");
echo $proc->transformToXML($xml);
// actual transformation