Here's the XML code i'm working with:
<inventory>
        <drink>
                <lemonade supplier="mother" id="1">
                        <title>Super Lemonade</title>
                        <price>$2.50</price>
                        <amount>20</amount>
                </lemonade>
                <lemonade supplier="mike" id="4">
                        <title>Lemonade Plus</title>
                        <price>$3.00</price>
                        <amount>20</amount>
                </lemonade>
                <pop supplier="store" id="2">
                        <title>Poppys</title>
                        <price>$1.50</price>
                        <amount>10</amount>
                </pop>
        </drink>
</inventory>
Then i wrote a simple code to practice working with XPath:
<?php
        $xmldoc = new DOMDocument();
        $xmldoc->load('sample.xml');
        $xpathvar = new Domxpath($xmldoc);
        $queryResult = $xpathvar->query('//lemonade/price');
        foreach($queryResult as $result){
                echo $result->textContent;
        }
?>
That code is working well, outputting all the lemonade price values as expected.
Now I need a XPATH to get me the TITLE and SUPPLIER of all items with amount = 20.
How can I do it ?
Thank you
 
     
     
    