xsl-list
[Top] [All Lists]

Re: [xsl] For CSV output file - should end of record marker be line feed or a carriage return from xsl

2014-11-08 07:11:50
RFC 4180 standardizes CRLF as the record separator for mime type "text/csv". So 
to that end the safest platform-independent way to specify compliant output is 
to write "
" or equivalent in your stylesheet.

However if you don't need compliant "text/csv" output then any other suggested 
method will work.

Regards,
--Paul

On Nov 7, 2014, at 18:10, Richard Fozzard - NOAA Affiliate 
richard(_dot_)fozzard(_at_)noaa(_dot_)gov 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:


Wolfgang Laun wolfgang(_dot_)laun(_at_)gmail(_dot_)com wrote on 11/07/2014 
02:06 PM:
You'll stand a better chance of getting your line ends right by using
<xsl:text>
</xsl:text>
with the line end being represented by whatever it is on the system where
the text file containing these two lines resides.
Agreed! If your XSLT is running on the same OS where you plan to use the CSV.

(This would be CR+LF on
Windowses, LF on Unices and CR on Mac OSs.)
BTW, the CR was only used on Mac OS 9 and earlier:

  http://en.wikipedia.org/wiki/Newline#Representations

Mac OS 10.* shifted to Unix (FreeBSD) back in about 2001.


XML/XSL (and HTML) were designed from the ground up to handle just about any 
kind of end-of-line you wanted to throw at them. But of course, the program 
using your CSV may not be so tolerant. It sounds like you're using Windows, 
and some of those older Windows programs may require the traditional CR+LF.

--Rich

Explicitly requesting CR or LF or CR+LF means that the result will not
necessarily have the intended line structure on one system or the other,
i.e., wherever you run the XSLT.

-W

On 7 November 2014 18:40, Catherine Wilbur cwilbur(_at_)uwindsor(_dot_)ca <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

1) Currently I am using a line feed in my code at the end.  Should it be a
line feed or carriage return?  Reason I am asking is because when I open my
CSV file in NotePad or WordPad the data wraps.  But with Notes++ or Excel
the data does not wrap.  Currently using a line feed at end of my data.
Assuming it should be a carriage return.  Guessing that the data is
wrapping when I open the CSV file because it does not recognize the
carriage return or line feed but Notes++ does recognize these characters.


http://stackoverflow.com/questions/7965642/explicitly-specify-linefeed-character-and-not-carriage-return

Should I be using a line feed in my code.  (this is what I am using now)
         <xsl:text>&#xA;</xsl:text>

Or should I be using a carriage return in my code.
 <xsl:text>&#xD;</xsl:text>


_____________________________________________________________________
Catherine Wilbur  |  Senior Application Programmer  |  IT Services
401 Sunset Avenue, Windsor ON Canada  N9B 3P4
(T) 519.253.3000 Ext. 2745  |  (F) 519.973.7083  |  (E)
cwilbur(_at_)uwindsor(_dot_)ca
www.uwindsor.ca/its
 XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <-list/528976> (by
email <>)

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>