You must Sign In to post a response.
  • Category: XML

    Xml to xml conversion using xslt

    I am using c#. I want to convert 1 xml file to some other xml format using xslt.

    please provide any sample for this to better understand the concept of xslt.
  • #766870
    I didn't understand your problem please eleborate it to transform xml in to end user readable form you use XsltTransform.
    SRI RAMA PHANI BHUSHAN KAMBHAMPATI

  • #769678
    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


  • Sign In to post your comments