title: Less complex XPath expression with XML namespace
body: <p>I extract values from XML with namespace using xpath. The XML has namespaces. I find the below <code>local-name</code> a bit complex. Is there a way to achieve the same with a less complex expression? The below example is in Python3 on Ubuntu Linux.  I would prefer a generic solution to a specific programming language or environment.</p>
  
  <pre><code>$ cat getname.py 
  from lxml import etree
  tree = etree.parse("data.xml")
  root = tree.getroot()
  r = tree.xpath("//*[local-name()='term'][@*[local-name()='id' and .='W08003']]")
  for i in r: 
      print (i.text)
  
  $ cat data.xml
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;soap:Body&gt;
      &lt;ns2:ucReply xmlns:ns1="http://www.uc.se/schemas/ucOrderRequest/" xmlns:ns2="http://www.uc.se/schemas/ucOrderReply/"&gt;
        &lt;ns2:status ns2:result="ok"/&gt;
        &lt;ns2:ucReport&gt;
          &lt;ns2:xmlReply&gt;
            &lt;ns2:reports ns2:lang="swe"&gt;
              &lt;ns2:report ns2:index="0"&gt;
                &lt;ns2:group ns2:name="ID-uppgifter, fysiker" ns2:key="" ns2:index="0" ns2:id="W080"&gt;
                  &lt;ns2:term ns2:id="W08001"&gt;9550908890&lt;/ns2:term&gt;
                  &lt;ns2:term ns2:id="W08002"&gt;8477362551&lt;/ns2:term&gt;
                  &lt;ns2:term ns2:id="W08003"&gt;Medel Svensson&lt;/ns2:term&gt;
                  &lt;ns2:term ns2:id="W08004"&gt;Högvägen 1&lt;/ns2:term&gt;
                  &lt;ns2:term ns2:id="W08005"&gt;45171&lt;/ns2:term&gt;
                  &lt;ns2:term ns2:id="W08006"&gt;Uddevalla&lt;/ns2:term&gt;
                  &lt;ns2:term ns2:id="W08018"&gt;S&lt;/ns2:term&gt;
                &lt;/ns2:group&gt;
              &lt;/ns2:report&gt;
            &lt;/ns2:reports&gt;
          &lt;/ns2:xmlReply&gt;
        &lt;/ns2:ucReport&gt;
      &lt;/ns2:ucReply&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  $ python3 getname.py 
  Medel Svensson
  $ 
  
  </code></pre>