输入 xml:
<Root>
<RootHeader>Header</RootHeader>
<Reference>
<name>RefName</name>
<value>Header001</value>
</Reference>
<NodeNumber>1</NodeNumber>
<Reference>
<name>RefName</name>
<value>100</value>
</Reference>
<NodeNumber>2</NodeNumber>
<Reference>
<name>RefName</name>
<value>101</value>
</Reference>
<NodeNumber>3</NodeNumber>
<Reference>
<name>RefName</name>
<value>101</value>
</Reference>
<NodeNumber>4</NodeNumber>
<Reference>
<name>RefName</name>
<value>100</value>
</Reference>
<NodeNumber>5</NodeNumber>
<Reference>
<name>RefName</name>
<value>102</value>
</Reference>
</Root>
预期输出:
<Root>
<RootHeader>Header</RootHeader>
<Reference>
<name>RefName</name>
<value>Header001</value>
</Reference>
<GroupingSequenceNumber>1</GroupingSequenceNumber>
<NodeNumber>1</NodeNumber>
<Reference>
<name>RefName</name>
<value>100</value>
</Reference>
<GroupingSequenceNumber>1</GroupingSequenceNumber>
<NodeNumber>2</NodeNumber>
<Reference>
<name>RefName</name>
<value>101</value>
</Reference>
<GroupingSequenceNumber>2</GroupingSequenceNumber>
<NodeNumber>3</NodeNumber>
<Reference>
<name>RefName</name>
<value>100</value>
</Reference>
<GroupingSequenceNumber>3</GroupingSequenceNumber>
<NodeNumber>4</NodeNumber>
<Reference>
<name>RefName</name>
<value>100</value>
</Reference>
<GroupingSequenceNumber>1</GroupingSequenceNumber>
<NodeNumber>5</NodeNumber>
<Reference>
<name>RefName</name>
<value>102</value>
</Reference>
</Root>
如何根据根/参考/值进行分组并在输出中添加分组序列号?
分组中应排除标题中的引用。意味着分组应该在出现 NodeNumber 之后开始。
先感谢您。