1 |
bareface |
1.1 |
<?php |
2 |
|
|
|
3 |
|
|
require_once("YakkaXml.php"); |
4 |
|
|
|
5 |
|
|
class YakkaXslProcessor { |
6 |
|
|
function YakkaXslProcessor() { |
7 |
|
|
} |
8 |
|
|
|
9 |
bareface |
1.2 |
function process($source, $template, $baseDirectory = "") { |
10 |
bareface |
1.1 |
if (is_object($source) && $source->is("YakkaXml")) |
11 |
|
|
$sourceXml = $source->toXml(); |
12 |
|
|
else |
13 |
|
|
$sourceXml = $source; |
14 |
|
|
|
15 |
|
|
if (is_object($template) && $template->is("YakkaXml")) |
16 |
|
|
$templateXml = $template->toXml(); |
17 |
|
|
else |
18 |
|
|
$templateXml = $template; |
19 |
|
|
|
20 |
|
|
$xsltProcessor = xslt_create(); |
21 |
|
|
$xsltArguments = array( |
22 |
|
|
"/_xml" => $sourceXml, |
23 |
|
|
"/_xsl" => $templateXml |
24 |
|
|
); |
25 |
|
|
|
26 |
|
|
$xsltParameters = array(); |
27 |
|
|
|
28 |
bareface |
1.2 |
xslt_set_base($xsltProcessor, "file://".$baseDirectory); |
29 |
bareface |
1.1 |
$resultXml = new YakkaXml(xslt_process($xsltProcessor, "arg:/_xml", "arg:/_xsl", null, $xsltArguments, $xsltParameters)); |
30 |
|
|
xslt_free($xsltProcessor); |
31 |
|
|
|
32 |
|
|
return $resultXml; |
33 |
|
|
} |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
?> |