1
我試圖計算for循環中的記錄數及其值(對於特定列)的總和。請找到下面的代碼並給我建議。XSLT 2.0如何爲每個組循環添加a的值
<xsl:for-each-group select="current-group()" group-by="CostCentre/PCCode">
<!-- variables for each pc code -->
<xsl:variable name="chargeRate" select="SpaceTariffGroup/ChargeRate"/>
<xsl:variable name="dedicatedArea"
select="sum((current-group()[SpaceType/ChargeBackType = $chargeBackTypeDedicatedArea]/(Area*CalculationFactor)))"/>
<xsl:variable name="floorFactor"
select="$dedicatedArea div ($totalDedicatedAreaPerFloor)"/>`enter code here`
<xsl:variable name="floorCommonArea"
select="$floorFactor * $totalFloorCommonAreaPerFloor"/>
<xsl:variable name="dedicatedAndFloorCommonArea"
select="($dedicatedArea + $floorCommonArea)"/>
<xsl:variable name="totalChargedArea"
select="$dedicatedAndFloorCommonArea"/>
<xsl:variable name="totalChargedAmount"
select="$chargeRate * $totalChargedArea"/>
<xsl:value-of select="$totalChargedArea"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="$totalChargedAmount"/>
enter code here
</xsl:for-each-group>
會打印這樣的東西。 100,5000 200,5000 300,5000 400,5000
我想這樣的輸出中。 100,5000 200,5000 300,5000 400,5000 4,20000(這最後一排是總的記錄,這些記錄的值之和)不知道我怎樣才能得到它