[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Windows-style CRLF in text output

Subject: Re: Windows-style CRLF in text output
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 10 Jul 2008 21:54:49 +0200
Re:  Windows-style CRLF in text output
Michael Kay wrote:
<snip />, whereas if it contains

<xsl:text>&#x0d;&#x0a;</xsl:text>

then it will write xDxA. Of course there's plenty of scope for the Java
runtime and the operating system to change that before it hits the disk. In
fact one way to achieve what you want might be to write a Java Writer that
adjusts the line endings as required, and send the transformation output to
that Writer.

An alternative approach, along the lines of Dan Appleman's infamous "it CAN be done in language xxx", could be to not write xA or xD at all, instead use a Unicode Private Use character. Then, after serializing, these "newlines" can be converted by either reprocessing it as unparsed-text with XSLT 2.0 (and writing it as method="text"), using sed on Unix or Perl or Ruby or Java or whatever you like to use to replace these Private Use characters to your type of line endings.


That way you bypass the XML line ending normalization.

One additional note, if I recall correctly, using a character map, you bypass the normalization process too and the newline character that you can create that way is not allowed to be changed... at least that's what I believe that the spec is saying.

Cheers,
-- Abel --

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.