Today a colleague asked me how best to insert newlines into a concatenated set of address lines within a map. It struck me that despite spending eleven years as a BizTalk developer, creating hundreds if not thousands of maps, and even authoring a Pluralsight course on the Mapper, I’ve never actually attempted something as simple as inserting a newline into a string output!
Like most programmers with C# .NET experience, the first instinct was to try inserting “\n” or “\r\n” into the string. But of course that wouldn’t work – the output of a non-scripted mapper link is XSLT, not .NET code.
So that leads to the assumption that an XML entity character is required; surely that will work? Since the string “
” is the XML entity representation of a carriage return followed by a line feed (CR LF), we should be able to just insert that as a constant parameter within the String Concatenate functoid:

But then it becomes evident that the mapper escapes all characters that might otherwise be unintentionally interpreted as markup:

Hmmm… not turning out to be as easy as we thought. Surely we don’t need to resort to inline XSLT just to insert a newline into text?
Read more of this post