title: Extract data from XML using ksh script
body: <p>The first question I asked on this topic was closed because of lack of info. So asking this again with some more details added.</p>
  
  <p>I have to extract a value given in one tag from a xml file and I have to do it using ksh (I can solve this in perl but I have to do it ksh, cannot use third party tools like xmlsh)</p>
  
  <p>sample.xml</p>
  
  <pre><code>&lt;?xml version="1.0" standalone="yes" ?&gt;
  &lt;parent_one&gt;
    &lt;parent_two&gt;
      &lt;Pool&gt;
        &lt;pool_name&gt;ABC&lt;/pool_name&gt;
        &lt;percent_full&gt;79&lt;/percent_full&gt;
        &lt;pool_state&gt;Enabled&lt;/pool_state&gt;
      &lt;/Pool&gt;
      &lt;Pool&gt;
        &lt;pool_name&gt;DEF&lt;/pool_name&gt;
        &lt;percent_full&gt;40&lt;/percent_full&gt;
        &lt;pool_state&gt;Enabled&lt;/pool_state&gt;
      &lt;/Pool&gt;
      &lt;Pool&gt;
        &lt;pool_name&gt;XYZ&lt;/pool_name&gt;
        &lt;percent_full&gt;40&lt;/percent_full&gt;
        &lt;pool_state&gt;Disabled&lt;/pool_state&gt;
      &lt;/Pool&gt; 
      &lt;Totals&gt;
        &lt;total_tracks&gt;4546456&lt;/total_tracks&gt;
        &lt;percent_full&gt;48&lt;/percent_full&gt;
      &lt;/Totals&gt;
    &lt;/parent_two&gt;
  &lt;/parent_one&gt;
  </code></pre>
  
  <p>The ksh script should read sample.xml and print ABC, DEF from pool_name tag because the corresponding pool_state tag is enabled. It should not print XYZ because its pool_state tag is disabled.</p>
  
  <p>The ksh script would read sample.xml and output the following</p>
  
  <p>ABC</p>
  
  <p>DEF</p>
  
  <p>Is this feasible in ksh or do I have to use perl for this?</p>