[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] How to prevent "question mark in block" characters converting xml to csv?


Subject: Re: [xsl] How to prevent "question mark in block" characters converting xml to csv?
From: Michael Ludwig <milu71@xxxxxx>
Date: Tue, 2 Mar 2010 23:41:43 +0100

KARR, DAVID (ATTSI) schrieb am 02.03.2010 um 10:41:49 (-0800):
> This is partially an Excel question, but I'm writing a stylesheet to
> convert an XML file to a CSV, and I have to do some things to make it
> a valid CSV, like quoting the values, escaping quotes, etcetera.

C/Perl module Text::CSV_XS does it all for you without you having to
worry about such boring details.

> One thing that I don't see how to solve is that if the resulting CSV
> field has embedded newlines, when I view the result in Excel, the end
> of each embedded line has a "question mark in block" character.  How
> do I have to massage the transformed xml data to prevent that?

The quote character handles whitespace, including newlines. Again,
Text::CSV_XS does it all for you.

If I were you, I'd grab the Perl libraries for LibXML and LibXSLT, use
your current templates or functions to assemble the XML for one record,
register a Perl extension function with the XSLT processor that hands
the data to the Text::CSV_XS, and be done.

-- 
Michael Ludwig


Current Thread
Keywords