我有以下XML文件,每個SALES標記中都有重複的DateSold標記。 我需要那些被替換爲DateSold和TimeSold。或者將日期和時間部分合併爲一個標籤。用XSL重命名或合併重複XML標記
源XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<SALES>
<InvoiceID>A13A30000011</InvoiceID>
<LineID>1</LineID>
<UPC>058030020130</UPC>
<Desc>PS WQ VIT E 200IU 100'S</Desc>
<DateSold>2013-10-30</DateSold>
<DateSold>10:02:42</DateSold>
<QTY>000001</QTY>
<UnitRetail>000006.99</UnitRetail>
<UnitCost>000003.37</UnitCost>
</SALES>
<SALES>
<InvoiceID>A13A30000021</InvoiceID>
<LineID>2</LineID>
<UPC>063601699165</UPC>
<Desc>GENTEAL GEL DROPS 15ML</Desc>
<DateSold>2013-10-30</DateSold>
<DateSold>10:03:15</DateSold>
<QTY>000001</QTY>
<UnitRetail>000010.99</UnitRetail>
<UnitCost>000007.44</UnitCost>
</SALES>
</root>
輸出將是:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<SALES>
<InvoiceID>A13A30000011</InvoiceID>
<LineID>1</LineID>
<UPC>058030020130</UPC>
<Desc>PS WQ VIT E 200IU 100'S</Desc>
<DateSold>2013-10-30</DateSold>
<TimeSold>10:02:42</TimeSold>
<QTY>000001</QTY>
<UnitRetail>000006.99</UnitRetail>
<UnitCost>000003.37</UnitCost>
</SALES>
<SALES>
<InvoiceID>A13A30000021</InvoiceID>
<LineID>2</LineID>
<UPC>063601699165</UPC>
<Desc>GENTEAL GEL DROPS 15ML</Desc>
<DateSold>2013-10-30</DateSold>
<TimeSold>10:03:15</TimeSold>
<QTY>000001</QTY>
<UnitRetail>000010.99</UnitRetail>
<UnitCost>000007.44</UnitCost>
</SALES>
</root>
這是確定的,如果它被合併爲
<SALES>
<InvoiceID>A13A30000021</InvoiceID>
<LineID>2</LineID>
<UPC>063601699165</UPC>
<Desc>GENTEAL GEL DROPS 15ML</Desc>
<DateSold>2013-10-30 10:03:15</TimeSold>
<QTY>000001</QTY>
<UnitRetail>000010.99</UnitRetail>
<UnitCost>000007.44</UnitCost>
</SALES>
請包括你已經嘗試了一些什麼信息,以及在哪裏卡住了。本網站不適用於請求爲您編寫代碼的請求。 – IMSoP
' 2013-10-30 10:03:15'形成不好 –
Hash