Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to multiline content using xml to html

I am having a string which is multiline in content and I use br tag or "\n" or Environment.newLine for it. Which I finally assign to XMLwriter like

writer.WriteElementString("FINALDESTINATION", valFinalDest);

But after loading the xsl file and writing my html using XmlTextWriter I loose the new line in the resulting html file. Is there any way I could retain the newline in the resulting html file.

Using br tags results in inline br tags in the html, while environment.newline and "\n" does not renders the final html with multiline content but in a single line.

like image 892
Vinay Avatar asked Feb 25 '26 06:02

Vinay


1 Answers

You have 2 options:

  1. Replace new line with br, p, div, etc.
  2. Put content inside pre element, which preserves both spaces and line breaks.
like image 165
Kirill Polishchuk Avatar answered Feb 27 '26 20:02

Kirill Polishchuk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!