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 FeedsNews Feed (RSS) Free Video Tutorial & XSL Transformation tutorial with filesNews Feed (RSS) Free Video Tutorial & XSL Transformation tutorial with files
Previous
 
Next
New Post
5/22/2008 12:10 PM
 

Ok, here's a bit of explaination.

As the RSS v2.0 spec goes, each RSS feed has attributes that are either required or optional, which is a good and sometimes a very bad thing due to the many flavors of how this spec get interpreted by browser coders like MS IE and FireFox.  Some forgive and forget, some forgive, others just forget.  I'll try to explain further.

In the xsl above, I coded to allow for a news feed to include the optional Channel image attributes.  (Go to Harvard Law to read the RSSv2.0 specs).  As such, I created variables to hold the various information, which whould allow me to use the variable name in calls to them later in the code. 

Source Feed
<channel> <ttl>15</ttl> <title>Dispatch Online - News</title> <link>http://www.dispatch.co.za</link> <description>All the top News stories</description> <image> <url>http://www.dispatch.co.za/RSS/Images/Daily Dispatch_News204672.jpg</url> <title></title> <link>http://www.dispatch.co.za/RSS/Images/Daily Dispatch_News204672.jpg</link>
</image>
XSL variables
<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"/>

Later code references:

<div class="rssChannelTitle">
 <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> 
 <a href="{$link}"><xsl:value-of select="title" /></a><br/>
 </div>

Now, turn on the thinking cap.  Normally, the specs say the Channel attribute contains information about the Channel image like the link, title, URL, with the image width, height as optional.  Most source feeds have some blurb about usage of their feeds that includes giving due attribution to the source.  That includes the Name of the News source, along with their back link and a company icon image.  The Channel Image attribute is what is usually used to provide this information.  As a user/coder, you have a choice on what to do about giving attribution, but I generally choose to include it, as I don't mind giving them their due for hiring photogs, writers, and such. Small price to pay for the news feed, I figure.

In the sample XSL above, I assumed that the height and width would be defaulted to the RSSv2.0 specs max settings if not provided, or just not displayed.  In MS IE, if an image attribute is detected without the width and height information, it will not display at all.  However, in FireFox, it just displays the image as the link to it is given. 

Each of the variables are referenced to make it easier to code (decide for yourself).  None of them are actually needed if you don't want the image attribution to display, though.  That's the beauty of 'feeding yourself'.  Use what you will, choice is yours.

So, if you don't want the image stuff, just take this bit of code out.

 <xsl:if test="$image">
    <a href="{$ilink}" title="{$idesc}"><xsl:value-of select="ilink" /></a>
    <img src="{$image}" style="float: left; margin: 2px; border: 0px;"/>
 </xsl:if> 

Nothing to it.  In that code you'll see the variables being referenced.  Again, this is only one of the many, many ways to approach the problem and solve it.

Hope that clears it up.

Cheers !-)

 
New Post
5/22/2008 12:22 PM
 

OFF TOPIC: Why yes I am.  check out www.mogridgedesign.co.za or www.shebangwebsites.co.za

Why do you ask?? (Not that this is the place for these discussions....


Shebang Websites - A product of Mogridge Design
Hey, we're partnered with UntangleMyWeb.com

 
New Post
5/22/2008 12:27 PM
 

A bit more...

You don't see the full Channel Image attributes in the 'Dispatch Online - News' feed, but check out other newsfeeds sources, like this one from 'USAToday'.

    <image>
      <title>USATODAY.com News - Top Stories</title>
      <width>142</width>
      <height>18</height>
      <link>http://www.usatoday.com/news/default.htm</link>
      <url>http://images.usatoday.com/_common/_images/usatodaycom_135x20.gif</url>
    </image>

In the 'Dispatch Online News', the provider mixes a lot of things up.  It's not really just an RSSv2.0 feed, which makes it a bit of a sweat to custom transform, though it's just a matter of going through it.  Now, this is not to say they've botched it up, it's just shows that there is nothing you can count on with any degreee of certainty with transforming news feeds.  The truth is this: if you customize a feed, you will probably wind up customizing it again and again over time, as the news provider changes their feed structure.  That's why the more modern browsers have gone to internal support of rss for display of news feeds, which detect the RSS version, namesapces, and make a decision on what to include, and exclude.  It's another approach to the problems of so many variances and structure changes of newsfeeds.

Now, the issue with this internal transformation is you are stuck with the implementation, and don't have a lot of say about how to display it.  If you are not a coder, then you probably don't care, because all you want is the feed (at least to start), others want more control, and that's where customization of the xsl come into play.

 

Now, back to your regular programming.... 

 
New Post
5/23/2008 8:12 PM
 

Methuzala wrote

OFF TOPIC: Why yes I am.  check out www.mogridgedesign.co.za or www.shebangwebsites.co.za

Why do you ask?? (Not that this is the place for these discussions....

I grew up there (Port Rex, '95) but left for UK in '99 when I was 21 - just rare to find a fellow slummies person on the net these days with it being such a small place ;) I like your sites - glad to see DNN/web design etc. is going well in good old South Africa!


Entrepreneur

PokerDIY Tournament Manager - PokerDIY Tournament Manager<
PokerDIY Game Finder - Mobile Apps powered by DNN
PokerDIY - Connecting Poker Players

 
New Post
6/2/2008 12:30 PM
 
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsNews Feed (RSS) Free Video Tutorial & XSL Transformation tutorial with filesNews Feed (RSS) Free Video Tutorial & XSL Transformation tutorial with files


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