Another total Nuby collection.

I have an xml file from which I wish to eliminate all elements that have any attributes at all. All I really need to do is eliminate the contents of the attribute. How do I do this?

My plan is to start with

<xsl:template match="Contains an attribute">
<bfbfb />
</xsl:template>

Of course the XPATH equivalent to "Contains an attribute" is unknown to me.

All help appreciated

Achava

It's an Identity Template with a match on ANY element that has an attribute. ' match="*[@*]" '

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="@*|node()">
		<xsl:copy>
			<xsl:apply-templates select="@*"/>
			<xsl:apply-templates/>
		</xsl:copy>
	</xsl:template>

	<xsl:template match="*[@*]" />
</xsl:stylesheet>

You might want to also remove all the resulting whitespace by adding

<xsl:strip-space elements="*"/>

to the stylesheet provided by iceandrews.

This question has already been answered. Start a new discussion instead.