Components: PHP, XSL, XML Data

Download ZIP file: congress.zip

congress
|-- congress.php
|-- data
|   |-- people.xml
|   `-- usps.xml
|-- index.php
`-- xsl
   |-- grid.xsl
   |-- list.xsl
   `-- toc.xsl 

PHP

<?php
$fXml  = "data/people.xml";

# LOAD XML FILE
$XML = new DOMDocument();
$XML->load( $fXml );

# START XSLT
$xsltproc = new XSLTProcessor();
$XSL = new DOMDocument();
$fXslBase = './xsl/';
$fXsl = $fXslBase.'list.xsl';
if ($_GET['view']) {
  $fXsl = $fXslBase.$_GET['view'].'.xsl';
}

$XSL->load( $fXsl, LIBXML_NOCDATA);
$xsltproc->importStylesheet( $XSL );

if ($_GET['st']) {
   $xsltproc->setParameter('','ST',$_GET['st']);
}
#PRINT
print $xsltproc->transformToXML( $XML );
?>r
    

Copyright © 2002-2009 David P. Heitmeyer

Bookmark and Share