diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/index.php b/index.php new file mode 100644 index 0000000..add7a8a --- /dev/null +++ b/index.php @@ -0,0 +1,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(); + +?>
\ No newline at end of file |