title: Writing an xsl when clause with multiple conditions
body: <p>I'm fairly new to xslt so I may be missing something easy, but I can't seem to find it. I'm trying to construct a when clause with multiple condition. Herese what I have.</p>
  
  <pre><code>&lt;xsl:when test="(string-length(current()/SSN/text())) = 9 AND not(string(number(current()/SSN/text())) = 'NaN')"&gt;
      &lt;IdCodeQualifier&gt;
          &lt;xsl:value-of select="'34'" /&gt;
      &lt;/IdCodeQualifier&gt;
      &lt;SSN&gt;
          &lt;xsl:value-of select="current()/SSN/text()" /&gt;                  
      &lt;/SSN&gt;
  &lt;/xsl:when&gt;
  </code></pre>
  
  <p>This results in:</p>
  
  <blockquote>
    <p>XSLT compile error at (97,16). See InnerException for details. 'boolean((string-length(current()/SSN/text())) = 9 AND not(string(number(current()/SSN/text())) = 'NaN'))' is an invalid XPath expression. 'boolean((string-length(current()/SSN/text())) = 9 AND not(string(number(current()/SSN/text())) = 'NaN'))' has an invalid token.</p>
  </blockquote>
  
  <p>However this works fine.</p>
  
  <pre><code>&lt;xsl:when test="string-length(current()/SSN/text()) = 9"&gt;
      &lt;xsl:if  test="string(number(current()/SSN/text())) != 'NaN'"&gt;
          &lt;IdCodeQualifier&gt;
              &lt;xsl:value-of select="'34'" /&gt;
          &lt;/IdCodeQualifier&gt;
          &lt;SSN&gt;
              &lt;xsl:value-of select="current()/SSN/text()" /&gt;                  
          &lt;/SSN&gt;
      &lt;/xsl:if&gt;
  &lt;/xsl:when&gt;
  </code></pre>
  
  <p>So what am I missing?</p>