00001 <?php
00007 class STransXSL extends STrans
00008 {
00013 public function doc() {
00014 return "STransXSL applies an XSLT stylesheet to the input XML"
00015 . " to accomplish its translation.";
00016 }
00017
00018
00019
00020
00021
00026 public function getInFormat() {
00027 return 'xml';
00028 }
00029
00034 public function getOutFormat() {
00035 return 'html';
00036 }
00037
00043 public function translate ($si)
00044 {
00045 if(parent::translate($si) === false ) return false;
00046
00047
00048
00049 $this->sendToTarget($si, $this->transformJournalXML($si, $si->getSource()));
00050 }
00051
00058 public function transformJournalXML($si, $input)
00059 {
00060
00061 $xsl = new DomDocument();
00062 $xslfile = $si->getOption('xslFile');
00063 $xsl->load("$xslfile");
00064 $inputdom = new DomDocument();
00065 $inputdom->loadXML($input);
00066
00067
00068 $proc = new XsltProcessor();
00069 $xsl = $proc->importStylesheet($xsl);
00070
00071
00072 $newdom = $proc->transformToDoc($inputdom);
00073 return $newdom->saveXML();
00074 }
00075
00076 }
00077
00078 ?>