SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Remove image from displaying from the RSS feed

    Hi,
    I am using XSL to display my RSS feed, I am also only displaying X amt of characters from the description on the screen. The problem I am running into is when there is an image, it displays it or nothing at all of the description. How do get it to skip the image and not count that in the character count?

  2. #2
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is it possible to remove the image part of the string before displaying the description?

  3. #3
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,635
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Sure. Probably would help to see the XSL and perhaps the RSS feed in question.

  4. #4
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XSL

    Code XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- DWXMLSource="http://info.hdsupplyelectrical.com/CMS/UI/Modules/BizBlogger/rss.aspx?tabid=213776&moduleid=321994&maxcount=25&t=fa17b3cd-d674-487d-8a0c-78d81470e448" -->
    <!DOCTYPE xsl:stylesheet  [
    	<!ENTITY nbsp   " ">
    	<!ENTITY copy   "">
    	<!ENTITY reg    "">
    	<!ENTITY trade  "™">
    	<!ENTITY mdash  "—">
    	<!ENTITY ldquo  "“">
    	<!ENTITY rdquo  "”"> 
    	<!ENTITY pound  "">
    	<!ENTITY yen    "">
    	<!ENTITY euro   "€">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <xsl:output method="html" encoding="UTF-8"/>
     <xsl:template name="getDate">
          <xsl:param name="dateTime" />
          <xsl:value-of select="substring($dateTime,0,4)" />
          <xsl:text>, </xsl:text>
          <xsl:value-of select="substring($dateTime,6,3)" />
          <xsl:value-of select="substring($dateTime,9,3)" />
          <xsl:value-of select="substring($dateTime,12,5)" />
     
      </xsl:template>
     
    <xsl:template match="/">
    <xsl:for-each select="rss/channel/item">
    	<xsl:if test="position()&lt;=2"><div class="blog-post">
      <!--Display Date -->
      <span class="date">
      <xsl:call-template name="getDate">
          <xsl:with-param name="dateTime" select="pubDate" />
      </xsl:call-template>
      </span>
      <br /><a href="{link}" target="_blank"><b><xsl:value-of select="title"/></b></a>
     
      <div class="blog-post">
      <xsl:value-of select="substring(description,1,100)" disable-output-escaping="yes"/>
      <span class="right"><!--<a href="{link}" target="_blank">-->...</span></div>
      <div class="clear"></div>
      </div></xsl:if>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    Feed: http://info.hdsupplyelectrical.com/

    if you notice the most recent post has an image first, so that is being counted towards the 100 character limit...
    Last edited by Mittineague; Nov 19, 2010 at 16:35. Reason: reformatting bbcode tags


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •