#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    3
    Rep 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 ?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    1
    Rep Power
    0
    Hi Sir,

    Can u tell share your whole code which convert xml to csv?

    Is it possible to share that code?

IMN logo majestic logo threadwatch logo seochat tools logo