php xml with xsd foreach,找出哪个块

i read out a xml file with xsd, with this code:

 foreach ($xpath->evaluate('//caaml:validAspect') as $expositons) {
    echo $xpath->evaluate('string(@xlink:href)', $expositons)."<br>";
 }

here i get all results but i can not assign them in which block they are. and i also tried this:

foreach ($xpath->evaluate('//caaml:DangerRating') as $dangerRating) {
    echo $xpath->evaluate('string(caaml:validAspect/@xlink:href)', $dangerRating)."<br>";
}

here i only get the first value of the validAspect field.

and here is the xml structure:

enter image description here

and now my problem is that how can i find out in with block the data is?

Thanks!

now i tried this:

foreach ($xpath->evaluate('//caaml:DangerRating') as $i => $block) {
  echo "block $i
";
  foreach ($xpath->evaluate('/caaml:validTime/caaml:validAspect', $block) as $expositions) {
    echo $xpath->evaluate('string(@xlink:href)', $expositons)."<br>";
  }
}

but i do not get any result …

You could get the block first then the section

<?php
$xml = new DOMDocument;
$xml->load("test.xml"); 
$xpath = new DOMXPath($xml);
foreach ($xpath->evaluate('//caaml:DangerRating') as $i => $block) {
    echo "block $i
";
    foreach ($xpath->evaluate('./caaml:validAspect', $block) as $expositions) {
        echo $xpath->evaluate('string(@xlink:href)', $expositions) . "
";
    }
}