How to show date for news in Sidebar?

Topics: Developer Forum, User Forum
Mar 29, 2008 at 2:57 PM
Anyone knows what needs to be done in order to show the NewsDate for each news item in the Sidebar?
By default the publishing date (NewsDate) for the news is only shown in the News list page, but it's not shown when you send it to the sidebar.

Apr 2, 2008 at 8:52 AM
Hello
This is done in sidebar.xsl
Example of how to do it below.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
exclude-result-prefixes="content">
<xsl:output method="html" omit-xml-declaration="yes" indent="yes"/>

<xsl:template match="/">

<div class="rssChannel">
<h3 class="newsTitle">News</h3>
<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="title" select="title" />
<xsl:variable name="pubDate" select="NewsDate" />

<xsl:apply-templates select="item"/>

</xsl:template>

<xsl:template match="item">

<xsl:variable name="item_link" select="link"/>
<xsl:variable name="item_date" select="pubDate"/>

<a href="{$item_link}" class="msoNormal" style="border:0px;font-weight:normal;width:200px;margin-left:0px;padding-left:0px;">
<xsl:value-of select="pubDate"/> <xsl:value-of select="title"/>
</a>

</xsl:template>

</xsl:stylesheet>