I am using VS 2008, .net 3.5 to generate an html page using XSLT.
I have a message containing \ r \ n (newlines)
I use this in an XSL file:
<b>Message: </b><xsl:value-of select="Message"/><br/>
I need to replace \ r \ n with <br/>in xsl. I saw several links, but could not find a solution for my problem:
I use this C # code before calling to convert XSLT, but not correctly:
m = m.Replace(@"\r\n", "
");
m = m.Replace(@"\n", "
");
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 these links, but not a solution
Interpretation of newline with xsl: text?
XSLT replacement function not found
The replace function is only available in XSLT version 2.0, not the version 1.0 that Visual Studio uses. Just because you specified version = "2.0" does not mean that Visual Studio supports it.
I use this as the last link, but I get the 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>
?