Posted 22 August 2013
by Phil G. Fearon

Share this blog:

Read more in Document Management

Reviewing XML Documents for an N-Way Merge

In this, my first post on our DeltaXignia blog, I will be pondering the issue of how to effectively visualise multiple revisions made to a single document. I realize, of course, that there are many good examples of 3-way comparison rendering (2 revisions with a common ancestor), but how about 5-way or 10-way?

Before we begin

To help provide some visual context for this, I modified a pre-existing Saxon-CE XSLT 2.0 app to develop what is a simple ad-hoc web-based prototype. I used XSLT 2.0 rather than JavaScript to drive the prototype because I already had an open source XSLT 2.0 project to provide a base, and it also allowed me to reuse some code from DeltaXignia’s samples.

A scenario

The scenario I’m using is based on a DITA document with 4 revisions, each modified by a different author, and a common ancestor:


In the above diagram, we start with the base DITA document which is the ‘common ancestor’ for all changes. Four stakeholders annabenchris and david were asked to review the base document and make their amendments in place and return the amended version. We now need to review all these change documents with a view to combining them in a coherent way into a single document again.

From the diagram we can see that some changes made by anna and ben are similar and also overlap with those from chris. This may be coincidence but it is more likely that they got the changes from the same source as chris. Regardless of the cause, we need to cater for this kind of ‘compound’ change also.

Collating revisions with DITA Merge

To collate all the revision documents, I used our new  DITA Merge  solution from DeltaXignia and added the documents returned by anna, ben, chris and david, plus the base document. Using DITA Merge’s Java API I created a simple Java-FX app which allowed me to  merge  documents by drag and drop from a file-view but I could equally have initiated the process from the command-line without any code.

Reviewing results

Annotated XML

The result from DITA Merge is a single DITA document annotated with ‘version identifiers’ highlighting the ‘owner’ of each modified document part. We can now use XSLT to produce a rendered WYSYWIG output, but first, here’s a look at the XML output from the merge.

© 2000-2025 DeltaXML Ltd. registered in England and Wales (Company No. 2528681), trading as DeltaXignia. All rights reserved