title: How to show Rss on my page
body: <p>I have created xml file using the code below(aspx.cs) and now i am trying to show the xml file on my page using xslt and literal control (look in my aspx)</p>
  
  <ul>
  <li><p>aspx:</p>
  
  
  
  <p></p>
  
  <pre><code>                &lt;asp:Literal ID="RssHtml" runat="server" /&gt;
  </code></pre>
  
  <p>
  
  </p></li>
  <li><p>aspx.cs:</p>
  
  <p>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Data.SqlClient;
  using System.Xml;
  using System.Text;
  using System.Configuration;
  using System.IO;
  using System.Xml.Xsl;</p>
  
  <p>public partial class Rss : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {</p>
  
  <pre><code>Response.Clear();
  Response.ContentType = "application/rss+xml";
  XmlTextWriter objX = new XmlTextWriter(Server.MapPath("App_Code/RssDef.xml"), Encoding.UTF8);
  objX.WriteStartDocument();
  objX.WriteStartElement("rss");
  objX.WriteAttributeString("version", "2.0");
  objX.WriteStartElement("channel");
  
  SqlCommand cmd = new SqlCommand("Select * from RssFeeds", new SqlConnection(ConfigurationManager.ConnectionStrings["igroup13_test1ConnectionString"].ConnectionString));
  cmd.Connection.Open();
  SqlDataReader dr = cmd.ExecuteReader();
  
  objX.WriteElementString("title", "RSS.....");
  objX.WriteElementString("link", "");
  objX.WriteElementString("description", "desc");
  objX.WriteElementString("language", "en-us");
  objX.WriteElementString("ttl", "60");
  objX.WriteElementString("lastBuildDate", String.Format("{0:R}", DateTime.Now));
  
  while (dr.Read())
  {
      objX.WriteStartElement("item");
      objX.WriteElementString("title", dr["title"].ToString());
      objX.WriteElementString("link", "");
      objX.WriteElementString("description", dr["description"].ToString());
      objX.WriteElementString("pubDate", String.Format("{0:R}", dr["publishDate"]));
      objX.WriteEndElement();
      //objX.WriteEndElement();
  }
  
  objX.WriteEndElement();
  objX.WriteEndElement();
  objX.WriteEndDocument();
  objX.Flush();
  objX.Close();
  Response.End();
  
  
  #region load the XML file
  // Use my local XML file (that I've created)
  String strXmlSrc = Server.MapPath("~/App_Code/RssDef.xml");
  
  //  Load the XML file into the XmlDocument object.
  XmlDocument myXmlDoc = new XmlDocument();
  try
  {
      myXmlDoc.Load(strXmlSrc);
  }
  catch (Exception ex)
  {
      Response.Write("error in loading XML document " + ex.Message);
      return;
  }
  #endregion
  
  #region load the XSLT file
  //  Load our XSL file into the Xsl Transform object.
  String strXslFile = Server.MapPath("~/App_Data/Def.xslt");
  XslCompiledTransform myXslDoc = new XslCompiledTransform(true);
  try
  {
      myXslDoc.Load(strXslFile);
  }
  catch (Exception ex)
  {
      Response.Write("error in loading XSLT document " + ex.Message);
      return;
  }
  #endregion
  
  #region Transform the XML into XHTML
  //  Create a StringBuilder and then point a StringWriter at it.
  //  I'm using this to hold the HTML output by the Transform method
  StringBuilder myStringBuilder = new StringBuilder();
  StringWriter myStringWriter = new StringWriter(myStringBuilder);
  
  try
  {
      myXslDoc.Transform(myXmlDoc, null, myStringWriter);
  }
  catch (Exception ex)
  {
      Response.Write("error in transforming the document " + ex.Message);
      return;
  }
  #endregion
  
  #region Write to the HTML Page
  //  Take theresulting HTML and display it via an ASP.NET
  //  literal control.
  RssHtml.Text = myStringBuilder.ToString();
  #endregion
  
  
  }
  </code></pre>
  
  <p>}</p></li>
  <li><p>xslt:</p></li>
  </ul>
  
  <p>
    </p>
  
  <p></p>
  
  <pre><code>&lt;xsl:for-each select="rss/channel"&gt;
    &lt;h2&gt;
      &lt;a href="{link}"&gt;
        &lt;xsl:value-of select="title" /&gt;        
      &lt;/a&gt;
  
    &lt;/h2&gt;
    &lt;h4&gt;
      &lt;xsl:value-of select="description"/&gt;
    &lt;/h4&gt;
  &lt;/xsl:for-each&gt;
  
  &lt;ul&gt;
    &lt;xsl:for-each select="rss/channel/item"&gt;
      &lt;li&gt;
        &lt;a href="{link}"&gt;
          &lt;strong&gt;
            &lt;xsl:value-of select="title" /&gt;
  
          &lt;/strong&gt;
        &lt;/a&gt;
  
      &lt;/li&gt;
  
      &lt;xsl:value-of select="descreption"/&gt;
      &lt;br/&gt;
      &lt;xsl:value-of select="pubDate"/&gt;
  
    &lt;/xsl:for-each&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <p>What am i doing wrong?</p>