Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsStripping html tags  from descriptionStripping html tags from description
Previous
 
Next
New Post
9/12/2006 6:53 PM
 
Saw a couple people asking how to do this, but didn't find any explanation - so here is a way to strip all html tags out of the description, assuming you are using a customized xsl for the stylesheet:

Replace: <xsl:value-of select="description"/>
with: <xsl:apply-templates select="description" />

And replace:
<xsl:template match="description">
  <br>
    <xsl:value-of select="."/>
  </br>
</xsl:template>


With:
<xsl:template match="description">
    <xsl:call-template name="strip-tags">
        <xsl:with-param name="text" select="."/>
    </xsl:call-template>
</xsl:template>

<xsl:template name="strip-tags">
    <xsl:param name="text"/>
    <xsl:choose>
        <xsl:when test="contains($text, '&lt;')">
            <xsl:value-of select="substring-before($text, '&lt;')"/>
            <xsl:call-template name="strip-tags">
                    <xsl:with-param name="text" select="substring-after($text, '&gt;')"/>
            </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="$text"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

...and that should do it.
 
New Post
9/12/2006 7:30 PM
 
Great post!  Thanks for the contribution!
 
New Post
9/21/2006 8:56 PM
 

Greetings:

Actually, there is a post from 12/25/2005 "Google News Feeds Output HTML" (in this forum) which provides a single parm addition in a tag, to solve the problem.  I just loaded v3.3.5 and couldn't beleive this issue exists.  Perhaps there's a reason I'm not aware of that HTML code would need to be displayed to the user?

Ed in Tampa

 

 
New Post
9/22/2006 5:56 PM
 

The difference between the two methods is that disable-output-escaping="yes" will still allow html tags in the text of the description.  It just prevents the stylesheet from converting < and > to &lt; and &gt; (plus a couple others)

The code I'm using will strip out all html tags, leaving you with plain text.  Which is convenient when you don't want someone elses bold/img/marquee/blink tags showing up on your homepage.

 
New Post
9/23/2006 7:52 AM
 

clyoungberg...

Thank you clarifying that difference. 

If I may take advantage of your expertise, I've an RSS question that may not be related to the DNN module.  I've a news feed I'm using in that module (http://www.tampagov.net/appl_rss_feeds/rss.asp?feed=news) that doesn't return the date/time stamp of the news events, as I often see in other news feeds.

Question: Is that a function of how the XML used in the feed is constructed (I've no control over), or do I need to set some other parm to view these dates in the module?

Any and all guidance is greatly appreciated.

Regards,

Ed in Tampa

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsStripping html tags  from descriptionStripping html tags from description


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out