Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Up **** creak without a paddle! cvs + xslt + xml

Options
  • 14-09-2009 3:23pm
    #1
    Registered Users Posts: 610 ✭✭✭


    Hey guys, need a bit of guidance.. need to convert an cvs file into the following xml format.. need to create and xslt to do the transformation. so where to start..

    csv file looking like this:
    FS,GD,DFD,DTD,HI,DT,DV,V,N,D,C,DR
    XXX,1/1/2009 11:11:11 PM,1/1/2009 12:00:00 AM,1/1/2009 12:00:00 AM,XXXXX,XX,99,1,,,,url,

    xml needs to look like this..
    <Root>
    <FI>
    <GD>2009-01-01T11:11:11Z</GD><!-- [FONT=&quot]ISO 8601format[/FONT] -->
    <DFD>2009-01-01T11:11:11Z</DFD>
    <DTD>2009-01-01T11:11:11Z</DTD>
    <RowCount>1</RowCount>
    <FS>XXX</FS>
    <FF>Yes</FF> <!--optional-->
    <Notes>Lorem</Notes><!--optional-->
    </FI>
    <MV>
    <rowdata>
    <V></V>
    <D></D>
    <N></N>
    </rowdata>
    </MV>
    </Root>


    anyone point me in the right direction of how to start this even get the top part of this?


Comments

  • Registered Users Posts: 3,078 ✭✭✭onemorechance




  • Registered Users Posts: 610 ✭✭✭nialo


    Thanks! need more direction than that! ive been looking at the site and my issue is im going from csv to xml. its not in elements and rows. its a flat file. do i get the flat file into rows and columns first in xml then work on the template further to put it into the correct sections or does the xslt care?


  • Registered Users Posts: 3,078 ✭✭✭onemorechance


    http://andrewjwelch.com/code/xslt/csv/csv-to-xml_v2.html

    You will need to use XSLT 2.0, which may not be free.


  • Registered Users Posts: 2,781 ✭✭✭amen


    is this work or project?
    once off or ongoing?


  • Registered Users Posts: 610 ✭✭✭nialo


    once off. work. just started in a new place and they thought it would be a nice way to get started! given i havent done xml before! think nobody else wanted the job so i got it! :)


  • Advertisement
  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Do some research into it and learn. It will feel a lot more rewarding when you get it done.


  • Registered Users Posts: 610 ✭✭✭nialo


    Done now. ended using c# to convert the csv to xml then doing the transformation.. as i had to use xslt v1.0...


  • Registered Users Posts: 8,070 ✭✭✭Placebo


    i would have used php, how hard is it to manipulate and play with csv files in C?


  • Registered Users Posts: 981 ✭✭✭fasty


    Placebo wrote: »
    i would have used php, how hard is it to manipulate and play with csv files in C?

    It's insanely easy.


  • Registered Users Posts: 610 ✭✭✭nialo


    its not a question of how hard or easy. its the specification i had to work under. taking a report from reporting services that had to be outputted in excel, converted to csv then into xml, from there transformed into another xml document to be imported into another system. system had c# and vb.net as its dlls and front end. dont ask me why. this is the way they want it done.


  • Advertisement
  • Registered Users Posts: 2,781 ✭✭✭amen


    you could have put a wrapper dll around the report server dll and made it give you the results in xml and the transformed it


  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Why bother with the wrapper.. just use the Reporting Services Web Service and export as XML (which is there by default)


  • Registered Users Posts: 610 ✭✭✭nialo


    yes this is all true! but they have coded the system in such a way that they cant use the xml export function throught rs. and im only gettting my hands on the export after its been put into excel..


Advertisement