我是 XSLT 的新手。我有合并和添加的要求。
XML:
<OrderDetails>
<OrderDetail action="add">
<OrderedUnits>18</OrderedUnits>
<Date>2013-09-30T00:00:00</Date>
<LocationCode>3202</LocationCode>
<PONumber>022548295755</PONumber>
</OrderDetail>
<OrderDetail action="add">
<OrderedUnits>12</OrderedUnits>
<Date>2013-09-30T00:00:00</Date>
<LocationCode>3202</LocationCode>
<PONumber>022548295755</PONumber>
</OrderDetail>
<IOrderDetail action="add">
<OrderedUnits>18</OrderedUnits>
<Date>2013-09-30T00:00:00</Date>
<LocationCode>3202</LocationCode>
<PONumber>022548295762</PONumber>
</OrderDetail>
<OrderDetails>
如果LocationCode
、Date
和PONumber
字段匹配,我需要添加OrderedUnits
并使其只有一个条目。
预期的输出 XML:
<OrderDetails>
<OrderDetail action="add">
<OrderedUnits>30</OrderedUnits>
<Date>2013-09-30T00:00:00</Date>
<LocationCode>3202</LocationCode>
<PONumber>022548295755</PONumber>
</OrderDetail>
<IOrderDetail action="add">
<OrderedUnits>18</OrderedUnits>
<Date>2013-09-30T00:00:00</Date>
<LocationCode>3202</LocationCode>
<PONumber>022548295762</PONumber>
</OrderDetail>
<OrderDetails>
我该如何编写这个 XSLT?