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 :
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

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 171 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 83

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans