XSLT - 删除所有属性

laj*_*rre 2 xml xslt xslt-1.0

非常直截了当的问题.没有找到这个答案.

想看看没有属性轴的XSLT 1.0,如果可能的话也要看其他的(我使用的是python的lxml lib,它并没有真正追上那些东西).

JLR*_*she 8

您的解决方案应该没有问题,但有一种更简单的方法 - 只需使用不包含属性的身份模板:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes" indent="yes"/>
  <xsl:strip-space elements="*"/>

  <xsl:template match="node()">
    <xsl:copy>
      <xsl:apply-templates />
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)