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"?>
<xmlbeispiel>
    <titel>Vertreter</titel>
    <eintrag>
        <bundesland>Baden-Württemberg</bundesland>
        <vertreter>Bernd Berlinger</vertreter>
    </eintrag>
    <eintrag>
        <bundesland>Bayern</bundesland>
        <vertreter>Beate Berger</vertreter>
    </eintrag>
    <eintrag>
        <bundesland>Berlin</bundesland>
        <vertreter>Britta Bartsch</vertreter>
    </eintrag>
    <eintrag>
        <bundesland>Hamburg</bundesland>
        <vertreter>Hans Held</vertreter>
    </eintrag>
    <eintrag>    
        <bundesland>Niedersachsen</bundesland>
        <vertreter>Nadine Kiefer</vertreter>
    </eintrag>
    <eintrag>
        <bundesland>Nordrhein-Westfalen</bundesland>
        <vertreter>Norbert Niederberger</vertreter>
    </eintrag>
    <eintrag>
        <bundesland>Rheinland-Pfalz</bundesland>
        <vertreter>Regine Rust</vertreter>
    </eintrag>
    <eintrag>
        <bundesland>Saarland</bundesland>
        <vertreter>Sabine Sieger</vertreter>
    </eintrag>
    <eintrag>
        <bundesland>Sachsen</bundesland>
        <vertreter>Sven Sparker</vertreter>
    </eintrag>
</xmlbeispiel>

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">Bundesland</th>
            <th style="text-align:left">Sales Contact</th>
        </tr>
        <xsl:for-each select="xmlbeispiel/eintrag">
            <tr>
                <td><xsl:value-of select="bundesland"/></td>
                <td><xsl:value-of select="vertreter"/></td>
            </tr>
        </xsl:for-each>
    </table>
</xsl:template>
</xsl:stylesheet>

Display in the mailing