我一直在为特定的 SQL 查询表编写 XSL 样式表。我想按“tcode”对结果进行分组,并对每个数字列的值求和。任何帮助,将不胜感激。
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:strip-space elements="h_ind h_year h_code" />
<xsl:variable name="v_warning" select="CustomDeferredReport/title/ds_type" />
<xsl:template match="/">
<HTML>
<BODY>
<TABLE>
<TR valign="top">
<TD style="color:black; font-family: arial; font-size: 14pt; font-weight: bold" width="800">
<xsl:choose>
<xsl:when test="$v_warning = '1'">
<xsl:value-of select="CustomDeferredReport/title/rpt_title" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="CustomDeferredReport/title/rpt_warning" />
</xsl:otherwise>
</xsl:choose>
</TD>
</TR>
</TABLE>
<xsl:choose>
<xsl:when test="$v_warning = 1">
<TABLE>
<TR style="text-decoration: underline; font-family: arial; font-size: 8pt; font-weight: bold">
<BOLD>
<TD width="100">Code</TD>
<TD width="200">Name</TD>
<TD width="100">Beginning Balance</TD>
<TD width="100">Current Activity</TD>
<TD width="100">Other Activity</TD>
<TD width="100">Balance Sheet Only Activity</TD>
<TD width="100">Ending Balance</TD>
</BOLD>
</TR>
<xsl:for-each select='/CustomDeferredReport/temps'>
<TR style="font-family: arial; font-size: 8pt">
<TD><xsl:value-of select='tcode'/></TD>
<TD><xsl:value-of select='tname'/></TD>
<TD align="right"><xsl:value-of select='tbbal'/></TD>
<TD align="right"><xsl:value-of select='tdiff'/></TD>
<TD align="right"><xsl:value-of select='tothd'/></TD>
<TD align="right"><xsl:value-of select='tbsd'/></TD>
<TD align="right"><xsl:value-of select='tebal'/></TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>