I need to copy from input document to output document all attributes but one.
My input is like this:
<mylink id='nextButton' type='next' href='javascript:;' />
And I need output like this:
<a id='nextButton' href='javascript:;' />
If I use the following XSL:
<xsl:template match='mylink'> <a><xsl:copy-of select='attribute::*'/></a> </xsl:template>
I get all attributes to output like this:
<a id='nextButton' type='next' href='javascript:;' />
But I want to ignore the ‘type’ attribute. I’ve tried the following but none of them seems to work the way I need:
<xsl:copy-of select='attribute::!type'/> <xsl:copy-of select='attribute::!'type''/> <xsl:copy-of select='attribute::*[!type]'/> <xsl:copy-of select='attribute::not(type)'/>
How should I write my stylesheet to get needed output?
Shortest form:
Longer one (that’s the first thing I came up with, I leave it for reference):