Tuesday, June 10, 2008

XSLT transformation for removing a single element/node

For some reason this took me a while to figure out. If you define an empty "template", the processing will be skipped.

<xsl:stylesheet version='1.0'

xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match='ElementToSkip'/>

<xsl:template match='*'>

<xsl:copy>

<xsl:apply-templates select='@*|node()'/>

</xsl:copy>

</xsl:template>

</xsl:stylesheet>