Flexible Content Areas with XML Interfaces

Here is a good way to display a grid of external content in an email without repeating a significant amount of AMPScript. It utilizes an XML string and uses XPATH to retrieve content using the BuildRowSetFromXML() function.

Slide deck from my ExactTarget Connections Conference 2014 presentation

Helpful Links/Resources

Double Wide v2 – Responsive Email Pattern
XPATH reference
All AMPScript Functions
LookupOrderedRows() Function
BuildRowsetFromXML() Function
TreatAsContent() Function
ContentAreaByName() Function

Product Data Extension

SKUProductImageURLAvgCustomerRatingApprovedForEmail
1234http://placehold.it/150x150&text=12344true
2468http://placehold.it/150x150&text=24683true
1357http://placehold.it/150x150&text=13575true

Email Init Section

Email Body

Content Area Init Section

Content Area Body

Questions? Comments? Feel free to leave a comment below.

5
Leave a Reply

avatar
3 Comment threads
2 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
felipeAbhishekAdam SpriggsKelly Sullivan Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Kelly Sullivan
Guest
Kelly Sullivan

Saw your presentation at CNX14. Thanks! This is a HUGE help. It will save me a ton of time!

Abhishek
Guest
Abhishek

suppose i have a xml file stored in data extension, can i parse the xml from DE using ampscript? will it be possible even with nested nodes?

felipe
Guest

I am trying to simulate a method that needs to return an SKU. When I execute this in an email and preview it doesn’t return SKU. However, I am trying to render it in a content are and assign the value to a variable and it does not work. Render the SKU %%=TreatAsContent(ContentAreaByName(“My Contents\DISCLAIMERS”))=%% Does not render the value in the variable %%[ set @listOfSkus = TreatAsContent(ContentAreaByName(“My Contents\DISCLAIMERS”)) ]%% Method: %%[ set @itemNum = BuildRowsetFromXML(LINE_ITEMS,"//ITEM/ITEM_NUMBER",1) set @itemCount = RowCount(@itemNum) <pre> if @itemCount >= 1 then for @cnt = 1 to @itemCount do set @itemSku = Field(Row(@itemNum,@cnt),”Value”, 0) set @joinme =… Read more »