title: How to check if an attribute exists in a XML file using XSL
body: <p>At runtime I can have two formats of a XML file:</p>
  
  <ol>
  <li><pre><code>&lt;root&gt;
      &lt;diagram&gt; 
          &lt;graph color= "#ff00ff"&gt;    
              &lt;xaxis&gt;1 2 3 12 312 3123 1231 23 &lt;/xaxis&gt;
              &lt;yaxis&gt;1 2 3 12 312 3123 1231 23 &lt;/yaxis&gt;
          &lt;/graph&gt;  
      &lt;/diagram&gt; 
  &lt;/root&gt;
  </code></pre></li>
  <li><pre><code>&lt;root&gt;
      &lt;diagram&gt; 
          &lt;graph&gt;    
              &lt;xaxis&gt;1 2 3 12 312 3123 1231 23 &lt;/xaxis&gt;
              &lt;yaxis&gt;1 2 3 12 312 3123 1231 23 &lt;/yaxis&gt;
          &lt;/graph&gt;  
      &lt;/diagram&gt; 
  &lt;/root&gt;
  </code></pre></li>
  </ol>
  
  <p>Depending on the presence of the color attribute 
  i have to process the values of the xaxis and yaxis.</p>
  
  <p>I need to do this using XSL.
  Can anyone help me in hinting me a snippet where i can check these condtions.</p>
  
  <p>I tried using </p>
  
  <pre><code>&lt;xsl: when test="graph[1]/@color"&gt;
       //some processing here using graph[1]/@color values
  &lt;/xsl:when&gt;
  </code></pre>
  
  <p>i got an error ...</p>