[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: reading a .xsv file in xslt

Subject: Re: reading a .xsv file in xslt
From: a kusa <akusa8@xxxxxxxxx>
Date: Mon, 8 Mar 2010 14:59:59 -0600
Re:  reading a .xsv file in xslt
Hi

The csvtoxml converter works very well with single files. But if I
want to convert it to work with a batch of files, how do I do it? The
variable in the program 'pathtoCSV' points to only a single CSV file
which gets parsed. But I want to be able to use it to work on multiple
files.

Any ideas/tips is appreciated.
Thanks.

On Wed, Feb 3, 2010 at 8:00 AM, a kusa <akusa8@xxxxxxxxx> wrote:
> Thanks so much for all your responses!
>
> Andrew, I will try your stylesheet and let you know if I have any
questions.
>
>
>
> On Wed, Feb 3, 2010 at 4:56 AM, Andrew Welch <andrew.j.welch@xxxxxxxxx>
wrote:
>> On 3 February 2010 10:27, ac <ac@xxxxxxxxxxxxx> wrote:
>>> Hi Andrew,
>>>
>>> I am not sure that I understand well your point on QNames and
>>> normalize-space, as if the header line is missing from the csv, picking
it
>>> up to try to derive element or attribute names from it is bound to
generate
>>> invalid QName errors,
>>
>> I thought you were saying there was occasionally a single blank line
>> before the header line?   As it stands the transform expects there to
>> be a header line... if you know your csv doesnt have a header line,
>> then its simple to modify the transform to put one in.  If you want it
>> to handle a unknown mixture of csv with and without headers, then you
>> are going beyond its original goal.
>>
>>> '&#xa;' indeed displays as space in html but wouldn't '\r?\n' be more
>>> portable?
>>
>> Yes, I have had the intention of correcting that for a while now :)
>>
>> http://markmail.org/message/64tnjaaarhu3buhk
>>
>> ...but the people that pay get the priority.
>>
>>> As a note on extending your example, the name for <root> and <row> could
be
>>> parametrized and I think that I would move <root> further outside the
nested
>>> code and allow $csvpath to be a space-delimited name list, for example,
to
>>> easily support csv file merge into the tree, by simply looping over the
>>> tokenized file paths.
>>
>> I would suggest that rather do it all in one transform, you leave the
>> csv-to-xml as one step, and do any further processing, such as
>> combining csvs, or transforming the xml into some other xml, as
>> subsequent steps in the pipeline.
>>
>>> Your code offers a good basic design and I especially like your regex
token
>>> grabber.
>>
>> That was done with the help of this list :)
>>
>>
>>
>> --
>> Andrew Welch
>> http://andrewjwelch.com
>> Kernow: http://kernowforsaxon.sf.net/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.