VB RSS stylesheet



Having some trouble with picking up my XSL sheet when generating the RSS feed on my website.


I'm doing this through the code behind in VB but when the RSS is generated it's all coming through in one line.


What am I doing wrong?



Public Sub RssFeed(ByVal cxt As HttpContext)
Dim outString As String = ""
cxt.Response.Clear()
cxt.Response.ContentType = "application/rss+xml"
cxt.Response.ContentEncoding = System.Text.Encoding.UTF8
Using xw As New XmlTextWriter(cxt.Response.OutputStream, Text.Encoding.UTF8)

xw.WriteStartDocument()
'processing instruction to style the rss
Dim PIText As String = "type=""text/xsl"" href=""Styles/rss.xsl"""
xw.WriteProcessingInstruction("xml-stylesheet", PIText)

xw.WriteStartElement("rss")
xw.WriteAttributeString("version", "2.0")
xw.WriteAttributeString("xmlns", "atom", Nothing, "http://ift.tt/r5ut6F")

'channel contains all the RSS feed details
xw.WriteStartElement("channel")

xw.WriteStartElement("atom:link")
xw.WriteAttributeString("stuff")

xw.WriteEndElement()

xw.WriteElementString("title")
xw.WriteElementString("link")
xw.WriteElementString("description")
xw.WriteElementString("language", "en-gb")

xw.WriteStartElement("category")
xw.WriteAttributeString("domain")
xw.WriteString("Event Log")
xw.WriteEndElement()

'db connection stuff

No comments:

Post a Comment