Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1015593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:25:26+00:00 2026-05-16T10:25:26+00:00

I use VS 2008, .net 3.5 for generate page html using XSLT. I have

  • 0

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", "&#xD;&#xA;");
            m = m.Replace(@"\n", "&#xA;");
            //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

Interpreting newlines with xsl:text?

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="&lt;br/&gt;"/>
 </xsl:call-template>

suggestions, any sample code works ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:25:26+00:00Added an answer on May 16, 2026 at 10:25 am

    The call template above looks OK, you just need the template to go with it!

    <!-- XSL FILE -->
    
    
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
            version="1.0">
      <xsl:variable name="_crlf"><xsl:text>
    </xsl:text></xsl:variable>
      <xsl:variable name="crlf" select="string($_crlf)"/>
      <xsl:template match="/">
    
        <xsl:for-each select="//demo">
          Demo:
          <xsl:call-template name="crlf-replace">
        <xsl:with-param name="subject" select="./text()"/>
          </xsl:call-template>
        </xsl:for-each>
      </xsl:template>
    
      <xsl:template name="crlf-replace">
        <xsl:param name="subject"/>
    
        <xsl:choose>
          <xsl:when test="contains($subject, $crlf)">
        <xsl:value-of select="substring-before($subject, $crlf)"/><br/>
        <xsl:call-template name="crlf-replace">
          <xsl:with-param name="subject" select="substring-after($subject, $crlf)"/>
        </xsl:call-template>
          </xsl:when>
          <xsl:otherwise>
        <xsl:value-of select="$subject"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:template>
    
    </xsl:stylesheet>
    
    
    <!-- XML FILE -->
    
    <?xml version="1.0"?>
    
    <demos>
      <demo>xslt is really fun</demo>
      <demo>you quite often use recursion in xslt</demo>
      <demo>so there!</demo>
    </demos>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used to use discountasp.net and I can use Visual Studio 2008 to publish
I use Visual Studio 2008. I haven't seen this behavior before and, as far
I currently use VS 2008 Professional, but I'm trying to get Team System Developer
I use Visual C++ 2008 in Visual Studio 2008. I frequently use the following
We use Visual Studio 2008 and Surround SCM for source control. SCM drops files
We use Visual Studio 2008 for C# application development. We launch three process when
I'd like to use Visual Studio 2008 IDE for editing my local database schema
What is the best way to use SQL Server 2008 as a development database,
How do I use the profiler in Visual Studio 2008? I know theres a
I am trying to use the new DATETIMEOFFSET data type in SQL 2008 but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.