A function to get the value of an attribute given the name of the desired attribute and the results of attributes() to the second parameter.
<?php
function getAttribute($name, $att)
{
foreach($att as $i)
{
if($i->name()==$name)
return $i->value();
}
}?>