title: php xpath query xml for matching value
body: <p>I'm trying to use xpath to query for a particular email address in the following XML.</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;records&gt;
          &lt;record&gt;
            &lt;f id="6"&gt;sample data 1&lt;/f&gt;
            &lt;f id="7"&gt;user full name 1&lt;/f&gt;
            &lt;f id="8"&gt;first name 1&lt;/f&gt;
            &lt;f id="9"&gt;phone number 1&lt;/f&gt;
            &lt;f id="10"&gt;user1@example.com&lt;/f&gt;
            &lt;f id="11"&gt;user1 last name&lt;/f&gt;
            &lt;f id="12"&gt;url 1&lt;/f&gt;
          &lt;/record&gt;
          &lt;record&gt;
            &lt;f id="6"&gt;sample data 2&lt;/f&gt;
            &lt;f id="7"&gt;user full name 2&lt;/f&gt;
            &lt;f id="8"&gt;first name 2&lt;/f&gt;
            &lt;f id="9"&gt;phone number 2&lt;/f&gt;
            &lt;f id="10"&gt;user2@example.com&lt;/f&gt;
            &lt;f id="11"&gt;user2 last name&lt;/f&gt;
            &lt;f id="12"&gt;url 2&lt;/f&gt;
          &lt;/record&gt;
          &lt;record&gt;
            &lt;f id="6"&gt;sample data 3&lt;/f&gt;
            &lt;f id="7"&gt;user full name 3&lt;/f&gt;
            &lt;f id="8"&gt;first name 3&lt;/f&gt;
            &lt;f id="9"&gt;phone number 3&lt;/f&gt;
            &lt;f id="10"&gt;user3@example.com&lt;/f&gt;
            &lt;f id="11"&gt;user3 last name&lt;/f&gt;
            &lt;f id="12"&gt;url 3&lt;/f&gt;
          &lt;/record&gt;
        &lt;/records&gt;
  </code></pre>
  
  <p>I'm using PHP and so far I'm able to query for ALL the email addresses by the following line.</p>
  
  <pre><code>$result = $xml-&gt;xpath('/records/record/f[@id="10"]');
  </code></pre>
  
  <p>However, I want to be able to query for a particular email address, e.g. "user2@example.com".  Can this be done all in one line with xpath?</p>
  
  <p>Also, I need to return some of the other values in the XML based on that email address.</p>
  
  <p>For example, I'd query the XML for "user2@example.com" and then return "user full name 2", "sample data 2", etc.</p>
  
  <p>Any help would be appreciated!  I'm relatively new to xpath and after trying to look through examples on W3C schools I'm coming up short.</p>