Trying to create a Simple RSS feed template.

Hi all,

I am trying to create a very simple RSS feed of our news items on our website using Rhythmyx 6.5.2. I have read a few posts on here about the way to go is full page template formatting using xslt.

I have come up with a first draft code but am struggling with error.

The prefix “xsl” for element “xsl : output” is not bound.

Am I going in the right direction producing the rss feed this way and any tips on how to refine my feed.

Many thanks in advance.

Gavin


<!-- begin XSL -->
<xsl:output method="xml" version="1.0" indent="yes"/>
<!-- end XSL -->
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template news="/">
	
		<rss version="2.0">
		<channel>
		<title>Moray Council - News</title> 
		<description>This is the Latest News Articles from the Moray Coucil Website</description> 
		<link>http://www.moray.gov.uk</link> 
		<language>en-gb</language> 
	
		
		
		<xsl:for-each select="channel/article">
		<article>
		<title><xsl:value-of select="/*/shared/newstitle" /></title> 
		<date><xsl:value-of select="/*/shared/newsdisplaydate" /></date> 
		<link><xsl:value-of select="/*/shared/psx-link" /></link> 
		</article>	
		</xsl:for-each>
		

		</channel>
		</rss>

   </xsl:template>
</xsl:stylesheet>

xsl:output element goes inside the stylesheet. you currently have it outside of the stylesheet.

Is there any reason that you are using xsl? We have a slot macro defined that outputs the content in an xml format. Using that with the mime type as “text/xml” and no global template in a page template produces an rss feed for a particular content type…(say autoindexer).

I’ve stripped away some extra things that we are doing (such as determining the content type and showing certain fields per content type), but the basics and the gist of what we are doing is:


## page template
<?xml version="1.0"?>
<rss version="2.0">
<channel>	
#set($pageSiteID = $rx.asmhelper.getSingleParamValue($sys.params,'sys_siteid'))##
#set($pageSiteBase = $rx.location.siteBase($pageSiteID,"no"))##
#set($fullHTMLPageURL= $rx.location.generate($sys.assemblyItem, "vtPgTag"))##
##prepend side url if it does not exist
#if($fullHTMLPageURL.indexOf("http")!=0)##
#set($fullHTMLPageURL= "$pageSiteBase$fullHTMLPageURL")
#end##
##
 <title>#displayfieldEsc("displaytitle")</title>
 <link>$fullHTMLPageURL</link>
 <description>#displayfieldEsc("description")</description>
 <language>#displayfield("feed_language")</language>
 <pubDate>$tools.date.format("EEE', 'dd' 'MMM' 'yyyy' 'HH:mm:ss' 'Z",$sys.item.getProperty("sys_contentstartdate").Date)</pubDate>
 <managingEditor>#displayfieldEsc("feed_contact")</managingEditor>
 <webMaster>#displayfieldEsc("feed_contact")</webMaster>
 <docs>http://cyber.law.harvard.edu/rss/rss.html</docs>
</channel>
</channel> 
#vtBuildRSS2FeedItems('myslot' "${fullHTMLPageURL}" "${pageSiteBase}")
</rss>



## Builds an rss2 feed (without the headers ie. inside the channel) of the items in the slot
#macro(vtBuildRSS2FeedItems $slotname $defaultURL $defaultSiteBas)##
#initslot($slotname $params)##
#if ($sys.part.render)##
#if($sys.currentslot.slot && $sys.currentslot.relresults.size() > 0)##
##
#foreach($relresult in $sys.currentslot.relresults )##
#set($currItem = $relresult.getNode())##
#set($currItemAssemblyItem = $relresult.clone())##
$currItemAssemblyItem.setNode($currItem)##
#set($toParse = $rx.location.generate($currItemAssemblyItem, "snTitleLink"))##
#vtExtractURL($toParse $defaultSiteBase $currItemURL "url")##
<item>
  <title>$rx.codec.escapeForXml($currItem.getProperty("rx:displaytitle").String.trim())</title>
  <link>$currItemURL</link>
 <description>$rx.codec.escapeForXml($currItem.getProperty("rx:description").String.trim())</description>##
 <pubDate>#vtFormatRSS2DateTime($currItem.getProperty("sys_contentstartdate").Date)</pubDate>
</item>
#end## for each
#endslot($slotname)##
#end## macro vtBuildRSS2FeedItems

Many Thanks for your feedback guys. jitendra is that formatting using velocity templating? We are currently using HTML templates at the mo.

I am not sure what you mean by velocity templating… If you mean: do I use velocity in the templates, then yes (the macros for the slot and also to display title, description, etc)…the page template would just be output as any other html page (except with the .xml extension)