Doesn't look like umbraco.library has what you need, so you're probably going to need to write your own xslt extension to replace line breaks using RegEx.Replace. Pretty straightforward and a useful thing to have set up when you need other functions like this.
You'll either need to use some of the exslt extension methods (such as regex, but there may be others in there) or build your own extension (or use incline c#).
Or... and this would be quick and sneaky if it works...
Glad you found a solution. But I actually think that you can maybe use the XSLT function normalize-space() to solve this. I had an issue a few days ago where I needed to fetch some rich text data from umbraco inside a javascript. The script kept choking when it received the data because of line breaks in the HTML.
I solved it using the above mentioned function. So you could try writing this:
Removing TinyMCE line breaks
Can't get this to work at all
I need to strip out all the line breaks so I can use the tinymce value in javascript.
I've tried:
The value of address is
But I need it to be
Any ideas?
Cheers,
Rich
Doesn't look like umbraco.library has what you need, so you're probably going to need to write your own xslt extension to replace line breaks using RegEx.Replace. Pretty straightforward and a useful thing to have set up when you need other functions like this.
http://en.wikibooks.org/wiki/Umbraco/Create_xslt_exstension_like_umbraco.Library_in_C
You'll either need to use some of the exslt extension methods (such as regex, but there may be others in there) or build your own extension (or use incline c#).
Or... and this would be quick and sneaky if it works...
Notice the indent="no" element. Give that a shot and see what happens first.
cheers,
doug.
Did you also try
Dan
Thanks guys, I went with a quick C# solution in the end.
Didn't get to try another solution but will try then when I get a sec and report back.
Thanks again.
Hi Rich
Glad you found a solution. But I actually think that you can maybe use the XSLT function normalize-space() to solve this. I had an issue a few days ago where I needed to fetch some rich text data from umbraco inside a javascript. The script kept choking when it received the data because of line breaks in the HTML.
I solved it using the above mentioned function. So you could try writing this:
So if the stuff you are doing now does not work then try it out :-)
/Jan
Jan,
Your solution worked well for me - I was taking data from the rich text editor so did not need the ReplaceLineBreaks call.
Thanks
Paul
is working on a reply...