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 />

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

All help appreciated


Recommended Answers

All 3 Replies

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

<xsl:stylesheet version="1.0" xmlns:xsl="">

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

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

Thank you for your answer.

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

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

to the stylesheet provided by iceandrews.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.