I have a .csv file generated and I want to transform it to xml using xslt.
How to do that? I'm not good in xslt. Please, help me.
Thank you.
Here's my .csv file
CONTRACT_NUMBER,CLIENT_NAME_FULL,STREET_ADDRESS,REGISTRY_NO,DATE_RECEIVED,STATUS,REMARKS
3300016335,name,"address",1_A,3/26/2014,Received,with signature
Desired xml:
<root>
<row>
<CONTRACT_NUMBER>CONTRACT_NUMBER</CONTRACT_NUMBER>
<CLIENT_NAME_FULL>CLIENT_NAME_FULL</CLIENT_NAME_FULL>
<STREET_ADDRESS>STREET_ADDRESS</STREET_ADDRESS>
<REGISTRY_NO>REGISTRY_NO</REGISTRY_NO>
<DATE_RECEIVED>DATE_RECEIVED</DATE_RECEIVED>
<STATUS>STATUS</STATUS>
<REMARKS>REMARKS</REMARKS>
</row>
<row>
<CONTRACT_NUMBER>345678912</CONTRACT_NUMBER>
<CLIENT_NAME_FULL>name</CLIENT_NAME_FULL>
<STREET_ADDRESS>address</STREET_ADDRESS>
<REGISTRY_NO>122345</REGISTRY_NO>
<DATE_RECEIVED>10/10/14</DATE_RECEIVED>
<STATUS>fghdsjkls</STATUS>
<REMARKS>fdhjgkdfl</REMARKS>
</row>
</root>
You probably could do it with some of the string manipulation functions, but I strongly advise against that. Especially if your schema just basically amounts to:
You really don't need XSLT for something that simple. Use the right tools for the job, and this is not a job for XSLT, judging by the information given.
What you're asking for (CSV to XML) cannot be done with XSLT.
From wikipedia:
XSLT can take a source XML document and transform it into a different document (usually XML, but it could be anything), but XSLT is not an appropriate tool for converting CSV data into a different format.