{"id":29,"date":"2017-02-27T16:46:00","date_gmt":"2017-02-27T16:46:00","guid":{"rendered":"\/lisa\/post\/2017\/02\/27\/Using-Raw-HTML-with-HTMLListener.aspx"},"modified":"2017-02-27T16:46:00","modified_gmt":"2017-02-27T16:46:00","slug":"using-raw-html-with-htmllistener","status":"publish","type":"post","link":"https:\/\/spacefold.com\/lisa\/2017\/02\/27\/using-raw-html-with-htmllistener\/","title":{"rendered":"Using Raw HTML with HTMLListener"},"content":{"rendered":"<h2>I am not sure why I never got around to doing this&#8230;.<\/h2>\n<p><a href=\"http:\/\/yousfi.over-blog.com\/contact\" target=\"_blank\" rel=\"noopener\">Yousfi Benameur<\/a>&nbsp;has written to ask how he can use raw HTML tags (presumably in a memo or string field) and output richly-formatted HTML using HTML Listener. &nbsp;<\/p>\n<p>&nbsp;<img decoding=\"async\" style=\"display: block; margin-left: auto; margin-right: auto;\" src=\"\/lisa\/wp-non\/migrated\/2017\/2\/RawHTML1.PNG\" alt=\"\" \/><\/p>\n<p>This sounds like it should be possible natively with no trouble at all, but all HTMLListsener does is take VFP FRX XML and transform it using XSLT. &nbsp;XMLListener, which actually creates VFP FRX XML, escapes all text content, for good reasons.<\/p>\n<p>To get your original HTML tags faithfully rendered by HTMLListener, therefore, you have to tell your XSLT to output the text content unescaped.&nbsp;<\/p>\n<h2>So, okay, I&#8217;ve implemented it now\/tonight.<\/h2>\n<p>To use this, all you really have to do is, a) use a new XSLT with slight changes over the Sedna or SP2 version, which I&#8217;ll provide herein, and, b) tell it that a particular text object in the layout contains raw HTML tags and you don&#8217;t want its contents escaped. &nbsp;<\/p>\n<p>No changes to any VCX or the Report Builder is needed for this. &nbsp;I just created a custom attribute and told my new XSLT to pay attention to it. &nbsp;Here&#8217;s what that looks like in the Report Builder. &nbsp;To work with the XSLT as currently created, it has to be a Yes-No Advanced property, it has to be called HTML.Raw, and it has to have the value Yes.<\/p>\n<h2><img decoding=\"async\" style=\"font-size: 10px; display: block; margin-left: auto; margin-right: auto;\" src=\"\/lisa\/wp-non\/migrated\/2017\/2\/RawHTML2.PNG\" alt=\"\" \/><\/h2>\n<p>&nbsp;<\/p>\n<h2>It probably has some limitations. &nbsp;<\/h2>\n<p>This is not a very polished implementation. It&#8217;s not burned into the various configuration details of the shipping HTMLListener, or Report Builder, so you just &#8230; create the attribute on the fly.<\/p>\n<p>I&#8217;m sure there are other things it can&#8217;t do. For one thing, it doesn&#8217;t work properly if you use textareas for stretching text contents in the designer. &nbsp;The standard XSLT does this by default because everybody in the beta of VFP 9 wanted to make sure that every possible type of stretching content would show up the way they thought it should.<\/p>\n<p>So, along with designating a custom XSLT file, you&#8217;ll need to either <em>not<\/em>&nbsp;use stretching text objects or just tell the XSLT not to use textareas for stretching text objects. &nbsp;<\/p>\n<h2>Think you can live with that?<\/h2>\n<p>Assuming so, your code basically becomes this:<\/p>\n<p><img decoding=\"async\" style=\"display: block; margin-left: auto; margin-right: auto;\" src=\"\/lisa\/wp-non\/migrated\/2017\/2\/RawHTML3.PNG\" alt=\"\" \/><\/p>\n<h2>&#8230; and here&#8217;s the revised XSLT.<\/h2>\n<p>Et voil&agrave;, as some of us who knew how to spell properly used to say on FoxForum:&nbsp;<\/p>\n<p><a href=\"\/lisa\/wp-non\/migrated\/2017\/2\/xsltprocessoruser-sp2Plus.zip\">xsltprocessoruser-sp2Plus.zip (7.77 kb)<\/a>&nbsp; <\/p>\n<p>It&#8217;s a little bit of a rush job but a nice example of how you can quickly extend the provided system without getting deep into the bowels of the provided component code.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am not sure why I never got around to doing this&#8230;. Yousfi Benameur&nbsp;has written to ask how he can use raw HTML tags (presumably in a memo or string field) and output richly-formatted HTML using HTML Listener. &nbsp; &nbsp; This sounds like it should be possible natively with no trouble at all, but all<a class=\"more-link\" href=\"https:\/\/spacefold.com\/lisa\/2017\/02\/27\/using-raw-html-with-htmllistener\/\">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":[5,9,10],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-reporting","category-visual-foxpro","category-xml-xslt"],"_links":{"self":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/29","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=29"}],"version-history":[{"count":0,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"wp:attachment":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}