Conditional Formatting

DreyTech
DreyTech used Ask the Experts™
on
I need to know how to code in XSL for SharePoint 2010 (via SharePoint Designer) the following statement for a webpart:

If the created date of an item is older than two days, show alert icon on alert column.
Web Part
The conditional formatting would be something like this:

<td align="center">
            <xsl:attribute name="style">
                        <xsl:if test="ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($thisNode/@Created))) &lt; ddwrt:DateTimeTick(ddwrt:GenDisplayName(string($Today)))" ddwrt:cf_explicit="1">color: #FF0000;</xsl:if>
            </xsl:attribute>
            <span class="fa fa-exclamation" />
</td>


I have not been able to get this to work. It is a custom webpart with filters already applied to it.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jamie McAllisterCloud Expert
Most Valuable Expert 2013
Top Expert 2014

Commented:
I did something very similar to that here; http://the-north.com/sharepoint/post/Replace-Task-List-Status-Column-with-Icons-in-SharePoint-2010

See if that guidance helps.

Author

Commented:
Hello Jamie! Thank you for the prompt answer, it is helpful, however, this is not what I am looking for.

I need to show the alert icon if a case has been open for more than 2 days. So if for example I were to create a case today (june 11, 2015), the alert icon should pop up two days later (june 13, 2015).

Is there any way to calculate this using xsl so that I can use it on my webpart?
Cloud Expert
Most Valuable Expert 2013
Top Expert 2014
Commented:
I dabble in XSL, but I'm not able to present a full expression here for use outside of SPD. What I can do is show you how to do it like the tutorial I wrote.

You'd follow the steps on my blog but when defining the expression click Advanced;
Advanced button
The XSL to use is this; not(ddwrt:IfNew((ddwrt:GenDisplayName(string($thisNode/@Created)))))

This will highlight anything created more than two days ago.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial