xsl-list
[Top] [All Lists]

Re: [xsl] reading a .xsv file in xslt

2010-02-03 04:56:56
On 3 February 2010 10:27, ac <ac(_at_)hyperbase(_dot_)com> 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/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--