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

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...RSS helpRSS help
Previous
 
Next
New Post
6/7/2006 12:27 PM
 
We are using DNN 3.1 and wondering if to put a RSS feed on our site using the News Feed (RSS) module that comes default with dnn do you just get the link and add it?  I do this and I get a lot of html code which doesn't look good.  Is there something I am missing like a format file or something each rss also requires?

Thanks for your help in advance.
 
New Post
7/26/2006 9:27 AM
 
Well, I have had some success with rss feeds while others I have not.  I did find out that you can use the default module but it spits out all the feeds.  To limit the output you need a xsl stylesheet.  I created it on my pc and then did an upload through dnn admin since just putting on the server will not recognize the .xsl file. 

The xsl file I used is:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/>

<xsl:template match="rss">
  <!-- Do not show channel image -->
  <xsl:for-each select="channel/item[position() &lt; 7]">

    <br>

    <strong><a href="{link}" target="_new"><xsl:value-of select="title"/></a></strong><br></br>
    <xsl:value-of disable-output-escaping="yes" select="description"/>

    </br>
    <br></br>
  </xsl:for-each>
</xsl:template>

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

</xsl:stylesheet>

This will display 6 results (or less) of the feed.

NEW QUESTION:
Are some feeds just don't work right?
I have a sample that doesn't work with this stylesheet at:
http://www.yourworldoutdoors.com/OutdoorBusiness/NaturalResourcesBusinesses/tabid/73/Default.aspx

The actual rss is: http://www.nature.com/nature/current_issue/rss

Anyone have any thoughts on why it's all one jumbled output?

 
New Post
7/26/2006 9:43 AM
 
it depends on the format of the particular rss feed.  if its rss 0.91 or rss 2.0 you can probably get away with using the xslt stylesheet supplied in your portal root.  From memory, its called RSS91HTML.xsl.  Just edit your newsfeed and select the file as below;



Link Type:

File Location:

File Name:

Upload New File


but if the rss feed is in RDF format then you'll have to use a different stylesheet.  I'm not too familiar with the RDF format but if you do a bit of googling then you're bound to find something

cheers
 
New Post
7/26/2006 12:07 PM
 
Ended up finding something then modifing.  This is what I came up with that works well.

<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rss="http://purl.org/rss/1.0/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:admin="http://webns.net/mvcb/"
>

<xsl:output method="html"/>

<xsl:template match="/">
    <html>
        <head>
            <title><xsl:value-of select="rdf:RDF/rss:channel/rss:title"/> (RSS 1.0 feed)</title>
            <xsl:call-template name="output_css"/>
        </head>
        <body>
            <xsl:apply-templates select="/rdf:RDF/rss:channel"/>
            <xsl:for-each select="/rdf:RDF/rss:item[position() &lt; 7]">
                <xsl:sort select="dc:date" order="descending"/>
                <xsl:call-template name="display_item">
                    <xsl:with-param name="full" select="1"/>
                </xsl:call-template>
            </xsl:for-each>
        </body>
    </html>
</xsl:template>

<xsl:template match="/rdf:RDF/rss:channel">
    <h1><a href="{rss:link}"><xsl:value-of select="rss:title"/></a></h1>
    <xsl:call-template name="display_description"/>
    <xsl:apply-templates select="/rdf:RDF/rss:textinput"/>
</xsl:template>

<xsl:template match="/rdf:RDF/rss:image">
    <a href="{rss:link}" title="{rss:title}">
        <img src="{rss:url}" width="{rss:width}" height="{rss:height}" alt="{rss:title}" border="0"/>
    </a>
</xsl:template>

<xsl:template match="/rdf:RDF/rss:textinput">
    <form action="{rss:link}">
        <p><xsl:value-of select="rss:description"/></p>
        <input type="text" name="{rss:name}"/>
        <input type="submit" value="{rss:title}"/>
    </form>
</xsl:template>

<xsl:template name="output_css">
    <style type="text/css">
    body { background-color: #ffffff; color: #000000; font-family: Georgia, Times New Roman }
    acronym { border-bottom-style: dotted; border-bottom-width: 1px; cursor: help; border-bottom-color: #999999; }
    .content { background-color: #f0f0f0; padding: 10px }
    .item { }
    .description { }
    .properties { background-color: #f7f7f7 }
    </style>
</xsl:template>

<xsl:template name="output_intro">
    <xsl:comment>Generated from a RSS 1.0 feed by a XSLT style sheet.</xsl:comment>
    <h1>What is this?</h1>
    <p>
        This is a <a href="http://web.resource.org/rss/1.0/" title="RDF Site Summary (RSS) 1.0 Official Website">RSS 1.0</a> feed.
        You can subscribe to this feed using your favorite
        <a href="http://dmoz.org/Reference/Libraries/Library_and_Information_Science/Technical_Services/Cataloguing/Metadata/RDF/Applications/RSS/News_Readers/" title="RSS News Readers">
        News Aggregator</a>, to be notified automatically when new entries are added.
        You can find out additional information here: <a href="http://www.whatisrss.com" title="One page introduction to RSS">http://www.WhatIsRSS.com</a>
    </p>
    <xsl:if test="starts-with(system-property('xsl:vendor'), 'Transformiix')">
        <xsl:if test="starts-with(system-property('xsl:version'), '1')">
            <p>
                Your browser uses the <a href="{system-property('xsl:vendor-url')}" title="XSLT Mozilla Project">
                Mozilla Transformiix</a><xsl:text> </xsl:text>
                <a href="http://www.xslt.com" title="Extensible Stylesheet Language Transformations">XSLT</a> engine.
                This engine
                <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=98168#c11" title="Bug Report">will not support</a>
                the <i>disable-output-escaping</i> attribute on the <i>xsl:value-of</i> element.
                Because of this some items may look weird. If you are a RSS author, please consider using well-formed XML
                instead of <acronym title="Character Data">CDATA</acronym>.
            </p>
        </xsl:if>
    </xsl:if>
</xsl:template>

<xsl:template name="display_date">
    <xsl:variable name="year" select="substring(dc:date,1,4)"/>
    <xsl:variable name="month" select="substring(dc:date,6,2)"/>
    <xsl:variable name="day" select="substring(dc:date,9,2)"/>
    <xsl:variable name="time" select="substring(dc:date,12,8)"/>
    <xsl:variable name="timezone" select="substring(dc:date,20,6)"/>
    <xsl:variable name="day_short">
        <xsl:choose>
            <xsl:when test="substring($day,1,1)='0'"><xsl:value-of select="substring($day,2,1)"/></xsl:when>
            <xsl:otherwise><xsl:value-of select="substring($day,1,2)"/></xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="month_name">
        <xsl:choose>
            <xsl:when test="$month='01'">January</xsl:when>
            <xsl:when test="$month='02'">February</xsl:when>
            <xsl:when test="$month='03'">March</xsl:when>
            <xsl:when test="$month='04'">April</xsl:when>
            <xsl:when test="$month='05'">May</xsl:when>
            <xsl:when test="$month='06'">June</xsl:when>
            <xsl:when test="$month='07'">July</xsl:when>
            <xsl:when test="$month='08'">August</xsl:when>
            <xsl:when test="$month='09'">September</xsl:when>
            <xsl:when test="$month='10'">October</xsl:when>
            <xsl:when test="$month='11'">November</xsl:when>
            <xsl:when test="$month='12'">December</xsl:when>
        </xsl:choose>
    </xsl:variable>
    <xsl:value-of select="$day_short"/><xsl:text> </xsl:text>
    <xsl:value-of select="$month_name"/><xsl:text> </xsl:text>
    <xsl:value-of select="$year"/><xsl:text> </xsl:text>
    <xsl:value-of select="$time"/><xsl:text> </xsl:text>
    GMT <xsl:value-of select="$timezone"/>
</xsl:template>

<xsl:template name="display_properties">
    <div class="properties">
    <p>
    <xsl:if test="dc:language!=''">
        Language: <xsl:value-of select="dc:language"/><br/>
    </xsl:if>
    <xsl:if test="dc:creator!=''">
        Creator: <xsl:value-of select="dc:creator"/><br/>
    </xsl:if>
    <xsl:if test="dc:subject!=''">
        Subject: <xsl:value-of select="dc:subject"/><br/>
    </xsl:if>
    <xsl:if test="dc:date!=''">
        Date: <xsl:call-template name="display_date"/><br/>
    </xsl:if>
    <xsl:if test="admin:generatorAgent/@rdf:resource">
        Generator: <a href="{admin:generatorAgent/@rdf:resource}"><xsl:value-of select="admin:generatorAgent/@rdf:resource"/></a><br/>
    </xsl:if>
    </p>
    </div>
</xsl:template>

<xsl:template name="display_description">
    <div class="description">
    <p>
        <xsl:value-of select="rss:description" disable-output-escaping="yes"/>
    </p>
    </div>
</xsl:template>

<xsl:template name="display_item">
    <xsl:param name="full"/>
    <xsl:choose>
        <xsl:when test="$full=1">
            <div class="item">
            <a name="item{position()}"></a>
            <h2>
                <a href="{rss:link}"><xsl:value-of select="rss:title"/></a>
            </h2>
            <xsl:call-template name="display_description"/>
            <xsl:if test="content:encoded">
                <div class="content">
                    <xsl:value-of select="content:encoded" disable-output-escaping="yes"/>
                </div>
            </xsl:if>
            </div>
        </xsl:when>
        <xsl:otherwise>
            <a href="#item{position()}"><xsl:value-of select="rss:title"/></a><br/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

</xsl:stylesheet>

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...RSS helpRSS help


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