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

Announcements

News and Announcements icon
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

I have the same question (0)
  • Community Member Profile Picture
    on at

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 79 Super User 2026 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 58 Most Valuable Professional

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 42 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans