ASP Snippet to Style an RSS Feed with XSL

I'm not much into using Active Server Pages (ASP) anymore but I'm all about stylin' RSS/ATOM feeds to generate web content. So, here is a handy little snippet of code in ASP that does just that.


<%
 dim source
 dim style

 set source = Server.CreateObject("Msxml2.DomDocument")
 source.async = false
 source.setProperty "ServerHTTPRequest", true
 source.load CStr("http://www.brianlawler.net/blog/summaries/atom.xml")

 set style = Server.CreateObject("Msxml2.DomDocument")
 style.async = false
 style.setProperty "ServerHTTPRequest", true
 style.load CStr("http://www.brianlawler.net/blog/summaries/atom.xsl")

 source.transformNodeToObject style, Response

 set source = nothing
 set style = nothing
%>

A handy thing to remember about ASP (and why I still use this) is that ASP.Net hosting services almost always support ASP. Why use the ASP? Because those same hosting services don't always help you mix-n-match using ASP.Net with domains mapped to anything but the root folder or to using sub-domains. ASP, though not as slick in features as its ASP.Net kin, is much more forgiving. The script above can be run in any location on a server.

No comments: