How to replace carriage return or line feeds with <BR>?

Posted on 2004-11-20
Last Modified: 2013-12-03
I've got the following code sample from EE to replace carriage returns or line feeds with my code, but I'm not sure where the code should go.

<xsl:template match="text()" priority="2">        
          <xsl:call-template name="break"/>

     <xsl:template name="break">                        
          <xsl:param name="text" select="."/>
               <xsl:when test="contains($text, '&#xa;')">
                    <xsl:value-of select="substring-before($text, '&#xa;')"/>
                    <xsl:call-template name="break">
                         <xsl:with-param name="text" select="substring-after($text, '&#xa;')"/>
                    <xsl:value-of select="$text"/>

Where would the above code go in
myy XSL code below:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=""

<xsl:output method="html" indent="yes" />

<xsl:template match="/">


<style type="text/css">
body {background-color:#f5f5f5}
h1 {text-align:center}
h2 {margin-top:0px;text-align:left;text-decoration:underline;color:red}
h3 {color:#00c;font-size:medium;margin-bottom:0px;margin-top:1ex;text-decoration:underline}
h4 {color:Blue;font-size:medium;text-align:center}
li,h3 {font-weight:bold}
pre {margin-top:0px;font-size:small;wrap}


<title>Daily Operations Status Report</title>

<H1>Daily Operations Status Report</H1>

  <xsl:apply-templates select="MSR/Info"/>



<xsl:template match="Info">

<xsl:when test="(BT30004 !='') or (LASTISA !='') or (SSEC !='') or (SIVU !='') or (CM10009 !='') or (ES00014 !='') or
(LASTSRDY !='') or (LASTSRM1 !='') or (LASTSRM2 !='') or (TNC !='') or (IPI !='') or (RPI !='') or (CMHM !='')
or (EBIS !='') or (MVS !='') or (AutoSys !='') or (NMFN !='') or (CSI !='') or (SB !='') or (STMT !='') or (EOS !='')
or (Virus !='') or (DB !='') or (PRNT !='') or (LNWN !='') or (WKNDPJ !='') or (BCP !='') or (Comment !='')">
<xsl:apply-templates select="TODAY"/>
<H2>Critical Application Cycle End Times</H2>
<H4>No Current Updates</H4>

<xsl:if test="(BT30004 !='') or (LASTISA !='')">
<h3>Critical Path Insurance/ISA</h3>
<xsl:apply-templates select="BT30004"/>
<xsl:apply-templates select="LASTISA"/>

<xsl:if test="(SSEC !='') or (SIVU !='')">
<xsl:apply-templates select="SSEC"/>
<xsl:apply-templates select="SIVU"/>

<xsl:if test="(CM10009 !='') or (ES00014 !='')">
<xsl:apply-templates select="CM10009"/>
<xsl:apply-templates select="ES00014"/>

<xsl:if test="(LASTSRDY !='') or (LASTSRM1 !='') or (LASTSRM2 !='')">
<xsl:apply-templates select="LASTSRDY"/>
<xsl:apply-templates select="LASTSRM1"/>
<xsl:apply-templates select="LASTSRM2"/>

<xsl:if test="(TNC !='') or (IPI !='') or (RPI !='') or (CMHM !='') or (EBIS !='')">
<xsl:apply-templates select="EBIS"/>
<xsl:apply-templates select="TNC"/>
<xsl:apply-templates select="IPI"/>
<xsl:apply-templates select="RPI"/>
<xsl:apply-templates select="CMHM"/>

<xsl:if test="(NMFN !='No Outages') or (CSI !='No Outages') or (SB !='No Outages') or (STMT !='No Outages')">
<xsl:apply-templates select="NMFN"/>
<xsl:apply-templates select="CSI"/>
<xsl:apply-templates select="SB"/>
<xsl:apply-templates select="STMT"/>

<xsl:apply-templates select="MVS"/>
<xsl:apply-templates select="AutoSys"/>
<xsl:apply-templates select="EOS"/>
<xsl:apply-templates select="Virus"/>
<xsl:apply-templates select="DB"/>
<xsl:apply-templates select="PRNT"/>
<xsl:apply-templates select="LNWN"/>
<xsl:apply-templates select="WKNDPJ"/>
<xsl:apply-templates select="BCP"/>
<xsl:apply-templates select="Comment"/>


<xsl:template match="TODAY[. != '']">
<h4>Cycle Run Of: <font color="#00008B"><xsl:value-of select="."/></font></h4>

<xsl:template match="BT30004[. != '']">
<li>Insurance DataBase ended at: <font color="#00008B"><xsl:value-of select="." /></font></li>

<xsl:template match="LASTISA[. != '']">
<li>ISA DataBase ended at: <font color="#00008B"><xsl:value-of select="." /></font></li>

<xsl:template match="SSEC[. != '']">
<li>Securities System Extract Cycle <font color="red">(2:30 AM SLA)
</font> ended at: <font color="#00008B"><xsl:value-of select="." /></font></li>

<xsl:template match="SIVU[. != '']">
<li>Securities Investment Warehouse Update <font color="red">(6 AM
SLA)</font> ended at: <font color="#00008B"><xsl:value-of select="." /></font></li>

<xsl:template match="CM10009[. != '']">
<li>Daily Commissions ended at: <font color="#00008B"><xsl:value-of select="." /></font></li>

<xsl:template match="ES00014[. != '']">
<li>Semi-Monthly Commissions ended at: <font color="#00008B"><xsl:value-of select="." /></font></li>

<xsl:template match="LASTSRDY[. != '']">
<li>Daily Sales Reporting Cycle ended at: <font color="#00008B"><xsl:value-of select="."/></font></li>

<xsl:template match="LASTSRM1[. != '']">
<li>MonthEnd Sales Day1 ended at: <font color="#00008B"><xsl:value-of  

<xsl:template match="LASTSRM2[. != '']">
<li>MonthEnd Sales Day2 ended at: <font color="#00008B"><xsl:value-of  

<xsl:template match="EBIS[. != '']">
EBIS/TNC Data Mart Load status: <font color="#00008B"><xsl:value-of  

<xsl:template match="TNC[. != '']">
<li>TNC/Client Information <font color="red">(7am SLA) </font> ended at: <font color="#00008B"><xsl:value-of  

<xsl:template match="IPI[. != '']">
<li>Investment Product Information <font color="red">(8am SLA) </font> ended at: <font color="#00008B"><xsl:value-of  

<xsl:template match="RPI[. != '']">
<li>Risk Product Information <font color="red">(7am SLA) </font> ended at: <font color="#00008B"><xsl:value-of  

<xsl:template match="CMHM[. != '']">
<li>Contact Management Historical Mart ended at: <font color="#00008B"><xsl:value-of  

<xsl:template match="MVS[. != '']">
<h3>MVS JobsTabled</h3><pre><xsl:value-of select="."/></pre>

<xsl:template match="AutoSys[. != '']">
<h3>AutoSys Jobs Tabled</h3><pre><xsl:value-of select="."/></pre>

<xsl:template match="NMFN[. != '']">
<li>NMFN and the Field Web Sites: <font color="#00008B"><xsl:value-of select="."/></font></li>

<xsl:template match="CSI[. != '']">
<li>CSI: <font color="#00008B"><xsl:value-of select="."/></font></li>

<xsl:template match="SB[. != '']">
<li>SiteBuilder: <font color="#00008B"><xsl:value-of select="."/></font></li>

<xsl:template match="STMT[. != '']">
<li>Statements: <font color="#00008B"><xsl:value-of select="."/></font></li>

<xsl:template match="EOS[. != '']">
<h3>EOS Availability</h3><div><xsl:value-of select="."/></div>

<xsl:template match="Virus[. != '']">
<h3>Virus Alerts</h3><div><xsl:value-of select="."/></div>

<xsl:template match="DB[. != '']">
<h3>DataBase Availability</h3><div><xsl:value-of select="."/></div>

<xsl:template match="PRNT[. != '']">
<h3>Outstanding Printing/Bursting</h3><div><xsl:value-of select="."/></div>

<xsl:template match="LNWN[. != '']">
<h3>LAN/WAN Availability</h3><div><xsl:value-of select="."/></div>

<xsl:template match="WKNDPJ[. != '']">
<h3>Weekend Projects</h3><div><xsl:value-of select="."/></div>

<xsl:template match="BCP[. != '']">
<h3>BCP Status Updates</h3><div><xsl:value-of select="."/></div>

<xsl:template match="Comment[. != '']">
<h3>Comments</h3><span><xsl:value-of select="."/></span>

<xsl:template match="*"/>


Question by:rkckjk
    LVL 19

    Accepted Solution

    put it just before <xsl:template match="*"/>
    LVL 52

    Expert Comment

    by:Carl Tawn
    It doesn't matter where you put it, just as long as it is outside of any other <xsl:template>'s

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
    Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now