Эта таблица стилей:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:x="urn:schemas-microsoft-com:office:excel">
<xsl:param name="pColumnNames" select="'Last Name,Email'"/>
<xsl:key name="kItemByPosition" match="item"
use="count(preceding-sibling::item)+1"/>
<xsl:template match="/">
<xsl:processing-instruction name="mso-application">
<xsl:text>progid="Excel.Sheet"</xsl:text>
</xsl:processing-instruction>
<Workbook>
<Worksheet ss:Name="Email Table">
<Table x:FullColumns="1" x:FullRows="1">
<xsl:apply-templates/>
</Table>
</Worksheet>
</Workbook>
</xsl:template>
<xsl:template match="metadata|row">
<Row>
<xsl:apply-templates/>
</Row>
</xsl:template>
<xsl:template match="item|value">
<xsl:if test="contains(concat(',',$pColumnNames,','),
concat(',',key('kItemByPosition',
position())/@name,','))">
<Cell>
<Data ss:Type="String">
<xsl:apply-templates select="@name|node()"/>
</Data>
</Cell>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Выход:
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:x="urn:schemas-microsoft-com:office:excel">
<Worksheet ss:Name="Email Table">
<Table x:FullColumns="1" x:FullRows="1">
<Row>
<Cell>
<Data ss:Type="String">Last Name</Data>
</Cell>
<Cell>
<Data ss:Type="String">Email</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">XXX</Data>
</Cell>
<Cell>
<Data ss:Type="String">xxx</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">xxy</Data>
</Cell>
<Cell>
<Data ss:Type="String">xx</Data>
</Cell>
</Row>
</Table>
</Worksheet>
</Workbook>