[xsl] Line endings in Saxon

Subject: [xsl] Line endings in Saxon
From: "Adam Schweitzer" <adam.schweitzer@xxxxxxxxxxxxx>
Date: Mon, 20 Aug 2007 15:40:18 -0400
It appears as if Saxon does not output line endings "correctly" for
Windows systems (ie LF only instead of CR+LF).  This, as it turns out,
becomes a problem for me.

More detailed explanation:
I have Saxon generate XML, which is in turn used inside an internal web
application by MSXML to produce HTML output.  For some reason unknown to
me, MSXML treats text with line endings CR+LF differently from LF.  In
the latter case, it outputs new lines, while in the former, only
whitepace.

This becomes a problem when I have javascript code in the output html:
alert('this is a test');
becomes

alert('this is
a test');

the latter of which does not run.

There are two possible solutions I've considered:
1) Open the Saxon-generated XML file in wordpad, save.  This converts
the LF to CR+LF (I think), and I get the output desired.
2) Change my stylesheets to use normalize-space()

Both of which have drawbacks.  The ideal solution would be if I could
compel the Saxon processor to output Windows line endings.  Is this
possible?

Cheers,
Adam Schweitzer
Orenda Aerospace Corporation

Current Thread