Rss.xslt

Rss.xslt


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="/">
        <ul>
            <xsl:for-each select="rss/channel/item">
                <li>
                    <a href="{link}">
                        <xsl:value-of select="title" />
                    </a>
                </li>
            </xsl:for-each>
        </ul>
    </xsl:template>
</xsl:stylesheet>

 

 

Rss.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Rss.aspx.vb" Inherits="Rss" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Rss</title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="font-size:10px; font-family:Tahoma;">
        <asp:Literal id="ltRss" runat="server" />
    </div>
    </form>
</body>
</html>

 

Rss.aspx.vb 


Imports System.IO
Imports System.Xml
Imports System.Xml.Xsl

Partial Class feedreader_rss
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim url As String = "https://blog.sorrentino.it/syndication.axd"
        Dim xslt As String
        xslt = HttpContext.Current.Server.MapPath("Rss.xslt")
        Dim doc As XmlDocument = New XmlDocument()
        doc.Load(url)
        Dim xsltDoc As XslCompiledTransform = New XslCompiledTransform()
        xsltDoc.Load(xslt)
        Dim sb As StringBuilder = New StringBuilder()
        Dim sw As StringWriter = New StringWriter(sb)
        xsltDoc.Transform(doc, Nothing, sw)
        ltRss.Text = sb.ToString
    End Sub

End Class