[XSL-LIST Mailing List Archive Home]
RE: [xsl] Cannot output CRLF
Subject: RE: [xsl] Cannot output CRLF|
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 2 May 2006 18:47:16 +0100
The XML parser is required to normalize CRLF to LF on input; the XSLT
processor only sees LF. The serializer is allowed to output a newline using
any representation that the parser will normalize back to LF, but the
chances are that it will simply use LF. If the document is going to be read
by a conformant XML parser, it doesn't make any difference. It's only when
you want to read it using an inflexible text editor or similar that you get
problems. The answer is to postprocess.
> -----Original Message-----
> From: Paul Venuti [mailto:venutip@xxxxxxxxxxx]
> Sent: 02 May 2006 18:29
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Cannot output CRLF
> Hi. I'm trying to output a carriage return followed by a line
> feed (CRLF) for compatability with a mainframe system I'm
> working with (don't ask). For some reason, though, I never get the CR.
> To simply the issue, I'm using the following stylesheet:
> <?xml version="1.0" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> <xsl:output method="text" />
> <xsl:template match="/">
> <xsl:text>Hello.& # x d; & # x a;</xsl:text> </xsl:template>
> (I added the extra spaces so those aren't interpreted as
> breaks by the browser -- in the actual stylesheet, there are
> no spaces.)
> From all the posts I've seen on this list, this should work.
> But when I view the resulting file in hex, this is what I get:
> 48 65 6C 6C 6F 2E 0A
> So that's H E L L O [LF]. What happened to the CR (0D)? I've
> tried this with both Saxon 8.6.1 and Xalan 2.7.0 ... same results.
> Any ideas?