Example 2 – Integrating XML content

Details for the example

Data source

XML file

Transformation

Yes

Personalisation/
parameter transfer

No

Agent

Content

Time of the update

Sending time

Notes on the example

In this example, a simple XML file is used as the data source. In the XML file, different sales representatives are assigned to the various federal states.

Through the transformation, the XML file is transformed to a table in HTML format and integrated into the mailing.

URL of the data source

https://example.com/content/vertreter.xml

XML file

Copy
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xmlexample>
    <title>Sales representatives</title>
    <entry>
        <district>City of London</district>
        <representative>Chris Leister</representative>
    </entry>
    <entry>
        <district>Cornwall</district>
        <representative>Cate Murray</representative>
    </entry>
    <entry>
        <district>Dorset</district>
        <representative>Dan Peters</representative>
    </entry>
    <entry>
        <district>Greater London</district>
        <representative>Gerry Miller</representative>
    </entry>
    <entry>
        <district>Kent</district>
        <representative>Kate Summer</representative>
    </entry>
    <entry>
        <district>Somerset</district>
        <representative>Sue Carter</representative>
    </entry>
    <entry>
        <district>Yorkshire</district>
        <representative>Zoe Shine</representative>
    </entry>
</xmlexample>

Transformation

Copy
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
    <table border="1" bordercolor="#FFFFFF">
        <tr>
            <th style="text-align:left">District</th>
            <th style="text-align:left">Sales representative</th>
        </tr>
        <xsl:for-each select="xmlexample/entry">
            <tr>
                <td><xsl:value-of select="district"/></td>
                <td><xsl:value-of select="representative"/></td>
            </tr>
        </xsl:for-each>
    </table>
</xsl:template>
</xsl:stylesheet>

Display in the mailing