Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to apply conditional formatting to a date column? I'm trying to set the columns background to red if the date has passed using the following

<xsl:if test="normalize-space($thisNode/@Completion_x0020_Date) >= 'Today'" ddwrt:cf_explicit="1">background-color: #71B84F;</xsl:if>

Thanks, Jason

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I got this from a post about filtering and formatting with Date Values. At this point, the main problem is around the formatting of the comparison. This is xml so when the parser sees ">', it views as the closing bracket and not as a comparison. You need to encode this as

"&gt;=" 

for the comparison to be recognized.

<xsl:if test="number(translate(substringbefore
(@Modified_Recently$Modified_Recently_ISO,'T'), '-',''))
&gt;= number(translate(substring-before($Today,'T'),'-',''))">
background-color: #00FF00;
</xsl:if>
share|improve this answer
add comment

Your Answer

 
discard

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.