How to limit results in a SharePoint XSL query

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-12-29T08:46:24Z Indexed on 2010/12/29 8:54 UTC
Read the original article Hit count: 337

Filed under:
|
|
|

Hello all, I am creating a SharePoint site that we will use to report issues with trucks used in our business. Linked to the list I have created will be a page that will display an overview of the trucks and a little truck icon will show the trucks current status. Green and the truck is okay (no open issues), Red and the truck have an open issue with status "Undrivable", Orange and there is two issues open that requires the user to look further into the truck before using it and finally a Gray truck for when there is a new issue created that has not been looked into (not sure if it is drivable or not).

I have managed to create the "Dashboard" and with my limit XSL/XPATH knowledge been able to add a truck and replicate the description above but... in my test I have created 4 issues, for example if three of them are changed to status Closed and one left to Undrivable I will get four icons on the page, three with Green trucks and the last one Red. So in theory it works but I obviously only want to see the last truck, one truck. I am not interested in seeing the others.

<xsl:template name="dvt_1.rowview">
 <xsl:variable name="CountReport" select="count(/dsQueryResponse/Rows/Row[@Highloader='GGEU12' and @Status!='Closed'])" />
 <xsl:variable name="MoreThan" select="$CountReport &gt; 1" />
 <xsl:variable name="NoReports" select="$CountReport = 0" />
 <xsl:variable name="Closed" select=" @Highloader='GGEU12' and @Status='Closed'" />
<xsl:choose>
<xsl:when test="$MoreThan">
<div class="ms-vb"><img title='More than one report exist!' border='0' alt='In Progress' src='highloader/Library/hl-orange.png' /></div>
</xsl:when>
<xsl:otherwise>
   <div class="ms-vb"><xsl:value-of disable-output-escaping="yes" select="@Icon" /></div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

My hope is that someone with slightly more knowledge can find the last piece of the puzzle for me! Thanks for reading and asking questions to fill any gap I left above.

David

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about query