我这里是循环一个月的数据
<!--days是每个月的天数-->
<xsl:variable name="days">
<xsl:value-of select="/root/row[1]/@days" />
</xsl:variable>
<xsl:call-template name="loop">
<xsl:with-param name="i" select="1" />
<xsl:with-param name="maxCount" select="$days" />
</xsl:call-template>
<xsl:template name="loop">
<xsl:param name="i" select="0" />
<xsl:param name="maxCount" select="0" />
<xsl:value-of select="$i" />,
<xsl:param name="tempvalue" select="format-number(sum(/root/row/@*[substring-after(name(.), 'Gather')=$i]),'########0')" />
<!--这里是要留意的,/root/row/@*[substring-after(name(.), 'Gather')=$i]),表示"/root/row/Gather"后面加 1~X 即/root/row/Gather1,/root/row/Gather2,/root/row/Gather3,...,/root/row/GatherX-->
<xsl:value-of select="$tempvalue" />,
<!--xsl:value-of select="./@*[$i+16]" /-->
<xsl:if test="$i < $maxCount">
<xsl:call-template name="loop">
<xsl:with-param name="i" select="$i+1" />
<xsl:with-param name="maxCount" select="$maxCount" />
</xsl:call-template>
</xsl:if>
</xsl:template>