title: "choose when" with variables XSLT
body: <p>I want to set the color of a table row according to the float value ..</p>
  
  <pre><code>....
  &lt;xsl:variable name="percent"&gt;
  &lt;xsl:value-of select="float(PercentageValue)" /&gt;
  &lt;/xsl:variable&gt;
  &lt;xsl:variable name="color"&gt;
  &lt;xsl:choose&gt;
  &lt;xsl:when test="$PercentageValue &amp;ge; 75.0"&gt;green&lt;/xsl:when&gt;
  &lt;xsl:when test="$PercentageValue &amp;lt; 75.0 and $PercentageValue &amp;ge; 50.0"&gt;orange&lt;/xsl:when&gt;
  &lt;xsl:otherwise&gt;red&lt;/xsl:otherwise&gt;
  &lt;/xsl:choose&gt;
  &lt;/xsl:variable&gt;
  &lt;tr bgcolor="$color"&gt;
  ....
  </code></pre>
  
  <p>what i want is ..</p>
  
  <pre><code>if(percent&gt;=75)
  tableRowColor=green;
  else if(percent&gt;=50.0 &amp;&amp; percent &lt;75.0)
  tableRowColor=orange;
  else
  tableRowColor=red;
  </code></pre>
  
  <p>Im relatively new to XSLT syntax .. what is the problem present above?
  Help appreciated!</p>
  
  <p>Edit 1: Sorry a typo while copy pasting for the variable being $PercentageValue
  Here is what ive done now ..</p>
  
  <pre><code>....
  &lt;xsl:variable name="PercentageValue"&gt;
          &lt;xsl:value-of select="number(percent)" /&gt;
      &lt;/xsl:variable&gt;
      &lt;xsl:variable name="color"&gt;
          &lt;xsl:choose&gt;
              &lt;xsl:when test="$PercentageValue &amp;gt;= 75.0"&gt;green&lt;/xsl:when&gt;
              &lt;xsl:when test="$PercentageValue &amp;lt; 75.0 and $PercentageValue &amp;gt;= 50.0"&gt;orange&lt;/xsl:when&gt;
              &lt;xsl:otherwise&gt;red&lt;/xsl:otherwise&gt;
          &lt;/xsl:choose&gt;
      &lt;/xsl:variable&gt;
  &lt;tr bgcolor="$color"&gt;
  .....
  </code></pre>
  
  <p>Now i do get the colors but all are black ..why so?</p>
  
  <p>Here is how im displaying
  <img src="https://i.stack.imgur.com/5HSFZ.png" alt="Without using any bgcolor attribute for tr ">
  Percentage values are at the end .. which is selected in a td for that tr so it does get displayed .. 
  actually the whole xml and xsl are dynamically generated via java, therefore there is alot of precision(double) over there . .does that cause a problem?</p>