{"id":105,"date":"2009-07-11T16:56:00","date_gmt":"2009-07-11T16:56:00","guid":{"rendered":"\/lisa\/post\/2009\/07\/11\/XSLT-and-your-mother-dont-speak-C.aspx"},"modified":"2009-07-11T16:56:00","modified_gmt":"2009-07-11T16:56:00","slug":"xslt-and-your-mother-dont-speak-c","status":"publish","type":"post","link":"https:\/\/spacefold.com\/lisa\/2009\/07\/11\/xslt-and-your-mother-dont-speak-c\/","title":{"rendered":"XSLT and your mother don&#8217;t speak C#"},"content":{"rendered":"<p>\nBeing an integration specialist is never dull.\n<\/p>\n<p>\nI am going to excerpt from&nbsp;an IM chat with one of the programmers on my team, about an SSIS package&nbsp;we&nbsp;are developing.\n<\/p>\n<dl>\n<dt>He:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\">I got:<br \/>\n&nbsp;<\/font><\/dd>\n<dl>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\">A package of type Policy, labelled as ECWISE\\XXX 2009-07-03 15:33:17.940, FAILED during its run from 2009-07-03 to 2009-07-03.\\r\\nHere is the error information: \\r\\n&quot;\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-Please do not reply to this automated message. <\/font><\/dd>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\"><br \/>\n<\/font>&nbsp;<\/dd>\n<\/dl>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\">why the \\r\\n escaped in the mail? <br \/>\ni used the xslt to transform the xml column into a string variable, and later i use this variable as the MailMessage.Body <\/font><\/dd>\n<dt>Me:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#6000bf\">how do you set message body on the Send Mail task?<\/font><\/dd>\n<dt>He:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\">i&#39;m using the script task and using the smtpclient<\/font><\/dd>\n<dt>Me:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#6000bf\">You put in the carriage return and newline escaped in your body, what do you expect? <\/font><\/dd>\n<dt>He<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\">i expect a real new line<\/font><\/dd>\n<dt>Me:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#6000bf\">Why? That&#39;s ridiculous. what do you mean by &quot;real&quot;?<\/font><\/dd>\n<dt>He:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\">I expect:<\/p>\n<p>Here is the error information: C:\\temp31 does not exist! <br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; <br \/>\nPlease do not reply to this automated message. <\/p>\n<p>Something like that. <\/font><\/dd>\n<dt>Me:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#6000bf\">FOR GOD SAKES<br \/>\nI KNOW WHAT A NEW LINE AND CARRIAGE RETURN LOOK LIKE<br \/>\nI mean: why do you use the word &quot;real&quot;&#8230;<br \/>\nWhat makes \\r\\n &quot;real&quot; to you?<br \/>\nThink about it. <\/font><\/dd>\n<\/dl>\n<h2>Sigh.<\/h2>\n<p>\nAt this point, everybody who knows me can tell this is a verbatim conversation, right?\n<\/p>\n<p>\nTo continue:\n<\/p>\n<dl>\n<dt>He: <\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\">I used the wrong word, sorry.<\/font> <\/dd>\n<dt>Me:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#6000bf\">No, don&#39;t say &quot;sorry&quot;. Figure it out!<br \/>\nWhy is \\r\\n &quot;real&quot;?<br \/>\nThink why you said it. <br \/>\nthey are only characters, why are they &quot;real&quot; ?<br \/>\n\\r\\n is real because&#8230; <\/font><\/dd>\n<dt>He:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\">I thought they are carriage return in text<\/font><\/dd>\n<dt>Me<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#6000bf\">Really? If you are writing a letter to your mother, and you write \\n\\r does she interpret it as lf cr?<br \/>\nThe letter is text.<br \/>\n[<font color=\"#003399\">A long pause here<\/font>]<br \/>\nWhen you wrote that string in your code what did you do?<br \/>\ndid you write x + &quot;\\r\\n&quot; + y in the script task? <\/font><\/dd>\n<dt>He:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\">Almost<br \/>\nI&#39;m doing it in XSLT, so concat(x, &quot;\\r\\n&quot;, y) <\/font><\/dd>\n<dt>Me:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#6000bf\">&lt;rofl&gt; <br \/>\nThat is utterly ridiculous. <br \/>\nLet me ask you about your mother again<br \/>\nDoes she read \\r\\n as CRLF?<\/font> <\/dd>\n<dt>He:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#003399\">Never.<\/font><\/dd>\n<dt>Me:<\/dt>\n<dd style=\"margin-left: 20px\"><font color=\"#6000bf\">That&#39;s right, never. <\/p>\n<p>So why do *you* read it that way? Why does it seem &quot;real&quot; to you?<\/p>\n<p>I will tell you why, but you will kick yourself&#8230; <strong>It&#39;s because you are a C# programmer .<\/p>\n<p><\/strong>\\r\\n is not &quot;real. It is just a convention in some languages. There is nothing &quot;real&quot; about it. <br \/>\nYour mother and XSLT don&#39;t speak C#.<\/font><\/dd>\n<dd style=\"margin-left: 20px\"><\/dd>\n<\/dl>\n<h2>&nbsp;&nbsp;<\/h2>\n<h2>It&#39;s not XSLT&#39;s fault, or your mother&#39;s.<\/h2>\n<p>\nIn XSLT he ended&nbsp;&nbsp;up using &lt;xsl:text&gt; to force a line break in his text e-mail message. That&#39;s okay, but please note you <strong>can <\/strong>use properly encoded <a href=\"http:\/\/en.wikipedia.org\/wiki\/Numeric_character_reference\" target=\"_blank\" title=\"read about numerical entity references\" rel=\"noopener\">entity references <\/a>to create a CRLF in XSLT, just like you can in C#.&nbsp;\n<\/p>\n<p>\nAs an interesting side-note, this project was being written in SSIS 2005. SSIS 2005 script tasks&nbsp;don&#39;t speak C# either. So, even if&nbsp;we were not using XSLT&nbsp;to formulate the message from the XML source containing the error information, we would have to use a VB convention, not \\r\\n, to get the job done.\n<\/p>\n<p>\nIf he were sending the message body as HTML rather than text for this error notice, he&#39;d have to use &lt;BR\/&gt;. SSIS 2005 script and HTML are two more&nbsp;environments that don&#39;t understand \\r\\n.\n<\/p>\n<p>\n<strong>There&#39;s always a way to do it.<\/strong>&nbsp;But there is nothing inherently &quot;real&quot; about \\r\\n, no matter a person who is single-language-centric might think.\n<\/p>\n<p>\nI want to be fair and say that this particular programmer is usually very agile-minded as we hook differently-abled types of code to each other in an integrated application. I&#39;m not pointing him out in particular.\n<\/p>\n<h2>We live in the Matrix<\/h2>\n<p>\nI&#39;m trying to say: in the world we live in now, <strong>nobody<\/strong> can afford to be language-centric.&nbsp; I&#39;m trying to say: <strong>none<\/strong> of this is real.&nbsp;\n<\/p>\n<p>\nUse what&#39;s best for the customer and best for the product. Don&#39;t get hung up on what&#39;s cool or what a vendor recommends.&nbsp; Don&#39;t get freaked out by the little places, like representation of characters, that are different in each environment.&nbsp;\n<\/p>\n<p>\nJust take a breath, get your bearings, you&#39;ll find the right &quot;words&quot; in the right dialect. If what you&#39;re trying to express is important, have a little faith and realize there&#39;s a way to do it, in any language, no matter where in the world you are.&nbsp;\n<\/p>\n<p>\nAnd <a href=\"http:\/\/en.wikipedia.org\/wiki\/Hill_Street_Blues\" target=\"_blank\" title=\"Hill Street Blues\" rel=\"noopener\">be careful out there<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Being an integration specialist is never dull. I am going to excerpt from&nbsp;an IM chat with one of the programmers on my team, about an SSIS package&nbsp;we&nbsp;are developing. He: I got: &nbsp; A package of type Policy, labelled as ECWISE\\XXX 2009-07-03 15:33:17.940, FAILED during its run from 2009-07-03 to 2009-07-03.\\r\\nHere is the error information: \\r\\n&quot;\\r\\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-Please<a class=\"more-link\" href=\"https:\/\/spacefold.com\/lisa\/2009\/07\/11\/xslt-and-your-mother-dont-speak-c\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4,6,10],"tags":[],"class_list":["post-105","post","type-post","status-publish","format-standard","hentry","category-general-techspeak","category-life","category-sql-server","category-xml-xslt"],"_links":{"self":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":0,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"wp:attachment":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}