TransformXML()
Apply an XSL transformation to XML data.
The TransformXML() function was designed for use with Classic Content. In some situations, using this function with Content Builder throws an exception. See Usage with Content Builder.
The TransformXML() function has these parameters:
xmlDocument(string): Required. The XML data to transform.xslDocument(string): Required. The XSL document to use to transform the XML data.
For both parameters, you can use another function, such as GetPortfolioItem(), to retrieve the XML or XSL content.
To use this function, pass it a source XML document and the XSL document that you want to use to transform the XML data.
This example uses the GetPortfolioItem() function to retrieve the XML and XSL files. Next, it applies the XSL file to the XML file as part of the transformation process. The result is passed to the TreatAsContent() function so that the AMPscript content in the transformed XML is evaluated.
This function throws an exception when you use it with Content Builder. To continue using this function with Content Builder, convert the XML and XSL documents to Base64 encoding, and store the encoded content as content blocks. Then, use the Base64Decode() function to decode the content blocks and pass them to this function.
This example shows how to transform XML by using content blocks encoded in Base64.
Because the process of converting XML and XSL documents to Base64 encoding makes them difficult to maintain and debug, we recommend that you avoid using this method when possible. Instead, use the BuildRowsetFromXml() function to handle XML content.