I want to print parent node attributes if Item is found. I am using XPath, PHP and XML. My code is
if( ! $xml = simplexml_load_file($my_feed) ) 
        { 
            echo 'unable to load XML file'; 
        } 
        else 
        { 
            $nodes = $xml->xpath("//Stock/Assortment[contains(translate(Item, 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЭЮЯ', 'абвгдеёжзиёклмнопрстуфхцчшщьыэюя'), '$search_phrase')]|/Stock/@City | /Stock/@CompanyName | /Stock/@Address | /Stock/@Date");
            foreach($nodes as $node)
            {
                if(strpos($node->Item,$search_phrase) !== false)
                {
                print $node->City.$node->CompanyName.$node->Address.$node->Date;
                }
                print $node->Item."\r\n".$node->Price."\r\n".$node->ValidDate."\r\n".$node->Manufacturer."\r\n"."<br/>";
            } 
        }
And it is not printing attributes of parent node, what is the problem? My xml is:
<?xml version="1.0" encoding="utf-8"?>
<Stock City="Душанбе" CompanyName="Фирик и ко" Address="Ленина 2" Date="12.06.2014 06:22:58">
  <Assortment>
    <ID>1</ID>
    <Item>3В амп.  №3 ( Витамины В1+В6+В12 )</Item>
    <Quantity>8</Quantity>
    <Price>17.0000</Price>
    <ValidDate>01.01.1999</ValidDate>
    <Summ>136.0000</Summ>
    <Manufacturer>Заглушка</Manufacturer>
    <Supplier>Заглушка</Supplier>
  </Assortment>
</Stock>
 
     
    