title: What is the difference between XSLT attributes when and if
body: <p>What is the difference between two given below codes? Both codes checks whether an attribute exists in a tag or not:</p>
  
  <pre><code>&lt;xsl:choose&gt;
    &lt;xsl:when test="string-length(DBE:Attribute[@name='s0SelectedSite']/node()) &amp;gt; 0"&gt; 
      &lt;table&gt;
          ...
      &lt;/table&gt;
    &lt;/xsl:when&gt;
    &lt;xsl:otherwise&gt;
      &lt;table&gt;
          ...
      &lt;/table&gt;
    &lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;xsl:if test="@Col1-AllocValue"&gt; 
      &lt;xsl:copy-of select="@Col1-AllocValue"/&gt;
  &lt;/xsl:if&gt;
  </code></pre>