
March 5th, 2013, 07:59 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 3
Time spent in forums: 1 h 4 m 29 sec
Reputation Power: 0
|
|
|
XML to CSV using XSLT
Hi All
I am looking for an intelligent efficient XSLT which does convert an XML document to CSV data. It should take care of all possible elements in the child nodes.
For example, the XML looks like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<sObjects>
<sObject>
<Name>Raagu</Name>
<BillingStreet>Hoskote</BillingStreet>
</sObject>
<sObject>
<Name>Rajath</Name>
<BillingStreet>BTM</BillingStreet>
<age>25</age>
</sObject>
<sObject>
<Name>Sarath</Name>
<BillingStreet>Murgesh</BillingStreet>
<location>Bangalore</location>
</sObject>
</sObjects>
And my out put CSV should look like this
Name,BillingStreet,age,location
Raagu,Hoskote,,
Rajath,BTM,25,
Sarath,Murgesh,,Bangalore
All the rows should have fields for all the keys in the CSV even though if the XML does have a value for it.
Could you please help me achieve this using XSLT code ?
|