So I have an XML file that I am trying to loop through in order, according to the attribute, \"order\".
Here is an example:
For future reference, here's something you can use to query nodes via XPath and sort the result via XPath as well: SimpleDOM. In this example, I sort all nodes by values of the order attribute:
include 'SimpleDOM.php';
$page = simpledom_load_string('
');
$nodes = $page->sortedXPath('//tree', '@order');
foreach ($nodes as $node)
{
echo $node->asXML(), "\n";
}