Sunday, 21 February 2016

Create a DashBoard Using XSLT with Statuswise Count to Assignee

<Xsl>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
             exclude-result-prefixes="msxsl" xmlns:ddwrt2="urn:frontpage:internal">

<xsl:output method='html' indent='yes'/>
<xsl:key name="Grouping" match="Row" use="@AssignedTo.id" />

<xsl:template match='dsQueryResponse' xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">


<table id="tbl1" cellpadding="10" cellspacing="0" border="0" style="padding:0px;" class="tableRound">
<xsl:apply-templates select='Rows/Row'/>
</table>
</xsl:template>
<xsl:template match='/' xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
<tr>
<td style="font-weight:bold; color:#002276">Assign To</td>
<td style="font-weight:bold; color:#002276">Completed</td>
<td style="font-weight:bold; color:#002276">In Progress</td>
<td style="font-weight:bold; color:#002276">Not Started</td>
<td style="font-weight:bold; color:#002276">Waiting on someone else</td>
</tr>

<xsl:for-each select="/dsQueryResponse/Rows/Row[generate-id(.)=generate-id(key('Grouping',@AssignedTo.id))]/@AssignedTo.id">
<xsl:sort />

<tr>

<td width="58%"><xsl:value-of select="key('Grouping',.)/@AssignedTo" disable-output-escaping="yes" /></td>
<td width="10%"><xsl:value-of select="count(key('Grouping',.)[@Status='Completed'])" disable-output-escaping="yes"></xsl:value-of></td>
<td width="10%"><xsl:value-of select="count(key('Grouping',.)[@Status='In Progress'])" disable-output-escaping="yes"></xsl:value-of></td>
<td width="10%"><xsl:value-of select="count(key('Grouping',.)[@Status='Not Started'])" disable-output-escaping="yes"></xsl:value-of></td>
<td width="10%"><xsl:value-of select="count(key('Grouping',.)[@Status='Waiting on someone else'])" disable-output-escaping="yes"></xsl:value-of></td>



</tr>

</xsl:for-each>  

</xsl:template>
</xsl:stylesheet></Xsl>

No comments:

Post a Comment