Beispiel #1
0
 * 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 <*****@*****.**>
 * @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);
 /**
  * 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);
         }
     }
 }
Beispiel #3
0
 <?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);