我需要通过添加订单价格总和将我的 XML 从一种格式转换为另一种格式。计算是Sum total (itemPrice*itemQty)
。我的请求 XML 如下
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:fetchOrderListResponse xmlns:ns2="http://impl.lob.xyz.com/">
<return>
<customerOrderNumber>1</customerOrderNumber>
<orderDetails>
<itemPrice>2.0</itemPrice>
<itemQty>1</itemQty>
<orderDetailsId>37516016-D71B-4790-951F-55D00B0CC159</orderDetailsId>
</orderDetails>
<orderDetails>
<itemPrice>5.0</itemPrice>
<itemQty>3</itemQty>
<itemUnit>0</itemUnit>
</orderDetails>
<orderId>84EC371D-40CA-455E-A0FA-7EA733E9BFD3</orderId>
</return>
<return>
<customerOrderNumber>1</customerOrderNumber>
<deliverydate>2013-02-06T00:00:00+05:30</deliverydate>
<orderDetails>
<itemPrice>7.0</itemPrice>
<itemQty>1</itemQty>
<orderDetailsId>9A5030BE-F95F-4C62-B5A2-41FF85423218</orderDetailsId>
</orderDetails>
<orderDetails>
<itemPrice>9.0</itemPrice>
<itemQty>5</itemQty>
<orderDetailsId>65A8B3BE-D407-43D8-8754-EA1E26AA56E4</orderDetailsId>
</orderDetails>
<orderId>0BDCB222-0117-47A9-8813-DF03A1D19E5E</orderId>
</return>
</ns2:fetchOrderListResponse>
</soap:Body>
</soap:Envelope>
在计算广告添加后,我需要将其转换为以下格式吗?使用 XSLT 的元素。转换后的 XML 应如下所示。请在这里提供帮助。
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:fetchOrderListResponse xmlns:ns2="http://impl.lob.xyz.com/">
<return>
<customerOrderNumber>1</customerOrderNumber>
<orderDetails>
<itemPrice>2.0</itemPrice>
<itemQty>1</itemQty>
<orderDetailsId>37516016-D71B-4790-951F-55D00B0CC159</orderDetailsId>
</orderDetails>
<orderDetails>
<itemPrice>5.0</itemPrice>
<itemQty>3</itemQty>
</orderDetails>
<orderId>84EC371D-40CA-455E-A0FA-7EA733E9BFD3</orderId>
**<ordertotal>17.0</ordertotal>**
</return>
<return>
<customerOrderNumber>1</customerOrderNumber>
<deliverydate>2013-02-06T00:00:00+05:30</deliverydate>
<orderDetails>
<itemPrice>7.0</itemPrice>
<itemQty>1</itemQty>
<orderDetailsId>9A5030BE-F95F-4C62-B5A2-41FF85423218</orderDetailsId>
</orderDetails>
<orderDetails>
<itemPrice>9.0</itemPrice>
<itemQty>5</itemQty>
<orderDetailsId>65A8B3BE-D407-43D8-8754-EA1E26AA56E4</orderDetailsId>
</orderDetails>
<orderId>0BDCB222-0117-47A9-8813-DF03A1D19E5E</orderId>
**<ordertotal>52.0</ordertotal>**
</return>
</ns2:fetchOrderListResponse>
</soap:Body>
</soap:Envelope>