Xpath缺少一些节点

I have XML stocksheet file. Nodes are like this one:`

<StockID>26868</StockID>

<LatinName>'The Garland' AGM</LatinName>

<CommonName>Rose</CommonName>

<DetailedDescription>A vigorous spreading climber. Masses of small semi-double creamy-white tinted pink daisy like flws. Very fragrant. Ht 15ft x 10ft. Lovely growing through trees or shrubs. Shade tolerant. Very hardy.</DetailedDescription>

<SalePriceIncVAT>19.99</SalePriceIncVAT>

<VATValue>20</VATValue>

<SalePrice>16.6583</SalePrice>

<QuantityAvailable>3</QuantityAvailable>

<GroupDescription>Roses</GroupDescription>


<GenusDescription>Rosa</GenusDescription>

<PotSize>4</PotSize>

<Locations>

  <Location>

    <Description>Nursery</Description>

    <Quantity>3</Quantity>

  </Location>

</Locations>

<Classifications>

  <Classification>

    <Description>Soil Type</Description>

    <Value>Any reasonable soil</Value>

  </Classification>

</Classifications>

`

I'm processing the file using PHP

    $_product = wc_get_product($id);

if($_product){ // check if it's got a product

$sku = $_product->get_sku();

$nodes = $xml->xpath('//StockDetails/StockDetail/StockID[.="'.$sku.'"]/parent::*');         
$result = $nodes[0];



    if(isset($result)){ 

It works quite well, but unfortunately it's a big file. It contains ~8000 nodes.

The problem is - for some reason it's missing ~200 nodes.

I assume that my Xpath line is wrong.

Can anyone lead me into a solution?