Here I am using TransformXML to parse xml to an email.
I have saved xsl stylesheet as a content block and used the above function to parse xml to the email.
When the email is previewed using the xml data from a DE I am constantly seeing this error. I have tried looking around for proper implementation of xsl and seems like what I have done is correct.
Here is the xsl stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="message/subscribers/subscriber">
<tr>
<td align="center" valign="top">
<table align="center" class="em_main_table" bgcolor="#faf8f9" width="640" border="0" cellspacing="0" cellpadding="0" style="table-layout:fixed; width:640px;">
<tbody>
<tr>
<td class="em_orange em_aside" valign="top" align="left" style="font-family: 'Montserrat', Arial, sans-serif; font-size: 24px; color: #f0683e; padding-left: 63px; padding-right: 63px; line-height: 28px; font-weight: 300; letter-spacing: 3px;">YOUR ORDER CONFIRMATION</td>
</tr>
<tr>
<td class="em_black em_aside" valign="top" align="left" style="font-family: Arial, sans-serif; font-size: 14px; color: #000000; padding-left: 63px; padding-right: 63px; line-height: 18px;">Hi <xsl:value-of select="firstname" />,</td>
</tr>
</tbody>
</table>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
And here is the xml:
<message>
<content>
<id>1234</id>
</content>
<subscribers>
<subscriber>
<firstname>Sample</firstname>
<lastname>Sample</lastname>
<email>[email protected]</email>
</subscriber>
</subscribers>
</message>
Also here is the AMPScript that does the transformation part:
%%[
VAR @data
SET @data = AttributeValue('data')
SET @xsl = ContentBlockByKey('test_xsl_file')
SET @OutputTransform = TreatAsContent(TransformXML(@data,@xsl)))]%%
%%=v(@OutputTransform)=%%
And lastly this is the error:
Stylesheet must start either with an 'xsl:stylesheet' or an 'xsl:transform' element, or with a literal result element that has an 'xsl:version' attribute, where prefix 'xsl' denotes the 'http://www.w3.org/1999/XSL/Transform' namespace.