title: XSL using a variable with when test
body: <p>I am having much difficulty trying to operate on a variable value using <code>when test=...</code>.</p>
  
  <p>When I output <code>$tcbrand</code> it outputs <code>'Direct'</code> but when I operate on it, it returns <code>false</code> and hits the otherwise block. What am I doing wrong?</p>
  
  <pre><code>    &lt;fo:static-content flow-name="header-normal" font-size="10pt"&gt;  
  
                  &lt;xsl:variable name="tcbrand" select="smf:entity[@type='d2501b79-f888-4aa8-9fcf-a667a4c47c84']"/&gt;
  
                  &lt;fo:block font-size="10pt" text-align="left"&gt;
                      &lt;fo:inline font-weight="normal"&gt;Brand: &lt;xsl:value-of select="$tcbrand"/&gt;&lt;/fo:inline&gt;
                  &lt;/fo:block&gt;
  
                  &lt;xsl:choose&gt;
                      &lt;!--&lt;xsl:if test="$image = 'hello' "&gt;--&gt;
                      &lt;xsl:when test="string($tcbrand)='Direct'"&gt;
                          &lt;fo:block text-align="right" space-before="0mm"&gt;
                              &lt;fo:external-graphic src="url('C:\Program Files (x86)\numerointeractive\whitemail\Images\18-30.png')" /&gt;
                          &lt;/fo:block&gt;             
                      &lt;/xsl:when&gt;
  
                      &lt;xsl:otherwise&gt;                         
                              &lt;fo:block text-align="right" space-before="0mm"&gt;
                                  &lt;fo:external-graphic src="url('C:\Program Files (x86)\numerointeractive\whitemail\Images\ecom2.jpg')" /&gt;
                              &lt;/fo:block&gt;             
                      &lt;/xsl:otherwise&gt;                                
                  &lt;/xsl:choose&gt;
  </code></pre>
  
  <p>This is the xml that gets generated, which I am operating on:</p>
  
  <pre><code> &lt;smf:entity id="48659" type="d2501b79-f888-4aa8-9fcf-a667a4c47c84" confidence="1.0" author="2e0b99b3-9cba-4736-a59b-fe00b5f62871" validated="true" preferred="false" requiresComponentExtraction="false" changeTime="2012-11-26T14:47:28.840Z" nonPersistedId="false" modified="false"&gt;
             &lt;smf:value&gt;Direct&lt;/smf:value&gt;
          &lt;/smf:entity&gt;
  </code></pre>