Subject: RE: [xsl] Merging two xml files using a template file. From: "SHEIKH Sajjad" <Sajjad.SHEIKH@xxxxxxxxxxx> Date: Mon, 12 Jan 2004 17:46:28 +0100 |
Hi there, Have a look at the document() function in xslt. You can bring all your files together and then could apply the templates and operations as you want. Hope this helps. /s -----Original Message----- From: Bhaskar Reddy [mailto:bhaskar_reddy@xxxxxxxxxxx] Sent: 12 January 2004 17:32 To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Merging two xml files using a template file. Hi, I have many sets of data in xml files. Each set has three xml files. And each set has different tree structure. So I am looking for some general solution. I want to merge file 1 and file 2, depending on the attribute"src" from file 3( template file) of the set. Sample files for a set are as shown below.. the "src" attribute tells from where to get the value of that element. file 1: xml ------------- <Data> <Name> Peter Radke </Name> <Age> 34 </Age> <Address> <Street> 34 Peter Ave </Street> <City> Chicago</City> <Country> USA </Country> </Address> </Data> file 2: xml : Has very similar structure but different values <Data> <Name> Peter </Name> <Age> 38 </Age> <Address> <Street> 38 Bradway st</Street> <City> NewYork</City> <Country> USA </Country> </Address> </Data> file 3: xml : <Data> <Name src="file1"> </Name> <Age src="file2"></Age> <Address src="file2"> </Address> </Data> file 3 is a template file for merging file 1 and file 2. the src attribute in this file tells from where to get the element value from. For example the Name element value should be read from the file1 and the Age should be from the file 2. And the whole <Address> structure should be read from the file 2. So the result should look like Result FILE: ---------------- <Data> <Name> Peter Radke </Name> <Age> 38 </Age> <Address> <Street> 38 Bradway st</Street> <City> NewYork</City> <Country> USA </Country> </Address> </Data> The structure of these xml files are not predefined. So I can't hard code any element names. Can any one help me how to do it using XSLT. Thanks Bhaskar _________________________________________________________________ Free transactions in any ATM across India. http://server1.msn.co.in/msnleads/suvidha/dec03.asp?type=hottag Click here. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list ______________________________________________________________ This message has been scanned for all viruses by BTnet VirusScreen. The service is delivered in partnership with MessageLabs. This service does not scan any password protected or encrypted attachments. If you are interested in finding out more about the service, please visit our website at http://www.btignite.com/internetservices/btnet/products_virusscreen.htm ============================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Merging two xml files using a, Bhaskar Reddy | Thread | RE: [xsl] Merging two xml files usi, Bhaskar Reddy |
[xsl] Question about variable-field, Mir Farooq Ali | Date | Re: [xsl] Question about variable-f, David Carlisle |
Month |