title: Extract values conditionally from namespaced XML using XPath
body: <p>I need to extract some info from a XML using XPath ... the XML is like the following ...</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;feed xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" &gt;
     &lt;title type="text"&gt;DataEntities&lt;/title&gt;
     &lt;m:count&gt;4&lt;/m:count&gt;
     &lt;entry&gt;
        &lt;id&gt;0001&lt;/id&gt;
        &lt;title type="text"&gt;DataEntities&lt;/title&gt;
        &lt;content type="application/xml"&gt;
           &lt;m:properties&gt;
              &lt;d:internalId&gt;5b1daf597f3aee4f0d93e1ed&lt;/d:internalId&gt;
              &lt;d:datasetVersion&gt;2&lt;/d:datasetVersion&gt;
              &lt;d:Product&gt;PRODUCT0001&lt;/d:Product&gt;
              &lt;d:Version&gt;6.0.0&lt;/d:Version&gt;
              &lt;d:Middleware&gt;Apache WebServer&lt;/d:Middleware&gt;
              &lt;d:Versionmiddleware&gt;2.2.31&lt;/d:Versionmiddleware&gt;
              &lt;d:Hostname&gt;server01.mydomain.com&lt;/d:Hostname&gt;
              &lt;d:Technology&gt;PHP&lt;/d:Technology&gt;
           &lt;/m:properties&gt;
        &lt;/content&gt;
     &lt;/entry&gt;
     &lt;entry&gt;
       &lt;id&gt;0002&lt;/id&gt;
       &lt;title type="text"&gt;DataEntities&lt;/title&gt;
       &lt;content type="application/xml"&gt;
          &lt;m:properties&gt;
             &lt;d:internalId&gt;5b1daf345f3aee4f0d34e1ed&lt;/d:internalId&gt;
             &lt;d:datasetVersion&gt;2&lt;/d:datasetVersion&gt;
             &lt;d:Product&gt;PRODUCT0002&lt;/d:Product&gt;
             &lt;d:Version&gt;1.0.0&lt;/d:Version&gt;
             &lt;d:Middleware&gt;Apache WebServer&lt;/d:Middleware&gt;
             &lt;d:Versionmiddleware&gt;2.2.31&lt;/d:Versionmiddleware&gt;
             &lt;d:Hostname&gt;server02.mydomain.com&lt;/d:Hostname&gt;
             &lt;d:Technology&gt;Java&lt;/d:Technology&gt;
          &lt;/m:properties&gt;
       &lt;/content&gt;
     &lt;/entry&gt;
     &lt;entry&gt;
       &lt;id&gt;0003&lt;/id&gt;
       &lt;title type="text"&gt;DataEntities&lt;/title&gt;
       &lt;content type="application/xml"&gt;
          &lt;m:properties&gt;
             &lt;d:internalId&gt;5b1daf123f3aee4f0d33e1ed&lt;/d:internalId&gt;
             &lt;d:datasetVersion&gt;2&lt;/d:datasetVersion&gt;
             &lt;d:Product&gt;PRODUCT0003&lt;/d:Product&gt;
             &lt;d:Version&gt;5.0.0&lt;/d:Version&gt;
             &lt;d:Middleware&gt;Apache WebServer&lt;/d:Middleware&gt;
             &lt;d:Versionmiddleware&gt;2.2.31&lt;/d:Versionmiddleware&gt;
             &lt;d:Hostname&gt;server01.mydomain.com&lt;/d:Hostname&gt;
             &lt;d:Technology&gt;PHP&lt;/d:Technology&gt;
          &lt;/m:properties&gt;
       &lt;/content&gt;
     &lt;/entry&gt;
     &lt;entry&gt;
       &lt;id&gt;0004&lt;/id&gt;
       &lt;title type="text"&gt;DataEntities&lt;/title&gt;
       &lt;content type="application/xml"&gt;
          &lt;m:properties&gt;
             &lt;d:internalId&gt;5b1daf345f3aee4f0d34e1ed&lt;/d:internalId&gt;
             &lt;d:datasetVersion&gt;2&lt;/d:datasetVersion&gt;
             &lt;d:Product&gt;PRODUCT0004&lt;/d:Product&gt;
             &lt;d:Version&gt;4.0.0&lt;/d:Version&gt;
             &lt;d:Middleware&gt;Apache WebServer&lt;/d:Middleware&gt;
             &lt;d:Versionmiddleware&gt;2.2.31&lt;/d:Versionmiddleware&gt;
             &lt;d:Hostname&gt;server01.mydomain.com&lt;/d:Hostname&gt;
             &lt;d:Technology&gt;PHP&lt;/d:Technology&gt;
          &lt;/m:properties&gt;
       &lt;/content&gt;
     &lt;/entry&gt;
  &lt;/feed&gt;
  </code></pre>
  
  <p><strong>What I need is to find the products that are on the same hostname,</strong> for example fixing the server like "server01.mydomain.com" to extract, as result, PRODUCT0001, PRODUCT0003 and PRODUCT0004 (note NOT PRODUCT0002), or, fixing the server like "server02.mydomain.com" to extract , as result, only PRODUCT0002.</p>
  
  <p>I've tried to use</p>
  
  <pre><code>//d:Product
  </code></pre>
  
  <p>and it works and the result is</p>
  
  <pre><code>Element='&lt;d:Product xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"&gt;PRODUCT0001&lt;/d:Product&gt;'
  Element='&lt;d:Product xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"&gt;PRODUCT0002&lt;/d:Product&gt;'
  Element='&lt;d:Product xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"&gt;PRODUCT0003&lt;/d:Product&gt;'
  Element='&lt;d:Product xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"&gt;PRODUCT0004&lt;/d:Product&gt;'
  </code></pre>
  
  <p>I don't know how to indicate that I need "only" the products that are on the <code>d:Hostname</code> value "server01.mydomain.com"</p>
  
  <p>I've tried using </p>
  
  <pre><code>//d:Product/@d:Hostname['server01.mydomain.com']
  </code></pre>
  
  <p>but it doesn't work.</p>
  
  <p>Any suggestions about the XPath syntax I have to use?</p>