ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scot P. Floess" <flo...@mindspring.com>
Subject Re: AW: csv to html via xslt or xslt2 task ?
Date Fri, 07 Mar 2008 17:29:28 GMT
Additionally, I have CSV parsers at http://jplate.sourceforge.net - 
there are 2:  one that adheres to RFC4180 and another that is a little 
more lax than the RFC...  As Steve mentions, it isn't sufficient to 
break on commas if they are enclosed in quotes (same holds true of line 
breaks)...

I have examples and a utility package that can take a String, Stream, 
Reader, etc, and return a List <List <String>>



Steve Loughran wrote:
> Dan Stromberg wrote:
>>
>> http://stromberg.dnsalias.org/~dstromberg/to-table.html
>>
>> Jan.Materne@rzf.fin-nrw.de 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 http://opencsv.sourceforge.net/ 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 
> right.
>
> FYI, the code I wrote is up here:
> http://smartfrog.svn.sourceforge.net/viewvc/smartfrog/trunk/core/components/csvfiles/

>
>

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message