Transforming XML with XSL
<?php
if (! extension_loaded ( "xsl" )) {
dl ( "php_xsl.dll" );
}
$xslt = new xsltProcessor ( );
$xslt->importStyleSheet ( DomDocument::load ( 'data.xsl' ) );
$data = new DomDocument ( "1.0", "iso-8889-1" );
$data->preserveWhiteSpace = false;
$local_file = "data.xml";
$data->load ( 'http://data.org/data.xml' );
$fp = fopen ( $local_file, "wt" );
if ($fp) {
fwrite ( $fp, $data->saveXML () );
fclose ( $fp );
}
echo $xslt->transformToXML ( $data );
?>
Related examples in the same category