We have upgraded our support system to serve you better.
For Support, please go to our Momentive Support Hub located here.

Skip to main content

XslGenerator:RSS1

 
 

XslGenerator:RSS1

Overview

Here is an XslGenerator sample for a CMS Page Detail that outputs an RSS Feed. You may need to adjust the class types to fit our own CSS.

Samples

Generic RSS Feed

{BeginPostUrl}http://www.wwltv.com/newskiosk/rss/localnews.xml{EndPostUrl}
{BeginCacheDurationMinutes}60{EndCacheDurationMinutes}
{BeginXsl}
<?xml   version="1.0"   encoding="UTF-8"   ?>
<xsl:stylesheet   version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template   match="channel">
        <SPAN   class="FeedTitle">
            <DIV   class="bodyTXT">
                <B>FROM THE BIG EASY</B>
            </DIV>
        </SPAN>
        <DIV   class="box01"   style="width:260;padding:4px;">
            <span   class="tinyTXT">
                <xsl:value-of   select="pubDate"   />
            </span>
            <span   class="tinyTXT">
                <xsl:apply-templates   select="item"   />
            </span>
        </DIV>
    </xsl:template>
    <xsl:template   match="item">
        <DIV   style="line-height:16px;">
            <a   href="{link}">
                <xsl:value-of   select="title"   />
            </a>
        </DIV>
    </xsl:template>
</xsl:stylesheet>
{EndXsl}

Yahoo Weather

Here is another sample that outputs Yahoo Weather:

{BeginPostUrl}http://xml.weather.yahoo.com/forecastrss?p=80228{EndPostUrl}
 
{BeginXsl}
<?xml   version="1.0"   encoding="ISO-8859-1"?>
<xsl:stylesheet   version="1.0"  
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0"  
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"   >
<xsl:output   method="html"   />
 
<xsl:template   match="/rss">
    <p>Live Weather</p>
 
    <xsl:apply-templates   select="channel"   />
 
</xsl:template>
 
<!-- the yweather note is defined in the top xmls area -->
<xsl:template   match="channel">
    Welcome to: <xsl:value-of   select="title"   /><br   />
    Location: <xsl:value-of   select="yweather:location/@city"   />,  <xsl:value-of   select="yweather:location/@region"   /><br   />
 
<!-- this is getting using the shot cut to generate a dynamic link -->
<p>Link to Google Map<a   href="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;ie=UTF8&amp;ll={item/geo:lat},{item/geo:long}&amp;spn=0.218473,0.466919&amp;z=11&amp;om=1">click here</a>
</p>
</xsl:template>
 
</xsl:stylesheet>
{EndXsl}

Included AV_RSS.XSL File

NetForum provides a built-in XSL file in /style/xsl/av_rss.xsl.

Feel free to use this or make a copy of it and modify it to suit your own purposes. If you make a copy, put it in your own subfolder, perhaps in eweb/style/abcde/xsl/ where abcde is your own acronym. Do not modify av_rss.xsl because it will get overwritten in upgrades.

If you were to use av_rss.xls then the content definition would be these three lines:

{BeginPostUrl}http://www.wwltv.com/newskiosk/rss/localnews.xml{EndPostUrl}
{BeginXslFileName}style/xsl/av_rss.xsl{EndXslFileName}
{BeginCacheDurationMinutes}60{EndCacheDurationMinutes}

Aggregating and Caching RSS Feeds

To be a good citizen, as any RSS aggregator will do, you must cache this RSS feed to avoid hitting this URL over and over:

{BeginCacheDurationMinutes}60{EndCacheDurationMinutes}
Was this article helpful?
0 out of 0 found this helpful