XML RTF 模板中的标签分组以抑制重复

XML Tag grouping in RTF Template to suppress duplicates

我的XML生成的标签如下-

<P_MONTH>01</P_MONTH>


-<G_1>

<DIVISION>CA Division</DIVISION>

<DISTRICT>CA District</DISTRICT>

<DEPARTMENT>Global Operations</DEPARTMENT>

<DEP_EMPL_COUNT>9</DEP_EMPL_COUNT>

</G_1>


-<G_1>

<DIVISION>CA Division</DIVISION>

<DISTRICT>CA District</DISTRICT>

<DEPARTMENT>Laboratory Services</DEPARTMENT>

<DEP_EMPL_COUNT>11</DEP_EMPL_COUNT>

</G_1>


-<G_1>

<DIVISION>CA Division</DIVISION>

<DISTRICT>CA District</DISTRICT>

<DEPARTMENT>Corporate</DEPARTMENT>

<DEP_EMPL_COUNT>3</DEP_EMPL_COUNT>

</G_1>


-<G_1>

<DIVISION>CA Division</DIVISION>

<DISTRICT>S District</DISTRICT>

<DEPARTMENT>Corporate Administration</DEPARTMENT>

<DEP_EMPL_COUNT>6</DEP_EMPL_COUNT>

</G_1>


-<G_1>

<DIVISION>CA Division</DIVISION>

<DISTRICT>S District</DISTRICT>

<DEPARTMENT>Corporate Technology</DEPARTMENT>

<DEP_EMPL_COUNT>1</DEP_EMPL_COUNT>

</G_1>

当我在 RTF 模板中像下面这样使用这些标签时 -

DIVISION                            DISTRICT                    DEPARTMENT                 COUNT
<?for-each:G_1?> <DIVISION>         <DISTRICT>                   <DEPARTMENT>             <COUNT> <?end for-each?>

这给出了这样的输出 -

DIVISION              DISTRICT                          DEPARTMENT                      COUNT
CA Division           CA District                     Global Operations                  9
CA Division           CA District                     Laboratory Services                11
CA Division           CA District                     Corporate                          3
CA Division           S District                      Corporate Administration           6 
CA Division           S District                      Corporate Technology               1

我希望抑制 division 和 district 中的重复值,并且输出看起来像 -

DIVISION              DISTRICT                          DEPARTMENT                      COUNT
CA Division           CA District                     Global Operations                  9
                                                      Laboratory Services                11
                                                      Corporate                          3
                      S District                      Corporate Administration           6 
                                                      Corporate Technology               1

如何实现?我无法正确使用 for-each-group 来对标签进行分组。有人可以帮忙吗?

我会使用嵌套表格和 for-each-group 功能。

RTF:

输出

你也可以使用变量。像这样:

RTF 确保将 "if" 逻辑放在 alt-text/field 属性中,否则它可能无法工作。我把它拿出来让你在这里看得更清楚。

输出