Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm trying to convert line breaks that the administrator has entered into a multiple textbox. I need this to be done in my XSLT. Here's my code:
<xsl:value-of select="umbraco.library:ReplaceLineBreaks($currentPage/textStartPage)" />
I know that there is a valid text value with line breaks in $currentPage/textStartPage since the text is printed to the page. And the line breaks are visible when I view the HTML source code but since no HTML tags are generated using the above code I get one long text withour line breaks.
I'm using umbraco v 4.9.0 (Assembly version: 1.0.4633.18696).
Just on the off-chance, are you using a Mac (OS X) to edit your content?
The reason I ask is that I know that the "ReplaceLineBreaks" function does a string replace on the "\n" control character (swapping it out for a "<br/>"), but I believe on the Mac a newline is an "\r" character. Are you able to edit the content from a Windows machine?
I could be completely wrong about this... but seeing as no one else had replied, I thought it might help?
Are you by any chance seeing some weird characters/content where the linebreaks were supposed to be? (e.g.: <br/>)
The value-of instruction can only return a string of text, which will make any HTML content come out as escaped. You can try to add a flag to the instruction to disable this:
<xsl:value-of select="umbraco.library:ReplaceLineBreaks($currentPage/textStartPage)" disable-output-escaping="yes" />
The \n vs. \r thing ideally shouldn't be a problem, as one of the beatiful things of using XML is that all linefeeds must be normalized initially by the parser, so regardless of platform they should all end up as the character when the file is parsed and ready for use, e.g., with XSLT.
I came across this on a legacy system supported and that last attribute did the trick indeed. Without it it return < and >.
This was after adding the suggested template code at http://our.umbraco.org/forum/umbraco-pro/contour/18103-Send-xslt-transformed-email-Here-is-my-xslt-email-template
without any changes. Not sure why it worked for other in that forum post as no one seems to complained about it...
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted