我正在尝试执行xslt转换,以便根据多个属性过滤重复的元素。 输入XML:
<rootNode>
<node id="N10102017004" bomHeader="true">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017004">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017004">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017056" bomHeader="true">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017056">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017056">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017089">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017090">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017090">
<request>
<someText>aaa</someText>
</request>
</node>
我想要的是当node元素具有id和bomHeader属性时,然后根据id需要删除duplicate元素。如果没有bomHeader属性,则无需删除重复的id元素。
我的XSL返回:
<rootNode>
<node id="N10102017004" bomHeader="true">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017004">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017056" bomHeader="true">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017056">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017089">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017090">
<request>
<someText>aaa</someText>
</request>
</node>
预期的OUTPUT XML:
<rootNode>
<node id="N10102017004" bomHeader="true">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017056" bomHeader="true">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017089">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017090">
<request>
<someText>aaa</someText>
</request>
</node>
<node id="N10102017090">
<request>
<someText>aaa</someText>
</request>
</node>