SHARE
TWEET

Untitled

a guest Jun 20th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // INITIALIZE PROCESSOR
  3. $saxonProc = new SaxonSaxonProcessor();
  4. $xsltProc = $saxonProc->newXsltProcessor();
  5.  
  6. $lang = $_GET['lang'];
  7. $rubrik = $_GET['rubrik'];
  8. $seite = $_GET['seite'];
  9.  
  10. // LOAD XSLT SCRIPT
  11. $xslFile = "../ressources/xslt/transform_article_partials_to_html.xslt";
  12. $xsltProc->compileFromFile($xslFile);
  13.  
  14. // SET PARAMS
  15. $dir = __DIR__ . "/articles/" . $lang;
  16. $filename = "{$rubrik}_{$seite}.html";
  17. $filelist = scandir($dir, 1);
  18.  
  19.  
  20. $xdmvalue = $saxonProc->createAtomicValue($filename);
  21. $xsltProc->setParameter("articlePfad", $xdmvalue);
  22.  
  23. $xdmvalue = $saxonProc->createAtomicValue($lang);
  24. $xsltProc->setParameter("lang", $xdmvalue);
  25.  
  26. // LOAD SOURCE XML
  27. if($seite == null) {
  28.   $filename = "{$rubrik}.html";
  29.   if(in_array($filename, $filelist)) {
  30.     $xmlFile = $dir . "/" . $filename;    
  31.   } else {
  32.     echo "404";
  33.     exit;
  34.   }
  35. } else if(isset($seite) && isset($rubrik)){
  36.   if(in_array($filename, $filelist)) {
  37.     $xmlFile = $dir . "/" . $filename;
  38.   } else {
  39.     echo "404";
  40.   }
  41. }
  42.  
  43. $xsltProc->setSourceFromFile($xmlFile);
  44.  
  45. // RUN TRANSFORMATION    
  46. $result = $xsltProc->transformToString();
  47.  
  48. echo $result;
  49.  
  50. // RELEASE RESOURCES
  51. $xsltProc->clearParameters();
  52. $xsltProc->clearProperties();
  53.  
  54. unset($xsltProc);
  55. unset($saxonProc);  
  56. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top