简体   繁体   中英

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. XML Tidy formats all the nodes with proper line breaks and indentation if an XML file is all slopped onto one line. ...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:

<?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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