怎么不复制一些属性?

mar*_*its 22 xslt xpath

我需要从输入文档复制到输出文档除了一个属性之外的所有属性.

我的输入是这样的:

<mylink id="nextButton" type="next" href="javascript:;" />
Run Code Online (Sandbox Code Playgroud)

我需要像这样的输出:

<a id="nextButton" href="javascript:;" />
Run Code Online (Sandbox Code Playgroud)

如果我使用以下XSL:

<xsl:template match="mylink">
    <a><xsl:copy-of select="attribute::*"/></a>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)

我得到所有属性输出如下:

<a id="nextButton" type="next" href="javascript:;" />
Run Code Online (Sandbox Code Playgroud)

但我想忽略"类型"属性.我尝试过以下但是它们似乎都没有按照我需要的方式工作:

<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)"/>
Run Code Online (Sandbox Code Playgroud)

我应该如何编写样式表以获得所需的输出?

var*_*tec 37

最短形式:

<xsl:template match="mylink">
    <a><xsl:copy-of select="@*[name()!='type']"/></a>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)

更长一点(这是我想出的第一件事,我留待参考):

<xsl:template match="mylink">
    <a>
     <xsl:for-each select="@*">
      <xsl:if test="name() != 'type'">
       <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
      </xsl:if> 
     </xsl:for-each>
    </a>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)