我有以下xml文件:
<xfa:data>
<form1>
<Page1>
<Page2>
<contractInfo> ... </contractInfo>
<paymentInfo> ... </paymentInfo>
</form1>
<commercialType> .... </commercialType>
<userList> ... </userList>
<officesList> ... </officesList>
<commercialType> .... </commercialType>
<userList> ... </userList>
<officesList> ... </officesList>
<commercialType> .... </commercialType>
<userList> ... </userList>
<officesList> ... </officesList>
</xfa:data>
我想删除commercialType,userList和officesList节点的每一个事件,所以我的输出将是:
<xfa:data>
<form1>
<Page1>
<Page2>
<contractInfo> ... </contractInfo>
<paymentInfo> ... </paymentInfo>
</form1>
</xfa:data>
我怎么能用XSLT做到这一点?
谢谢
答案 0 :(得分:16)
此转换会产生预期效果:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="commercialType|userList|officesList"/>
</xsl:stylesheet>
答案 1 :(得分:0)
身份转换加<xsl:template match="commercialType" priority="10"/>
。