title: xmlstarlet select value
body: <p>This is the xml-data: </p>
  
  <pre><code>&lt;DATA VERSION="1.0"&gt;
    &lt;TABLES&gt;
      &lt;ITEM&gt;
        &lt;identifyer V="1234"&gt;&lt;/identifyer&gt;
        &lt;property1 V="abcde"&gt;&lt;/property1&gt;
        &lt;Property2 V="qwerty"&gt;&lt;/property2&gt;
      &lt;/ITEM&gt;
      &lt;ITEM&gt;
        &lt;identifyer V="5678"&gt;&lt;/identifyer&gt;
        &lt;Property1 V="zyxwv"&gt;&lt;/property1&gt;
        &lt;Property2 V="dvorak"&gt;&lt;/property2&gt;
      &lt;/ITEM&gt;
    &lt;/TABLES&gt;
  &lt;/DATA&gt;
  </code></pre>
  
  <p>I am trying to find <code>property2</code> of the item where <code>identifyer</code> has value <code>1234</code>. I can select the data: </p>
  
  <pre><code>$ xmlstarlet sel -t -c "/DATA/TABLES/ITEM/identifyer [@V=1234]" test.xml 
  &lt;identifyer V="1234"/&gt;
  </code></pre>
  
  <p>Two types of output would be desirable: </p>
  
  <pre><code>$ xmlstarlet &lt;some magic&gt;
  &lt;identifyer V="1234"&gt;&lt;/identifyer&gt;
  &lt;property1 V="abcde"&gt;&lt;/property1&gt;
  &lt;Property2 V="qwerty"&gt;&lt;/property2&gt;
  </code></pre>
  
  <p>And: </p>
  
  <pre><code>$ xmlstarlet &lt;some magic&gt;
  qwerty
  </code></pre>