title: how to apply XSL to XML with xsltargument using c#?
body: <p>i have a user control in which i want to pass page url to my XSL sheet and apply it to my XML file . as a result of it should produce some HTML output. Please explain how to do this? </p>
  
  <pre><code>xml file name: myXml.xml 
  Xsl file name: mwXsl.xsl
  Parameter to be passed by usercontrol(.cs) file: url of parent page.
  </code></pre>
  
  <p>i've defined XSL stylesheet. All i need to pass the argument to that file. in usercontrol(ascx) file i have this code </p>
  
  <pre><code>&lt;asp:Xml ID="BControl" runat="server" DocumentSource="/wsitemap.sitemap" TransformSource="/Bread.xslt"&gt;&lt;/asp:Xml&gt;
  </code></pre>
  
  <p>where wsitemap.sitemap is a XML file. if my XSLT get the argument the above code will be able to produce the desired output. so i need c# code for that. </p>
  
  <p>in usercontrol (.cs file) i have :</p>
  
  <pre><code>public static string Transform(string xml, string xsl, XsltArgumentList argsList) 
      { 
          XDocument selectedXml = XDocument.Parse(xml);
          XslCompiledTransform xmlTransform = new XslCompiledTransform();
          StringBuilder htmlOutput = new StringBuilder();
          XmlWriter writer = XmlWriter.Create(htmlOutput);
          xmlTransform.Load(new XmlTextReader(new StringReader(xsl)));
          xmlTransform.Transform(selectedXml.CreateReader(), argsList, writer);
          return htmlOutput.ToString();
      } 
      protected void Page_Load(object sender, EventArgs e)
      {
          string curPageId = Page.Request.Url.AbsoluteUri;
          XsltArgumentList xslArgs = new XsltArgumentList();
          xslArgs.AddParam("curPage", "", curPageId);
          string output=Transform("wsitemap.sitemap","bread.xslt",xslArgs);
          Response.Clear(); Response.Write(output);
      }
  </code></pre>
  
  <p>but this code is not working , any other approach plz tell me</p>