title: xsl:choose Expression must evaluate to a node-set
body: <p>I am working with <code>C#</code> and <code>XSLT 2.0</code>. I am having problem with one of templates, it seems to be falling over <code>&lt;xsl:choose&gt;</code> statement. Values passed are <code>Key</code> - <code>Value</code> pairs and all but two values are decimals. Intention is to format decimals with 2 decimal places and <code>,</code> on thousands while integers should be without decimal places.</p>
  
  <pre><code>&lt;xsl:choose&gt;
        &lt;xsl:when test="Key='Seller count' || Key='Buyer count'"&gt;
          &lt;td&gt;
            &lt;xsl:value-of select="format-number(Value, '0')"/&gt;
          &lt;/td&gt;
        &lt;/xsl:when&gt;
        &lt;xsl:otherwise&gt;
          &lt;td&gt;
            &lt;xsl:value-of select="format-number(Value, '#,##0.00')"/&gt;
          &lt;/td&gt;
        &lt;/xsl:otherwise&gt;
      &lt;/xsl:choose&gt;` 
  </code></pre>
  
  <p>is giving me </p>
  
  <pre><code>An exception of type 'System.Xml.Xsl.XslTransformException' occurred in     System.Data.SqlXml.dll but was not handled in user code
  
  Additional information: Expression must evaluate to a node-set.
  </code></pre>
  
  <p>Which is somewhat surprising as it gets opening and closing <code>&lt;td&gt; &lt;/td&gt;</code> into both <code>when</code> and <code>otherwise</code>.</p>
  
  <p>I am assuming that this is something obvious that I am failing to see.</p>