ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: AW: csv to html via xslt or xslt2 task ?
Date Fri, 07 Mar 2008 17:27:52 GMT
Dan Stromberg wrote:
> wrote:
>> XSLT needs XML as input - so CSV wouldnt work.
>> If you want to use XSLT you need the step of converting csv to xml 
>> before.
>> Smallest way would use <script>:
>> - write html header
>> - iterate over the textfile line by line
>>   -- split the line by ","
>>   -- write the data line
>> - write html footer
>> Mmh ... maybe AntContrib:for could iterate over textfiles - I dont know.
>> Jan

I was doing some CSV work at work last week, turning spreadsheet columns 
into email. Life is a lot easier if you can push out the CSV as email, 
which you can get OpenOffice to do.

If you dont want to go that route (or want a batch process from CSV to 
HTML), use OpenCSV Its a nice little 
library which does the parsing. Set it up to run through your file and 
generate the XML that you then pump though XSL

*note that splitting the line by , isnt enough, you need to deal with 
quoted entries, commas in quotes, etc. Let someone else get the parser 

FYI, the code I wrote is up here:

Steve Loughran        
Author: Ant in Action 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message