Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving XML elements to another block in the same XML file

Status
Not open for further replies.

Madhulikha

Programmer
Oct 12, 2010
2
US
Hi,
I am new to XML & XSLT. I have a requirement which I have 1000 XML files to be modified.
The XML files which has retInformation (which is optional)
needs to be modified.
The label type && email elements under retInformation should be moved to SHIP block after the elment <serviceType> in the same XML file. pls let me know if you have any questions.

<?xml version="1.0" encoding="UTF-8"?>
<root>
<sampleXml>
<sample>
<ship>
<serviceType>Ground</serviceType>
<packageType>Your Package</packageType>
<retInformation>
<LabelType>ABC</LabelType>
<email>test@test.com</email>
<expirationDate>Date(1d)</expirationDate>
</retInformation>
<referenceInfo>
<yourReference xsi:nil="true"/>
<purchaseOrderNumber xsi:nil="true"/>
<invoiceNumber xsi:nil="true"/>
<departmentNumber xsi:nil="true"/>
</referenceInfo>
</ship>
</sample>
</sampleXML>
</root>


 
>I am new to XML...
Maybe, but can't be new everything. You are not interested in notepad+copy+paste, do you?
 
Can anyone give me an example of XSL trnasformation to acheive the above task??
 
That sample does not even have all the necessary ingredients to make it a self-contained representative sample. You cannot expect people to fill the gap for you on the sample itself (before even considering an xslt to do the job) if that effort is not apparently due on your part.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top