blob: add7a8aba2a7ff7b5201af56e8bcc1e6a0a3447f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
// PHP 5
if (isset($_GET['template'])) {
$xslfilename = $_GET['template']; // if 'template', then get template attribute
}
else {
$xslfilename = 'index';
}
// get additional arguments
$arguments = array(
'page' => $_GET['page']
);
/* load the xml file and stylesheet as domdocuments */
$xsl = new DomDocument();
$xsl->load("$xslfilename.xsl");
$xml = new DomDocument();
$xml->load("index.xml");
/* create the processor and import the stylesheet */
$proc = new XsltProcessor();
$xsl = $proc->importStylesheet($xsl);
$proc->setParameter(null, $arguments);
/* transform and output the xml document */
$newdom = $proc->transformToDoc($xml);
print $newdom->saveXML();
?>
|