Subject: Re: [xsl] reading a .xsv file in xslt|
From: a kusa <akusa8@xxxxxxxxx>
Date: Wed, 3 Feb 2010 08:00:49 -0600
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. > >> '
' 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/