web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to use XSLT

(0) ShareShare
ReportReport
Posted on by 30

Hi!

I have problem with translate xml to use XSLT.

I already have xml, XSLT Files. But I cant translate.

xslt Files

  
      
    
        
              
        .....

I try to search some code like this

XmlDocument Trans = new XmlDocument();
xmlTransfornedDoc = XSLFileTransform.transformXMLDocument(xmlDoc,xslDocument);

But It cant use in D365FO.

After Transfer It will be set on this XSLT Format.

_A1CE98CC_.JPG

I want to know XSLT transfer code in X .

please help!

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    You can use XSLT transform directly on Data management projects, without any development. Would that work out for you?

  • SYCNS Profile Picture
    30 on at

    I have to developmet.

    The process is that I get xml data from external API, and translate immediately to show xslt format.

    I want to go through all process in Class.

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    XSLT transforms XML files to different formats.

    But do you also want to render / display something after the XML has been transformed? That would require also many other steps than just converting XML to another kind of XML.

    What is your business requirement?

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    XSLT is not a format at all. It's a programming language for transforming XML files.

    What can you tell us about the output format that you want? Let's talk about implementation details (such as which programming language to use) later.

  • SYCNS Profile Picture
    30 on at

    Let me introduce required bussiness process.

    First, When I clicked button, then get XML data from API.

    Second, I set the data to XLST that already produced from other site.

    Third, I will show the above picture(my first question) format screen.(format is html)

    Also, when I opened the XLST that I explained second, then it show above picture.

    can you understand..???

  • SYCNS Profile Picture
    30 on at

    This is part of my code

    //I get data from API

           System.Net.WebClient web = new System.Net.WebClient();

           System.Net.WebHeaderCollection headers = web.Headers;

           headers.Add("Content-Type","application/json");

           System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();

           str json = FormJsonSerializer::serializeClass(request);

           System.Byte[] encodedBytes = encoder.GetBytes(json);

           System.Byte[] response = web.UploadData("demoapi.smartbill.co.kr/.../",encodedBytes);

           str jsonResponse = encoder.GetString(response);

           result = FormJsonSerializer::deserializeObject(classNum(SYC_ResultModel_Scrap), jsonResponse);

           if(result.ResultCode() == "30000")

           {

               values = FormJsonSerializer::deserializeCollection(classNum(List), jsonResponse, Types::Class, classStr(SYC_ResultModel_Dataset_Scrap));

               value = values.getEnumerator();

               if(values.elements()>0)

               {

                   resultArray = new System.String[values.elements()+1,2]();

                   int arrayLoop = 1;

                   while(value.moveNext())

                   {

                       resultDataSet = value.current();

                       resultArray.Set(arrayLoop,0,resultDataSet.ISSUE_ID());

                       resultArray.Set(arrayLoop,1,resultDataSet.DTI_MSG());

                       ///////DTI_MSG is the XML Data

                       arrayLoop++;

                   }

                   XmlDocument xmlDoc = new XmlDocument();

                   xmlDoc.loadXML(resultArray.Get(1,2));

                   XmlDocument xslDocument = new XmlDocument();

                   xslDocument.load(@"C:\Users\Administrator\Desktop\Issue_Preview_XSLT");

                   ///////Issue_preview_XSLT is the part I explained in the second part.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Find out some C# library that you can use to create PDFs out of XML with an XSLT file. Then use this library to create a PDF file, which you either offer for the user for download, or embed in D365FO form.

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Aha, so you want to execute an XSLT script to transform an XML file to HTML but you don't know how, correct?

    Look at DMFXsltTransform::transformFile(); it does almost what you want, except of that you want to do send and receive strings instead of file paths.

    You'll open the result (HTML), not the source code (XSLT) (as you said).

  • SYCNS Profile Picture
    30 on at

    Thanks Martin, Nikolaos.

    I will try to both of method.

    Matrin, you mean that when I use DMFXsltTransform::transformFile(), I have to parameter only the file path?

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    You can easily see which parameters the method expects by opening its definition in Visual Studio. You'd find that it has these parameters:DMFLocalFilePath inputFilePath, DMFLocalFilePath outputFilePath, str xsltString.

    Note that I didn't suggest using this method - I would rather extract just the part that you need. You could save the XML string to a temporary file and call transformFile(), but it looks like a waste of resources to me. I would rather use the string directly.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans