Back

Creating a BBC News Typewriter Ticker using RSS Feeds and ASP/VB Script

In this article we are going to look at creating an animated ticker that gets its data via an RSS feed from the BBC News web site and displays it as a typerwriter ticker similar to the one you find on the BBC web site.

The process involves a number of technologies:

  • XML - we receive the RSS feed from the BBC site in XML
  • XSLT - we then transform this XML to a format our javascript ticker understands using the ticker.xsl XSLT transformation
  • Javascript - This is the typerwriter ticker bit and is stored as a separate javscript file called home.js
  • CSS - The formatting of the typerwriter text is done via a cascading style sheet

All you need to do get the facility working is to open the contents of the zip file into the same directory and away you go!  Here is the code for the .asp file:

<%
Sub getNews(sourceFile)
 dim xslFile
 dim source, style
 xslFile = Server.MapPath("ticker.xsl")
 
 set source = Server.CreateObject("Msxml2.DomDocument")
 source.async = false
 source.setProperty "ServerHTTPRequest", true
 source.load CStr(sourceFile)
 
 set style = Server.CreateObject("Msxml2.DomDocument")
 style.async = false
 style.load xslFile
 
 source.transformNodeToObject style, Response
 set source = nothing
 set style = nothing
End Sub
%>

 
 
 
 

Note the following:

  • Some firewalls block RSS so you may have a problem with this if you are running it within a company network
  • Remember to put the onLoad="init();" in your body tag to kick the ticker off

 

Back


Make a Comment on this Article

Your Name:
Comment: