0

Since the retirement of classic content in Salesforce Marketing cloud, the AMPScript function TransformXML no longer works for new assets created in Content Builder (using it with XML/XSL from a DE for an order confirmation email).

Has anyone found a work-around that works? Trying to avoid using the Build Rowset options since our XML is rather complex with nesting and namespaces etc...

The following do not work:

Method One

Upload XML and XSL files to Content Builder Attempt to use: %%=TransformXML(ContentBlockById("xmlID"), ContentBlockById("xslID"))=%% Method fails because those files are not considered content blocks

Method Two

Copy/Paste XML and XSL files into separate Code Snippets Attempt to use: %%=TransformXML(ContentBlockById("xmlID"), ContentBlockById("xslID"))=%% Fails with the error: Failed to parse XML document. See inner exception for details. ​

Method Three

Import the XML and XSL into a data extension (example file included)

%%[ TransformXML(Lookup('TransformXMLTest', 'XML', 'ID', 1), Lookup('TransformXMLTest', 'XSL', 'ID', 1)) ]%%

Fails with the error:

Any Help is appreciated.

1 Answer 1

0

You might try this solution, in which you BASE-64 encode the XML and XSL before storing them in Content Builder.

In your case it'd be something like this:

%%[

set @xsl = Base64Decode(ContentBlockById("xmlID"), "UTF-8")
set @xml = Base64Decode(ContentBlockById("xslID"), "UTF-8")

]%%
%%=TreatAsContent(TransformXML(@xml,@xsl))=%%

Reference:

EDIT 2023-06-19

Confirmed that this method does indeed work. And, to be honest, it is much easier to use AMPscript and the BuildRowSetFromXML methods for building dynamic content.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .