I apologize for not publishing my decision earlier, but at that time I was too cramped. Better late than never think.
Instead of creating a complete aspx web page for each xml file associated, I created a stub and applied the xslt conversion at runtime from the associated Site.Master. The MasterPageFile stub property is set on this Site.Master. This approach sacrifices some performance, but it works on any web page of size. Below is an example webpage .
Example aspx stub file:
<%@ Page Title="Top Austin Beauty Salons List" MetaDescription="List of best Google-ranked Austin beauty salon" Language="C#" MasterPageFile="~/Site1.Master" %> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> </asp:Content>
Site.Master Page_Load:
protected void Page_Load(object sender, EventArgs e) { string vp = Page.AppRelativeVirtualPath; if (vp.ToLower().EndsWith("default.aspx") || vp.ToLower().EndsWith("webform2.aspx")) return; // ignore some aspx files used for ohter reasons string xmlPath = Page.MapPath(vp.Substring(0, vp.LastIndexOf(".")) + @".xml"); string xslPath = Page.MapPath("mainpage.xslt"); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); XsltArgumentList argsList = new XsltArgumentList(); argsList.AddParam("xmlPath", "", xmlPath); XslCompiledTransform xslt = new XslCompiledTransform(); xslt.Load(xslPath); // Execute the transform and output the results to a string writer. StringWriter sw = new StringWriter(); xslt.Transform(xmlDoc, argsList, sw); content.InnerHtml = sw.ToString(); // add the generated html to the associated stub aspx content section }
ron tornambe
source share