Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Can I execute xslt on the contents of a field?

(0) ShareShare
ReportReport
Posted on by

I'm looking at the documentation for these Web resources Stylesheet (XSL)

Reading the script.js example it shows an ActiveXObject that loads XML from file given the file's url.

I don't have a file.  I have a formContext.getAttribute(<fieldname>).getValue() where the field contains the XML that I want to transform.

How do I satisfy an Msxml2.DOMDocument.6.0 with a "stream" rather than a filename/url?

thanks

  • Community Member Profile Picture
    on at
    RE: Can I execute xslt on the contents of a field?

    I have qTransform.xslt and a sample of new_response saved to file referencing the xslt within stored on the file system.  When I browse it, the results are as I desire.  Now, how do I take it to CE?  I've imported the javascript, an html, the CSS and the same xslt to CE web resources.  Here is the javascript copied from the MS documentation where the most significant change is that instead of an xml file, I'm streaming the xml from field (dataXml.loadXml)

    // JavaScript source code
    var Sdk = window.Sdk || {};
    
    (function () {
        this.formOnLoad = function (ExecutionContext) {
            var formContext = ExecutionContext.getFormContext();
            var doing = formContext.ui.getFormType();
    
            Sdk.QADlog = {
                dataFile = formContext.getAttribute("new_response").getValue(),
                transformFile = "XSL/qTransform.xslt",
                showData = function () {
                    if (this.dataFile) {
                        var dataXml = new ActiveXObject("Msxml2.DOMDocument.6.0");
                        dataXml.async = false;
                        dataXml.loadXML(this.dataFile);
    
                        var transformXSLT = new ActiveXObject("Msxml2.DOMDocument.6.0");
                        transformXSLT.async = false;
                        transformXSLT.load(this.transformFile);
    
                        // Set the innerHTML of the results area to the output of the transformation.
                        var resultsArea = document.getElementById("results");
                        resultsArea.innerHTML = dataXml.transformNode(transformXSLT);
                    }
                }
            };
        };
    }).call(Sdk);
    Here's the html of the Webresource field on the form:

    prettyResponseHTML.PNG

    The field is blank.  Can anyone tell me why?  I welcome probing questions as I have no idea how to make this work.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106 Most Valuable Professional

#3
Eugen Podkorytov Profile Picture

Eugen Podkorytov 102

Overall leaderboard

Product updates

Dynamics 365 release plans