Repeating section as html table in mail describes how to transform a repeating section to html. It was done by template rules. Problem was it outputs all the Text Data that is present in the XML file even if no template rule is defined for a repeating section control since then applies the default rule for text.
To avoid that here for-each is used in stylesheet. Only these fields that have to appear in the output must be specified.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<!-- transform repeating section from xml to html -->
<xsl:template match="/">
<table border="1" width="100%" style="border-collapse:collapse;background-color:#eee;border:1px solid;color:black;font-size:100%;font-family:arial,helvetica,sans-serif;">
<thead>
<tr>
<td>first name</td>
<td>name</td>
<td>company</td>
</tr>
</thead>
<tbody>
<xsl:for-each select="//Items/Item">
<tr>
<td>
<xsl:value-of select="first_name" disable-output-escaping="yes" />
</td>
<td>
<xsl:value-of select="last_name" disable-output-escaping="yes" />
</td>
<td>
<xsl:value-of select="company" disable-output-escaping="yes" />
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:template>
</xsl:stylesheet>
Except for the stylesheet, everything remains as in Repeating section as html table in mail .