RSS In TEI How To

This page describes how to include RSS in AxKit / TEI infrastructures such as is used for the OUCS and OSS Watch websites. RSS is included using a block that looks like:

      <div id="stuarts-educause" type="externalrss">
        <head>Stuart's Blog</head>
        <p>
          <include xmlns="http://www.w3.org/2001/XInclude"
                   href="http://rss.oucs.ox.ac.uk/extras/getnewsfeed.php?url=http://connect.educause.edu/blog/stuartyeates/feed">
            <fallback>Stuart's Blog has no current entries.</fallback>
          </include>
        </p>
      </div>

The <include> tag does the work, retrieving the RSS from the URL and inserting it into the XML. In this case we're using the getnewsfeed.php script which acts as a cache, allowing a rapid timeout if the remote RSS is not working. The <fallback> tag contains text to be used if the RSS cannot be retrieved or contains no items. RSS items are formatted into a block such as:

     <div class="rss">
       <span class="rsstitle">
              <a href="http://connect.educause.edu/blog/stuartyeates/the_down_side_of_open_sourcing_java/13137"><i>The down side of open sourcing Java</i></a>
       </span> 
       <span class="rssdate">[Wed, 29 Nov 2006 05:31:14 -0600]</span> 
       <span class="rssdescription">
            <p>Sun vice president ....<p>
       </span>
     </div>

This can be be styled using CSS, because each of the tags has an class attribute. If there are several RSS feeds on the page, you can style them differently using the <div> id. Styling to turn hide the date and description (the long body) looks like:

.externalrss .rssdate  {
        display: none;
}
.externalrss .rssdescription {
        display: none;
}

The .externalrss prefix ensures that the styling does not affect other rss feeds on the site.

OSSWatchWiki: RSSInTEIHowTo (last edited 2013-04-15 13:56:17 by localhost)

Creative Commons License
The content of this wiki is licensed under the Creative Commons Attribution-ShareAlike 2.0 England & Wales Licence.

OSS Watch is funded by the Joint Information Systems Committee (JISC) and is situated within the Research Technologies Service (RTS) of the University of Oxford.