xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Boag/CAM/Lotus" <Scott_B...@lotus.com>
Subject Re: Merge multiple XML Docs into one XML Doc
Date Tue, 25 Jan 2000 18:30:11 GMT

Just use xsl:copy-of in XSLT.   <xsl:copy-of select="document
('http://foo.com/blah.xml')/*"/>  should copy the document element &
children of blah.xml to the result tree.

-scott




                                                                                         
                         
                    Brian Dupras                                                         
                         
                    <briand@cente        To:     "Xml-Apache (E-mail)" <general@xml.apache.org>
                   
                    ra.com>              cc:     (bcc: Scott Boag/CAM/Lotus)          
                            
                                         Subject:     Merge multiple XML Docs into one XML
Doc                     
                    01/25/00                                                             
                         
                    01:16 PM                                                             
                         
                    Please                                                               
                         
                    respond to                                                           
                         
                    general                                                              
                         
                                                                                         
                         
                                                                                         
                         




OK - this should be an easy one, but so far I've yet to find a definitive
answer.


I have a system where I'm given multiple XML DOM Documents that I need to
process and merge into a single DOM Document.  The known portions of the
input Documents get processed, while the unknown portions need to be copied
over directly.


The question is, how do I properly insert entire nodes (and their
childeren)
from one document to another?  Do I have to write my own recursive copy
routine?

I'm free to use either the DOM functions, or XSLT.


Brian


Given as DOM Documents:
           <doc1>
                     <foo>
                               <replaceme id="a"/>
                     </foo>
                     <bar/>
           </doc1>

           <doc2>
                     <bar>
                               <replaceme id="b">
                               <inserthere thexml="doc1">
                     </bar>
                     <foo/>
           </doc2>

           <doc3>
                     <inserthere thexml="doc1">
           </doc3>


Created from scratch:
           <output>
                     <bar>
                               <replaced>doc2 id b</replaced>
                               <foo>
                                          <replaced>doc1 id a</replaced>
                               </foo>
                               <bar/>
                     </bar>
           </output>





Brian Dupras
Centera Information Systems, Inc.
phone           303.939.0200 x294
fax        303.939.0111
web        http://www.centera.com
email           briand@centera.com





Mime
View raw message