XML Feed usage exampel — ASP

Fetching the XML

<%
Dim vURL, oHTTP, XMLDoc, vResponseText, oXSL

'URL to Newsletter XML file"
vURL = "http://www.moonrisemovies.com/newsletter-xml.asp"

'Set up objects
set oHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
set XMLDoc = Server.CreateObject ("Msxml2.DOMDocument.3.0")
set oXSL = server.CreateObject("Microsoft.XMLDOM")

'Fetch the XML file using oHTTP
with oHTTP
.SetTimeouts 20000, 20000, 20000, 20000
.open "GET",vURL, false
.send()
if .Status=200 then
vResponseText = oHTTP.responsetext
end if
set oHTTP = nothing
end with

'Load the response text into a an XML DOM object.
with XMLDoc
.async= false
.loadXML(vResponseText)
end with

'Apply your style sheet
with oXSL
.async = false
.load server.MapPath("/") & "/newsletter-template.xsl"
end with

'Transform the XML using your style sheet and place into a lcoal variable
vContent = XMLDoc.transformNode(oXSL)

'You can include this file as a server side include somewhere near the top of the page
'Then in your page you can Response out vContent whereever you want.

response.write vContent

'Don't forget the download our sample XSL style sheet

%>


XML "Style" Template

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="rss/channel" />
</xsl:template>

<xsl:template match="channel">
<h1><xsl:value-of select="title" /></h1>
<h2><xsl:value-of select="lastBuildDate" /></h2>
<ul style='padding-right:20px;list-style:none;'>
<xsl:apply-templates select="item" />
</ul>
<em><xsl:value-of select="copyright" /></em>
</xsl:template>

<xsl:template match="item">
<li class="dvdreview">
<xsl:apply-templates select="image" />
<div ><a class="review_title" href="{link}"><xsl:value-of select="title" /></a></div>
<div class="review"> <xsl:value-of disable-output-escaping="yes" select="description" />...</div>
<br style="clear:both;" />
</li>
</xsl:template>

<xsl:template match="image">
<img src="{url}" class="dvdbox" />
</xsl:template>
</xsl:stylesheet>

CSS Styles

.dvdreview{
margin-top:20px;
}
.review_title{
font-size:120%;
}
.review{}
.dvdbox{float:right;padding-left:8px;padding-bottom:8px;}