From http://www.w3.org/TR/xslt#modes
Modes allow an element to be processed multiple times, each time producing a different result.
This stylesheet:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="Rows">
<ul>
<xsl:apply-templates/>
</ul>
<table>
<xsl:apply-templates mode="table"/>
</table>
</xsl:template>
<xsl:template match="Row">
<li>
<xsl:value-of select="@Data1"/>
</li>
</xsl:template>
<xsl:template match="Row" mode="table">
<tr>
<xsl:apply-templates select="@*" mode="table"/>
</tr>
</xsl:template>
<xsl:template match="Row/@*" mode="table">
<td>
<xsl:value-of select="."/>
</td>
</xsl:template>
</xsl:stylesheet>
With this input:
<Rows>
<Row Style="OutputTemplateName" Data1="Data1Value" Data2="Data2Value" />
<Row Style="OutputTemplateName" Data1="Data1Value" Data2="Data2Value" />
</Rows>
Output:
<ul>
<li>Data1Value</li>
<li>Data1Value</li>
</ul>
<table>
<tr>
<td>OutputTemplateName</td>
<td>Data1Value</td>
<td>Data2Value</td>
</tr>
<tr>
<td>OutputTemplateName</td>
<td>Data1Value</td>
<td>Data2Value</td>
</tr>
</table>
Alejandro
2010-10-14 22:55:38