如何在通过XSLT转换为.xls文件时回转xml?
我的请求xml为: -
<?xml version="1.0" encoding="UTF-8"?>
<report>
<header>
<request_id>121</request_id><content_provider>ews</content_provider><report_date>2013-09-26</report_date>
</header>
<policy_detail><client_name>MR JOHN PHILIP GRACE</client_name><date_of_birth>1954-04-21</date_of_birth><policy_number>0081467839</policy_number><clawback>518.67</clawback><date_policy_inception>1992-08-07</date_policy_inception>106085</frn><master_agent_number>1212190</master_agent_number><agent_number>6354773</agent_number><clawback_date> </clawback_date>
</policy_detail>
<policy_detail><client_name>MISS LISA PORTER</client_name><date_of_birth>1970-05-18</date_of_birth><policy_number>0082625310</policy_number><clawback>463.72</clawback><date_policy_inception>1994-05-17</date_policy_inception><frn>106085</frn><master_agent_number>1212190</master_agent_number><agent_number>6366264</agent_number><clawback_date> </clawback_date>
</policy_detail>
<policy_detail><client_name>MRS ELAINE LOCKYER</client_name><date_of_birth>1957-09-07</date_of_birth><policy_number>0108791948</policy_number><clawback>64.98</clawback><date_policy_inception>2004-07-01</date_policy_inception><frn>106085</frn><master_agent_number>2178267</master_agent_number><agent_number>1212189</agent_number><clawback_date> </clawback_date>
</policy_detail>
<policy_detail><client_name>MR DEMETRIOUS PAPI</client_name><date_of_birth>1957-10-25</date_of_birth><policy_number>0019751627
</policy_number><clawback>427.71</clawback><date_policy_inception>1992-05-07</date_policy_inception><frn>106085</frn><master_agent_number>2001188</master_agent_number><agent_number>2009744</agent_number><clawback_date> </clawback_date>
</policy_detail>
<summary><policy_count>4</policy_count><clawback_total>1475.08</clawback_total>
</summary>
</report>
处理XSL是: -
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*">
<xsl:apply-template/>
</xsl:template>
<xsl:template match="policy_detail">
<xsl:value-of select="client_name"/>
</xsl:template>
在此之下,我必须根据特定的master_agent_no(即1212190)插入计算总回拨的代码。
答案 0 :(得分:1)
只需添加输出
的代码即可<xsl:value-of select="sum(//policy_detail[agent_number='1212190']/clawback)"/>
在样式表代码中的适当位置。