Load tranformation file from the web
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>
<%@ Import Namespace="System.Xml.XPath" %>
<script runat="server">
void Page_Load(object sender, System.EventArgs e)
{
string xmlPath = Request.PhysicalApplicationPath + @"\Books.xml";
XmlSecureResolver resolver = new XmlSecureResolver(new XmlUrlResolver(), "http://localhost");
NetworkCredential cred = new NetworkCredential("Administrator", "thiru","THIRU-SERVER3");
resolver.Credentials = cred;
XPathDocument xpathDoc = new XPathDocument(xmlPath);
XslCompiledTransform transform = new XslCompiledTransform();
XsltSettings settings = new XsltSettings();
settings.EnableDocumentFunction = true;
//Load the XSL stylsheet into the XslCompiledTransform object
transform.Load("http://localhost/Books.xsl", settings, resolver);
transform.Transform(xpathDoc, null, Response.Output);
}
</script>
Related examples in the same category