title: Using XPath, How do I select a node based on its text content and value of an attribute?
body: <p>Given this XML:</p>
  
  <pre><code>&lt;DocText&gt;
  &lt;WithQuads&gt;
      &lt;Page pageNumber="3"&gt;
          &lt;Word&gt;
              July
              &lt;Quad&gt;
                  &lt;P1 X="84" Y="711.25" /&gt;
                  &lt;P2 X="102.062" Y="711.25" /&gt;
                  &lt;P3 X="102.062" Y="723.658" /&gt;
                  &lt;P4 X="84.0" Y="723.658" /&gt;
              &lt;/Quad&gt;
          &lt;/Word&gt;
          &lt;Word&gt;
          &lt;/Word&gt;
          &lt;Word&gt;
              30,
              &lt;Quad&gt;
                  &lt;P1 X="104.812" Y="711.25" /&gt;
                  &lt;P2 X="118.562" Y="711.25" /&gt;
                  &lt;P3 X="118.562" Y="723.658" /&gt;
                  &lt;P4 X="104.812" Y="723.658" /&gt;
              &lt;/Quad&gt;
          &lt;/Word&gt;
      &lt;/Page&gt;
  &lt;/WithQuads&gt;
  </code></pre>
  
  <p></p>
  
  <p>I'd like to find the nodes that have text of 'July' and a Quad/P1/X attribute Greater than 90. Thus, in this case, it should not return any matches. However, if I use GT (>) or LT (&lt;), I get a match on the first Word element. If I use eq (=), I get no match.</p>
  
  <p>So:</p>
  
  <pre><code>//Word[text()='July' and //P1[@X &lt; 90]]
  </code></pre>
  
  <p>will return true, as will</p>
  
  <pre><code>//Word[text()='July' and //P1[@X &gt; 90]]
  </code></pre>
  
  <p>How do I constrain this properly on the P1@X attribute?</p>
  
  <p>In addition, imagine I have multiple Page elements, for different page numbers. How would I additionally constrain the above search to find Nodes with <code>text()='July', P1@X &lt; 90</code>, and Page<code>@pageNumber=3</code>?</p>