SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am aware of the various methods to colorcode columns (jquery, formula) I choose here to use designer on allitems.aspx on a list (im lazy and its easy).

I have given various columns background colors based on their values using xsl styles e.g. date > xx fine.

However... now i notice i have 1 calculated column in there (which display different numbers based on two others columns) where the xsl does not show the background color.

<xsl:attribute name="style">
    <xsl:if test="$thisNode/@Level. &lt; 4" ddwrt:cf_explicit="1" xmlns:ddwrt="">background-color: #33CC33;</xsl:if>

    <xsl:if test="$thisNode/@Level. &gt; 4 and $thisNode/@Level. &lt; 9" ddwrt:cf_explicit="1" xmlns:ddwrt="">background-color: #FFFF00;</xsl:if>

    <xsl:if test="$thisNode/@Level. &gt; 9 and $thisNode/@Level. &lt; 17" ddwrt:cf_explicit="1" xmlns:ddwrt="">background-color: #FF9900;</xsl:if>

    <xsl:if test="$thisNode/@Level. &gt; 16" ddwrt:cf_explicit="1" xmlns:ddwrt="">background-color: #FF0000; color: #FFFFFF;</xsl:if>


When I try to Google for this I find all the hits on "using a calculated column to display colorcoded fields" but I cant find "using designer XSL to colorcode background on a calculated column".

Should I add something extra in there, sort of delayed processing or should I add a jquery clause specifically for this column?

share|improve this question
Isn't it ironic that you use this method because it's easy, but can't get it to work? – Christophe May 10 '13 at 17:08
@Christophe : got it to work, answered it. Forgot it was txt. – edelwater May 11 '13 at 1:14

The field is text so... need to convert it back to numeric e.g.:

xsl:if test="number($thisNode/@Level) &lt; '12'" 

etc... works great.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.