SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2007
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS and RSS Newsfeed

    I have to provide a newsfeed to a corporate learning management system. I have no ability to influence the CSS or structure of the management system itself, only to give it the address of my XML file to provide the newsfeed. It does display it successfully but there are two things that don't display: the image in the <channel>
    Code:
        <image>
          <title>Academy News</title>
          <link>https://test.mysite.com/portal/home.asp</link>
          <url>https://test.mysite.com/portal/images/rss_title.gif</url>
          <width>144</width>
          <height>100</height>
        </image>
    ... and the CSS that I've tried to apply. I did this by linking to a CSS file:
    Code:
    <?xml-stylesheet href="rss.css" type="text/xsl" media="screen"?>
    (I've also tried linking to an absolute address)
    In the CSS itself I tried defining styles like the following, just for test:
    Code:
    title { font-weight:bold; color: red;}
    I thought the management system's own styles might be overriding mine but if I just paste the XML address into a browser it displays but with no styling and no 'main' image. Images in the individual posts do display:
    Code:
    <description><![CDATA[<img src="https://test.mysite.com/portal/images/saba/people.jpg" width=50 height=50>Here si a second news story with different text. Obviously.]]></description>
    Can anyone point out what I'm doing wrong? This doesn't have to display in any normal RSS readers, only in this particular system.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,200
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    How are people going to view this feed? Normally you use a feed reader of some kind. I've not seen <image> elements in feeds like that. Normally, the whole entry—images and all—should be pulled in through the <description>, shouldn't it?

  3. #3
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    IIRC image is an optional element on the channel -- it is what you see in some readers where the feed has an icon for example.

    The CMS is consuming the XML and displaying it and ignoring stuff it doesn't care about like your channel badge and your stylesheet.

    You might be able to successfully hack in your styles by embedding them in the description for each item.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2007
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99 View Post
    IIRC image is an optional element on the channel -- it is what you see in some readers where the feed has an icon for example.

    The CMS is consuming the XML and displaying it and ignoring stuff it doesn't care about like your channel badge and your stylesheet.

    You might be able to successfully hack in your styles by embedding them in the description for each item.
    Thanks. I'll try that. Do you mean for example
    Code:
    <description style="font-size:1.2em;">
    I'd assumed it probably was the system ignoring the tags I'd added but I wondered why the an ordinary browser also ignores them (for example if I paste the URL for the XML file into Internet Explorer)?

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2007
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @Ralph

    Thanks for replying. I tried just putting the image tag inside the description tag but it didn't show any.

    I don't know how this system actually displays the feed; I know it doesn't use a conventional feed reader. I don't even have access to the system, I was just told that if I supplied the owner with an RSS XML file it would display. Which it does within the limitations I've described.

  6. #6
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Nope. I mean, in your description you style the image. EG:

    Code:
    <description><![CDATA[<img src="https://test.mysite.com/portal/images/saba/people.jpg" style="margin:20px; float:right">Here si a second news story with different text. Obviously.]]></description>
    The parser grabs the contents of the description element, it doesn't look at attributes on the element itself.

  7. #7
    SitePoint Enthusiast
    Join Date
    Jan 2007
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99 View Post
    Nope. I mean, in your description you style the image. EG:

    Code:
    <description><![CDATA[<img src="https://test.mysite.com/portal/images/saba/people.jpg" style="margin:20px; float:right">Here si a second news story with different text. Obviously.]]></description>
    The parser grabs the contents of the description element, it doesn't look at attributes on the element itself.
    Got you! Thanks - I'll have a go with that.

  8. #8
    SitePoint Enthusiast
    Join Date
    Jan 2007
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks wb_99. That worked inside the description tag. Much better.


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
  •