Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • lingjing 28 posts 45 karma points
    Oct 08, 2010 @ 06:03
    lingjing
    0

    Problem with display textbox multiple in XSLT

    Hi All

    I am using Umbraco 4.5.2 and have a textbox multiple in the document properties.

    When I try to display the content in web page with XSLT, it ignores my "return" and keep all text in one line instead.

    My xslt code is like below:

    <h1><xsl:value-of select="$currentPage/quote" disable-output-escaping="yes"/></h1>

    Can you help me with that?

    Thank you

    Jing

  • Paul Blair 466 posts 731 karma points
    Oct 08, 2010 @ 08:27
    Paul Blair
    1

    Jing,

    I assume you are using a multi-line text box (rather than the rich text editor). If so you will need to convert the line breaks to html <br/> tags. Something like this:

    <xsl:value-of select='umbraco.library:Replace($currentPage/quote, "&#x0a;", "&lt;br/&gt;" )' disable-output-escaping='yes'/>
  • Sebastiaan Janssen 5052 posts 15505 karma points MVP admin hq
    Oct 08, 2010 @ 08:32
    Sebastiaan Janssen
    2

    Well, as there is no HTML in a textbox, it will not convert simple line-breaks to a html "<br />" either.

    But there's an XSLT extension for that! Try this:

    <h1><xsl:value-of select="umbraco.library:ReplaceLineBreaks($currentPage/quote)" disable-output-escaping="yes"/></h1>
  • Sebastiaan Janssen 5052 posts 15505 karma points MVP admin hq
    Oct 08, 2010 @ 08:34
    Sebastiaan Janssen
    0

    @Paul Haha, almost the same answer, ReplaceLineBreaks is a bit simpler to use though, I didn't even know it existed, but I though it'd be a common scenario, so I checked. :-) Learn something new every day.

  • lingjing 28 posts 45 karma points
    Oct 14, 2010 @ 22:46
    lingjing
    0

    Thanks Sebastiaan, it works well for me.

Please Sign in or register to post replies

Write your reply to:

Draft