All XML handling based on libxml2
<?php
$dom = new domDocument;
$dom->load('data.xml');
?>
XSL
<?php
$domxsl = domDocument::load('stylesheet.xsl');
$proc = new xsltProcessor;
$proc->importStyleSheet($domxsl);
echo $proc->transformToXML($dom);
?>
XPath
<?php
$ctx = new domXPath($dom);
$result = $ctx->query('/breakfast_menu/food[@itemno > 3]/price/text()');
foreach($result as $node) {
echo $node->nodeValue."<br />\n";
}
?>
menu.xml
SimpleXML
<?php
$menu = simplexml_load_file('menu.xml');
foreach ($menu->food as $item) {
echo "{$item->price}\t{$item->name}<br />\n";
}
?>
Output