converting xml to html using xsl and preserving newline / formatting ?

I want to build a web page on the fly based upon data stored in SQL. I currently read the data into a datatable and extract the xml representation. Using xsl I then apply an xslt stylesheet to produce an html representation of my data. This works great, however ...

Some of the data contain embedded \n character (entered via a richtextbox). How do I preserve these so the resultant html reflect the formating. Currently all formating characters are removed and I get one long string instead of a set of coherent paragraphs.

Also, is there a way in which I can transform rtf formated text direct to html ?

Thanks,

Nick

[634 byte] By [NickUk] at [2008-2-21]
# 1
If you are famliar with HTML you should know that in HTML \n is considered as plain space. There are two ways to preserve new line semantics in HTML - either put your text into <pre> tag or re-place each \n with <br> tag.
Here you can find a template for going the latter way: http://www.dpawson.co.uk/xsl/sect2/break.html#d2599e76

I don't think that's good idea to transform rtf with XSLT. There are plenty of converters (probably including free ones) on the market.

OlegTkachenko at 2007-9-9 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 2
Thanks for the link the additional xsl does the job nicely.

Nick

NickUk at 2007-9-9 > top of Msdn Tech,.NET Development,XML and the .NET Framework...

.NET Development

Site Classified