简体   繁体   English

XML比较工具可以“整理” XML并忽略属性差异

[英]XML compare tool that can “Tidy” the XML and ignore differences in attributes

I am looking at using Beyond Compare 3 with XML Tidy compare comparison format. 我正在研究将Beyond Compare 3XML Tidy比较比较格式一起使用。 XML Tidy formats all the nodes with proper line breaks and indentation if an XML file is all slopped onto one line. 如果XML文件全部倾斜到一行,则XML Tidy会使用适当的换行符和缩进来格式化所有节点。 ...So I would love a tool that can do this and can ignore differences in attributes , or not even show attributes at all (this is because attributes are irrelevant to my users). ...所以我很喜欢一个可以做到这一点,并且可以忽略属性差异甚至根本不显示属性的工具(这是因为属性与我的用户无关)。

Is there a tool that can do this? 有没有可以做到这一点的工具?

Thanks! 谢谢!

An XSLT identity transform that omits the attributes and sets the output to indent should work: 忽略属性并将输出设置为缩进的XSLT身份转换应该起作用:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output indent="yes" />

<xsl:template match="/">
    <xsl:apply-templates />
</xsl:template>

<xsl:template match="node()">
    <xsl:copy>
        <xsl:apply-templates />
    </xsl:copy>
</xsl:template>

</xsl:stylesheet>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM