xsl-list
[Top] [All Lists]

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

2010-03-02 16:42:24
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

--~------------------------------------------------------------------
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>
--~--