Xslt xsl分组、排序和求和、合计。。?
应该对所有代理编号重复此操作Xslt xsl分组、排序和求和、合计。。?,xslt,xslt-1.0,Xslt,Xslt 1.0,应该对所有代理编号重复此操作 agent number :1 (sorted order) PendingIssues:yes(if yes) product type: 1 policy number:445(sorted order) annual premium:12000.0 policy number:446 annual premium:12000.0 sub total pending:24000(12000+12000) PendingIssues:
agent number :1 (sorted order)
PendingIssues:yes(if yes)
product type: 1
policy number:445(sorted order)
annual premium:12000.0
policy number:446
annual premium:12000.0
sub total pending:24000(12000+12000)
PendingIssues:yes(if yes)
product type: 2
policy number:555
annual premium:12000.0
policy number:556
annual premium:12000.0
sub total pending:24000(12000+12000)
AfterBusinessIssues:yes(if yes)
product type: 1
policy number:445
annual premium:12000.0
policy number:446
annual premium:12000.0
sub total after business:24000(12000+12000)
AfterBusinessIssuess:yes(if yes)
product type: 2
policy number:445
annual premium:12000.0
policy number:446
annual premium:12000.0
sub total after business:24000(12000+12000).
这里的代理编号和策略编号应该是按顺序排列的。之前我发布了相同的xml。我得到了答案,但现在这对我来说是一个挑战,请任何人帮助我
分享xsl请改正我做错的地方..感谢广告
grand total :sub total pending(all)+sub total after business(all)=24000(12000+12000)+24000(12000+12000)=48000
FR#:
波尔数
---
年保费
$
年度保费小计
未决业务
$
您能否显示您正在使用的XSLT以及您现在得到的结果(与您想要得到的结果相反,如上所示)?上面所示的输出是我必须使用XSLT实现的输出
grand total :sub total pending(all)+sub total after business(all)=24000(12000+12000)+24000(12000+12000)=48000
<xsl:template match="/">
<xsl:variable name="types" select="//policyResult"></xsl:variable>
<xsl:for-each select="$types">
<xsl:sort select="ProductType"/>
<xsl:if test="generate-id(.)=generate-id($types[ProductType=current()/ProductType][1])">
<xsl:value-of select="ProductType"></xsl:value-of>
<xsl:variable name="agents" select="$types[ProductType=current()/ProductType]"></xsl:variable>
<xsl:for-each select="$agents">
<xsl:sort select="PolicyNumber"/>
<xsl:if test="generate-id(.)=generate-id($agents[AgentNumber=current()/AgentNumber][1])">
<fo:table border-style="" width="100%" border-spacing="4">
<fo:table-body>
<fo:table-row border-left-style="solid" border-right-style="solid" border-after-style="solid">
<fo:table-cell>
<fo:block font-family="arial" font-size="10pt"
font-weight="normal">
<fo:inline>
FR#:<xsl:value-of select="AgentNumber"></xsl:value-of>
</fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<xsl:for-each select="$agents[AgentNumber=current()/AgentNumber]">
<fo:block>
<xsl:text> </xsl:text>
</fo:block>
<fo:block>
<xsl:text> </xsl:text>
</fo:block>
<fo:table border-style="" width="100%" border-spacing="4">
<fo:table-column column-width="25%" />
<fo:table-column column-width="25%" />
<fo:table-column column-width="25%" />
<fo:table-column column-width="25%" />
<fo:table-body>
<fo:table-row border-before-style="solid" border-left-style="solid" border-right-style="solid">
<fo:table-cell>
<fo:block font-family="arial" font-size="10pt"
font-weight="normal">
<fo:inline>
Pol Number
</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-family="arial" font-size="10pt"
font-weight="normal">
<fo:inline text-decoration="underline">
<xsl:value-of select="PolicyNumber"></xsl:value-of>---<xsl:value-of select="ProductType"></xsl:value-of>
</fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row border-left-style="solid" border-right-style="solid">
<fo:table-cell>
<fo:block font-family="arial" font-size="10pt"
font-weight="normal">
<fo:inline>
Annual Premium
</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-family="arial" font-size="10pt"
font-weight="normal">
<fo:inline>
$<xsl:value-of select="AnnualPremium"></xsl:value-of>
</fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:for-each>
<fo:table border-style="solid" width="100%" border-spacing="4">
<fo:table-body>
<fo:table-row border-after-style="solid">
<fo:table-cell text-align="right">
<fo:block font-family="arial" font-size="10pt"
font-weight="normal">
<fo:inline>
Annual Premium SubTotal
</fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell border-right-style="solid">
<fo:block font-family="arial" font-size="10pt"
font-weight="normal">
<fo:inline>
Pending Business
</fo:inline>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block font-family="arial" font-size="10pt" text-align="center"
font-weight="normal">
<fo:inline><!--
$<xsl:value-of select="sum(//policyResult[AgentNumber=$agentNum]/AnnualPremium)"></xsl:value-o
-->
$<xsl:value-of select="sum($agents[AgentNumber=current()/AgentNumber]/AnnualPremium)"></xsl:value-of>
</fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
<fo:block>
<xsl:text> </xsl:text>
</fo:block>
<fo:block id="last-page"/>
</xsl:template>