| Topic | xsl template : Adding calculation in a group header |
| Output | Groupe Name + Result of formula |
| Step | Description |
| 1 | Create the template
<xsl:template name="FieldRef_Text_body.Display_x0020_Name" ddwrt:dvt_mode="body" match ="FieldRef[@Name='Display_x0020_Name']" mode="Text_body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:param name="thisNode" select="."/>
<xsl:choose>
<xsl:when test="@AutoHyperLink='TRUE'">
<xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping ="yes"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$thisNode/@*[name()=current()/@Name]"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
|
| 2 | Add the calculation part (after param and before choose)
1° we will store in a variable the selection criterium for the calculation
<xsl:variable name="cname" select="$thisNode/@Display_x0020_Name" /> <xsl:variable name="WD select="sum($Rows/Row[@Display_x0020_Name = $cname]/@Work_x0020_Days)"/> |
| 3 | Add the calculation result (after the xsl:choose closing tag
<xsl:value-of select="$WD"/> |
| 4 | If you want to add space between info, just add the following
<xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"> </xsl:text> |
No comments:
Post a Comment