xsl-list
[Top] [All Lists]

Merging arbitrary XML files

2005-05-29 12:55:36

Hello,

I'm in the need of merging arbitrary XML files. Before specifying what that in 
particular means, here's some prior discussions(google) of "merging XML 
files":

From this list:
http://www.xslt.com/html/xsl-list/2002-07/msg01320.html

Jeni's site:
http://www.jenitennison.com/xslt/merging-docs.html

whose link leads to:
http://sources.redhat.com/ml/xsl-list/2000-07/msg00766.html

A good discussion, focused on the Delta-XML product:
http://www.deltaxml.com/pdf/merging-xml-files.pdf

Most of the prior discussions, are about(IMHO, AFAICT) how to use document() 
and so forth; inserting a table from an XML file into an XHTML document, or 
to transform a part of a document() opened file into the source, for example.

What I am looking for is to merge two XML files with no knowledge about the 
formats in question. For example, for the following two files:

-----------
<doc>
        <foo/>
        <bar/>
</doc>
-----------

-----------
<doc>
        <foo href="content" />
        <bar/>
        <joe/>
</doc>
-----------

Would the result be:
-----------
<doc>
        <foo href="content" />
        <bar/>
        <bar/>
        <joe/>
</doc>
-----------

Some of the approaches wouldn't be obvious, but conventional. For example how 
to do with identical attributes would perhaps be defined as depending on what 
file that is merged into which one(or vice versa), and interpreting identical 
elements as that they should be added next to each other(as opposed to one 
replacing) is also arbitrary.

From my reading of the Delta-XML paper(skimmed), it looks like they solved it, 
by producing a middle-step with a XML file containing meta-data by the use of 
procedural-code(or whatever is term for those classic languages?), which then 
is with XSL-T transformed to a suitable output.

However.. I want to do it with XSL-T 1.0(or 2.0, if necessary), and perhaps 
some E-XSLT.

But I've not gotten very far. I think an Identity Transform is a good start. 
From each template that matches an element or attribute, one could from there 
look up the appropriate sections in the other file. 

AFAICT, one can find a lot of information about the context, but I don't know 
how to bring that to use in order to locate the nodes that needs to be merged 
from the other file.

I wonder:

Does anyone know of any open source project that attempts to do XML merging?

Anyone has a template or two of their shelf that does it? ;-)


In other words, brain storming, thoughts about this, is appreciated.


Cheers,

                Frans

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>