473,387 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

now to set line endings with XSLT

Hi,

I am using .Net 2.0 XslCompiledTransform with output method=text.

it seems to be converting all the line endings in the output to cr/lf
regardless of how I generate them. for instance, this fragment

<xsl:text>|&#xd;|&#xd;&#xa;|&#xa;|<xsl:text>

generates |<crlf>|<crlf>|<crlf>|

any idea how I can control the line endings generated by the XSLT processor?

TIA

Andy

Feb 26 '08 #1
3 3538
Andy Fish wrote:
any idea how I can control the line endings generated by the XSLT
processor?
I am not sure there is a way other than post-processing the result of
the XSLT transformation.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 26 '08 #2
FWIW I found out you can do it using XmlWriterSettings.NewLineChars or
XmlWriterSettings.NewLineHandling. here's a sample:

XslCompiledTransform trans = new XslCompiledTransform();
trans.Load(...);
XmlWriterSettings ws = trans.OutputSettings.Clone();
ws.NewLineChars = '\n';
using (XmlWriter xw = XmlWriter.Create(..., ws))
{
trans.Transform(..., xw);
}

Andy
"Martin Honnen" <ma*******@yahoo.dewrote in message
news:eA**************@TK2MSFTNGP04.phx.gbl...
Andy Fish wrote:
>any idea how I can control the line endings generated by the XSLT
processor?

I am not sure there is a way other than post-processing the result of the
XSLT transformation.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 28 '08 #3
Andy Fish wrote:
FWIW I found out you can do it using XmlWriterSettings.NewLineChars or
XmlWriterSettings.NewLineHandling. here's a sample:

XslCompiledTransform trans = new XslCompiledTransform();
trans.Load(...);
XmlWriterSettings ws = trans.OutputSettings.Clone();
ws.NewLineChars = '\n';
Nice. I tried settings NewLineChars too but did not clone it and then
the properties were read-only and my attempts failed.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 28 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: ajikoe | last post by:
Hello, I use windows notepad editor to write text. For example I write (in d:\myfile.txt): Helo World If I open it with python: FName = open(d:\myfile.txt,'r')
10
by: bob | last post by:
Hello, I use Microsoft Visual C++ .NET (version 7.1.3088) Sometimes (with big codes?) when I get a compile error and click on the error, the cursor is placed next to the wrong piece of code. The...
4
by: Fuzzyman | last post by:
Hello all, I'm handling some text files where I don't (necessarily) know the encoding beforehand. Because I use regular expressions to parse the text I *must* decode UTF16 encoded text...
18
by: Fuzzyman | last post by:
Hello all, I'm trying to detect line endings used in text files. I *might* be decoding the files into unicode first (which may be encoded using multi-byte encodings) - which is why I'm not...
5
by: jdbartlett | last post by:
After switching text editors, my code started causing mysterious PHP errors. I narrowed the problem down to the Unicode line endings I started using with the new text editor: when I save documents...
1
by: jandhondt | last post by:
IN Visual Studio 2005 with VB.NET when I open a solution I often get this warning: The line endings in the following file are not consistent. Do you want to normalize the line endings? The warning...
6
by: Ant | last post by:
Hi all, I've got a problem here which has me stumped. I've got a python script which does some text processing on some files and writes it back out to the same file using the fileinput module...
3
by: towers | last post by:
Hi I'm probably doing something stupid but I've run into a problem whereby I'm trying to add a csv file to a zip archive - see example code below. The csv just has several rows with carriage...
16
by: mazwolfe | last post by:
Someone recently asked about reading lines. I had this code written some time ago (part of a BASIC-style interpreter based on H. Shildts in Art of C) to read a file with the lines ended in any...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.