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 FeedsRSS Feeds: No HTML FormattingRSS Feeds: No HTML Formatting
Previous
 
Next
New Post
6/1/2008 9:09 PM
 

Go to http://dev.live.com/virtualearth/. Do you notice how good their xsl stylesheet filters out the description so there's no html formatting?

The same rss feed is at http://blogs.msdn.com/virtualearth/rss.xml with all formatting enabled.

Now how do you turn off HTML formatting in an xsl stylesheet?

 
New Post
6/2/2008 8:21 AM
 

First, you are confusing a web page render with an RSS feed.  In the first example, this is a web rendering app that pulls it's data from the feed and uses app code to take a bit of the feed's description. 

In the second, the feed is transformed using MS IE's internal method of transforming.  Yes, it has an XSL associated with it, too. 

The real question of how to turn off HTML formatting using and HTML stylesheet is the one you really want to learn, right.

I'll tackle that more in depth, but for now, generally, folks use the command to disable output escaping, which is well documented on this forum.  However, that won't get you exactly what you want, namely, just the text w/o all of the formatting exposed. 

All feed transformations begin with inspecting the newsource feed and making decisions about what further customization is needed for your specific need.

I dealt with the issue using an example newsfeed source, and gave a custom xsl to achieve some of the more commonly wanted features, like limiting number of items displayed, and partial display of the description.  Go to this link to see the discussion and view the example.  It may help explain more for you.

www.dotnetnuke.com/Community/Forums/tabid/795/forumid/48/threadid/8833/scope/posts/threadpage/2/Default.aspx

 
New Post
6/2/2008 12:29 PM
 

Allright, this question comes up a lot, so I'm giving, yet another example of how to do it.  Although, this is not the only way or maybe even the best way, but it IS A way.  In the xsl below, I'm using a template to strip the html, limiting the items displayed to 5, and using inline css styling.  This will work on an RSSv2.0 rss feed, but you may have to tweak it a bit to get exactly the look and feel you want.  So, enjoy...

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl"
   xmlns:dc="http://purl.org/dc/elements/1.1/">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<!-- RSSv2.0 XSL stylesheet -->
<!-- Displays only 5 items and description stripped of HTML -->
<!-- The template to strip HTML found here: http://code.techinterviews.com/xslt-to-strip-html/26 -->
<!-- and another example here: http://p2p.wrox.com/topic.asp?TOPIC_ID=56239 -->
<!-- 2008/05/21 By Request -->
<!-- Author: Phil 'iwonder' Guerra -->
<!-- Use with Author Attribution Please -->
<!-- ================================== -->

<xsl:template match="/">
<style media="all" lang="en" type="text/css">
.rssChannelTitle
{
 font-family:  Tahoma;
   font-size:  10pt;
 font-weight:  bold;
  text-align:  Left;
}
.rssChannelDescription
{
 font-family: Times;
   font-size: 11pt;
 font-weight: Bold;
  text-align: Left;
}
.rssItemTitle
{
 font-family:  Verdana;
   font-size:  10pt;
   font-weight: BOLD;
 font-color: #00000;
}
.rssItemDescription
{
 font-family:  Verdana;
   font-size:  10pt;
   font-weight:  Normal;
 font-color: red;
}
.rssItemPubDate
{
 font-family:  Times;
   font-size:  8pt;
   font-weight:  Normal;
 font-color: #000000;
}
</style>

 <div>
  <xsl:apply-templates select="rss/channel"/>
  </div>
</xsl:template>

<xsl:template match="rss/channel">
<xsl:variable name="link" select="link"/>
  <xsl:variable name="description" select="description"/>
  <xsl:variable name="image" select="image/url"/>
  <xsl:variable name="idesc" select="image/description"/>
  <xsl:variable name="ilink" select="image/link"/>
  <xsl:variable name="iwide" select="image/width"/>
  <xsl:variable name="ihigh" select="image/height"/>

<div class="rssChannel">
 <xsl:if test="$image">
    <a href="{$ilink}" title="{$idesc}"><xsl:value-of select="ilink" /></a>
    <img src="{$image}" height="{$ihigh}" width="{$iwide}" style="float: left; margin: 2px; border: 0px;"/>
 </xsl:if>
 </div>
 <div class="rssChannelTitle"> 
 <a href="{$link}">
 <xsl:call-template name="strip_HTML">
    <xsl:with-param name="value" select="title" />
</xsl:call-template>
 </a><br/></div>
 

<div class="rssChannelDescription">
<xsl:call-template name="strip_HTML">
    <xsl:with-param name="value" select="description" />
</xsl:call-template></div>
<div class="rssChannelsubHead">
 <xsl:value-of select="webMaster"/><br/>
 <xsl:value-of select="copyright"/><br/>
 <xsl:value-of select="lastBuildDate"/>
 <hr/>
</div>
<xsl:apply-templates select="item"/>

</xsl:template>

<xsl:template match="item">
<xsl:if test="position() &lt; 6"> <!-- limit the display to 5 items -->


  <xsl:variable name="item_link" select="link"/>
  <xsl:variable name="item_title" select="description"/>
  <div class="rssItemTitle">
    <a href="{$item_link}" title="{$item_title}"><xsl:value-of select="title" disable-output-escaping="yes"/></a>
</div>
<div class="rssItemPubDate">
 (<xsl:value-of select="pubDate"/>)
</div>

<div class="rssItemDescription">
<xsl:call-template name="strip_HTML">
    <xsl:with-param name="value" select="description" />
</xsl:call-template>
</div>
<hr/>
</xsl:if> <!-- end of If statement block for limiting number of items -->
</xsl:template>

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

</xsl:template>

</xsl:stylesheet>

Cheers ;-)

 
New Post
6/2/2008 4:00 PM
 

And for those that emailed (and others)...  Yes, you can limit the amount of text to translate in the description.  Just substitute this code in the call of the template, which limits the text to the first 300 characters.  Make it longer or shorter to suit your need...

<xsl:call-template name="strip_HTML">
    <xsl:with-param name="value" select="substring(description,1,300)" />
</xsl:call-template>...

Results in this example, which is easier to digest rather than all of the text that was put into the feed's description.


 

(Mon, 02 Jun 2008 02:29:31 GMT)
SignPoster.com recently launched with their new map-based search service leveraging Virtual Earth as a backdrop for locating available ad space. You put in a neighborhood, a search radius and media type (poster or bus) and off yo...

(Sat, 31 May 2008 03:07:50 GMT)
Trulia launched their new home searching tool dubbed "Snapshot" as a new and unique way to search for real estate. I have to say, this site IS ABSOLUTELY SICK. For you non-Gen Xers and y...

(Fri, 30 May 2008 06:12:45 GMT)
We sent out another customer/developer satisfaction survey today. We'd love to here what you have to say - good, bad or other - so feel free to complete the Virtual Earth Developer Satisfaction Survey. Here's the a...

(Thu, 22 May 2008 00:30:06 GMT)
I stumbled across a Virtual Earth mashup dubbed The Top 100 Iconic Photo Locations Map Room from Canon and Microsoft and realized there's a whole contest behind this thing (details below). First, the mashup! ...

(Wed, 21 May 2008 23:11:42 GMT)
I've mentioned Weather Central in the past with regards to some of their killing broadcasts which use Virtual Earth as a backdrop. Well, I caug...
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsRSS Feeds: No HTML FormattingRSS Feeds: No HTML Formatting


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