title: xmlstarlet XPath expression selects single result rather than multiple
body: <p>I have an XML file having structure like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;hudson&gt;
      &lt;authorizationStrategy&gt;
          &lt;roleMap type="globalRoles"&gt;
              &lt;role name="Employees"&gt;
                  &lt;assignedSIDs&gt;
                      &lt;sid&gt;abc&lt;/sid&gt;
                      &lt;sid&gt;bcd&lt;/sid&gt;                      
                  &lt;/assignedSIDs&gt;
              &lt;/role&gt;
          &lt;/roleMap&gt;
          &lt;roleMap type="projectRoles"&gt;   
              &lt;role name="test1" pattern=".*"&gt;
                  &lt;assignedSIDs&gt;
                      &lt;sid&gt;abc&lt;/sid&gt;
                      &lt;sid&gt;zxc&lt;/sid&gt;
                  &lt;/assignedSIDs&gt;
              &lt;/role&gt;
              &lt;role name="test2" pattern=".*"&gt;
                  &lt;permissions/&gt;
                  &lt;assignedSIDs&gt;
                      &lt;sid&gt;abc&lt;/sid&gt;
                      &lt;sid&gt;ghi&lt;/sid&gt;
                  &lt;/assignedSIDs&gt;
              &lt;/role&gt;
              &lt;role name="test3" pattern=".*"&gt;
                  &lt;permissions/&gt;
                  &lt;assignedSIDs&gt;
                      &lt;sid&gt;abc&lt;/sid&gt;
                  &lt;/assignedSIDs&gt;
              &lt;/role&gt;
          &lt;/roleMap&gt;
      &lt;/authorizationStrategy&gt;
  &lt;/hudson&gt;
  </code></pre>
  
  <p>Previously, I didn't gave the whole structure in question and the xpath i got in solution, didn't gave the result what I expected (on my system, but it gave to the person who answered my question) in following link <a href="https://stackoverflow.com/questions/33037486/search-tag-attribute-value-based-on-child-node-value-using-xmlstarlet">search tag attribute value based on child node value using XmlStarlet</a></p>
  
  <p>AS mentioned in that link, I want to find role tag name attribute based on value of sid tag. for eg: if I search for abc, the query must return Employees, test1, test2 and test3.</p>
  
  <p>Here's the script I used:</p>
  
  <pre><code>xmlstarlet sel -t -v "//role[.//sid = 'abc']/@name" test.xml
  </code></pre>
  
  <p>but it gave me only 'Employees'.</p>
  
  <p>I am using LINUX /bash. Please tell me, what I am missing in XPATH expression. </p>