SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Making RSS look... good!

    I'm using a nifty little rss feed creator called "Feedcreator". It's a php script integrated into the Mambo CMS.

    More often than not, my visitors do not have access to Firefox's live bookmarks, and they simply click on my syndication links, to grab the url for that feed type (I've got RSS 0.91, 1.0, 2.0, ATOM 0.3, and OPML ... The standard package for feedcreator).

    What's bothering me is that I've got no clue on how to integrate an rss style sheet, so that it ends up looking like a brand new page (Like SitePoint's ), and not just a list of items and categories... and link url's... Ugh... It hurts my eyes, and it most likely confuses my visitors.

    So how in the world do I go about styling-up my feeds? Any tips, pointers, suggestions? Any help is appreciated!
    Content Writing Service - Get custom SEO articles for 10$

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Learn XSL:
    http://www.w3schools.com/xsl/

    then create an XSL stylesheet to match your RSS feed. Attach the stylesheet to your RSS document like so:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <?xml-stylesheet type="text/xsl" href="my-rss-style.xsl"?>
    ...rss feed code here...

  3. #3
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Woah! That's something new!

    About how long will it take to learn XSL? Is it hard? Mmm... What other languages does it compare to?

    Thanks!
    Content Writing Service - Get custom SEO articles for 10$

  4. #4
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm... Well I'm still stuck... Now instead of having the tree like menu structure of the feed, I just get a paragraph (mind you, a SINGLE paragraph) of plain text...

    Could you help me out? Working with this page: http://www.duckvillage.net/index2.ph...S1.0&no_html=1

    RSS Feed:
    Code:
       <?xml version="1.0" encoding="ISO-8859-1"?>
      <!-- generator="FeedCreator 1.7.1" -->
      <?xml-stylesheet href="/rss.xsl" type="text/css"?>
      <rdf:RDF
          xmlns="http://purl.org/rss/1.0/"
          xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
          xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
          xmlns:dc="http://purl.org/dc/elements/1.1/">
          <channel rdf:about="Duck Village Network">
              <title>Duck Village Network (DuckVillage.Net)</title>
              <description>Duck Village Network Syndication (Latest News from the Duck Village Team)</description>
              <link>Duck Village Network</link>
              <image rdf:resource="http://www.duckvillage.net/images/M_images/weblink.png" />
              <dc:date>2004-12-06T12:13:26+01:00</dc:date>
              <items>
                  <rdf:Seq>
                      <rdf:li rdf:resource="http://www.duckvillage.net/news-stand/site-news/site-search-extended/"/>
      <rdf:li rdf:resource="http://www.duckvillage.net/web-browsing/web-browsers/live-bookmarks-for-firefox-users/"/>
      <rdf:li rdf:resource="http://www.duckvillage.net/news-stand/site-news/duck-village-network-drops-support-for-ie/"/>
                      <rdf:li rdf:resource="http://www.duckvillage.net/news-stand/site-news/duck-village-arcade/"/>
                      <rdf:li rdf:resource="http://www.duckvillage.net/news-stand/site-news/a-new-winter-themed-layout/"/>
                       <rdf:li rdf:resource="http://www.duckvillage.net/news-stand/site-news/winter-hits-the-village/"/>
                  </rdf:Seq>
              </items>
          </channel>
          <image rdf:about="http://www.duckvillage.net/images/M_images/weblink.png">
              <title>Duck Village Network</title>
              <link>Duck Village Network</link>
              <url>http://www.duckvillage.net/images/M_images/weblink.png</url>
           </image>
          <item rdf:about="http://www.duckvillage.net/news-stand/site-news/site-search-extended/">
              <dc:format>text/html</dc:format>
              <dc:source>Duck Village Network</dc:source>
              <dc:creator>Ilya (Dragon.EXE)</dc:creator>
              <title>Site Search Extended</title>
              <link>http://www.duckvillage.net/news-stand/site-news/site-search-extended/</link>
     <description>We are pleased to announce that we have extended the features of our site search. It now searches not only through all site content (including the Archive Box (villagearchive/0/)), but...</description>
          </item>
          <item rdf:about="http://www.duckvillage.net/web-browsing/web-browsers/live-bookmarks-for-firefox-users/">
              <dc:format>text/html</dc:format>
              <dc:source>Duck Village Network</dc:source>
              <dc:creator>Ilya (Dragon.EXE)</dc:creator>
              <title>Live Bookmarks for Firefox Users</title>
               <link>http://www.duckvillage.net/web-browsing/web-browsers/live-bookmarks-for-firefox-users/</link>
     <description>For those who are viewing the Duck Village Network through a Firefox browser, we've got a new surprise, one that is sure to convince some of you (that are still...</description>
          </item>
          <item rdf:about="http://www.duckvillage.net/news-stand/site-news/duck-village-network-drops-support-for-ie/">
              <dc:format>text/html</dc:format>
              <dc:source>Duck Village Network</dc:source>
              <dc:creator>Ilya (Dragon.EXE)</dc:creator>
               <title>Duck Village Network drops support for IE</title>
              <link>http://www.duckvillage.net/news-stand/site-news/duck-village-network-drops-support-for-ie/</link>
     <description>It may be a gloomy day for those who are still using Internet Explorer... But our decision has been made, and there's no turning back.As of today, the Duck Village...</description>
          </item>
          <item rdf:about="http://www.duckvillage.net/news-stand/site-news/duck-village-arcade/">
              <dc:format>text/html</dc:format>
              <dc:source>Duck Village Network</dc:source>
               <dc:creator>Ilya (Dragon.EXE)</dc:creator>
              <title>Bored? Not to worry!</title>
              <link>http://www.duckvillage.net/news-stand/site-news/duck-village-arcade/</link>
     <description>Are you bored? Are you at school in the computer lab? Then come on over to our arcade section (http://www.duckvillage.net/puarcade/), where you'll find all the classics, including Snake, PacMan,...</description>
          </item>
          <item rdf:about="http://www.duckvillage.net/news-stand/site-news/a-new-winter-themed-layout/">
              <dc:format>text/html</dc:format>
               <dc:source>Duck Village Network</dc:source>
              <dc:creator>Ilya (Dragon.EXE)</dc:creator>
              <title>A New Winter Themed Layout</title>
              <link>http://www.duckvillage.net/news-stand/site-news/a-new-winter-themed-layout/</link>
     <description>To celebrate the upcoming three months of the Winter season, we have created a new theme for you to use while browsing the Duck Village site. Bring in the Winter...</description>
          </item>
           <item rdf:about="http://www.duckvillage.net/news-stand/site-news/winter-hits-the-village/">
              <dc:format>text/html</dc:format>
              <dc:source>Duck Village Network</dc:source>
              <dc:creator>Ilya (Dragon.EXE)</dc:creator>
              <title>Winter Hits the Village!</title>
              <link>http://www.duckvillage.net/news-stand/site-news/winter-hits-the-village/</link>
     <description>Autumn is gone, and Winter is finally here! Joy! Ah... It's that time of the year again. Singing merry ol' songs, playing in the snow, drinking hot cocoa in...</description>
          </item>
       </rdf:RDF>
    XSL File:
    Code:
      <xsl:stylesheet version="1.0">
      <xsl:template match="/rdf:RDF">
      <html>
      	<head>
      <title>Headline Feed</title>
      <link rel="stylesheet" type="text/css" href="/rss.css"/>
      </head>
      	<body>
      	<div class="header">
     			You are viewing an RSS 1.0 headline feed. For information about how to
      			use an RSS feed, please consult the SitePoint.com
      <a href="http://www.sitepoint.com/syndication/">Syndication</a>
       page.
      		
      </div>
      	<div class="channel">
     	<h1><a href="http://www.duckvillage.net" title="Duck Village Network News">Duck Village News</a></h1>
      
      <xsl:for-each select="rss:items/rdf:Seq/rdf:li">
      <xsl:variable name="resource" select="@rdf:resource"/>
      <xsl:apply-templates select="/rdf:RDF/rss:item[@rdf:about=$resource]"/>
      </xsl:for-each>
      </div>
      </body>
      </html>
      </xsl:template>
      	<xsl:template match="rss:item">
      	<div class="item">
      	<h2>
      	<a>
      	<xsl:attribute name="href">
      <xsl:value-of select="rss:link"/>
      </xsl:attribute>
      <xsl:value-of select="rss:title"/>
      </a>
      </h2>
      	<p>
      <xsl:value-of select="rss:description"/>
      </p>
      </div>
      </xsl:template>
      </xsl:stylesheet>
    What am I doing wrong?
    Content Writing Service - Get custom SEO articles for 10$

  5. #5
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any help please?
    Content Writing Service - Get custom SEO articles for 10$

  6. #6
    SitePoint Wizard dragonfly_7456's Avatar
    Join Date
    Dec 2002
    Location
    Moscow, USSR
    Posts
    1,092
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please...
    Content Writing Service - Get custom SEO articles for 10$

  7. #7
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need type="text/xsl" not type="text/css" to get it detected by browsers (at least Firefox, didn't test it in IE). You also need to declare the XSL file properly.

    As for the actual rows, you need to foreach the channel.
    Code:
    				<xsl:for-each select="rss:channel"> 
     		    			<div class="channel">
     		    		    	<h1><a href="http://www.duckvillage.net" title="Duck Village Network News">Duck Village News</a></h1>
     		
     		    		    	<xsl:for-each select="rss:items/rdf:Seq/rdf:li">
     		    		    		<xsl:variable name="resource" select="@rdf:resource"/>
     		    		    		<xsl:apply-templates select="/rdf:RDF/rss:item[@rdf:about=$resource]"/>
     		    		    	</xsl:for-each>
     					</div>
     				</xsl:for-each>
    You can download the files I've updated if you'd like to take a look.


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
  •