Nibble

Converting Linebreaks

When using the textbox multiple datatype in umbraco you might want to convert the linebreaks into html <br> tags. This can be done just by checking a checkbox in the insert umbraco field dialog when inserting a field on your template. Just look for the convert linebreaks checkbox.

image

 

image 

 

In xslt you can also do this by using the umbraco library method umbraco.library.ReplaceLineBreaks(System.String)

So that would like a this:

<xsl:value-of select=”umbraco.library:ReplaceLineBreaks(data [@alias = ‘youralias’])”/>

3 Comments so far

  1. Ismail Mayat on October 3rd, 2008

    you live an learn. been using umbraco since 2006 and i didnt know you could do this!!!!

  2. Thomas Kahn on January 12th, 2009

    Don’t forget to set the parameter: disable-output-escaping=”yes” on the XSLT-tag as well. Otherwise you will get the break-tags printed in text on the page.

  3. pem on July 23rd, 2010

    sweet!
    cheers

Leave a Reply