Transform to remove duplicate and copy rest

后端 未结 4 1664
庸人自扰
庸人自扰 2021-01-21 11:54

I want the output xml to have grouped for the element \'c\', according to the attribute \'f\'. Here is my input xml and the xslt. I want the group to occur only once and the ot

4条回答
  •  没有蜡笔的小新
    2021-01-21 12:52

    One idea might be to save all values of c in a variable in a format that allows you to differentiate them from one-another, and then every time you encounter c, you check to see if that value is contained within the variable. If it is, skip to the next node. If it isn't, continue processing the current node.

    Tell me if you need more specific information

    EDIT: As an alternative, and probably an easier method (I've been using NAnt recently, so I might be giving you a NAnt strategy) is to sort all the nodes by their s values. Then just have a variable that stores the current value of c and compare until the value you're looking at isn't equal to the stored value. Then reassign the value and do it again!

提交回复
热议问题