Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Transform XML1 to XML2

Reply
Thread Tools

Transform XML1 to XML2

 
 
dhanya_ct dhanya_ct is offline
Junior Member
Join Date: May 2012
Posts: 1
 
      05-14-2012
Hi

I have following xml input and need to convert to another XML format using XSLT . Please can some help me.

<?xml version = "1.0" encoding = "UTF-8"?>
<Inputs xmlns = "http://www.asd.com/schemas/Service/Schema.xsd">
<row>
<column>
<name>CITY</name>
<value>DELHI</value>
</column>
<column>
<name>EMPID</name>
<value>87676</value>
</column>
<column>
<name>COMPANY</name>
<value>xyz</value>
</column>
</row>
<row>
<column>
<name>CITY</name>
<value>MUMBAI</value>
</column>
<column>
<name>EMPID</name>
<value>97987</value>
</column>
<column>
<name>COMPANY</name>
<value>abc</value>
</column>
</row>
<row>
<column>
<name>CITY</name>
<value>DELHI</value>
</column>
<column>
<name>EMPID</name>
<value>76767</value>
</column>
<column>
<name>COMPANY</name>
<value>jhkjh</value>
</column>
</row>
<row>
<column>
<name>CITY</name>
<value>MUMBAI</value>
</column>
<column>
<name>EMPID</name>
<value>12334</value>
</column>
<column>
<name>COMPANY</name>
<value>nnbn</value>
</column>
</row>
</Inputs>

and I need to convert it to below xml format using xslt. How to achieve this output.

<?xml version = "1.0" encoding = "UTF-8"?>
<ns0utput xmlns:ns0 = "http://www.asd.com/schemas/Service/Schema.xsd">
<ns0:Location>
<ns0:City>MUMBAI</ns0:City>
<ns0:Employee>
<ns0:EMPID>97987</ns0:EMPID>
<ns0:company>abc</ns0:company>
</ns0:Employee>
<ns0:Employee>
<ns0:EMPID>12334</ns0:EMPID>
<ns0:company>nnbn</ns0:company>
</ns0:Employee>
</ns0:Location>
<ns0:Location>
<ns0:City>DELHI</ns0:City>
<ns0:Employee>
<ns0:EMPID>87676</ns0:EMPID>
<ns0:company>xyz</ns0:company>
</ns0:Employee>
<ns0:Employee>
<ns0:EMPID>76767</ns0:EMPID>
<ns0:company>jhkjh</ns0:company>
</ns0:Employee>
</ns0:Location>
</ns0utput>
Please somebody provide me the xslt to achieve the above output.

Thanks in Advance
Dhanya
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pix: how to remove transform-test? Christoph Gartmann Cisco 1 09-10-2005 08:51 PM
blocking I/O with javax.xml.parsers.DocumentBuilder.parse() and javax.xml.transform.Transformer.transform() jazzdman@gmail.com Java 1 03-27-2005 06:56 AM
Office 2003 - MST transform help Billy K Microsoft Certification 0 02-24-2005 10:21 AM
Which transform-set for Cisco to Windows IPSec? Bill Cisco 0 08-09-2004 09:10 AM
chirpz transform in VHDL Hari VHDL 1 01-09-2004 04:23 PM



Advertisments