troubleshooting Question

XSL - count based on calculated value

Avatar of lwebber
lwebber asked on
Web Languages and StandardsMicrosoft SharePoint
6 Comments1 Solution809 ViewsLast Modified:
I have a SharePoint data view web part based on a Task list. Task items have a field called @DueDate. I have created an XLS variable that uses the getDayDelta template from Marc Anderson's date_templates.xsl library. The attached code snippet shows the code for the table column that displays the "dueDateDelta", which is the number of days from today up to the DueDate. When the dueDateDelta is negative, the task is overdue.

This works perfectly, and my data vew web part shows the dueDateDelta correctly.

What I now need to do is include some xsl in the group header of the DVWP. I need to count up the number of rows with a dueDateDelta of < 0 (i.e. overdue tasks). I need a separate count of rows with a dueDateDelta > 0 and < 5. The end result will be a group header that displays the number of tasks that are overdue as well as the number of tasks that are close to being due.

I am stumped on how to do the XSL count. I need to restrict the count to rows where the table column whose ID = DDDelta (see the code snippet) has a value < 0. But how do I form an xsl count() that does this?  
<td class="ms-vb" id="DDDelta">
	<!-- get the delta in days between the due date and today -->
	<xsl:variable name="dueDateDelta">
		<xsl:call-template name="getDayDelta">
			<xsl:with-param name="paramDateA" select="@DueDate" />
			<xsl:with-param name="paramDateB" select="$Today" />
		</xsl:call-template>
	</xsl:variable>
	<xsl:if test="not(normalize-space(@DueDate) = '')">
		<span><xsl:value-of select="$dueDateDelta" /></span>
	</xsl:if>
</td>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros