title: How to use xslt with attribute values as selectors ?
body: <p>I am trying to learn xslt and i am working an xml which looks like this. </p>
  
  <pre><code>&lt;Beats&gt;
   &lt;Beat&gt;
     &lt;Personal type="set"&gt;
        &lt;Usages type="box"&gt;
         1233
        &lt;/Usages&gt;
        &lt;NonUsages type="box"&gt;
         4122
        &lt;/NonUsages&gt;
     &lt;/Personal&gt;
  
     &lt;NonPersonal type="unset"&gt;
        &lt;Damages type="box"&gt;
         6466
        &lt;/Damages&gt;
        &lt;NonDamages type="box"&gt;
         5544
        &lt;/NonUsages&gt;
     &lt;/NonPersonal&gt;
  
     &lt;Confidential type="set"&gt;
        &lt;Discounts type="box"&gt;
         1233
        &lt;/Discounts&gt;
        &lt;NonDiscounts type="box"&gt;
         4122
        &lt;/NonDiscounts&gt;
     &lt;/Confidential&gt;
  
   &lt;/Beat&gt;
  &lt;/Beats&gt;
  </code></pre>
  
  <p>My Current aim is to just print out the numbers inside the inner tags. But i cannot use the names of the tags as selectors as only the attribute 'type'is of importance. I tried using the following xslt. But it didnt seem to work. </p>
  
  <pre><code>&lt;xsl:output method="text"/&gt;
  &lt;xsl:template match="*"&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;h2&gt; Test&lt;/h2&gt;
  &lt;xsl:for-each select="//Beats/Beat/[@type='set']"&gt;
     &lt;xsl:value-of select="[@type='box'] /&gt;
     &lt;br/&gt;
  &lt;/xsl:for-each&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>What am i doing wrong ? </p>
  
  <p>And one more thing i couldnt figure out was how to get the name of tags while using attributes as selectors. Instead of </p>
  
  <pre><code>&lt;xsl:value-of select="[@type='box'] /&gt;
  </code></pre>
  
  <p>which gives whats inside the tag; what can i use to get the name of the tag which contains this 'type=box' attribute ? (For. eg Usages, NonUsages, etc..)</p>