1

I have added a RSS viewer web part to my team site, and i added this custom XSL (code copies from here http://sonnyeom.com/wordpress/simplified-rss-xsl-for-sharepoint-rss-viewer/.), to display only the Title, Date and description of each feed :-

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
   version="1.0" exclude-result-prefixes="xsl ddwrt msxsl rssaggwrt" 
   xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
   xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
   xmlns:rssFeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:rss1="http://purl.org/rss/1.0/" xmlns:atom="http://www.w3.org/2005/Atom"
   xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
   xmlns:atom2="http://purl.org/atom/ns#">

    <!-- sets how many items to render -->
    <xsl:param name="rss_FeedLimit">5</xsl:param>

    <!-- locale ID for date and time -->
    <xsl:param name="rss_LCID">1033</xsl:param>

    <xsl:template match="rss">
        <xsl:variable name="Rows" select="channel/item"/>
            <xsl:for-each select="$Rows">
                <xsl:variable name="CurPosition" select="position()" />
                <xsl:if test="($CurPosition &lt;= $rss_FeedLimit)">
                    <div class="item link-item simple-rss" >

                            <!-- render TITLE and link to item -->
                            <a class="rss-title" href="{ddwrt:EnsureAllowedProtocol(string(link))}" target="_blank">
                                <xsl:value-of select="title"/>
                            </a>

                            <!-- format and render date -->
                            <div class="rss-pub-date">
                                <xsl:choose>
                                    <xsl:when test="string-length(pubDate) &gt; 0">
                                        <xsl:choose>
                                            <xsl:when test="contains(pubDate, '+')">
                                                <xsl:variable name="pubDateLength" select="string-length(pubDate) - 3" />
                                                <xsl:value-of select="ddwrt:FormatDate(substring-before(pubDate, '+'),number($rss_LCID),3)"/>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <xsl:variable name="pubDateLength" select="string-length(pubDate) - 3" />
                                                <xsl:value-of select="ddwrt:FormatDate(substring(pubDate,0,$pubDateLength),number($rss_LCID),3)"/>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <xsl:value-of select="ddwrt:FormatDate(string(dc:date),number($rss_LCID),3)"/>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </div>

                            <!-- render description -->
                            <div class="rss-description">
                                <xsl:value-of select="description" disable-output-escaping="yes"/>
                            </div>

                    </div>
                </xsl:if>
            </xsl:for-each>
    </xsl:template>

</xsl:stylesheet>

but currently i am getting these extra links under each feed :-

enter image description here

so is there a way to hide/remove them ?

  • hiding through JavaScript or css not a solution? – Ali Mar 17 '17 at 1:43
  • @Ali i always try to avoid such a solution for a simple reason that in this case i will be referencing the sharepoint css classes names, and doing so is not a preferred since this markup can change for a reason or another... so is there a more formal/standard way to hide these links,, within the xst code itself for example?? – john Gu Mar 17 '17 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.