Click to See Complete Forum and Search --> : CRLF problem with MSXML4


Carl Waldbieser
July 12th, 2002, 06:27 PM
I am using MSXML4 (SP1) on both Win98 and Win2000. When I apply an XSLT transform with an output method of "text", an extra carrige return is printed out at th end of each line. The following transform:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="text" encoding="UTF-8" />
<xsl:variable name="CR" >
<xsl:text>&amp;#xA;</xsl:text>
</xsl:variable>

<xsl:template match="/">Hello<xsl:value-of select="$CR" />World!</xsl:template>
</xsl:stylesheet>

produces the following output when applied to any valid document:

Hello

World!

Looking at the file with a hex editor, I can see:
48 65 6c 6c 6f 0d 0d 0a 57 6f 72 6c 64 21

It appears as though there is an extra 0d before the 0d 0a (CR LF). Any ideas why this is happening?

Thanks in advance,
Carl Waldbieser
waldbie@attlobal.net

dkar
July 16th, 2002, 06:12 AM
From what environment do you use MSXML. Mine works fine.

I had the same problem with xerces in java.
Sometimes it happens when two programs windows style and unix style incorrectly work with each other.

I have solve my problem by string replacement. :(