{"id":322,"date":"2012-07-24T10:12:44","date_gmt":"2012-07-24T17:12:44","guid":{"rendered":"https:\/\/mmman.itgroove.net\/?p=322"},"modified":"2023-02-24T21:47:01","modified_gmt":"2023-02-24T21:47:01","slug":"stripping-html-tags-from-an-xsl-value-in-sharepoint-2010","status":"publish","type":"post","link":"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/","title":{"rendered":"Stripping HTML Tags From an XSL Value (in SharePoint 2010)"},"content":{"rendered":"<p>I had a scenario where the contents of the value I was looking for was a multiline rich text value.\u00a0 The contents I cared about displaying to the end user was simply the text nodes contained within this value.\u00a0 In other words, what I cared about seeing was this:<\/p>\n<blockquote><p>Important Information: Exact timing and details of this meeting to be confirmed.\u00a0\u00a0 This meeting will be held in Nanaimo<\/p><\/blockquote>\n<p>But, what I was actually seeing on the screen was this:<\/p>\n<blockquote><p>Important Information: <span style=\"font-family: Courier New\">&lt;div&gt;&lt;div&gt;&lt;div&gt;Exact timing and details of this meeting to be confirmed.&lt;\/div&gt; &lt;div&gt; &lt;\/div&gt; &lt;div&gt;This meeting will be held in Nanaimo&lt;\/div&gt;&lt;\/div&gt; &lt;\/div&gt;<\/span><\/p><\/blockquote>\n<p>The value in the Row of my XSL result looked basically like this (with all the other node attributes stripped out for brevity\u2019s sake).<\/p>\n<p>[sourcecode language=&#8221;XML&#8221;]<br \/>\n&lt;Row ImportantInformation=&quot;&amp;lt;div class=&amp;quot;ExternalClass731DB49F9ACC43AAA73AB0C68C117F2F&amp;quot;&amp;gt;&amp;lt;div&amp;gt;&amp;lt;div&amp;gt;Exact timing and<br \/>\ndetails of this meeting to be confirmed.&amp;lt;\/div&amp;gt;&#xD;&#xA;&amp;lt;div&amp;gt; &amp;lt;\/div&amp;gt;&#xD;&#xA;&amp;lt;div&amp;gt;This meeting will be held in<br \/>\nNanaimo&amp;lt;\/div&amp;gt;&amp;lt;\/div&amp;gt;&#xD;&#xA;&amp;lt;\/div&amp;gt;&quot; \/&gt;<br \/>\n[\/sourcecode]<\/p>\n<p>I\u2019m not going to go into the details of how to get the XSL setup (basically, I changed \/Style Library\/XSL Style Sheets\/ItemStyle.xsl file in SharePoint Designer 2010), but to convert this value from the unwanted HTML output to the (desirable) text output, you can simply run it through the following transform.<\/p>\n<p>I added this stylesheet template to the end of the file (before the close <span style=\"font-family: Courier New\">&lt;\/xsl:stylesheet&gt;<\/span>).<\/p>\n<p>[sourcecode language=&#8221;XML&#8221;]<br \/>\n&lt;xsl:template name=&quot;strip-tags&quot;&gt;<br \/>\n &lt;xsl:param name=&quot;text&quot;\/&gt;<br \/>\n &lt;xsl:choose&gt;<br \/>\n    &lt;xsl:when test=&quot;contains($text, \u2018&amp;lt;\u2019)&quot;&gt;<br \/>\n       &lt;xsl:value-of select=&quot;substring-before($text, \u2018&amp;lt;\u2019)&quot;\/&gt;<br \/>\n       &lt;xsl:call-template name=&quot;strip-tags&quot;&gt;<br \/>\n          &lt;xsl:with-param name=&quot;text&quot; select=&quot;substring-after($text, \u2018&amp;gt;\u2019)&quot;\/&gt;<br \/>\n       &lt;\/xsl:call-template&gt;<br \/>\n    &lt;\/xsl:when&gt;<br \/>\n    &lt;xsl:otherwise&gt;<br \/>\n       &lt;xsl:value-of select=&quot;$text&quot;\/&gt;<br \/>\n    &lt;\/xsl:otherwise&gt;<br \/>\n &lt;\/xsl:choose&gt;<br \/>\n&lt;\/xsl:template&gt;<br \/>\n[\/sourcecode]<\/p>\n<p>To call this, I added a call to the XSL style sheet by changing my code<\/p>\n<p>FROM:<\/p>\n<p>[sourcecode language=&#8221;XML&#8221;]<br \/>\n&lt;div class=&quot;description&quot;&gt;<br \/>\nImportant Information:&lt;xsl:value-of select=&quot;@ImportantInformation&quot; \/&gt;<br \/>\n&lt;\/div&gt;<br \/>\n[\/sourcecode]<\/p>\n<p>TO:<\/p>\n<p>[sourcecode language=&#8221;XML&#8221;]<br \/>\n&lt;div class=&quot;description&quot;&gt;<br \/>\nImportant Information:<br \/>\n&lt;xsl:call-template name=&quot;strip-tags&quot;&gt;<br \/>\n   &lt;xsl:with-param name=&quot;text&quot; select=&quot;@ImportantInformation&quot;\/&gt;<br \/>\n&lt;\/xsl:call-template&gt;<br \/>\n&lt;\/div&gt;<br \/>\n[\/sourcecode]<\/p>\n<p>Hopefully this can help other people strip the HTML from a multi-line text value.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a scenario where the contents of the value I was looking for was a multiline rich text value.\u00a0 The contents I cared about displaying to the end user was simply the text nodes contained within this value.\u00a0 In other words, what I cared about seeing was this: Important Information: Exact timing and details &hellip; <a href=\"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/\"><\/a><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[7,40],"tags":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Stripping HTML Tags From an XSL Value (in SharePoint 2010) - Archive<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stripping HTML Tags From an XSL Value (in SharePoint 2010) - Archive\" \/>\n<meta property=\"og:description\" content=\"I had a scenario where the contents of the value I was looking for was a multiline rich text value.\u00a0 The contents I cared about displaying to the end user was simply the text nodes contained within this value.\u00a0 In other words, what I cared about seeing was this: Important Information: Exact timing and details &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/\" \/>\n<meta property=\"og:site_name\" content=\"Archive\" \/>\n<meta property=\"article:published_time\" content=\"2012-07-24T17:12:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-24T21:47:01+00:00\" \/>\n<meta name=\"author\" content=\"Colin Phillips (Alumni)\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Colin Phillips (Alumni)\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/\",\"url\":\"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/\",\"name\":\"Stripping HTML Tags From an XSL Value (in SharePoint 2010) - Archive\",\"isPartOf\":{\"@id\":\"https:\/\/regroove.ca\/archive\/#website\"},\"datePublished\":\"2012-07-24T17:12:44+00:00\",\"dateModified\":\"2023-02-24T21:47:01+00:00\",\"author\":{\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b\"},\"breadcrumb\":{\"@id\":\"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog Archive\",\"item\":\"https:\/\/regroove.ca\/archive\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Stripping HTML Tags From an XSL Value (in SharePoint 2010)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/regroove.ca\/archive\/#website\",\"url\":\"https:\/\/regroove.ca\/archive\/\",\"name\":\"Archive\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/regroove.ca\/archive\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b\",\"name\":\"Colin Phillips (Alumni)\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/regroove.ca\/archive\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g\",\"caption\":\"Colin Phillips (Alumni)\"},\"url\":\"https:\/\/regroove.ca\/archive\/author\/cphillips\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Stripping HTML Tags From an XSL Value (in SharePoint 2010) - Archive","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/","og_locale":"en_US","og_type":"article","og_title":"Stripping HTML Tags From an XSL Value (in SharePoint 2010) - Archive","og_description":"I had a scenario where the contents of the value I was looking for was a multiline rich text value.\u00a0 The contents I cared about displaying to the end user was simply the text nodes contained within this value.\u00a0 In other words, what I cared about seeing was this: Important Information: Exact timing and details &hellip;","og_url":"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/","og_site_name":"Archive","article_published_time":"2012-07-24T17:12:44+00:00","article_modified_time":"2023-02-24T21:47:01+00:00","author":"Colin Phillips (Alumni)","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Colin Phillips (Alumni)","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/","url":"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/","name":"Stripping HTML Tags From an XSL Value (in SharePoint 2010) - Archive","isPartOf":{"@id":"https:\/\/regroove.ca\/archive\/#website"},"datePublished":"2012-07-24T17:12:44+00:00","dateModified":"2023-02-24T21:47:01+00:00","author":{"@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b"},"breadcrumb":{"@id":"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/regroove.ca\/archive\/2012\/07\/24\/stripping-html-tags-from-an-xsl-value-in-sharepoint-2010\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Archive","item":"https:\/\/regroove.ca\/archive\/"},{"@type":"ListItem","position":2,"name":"Stripping HTML Tags From an XSL Value (in SharePoint 2010)"}]},{"@type":"WebSite","@id":"https:\/\/regroove.ca\/archive\/#website","url":"https:\/\/regroove.ca\/archive\/","name":"Archive","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/regroove.ca\/archive\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/adeb0df1cc7a862160be620ca7eace1b","name":"Colin Phillips (Alumni)","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/regroove.ca\/archive\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/14eeab0d377e9630e0983d9c08911979?s=96&d=mm&r=g","caption":"Colin Phillips (Alumni)"},"url":"https:\/\/regroove.ca\/archive\/author\/cphillips\/"}]}},"_links":{"self":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/322"}],"collection":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/comments?post=322"}],"version-history":[{"count":1,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/322\/revisions"}],"predecessor-version":[{"id":1983,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/posts\/322\/revisions\/1983"}],"wp:attachment":[{"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/media?parent=322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/categories?post=322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/regroove.ca\/archive\/wp-json\/wp\/v2\/tags?post=322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}