I use VS 2008, .net 3.5 for generate page html using XSLT.
I have Message, that contains \r\n (newlines)
I use this in XSL file:
<b>Message: </b><xsl:value-of select="Message"/><br/>
I need replace \r\n by <br/>
in xsl. I have seen several references but not get solution for my issue:
I use this code C# before I call to transform XSLT, but not right:
m = m.Replace(@"\r\n", "
");
m = m.Replace(@"\n", "
");
//m = System.Web.HttpUtility.HtmlDecode(m);
m = m.Replace(@"\r\n", "<br/>");
m = m.Replace(@"\n", "<br/>");
msg = "<Exception>"
+ "<Description>" + d + "</Description>"
+ "<Message>" + m + "</Message>"
+ "<DateTime>" + localTimeString + "</DateTime>"
+ "</Exception>";
I use this references, but not solution
http://stackoverflow.com/questions/185101/interpreting-newlines-with-xslt-xsltext
http://stackoverflow.com/questions/1069092/xslt-replace-function-not-found
The replace function is only available in XSLT version 2.0, not in version 1.0 which is what Visual Studio uses. Just because you've specified version="2.0" doesn't mean that Visual Studio supports it.
I use this like the last reference, but I get error:
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="Message"/>
<xsl:with-param name="replace" select="\r\n"/>
<xsl:with-param name="by" select="<br/>"/>
</xsl:call-template>
suggestions, any sample code works ?