Creating Dynamic Content with XML

From $1

    Doc-Wiki-BannerHK.png

    (Click the banner to go to the related Docs.Code.ExactTarget.com page.)

    You can insert XML into an email to construct attribute-based conditions that control the content a subscriber sees. Using XML allows you to build conditions similarly to how you can with the dynamic content feature available in the ExactTarget application UI.

    Also, this option can be used in combination with the API method (Add HTML Paste) for creating ExactTarget emails remotely.

    DTD

    The Document Type Definition (DTD) defines the valid XML structure within the ## reference. The DTD is not required as part of your XML string. You can find sample code attached to this page in the file labeled DTDSampleCode.txt.

    Example 1: Simple if..then

    In this example, the account contains a numeric attribute named Heating Bill. If the value of this attribute is greater than 100.00, then the Heating Tips text is displayed.

    ##<engine> 
    
        <if> 
    
            <eval attributeName="Heating Bill" operator="greater than" compareValue="100.00" /> 
    
            <then> 
    
                <output>Heating Tips: Visit our web site for more tips on reducing your heating costs.</output> 
    
            </then> 
    
        </if> 
    
    </engine>##

    You can also output the subscriber's value for the attribute:

    <output attributeName="Heating Bill" />
    Any content within your output tags must comply with XML standards. If your content contains predefined entity references (<, >, &, ', "), you must put your content within a CDATA tag.
    <output><![CDATA[<a href="http://www.example.com">Visit our web site for tips on reducing your heating costs.</a>]]></output>

    Example 2: Complex if..then

    In this example, the content is based on the subscriber's city. If the subscriber lives in Fishers or Carmel, the subscriber will see the Hamilton County News Brief content. If the subscriber lives in Indianapolis, the Indianapolis News Brief content will be displayed. If the subscriber does not live in any of these cities, then the Statewide Summary content will be displayed.

    ##<engine> 
    
        <if> 
    
            <or> 
    
                <eval attributeName="City" operator="equal to" compareValue="Fishers" /> 
    
                <eval attributeName="City" operator="equal to" compareValue="Carmel" /> 
    
            </or> 
    
            <then> 
    
                <output><![CDATA[<a href="http://www.example.com/HamiltonCounty.htm">Hamilton County News Brief</a>]]></output> 
    
            </then> 
    
        </if> 
    
        <if> 
        
            <eval attributeName="City" operator="equal to" compareValue="Indianapolis" /> 
    
            <then> 
    
                <output><![CDATA[<a href="http://www.example.com/Indy.htm">Indianapolis News Brief</a>]]></output> 
    
            </then> 
    
        </if> 
    
        <otherwise> 
    
            <output><![CDATA[<a href="http://www.example.com/State.htm">Statewide Summary</a>]]></output> 
        
        </otherwise> 
    
    </engine>##

    This page was last updated by Ryan Williams on Fri, 06 Jan 2012 21:25:53 GMT.

    If you require assistance with the ExactTarget application, please contact Global Support. If you wish to send Ryan direct feedback, fill out the form below:

     


    Was This Page Helpful?
    Suggestions or Comments:
    Name (optional):
    Email Address (optional):
    Enter 24675 backwards:
       
    Tags: (Edit tags)
    • No tags
    FileSizeDateAttached by 
    DTDSampleCode.txt
    No description
    543 bytes17:25, 6 Jan 2012AdminActions
    Comments (0)
    You must login to post a comment.

     
    Powered by MindTouch 2010
    Admin