Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 3rd, 2006, 10:30 AM
Authorized User
 
Join Date: Feb 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default xslt differencing between two xml files

I'm trying to use the msxsl.exe utility to do a simple differencing between two xml files that will generate another xml file that contains the differences between the two original xml files. I know there has to be some code out there that will get me pointed in the right direction. I have this copy code... I figure it can be modified to work with a little guidance. Any help would be appreciated... still learning.

Thanks!

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="no" encoding="UTF-8"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

 
Old August 3rd, 2006, 10:58 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Differencing between XML documents is a pretty complex subject, in defining exactly what differences you regard as significant, in deciding how they should be reported, and in devising and implementing algorithms. I'm afraid it's too big a problem for a simple answer.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 3rd, 2006, 11:23 AM
Authorized User
 
Join Date: Feb 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I didn't think it was going to be tough... I'm pulling an identical data file, just at different times during the week. Some additions but mostly changes are made to the data within the xml, so I thought it wouldn't be that tough to compare each subsequent data file to the original and build a new xml data file (based on that same schema) out of the differences between each comparison. Not much changes each time and there are 24 data tags to parse in each record.

 
Old August 3rd, 2006, 11:30 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Good, let us know the answer when you've done it.

The problem is of course easier if you make the scope narrower, for example if you know the two files conform to the same schema and you are only looking for differences in data content, or if you have ID attributes that you can use as comparison anchors.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 3rd, 2006, 01:38 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Take a look at Altovas Diff Dog. Maybe it can help.

 
Old August 4th, 2006, 08:49 AM
Authorized User
 
Join Date: Feb 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Until I can get my xsl command line routine to run... I found some shareware out there that does difference comparison and output. If anyone's interested it's call ExamXML and you can get it here... http://www.download.com/ExamXML/3000...-10566218.html






Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading XML files in XSLT newbieboobers XSLT 2 March 12th, 2008 11:42 AM
Can 1 xslt transform an xml doc into 2 text files Raju Sarode XSLT 7 November 3rd, 2006 04:10 PM
XSLT between two XML files NEO1976 XSLT 15 July 24th, 2006 08:52 AM
Compare two xml files using xslt sudha XSLT 0 March 10th, 2006 01:04 AM
Merge XML files into a xml file using xslt lxu XML 4 November 6th, 2003 06:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.