This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Merging XML


Rosh,
  I too am interested in such a solution.  Unfortunately due to a
combination of lack of time and/or skill I have not been able to pursue it
to an entirely satisfactory conclusion.

My initial guess would be to use a hybrid of Oliver's method and a method
proposed by Jeni Tennison.  For a specific format of an XML document Jeni
proposed using key() to determine equivalence between nodes and then adopt
a three phase approach (equivalent nodes from both the original and updated
xml document are passed as parameters starting with the root document)

1) Child Nodes Removed - For each child node in the original document
determine if it exists in the updated document (using key()?)

2) Child Nodes Added - For each child node in the updated document
determine if it exists in the original document (using key()?) (NB this is
the same template as 1) but with the node-set parameters swapped round)

3) Child Nodes amended - For each child node in the original document with
an equivalent child node in the updated document call the three phase
approach passing these two nodes as paramaters.

The problem is generating <xsl:key..> dynamically.  I've got a version
working (not fully tested) that sets the <xsl:key..> with a priori
knowledge of the format of the xml documents but haven't had time to extend
it for a more generic solution.  I have an inkling that you can't define
keys dynamically so I have it in the back of my mind that a double xsl
approach may need to be implemented, one to search the xml document for
attributes and create an xsl key definition document that can be included
into the merging tool (I have to admit that this sounds less likely to work
now that I've tried to explain it)

At the moment I'm plodding on (in a newbie way) and hoping that one of the
more experinced members of this list may find it interesting enough to turn
their attention to it.

I'll test my current solution and then post it, if it will help.

Thanks

Tom Mullen


-----------------------------------------------------------------
        Visit our Internet site at http://www.reuters.com

Any views expressed in this message are those of  the  individual
sender,  except  where  the sender specifically states them to be
the views of Reuters Ltd.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]