I'm trying to put some code that pulls in product names, but if that field is blank, I'm getting this error:
XML parameter cannot be null or an empty string. Function Name: TransformXML Parameter Name: XML Parameter Ordinal: 1 Parameter Type: Text Submitted Value: ClientID: 1041374 JobID: 0 ListID: 0 BatchID: 0 SubcriberID: 454254789 Data Source Type: CustomObject Data Source ID: 38577ee7-a008-e411-9421-3c4a92f8dd8c
I tried two different ways to put a fallback for blank ones:
%%[ if @RegisteredItems == "" or @RegisteredItems is NULL THEN ]%% We have received your registration for your gear. %%[ELSE]%% We have received your registration for the following products:
%%=TransformXML(TRIM(RegisteredItems), @xsl)=%% %%[ENDIF]%%
This works for ones with the necessary data but still results in the same error on the blank ones.
%%[IF NOT EMPTY(@RegisteredItems) THEN]%% We have received your registration for the following products:<br><br />
%%=TransformXML(TRIM(RegisteredItems), @xsl)=%% %%[ELSE]%% We have received your registration for your gear. %%[ENDIF]%%
This just shows the fallback for every instance. Is there a way to get this to fully work?
Edit: Thought it might be beneficial to add in the code for the XSL itself.
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match='/'>
<xsl:for-each select='registrations/registration'>
<b>Product Name:</b> <xsl:value-of select='product/name'/><br/>
<b>SKU:</b> <xsl:value-of select='product/sku'/><br/>
<b>Warranty Start Date:</b> <xsl:value-of select='purchase-date'/><br/>
<b>Warranty End Date:</b> <xsl:value-of select='warranty-end-date'/><br/>
<br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>