1

我想使用如下所示的 RTF 模板生成报告:

预期输出:

US
Cover   Insured
123456  INS1, INSB, INSA
987654  INS2

or

US
Cover   Insured
123456  INS1
        INSB
        INSA
987654  INS2

此处“被保险人”数据存在于具有不同标签名称的父级和子级层次结构中。应首先显示父“InsuredAccnt”(我的 XML 中的 INS1),然后显示子“InsuredAccounts”,该子“InsuredAccounts”将按“共享”排序 - 降序。

XML:

<?xml version="1.0" encoding="UTF-8" ?> 
<InsuredReport>
<GroupPolicies>
  <Cover>123456</Cover> 
  <Customer>Customer</Customer>
  <InsuredAccnt>INS1</InsuredAccnt>       
  <Organization>US</Organization> 
  <ListOfGroupPolicies_InsuredAccount>
     <GroupPolicies_InsuredAccount>
        <InsuredAccount>INSA</InsuredAccount> 
        <Share>5</Share> 
     </GroupPolicies_InsuredAccount>
     <GroupPolicies_InsuredAccount>
        <InsuredAccount>INSB</InsuredAccount> 
        <Share>20</Share> 
     </GroupPolicies_InsuredAccount>
  </ListOfGroupPolicies_InsuredAccount>
</GroupPolicies>
<GroupPolicies>
  <Cover>987654</Cover> 
  <Customer>ABC</Customer>
  <InsuredAccnt>INS2</InsuredAccnt>       
  <Organization>US</Organization> 
  <ListOfGroupPolicies_InsuredAccount />
</GroupPolicies>
</InsuredReport>

我不确定如何上传使用的 RTF,但这是相同的要点:

RTF:

<?for-each-group:GroupPolicies;./Organization?>

Grouping within Table based on Cover
<?for-each-group:current-group();./Cover?>

Displaying "Insured"
<?InsuredAccnt?>
<?for-each-group:current-group();./GroupPolicies_InsuredAccount?><?sort: Share?><?InsuredAccount?><?end for-each-group?>

当我给出这个时,我的系统将永远运行,我被迫终止会话。请有人指出我错在哪里。

4

1 回答 1

1

我能够使用以下方法实现期望:

<?InsuredAccnt?>
<?for-each:GroupPolicies_InsuredAccount?><?sort:Share;'descending';data-type='number'?><?InsuredAccount?><?end for-each?>

Current-Group() 标记不再需要。这会产生输出#2,即一个接一个地显示“InsuredAccounts”。

于 2016-01-19T09:29:22.297 回答