title: php xpath query to get parent node based on value in repeating child nodes
body: <p>I have an XML file structured as follows:</p>
  
  <pre><code>&lt;pictures&gt;
      &lt;picture&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;description&gt;&lt;/description&gt;
          &lt;facts&gt;
              &lt;date&gt;&lt;/date&gt;
              &lt;place&gt;Unites States&lt;/place&gt;
          &lt;/facts&gt;
          &lt;people&gt;
              &lt;person&gt;John&lt;/person&gt;
              &lt;person&gt;Sue&lt;/person&gt;
          &lt;/people&gt;
      &lt;/picture&gt;
      &lt;picture&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;description&gt;&lt;/description&gt;
          &lt;facts&gt;
              &lt;date&gt;&lt;/date&gt;
              &lt;place&gt;Canada&lt;/place&gt;
          &lt;/facts&gt;
          &lt;people&gt;
              &lt;person&gt;Sue&lt;/person&gt;
              &lt;person&gt;Jane&lt;/person&gt;
          &lt;/people&gt;
      &lt;/picture&gt;
      &lt;picture&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;description&gt;&lt;/description&gt;
          &lt;facts&gt;
              &lt;date&gt;&lt;/date&gt;
              &lt;place&gt;Canada&lt;/place&gt;
          &lt;/facts&gt;
          &lt;people&gt;
              &lt;person&gt;John&lt;/person&gt;
              &lt;person&gt;Joe&lt;/person&gt;
              &lt;person&gt;Harry&lt;/person&gt;
          &lt;/people&gt;
      &lt;/picture&gt;
  &lt;pictures&gt;
  </code></pre>
  
  <p>In one case, I need to search for pictures where place="Canada". I have an XPath that does this fine, as such:</p>
  
  <pre><code>$place = "Canada";
  $pics = ($pictures-&gt;xpath("//*[place='$place']"));
  </code></pre>
  
  <p>This pulls the entire "picture" node, so I am able to display title, description, etc.
  I have another need to find all pictures where person = $person. I use the same type query as above:</p>
  
  <pre><code>$person = "John";
  $pics = ($pictures-&gt;xpath("//*[person='$person']"));
  </code></pre>
  
  <p>In this case, the query apparently knows there are 2 pictures with John, but I don't get any of the values for the other nodes. I'm guessing it has something to do with the repeating child node, but can't figure out how to restructure the XPath to pull all of the picture node for each where I have a match on person. I tried using attributes instead of values (and modified the query accordingly), but got the same result. 
  Can anyone advise what I'm missing here?</p>