I think the above question intention is about to convert XML through XSLT like initially he has some XML and he want to do some modifications and after that he want generate resulted XML with XLST.
try to use below function to process the inputXML through XSLT to get the output XML.
private GenerateXML(string xmlInPath, string xsltPath, string xmlOutPath)
{
XsltArgumentList xslArg = new XsltArgumentList();
addressQuery addressQueryObj = new addressQuery();
xslArg.AddExtensionObject("urn:addressfinder", addressQueryObj);
XslCompiledTransform xslTrans = new XslCompiledTransform();
XPathDocument xPathDoc = new XPathDocument(xmlInPath);
XmlTextWriter writer = new XmlTextWriter(xmlOutPath, null);
try
{
xslTrans.Load(xsltPath);
xslTrans.Transform(xPathDoc, xslArg, writer);
return "Success";
}
catch (Exception ex)
{
return ex.Message.ToString();
}
writer.Close();
}
Thanks!
B.Ramana Reddy