lionelluo wrote
Hi, How to adjust the height of the rss feeds? It currently pushes the bottom of the site way down because there are so many articles. Is that the news feed style sheet? How does that work? Please help, many thanks.
Hello lionelluo
As well as Nina's suggestion, you can limit the number of items within your xsl file:
<xsl:if test="position() < 6">
If the position within the RSS feed is less than item number 6, then continue and display the following elements. This will display the first 5 items in the RSS feed.
<xsl:if test="position() < 6">
<br>
<strong><a href="{link}" target="_main"><xsl:value-of select="title"/></a></strong>
<br>
<xsl:value-of select="pubDate"/>
</br>
</xsl:if>
You can also use:
<xsl:for-each select="channel/item[position() < 6]">
Which selects the first 5 items from the RSS feed.
This is an example of how your file might look, you just need to edit to suit the required number.
---------------------------------------------------------------------
<?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">
<xsl:for-each select="channel/item[position() > 1]">
<!-- Test to limit number of items displayed. Here only 5 items will be transformed -->
<xsl:if test="position() < 6">
<br></br>
<!-- to open links in a new window, change target="_main" to target="_new" -->
<strong><a href="{link}" target="_main"><xsl:value-of select="title"/></a></strong>
<br>
<xsl:value-of select="pubDate"/>
</br>
<!-- only display markup for description if it's present -->
<!-- <xsl:value-of disable-output-escaping="yes" select="description"/> -->
<br></br>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="description">
<br>
<xsl:value-of select="."/>
</br>
</xsl:template>
</xsl:stylesheet>
----------------------------------------------------------------------
I hope this helps. You can find a useful RSS tutorial here: http://www.dnncreative.com/Tutorials/RSSNewsFeedXSLStylesheet/tabid/162/Default.aspx
Regards
Lynn