[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Merging two xml files


Subject: [xsl] Merging two xml files
From: Mulberry Technologies List Owner <xsl-list-owner@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 25 Aug 2003 11:20:19 -0400

>From: Patrick Martin <patrick.martin@xxxxxxxxxxx>
>To: "'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'" <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
>Subject: Merging two xml files
>Date: Mon, 25 Aug 2003 12:04:23 +0200
>
>Hi,
>
>I am trying to merge two xml files, using a xsl stylesheet. Those files are
>actually BEA Weblogic's configuration files (config.xml and a partial
>config.xml), but I'd like the xsl script to be quite generic (avoid
>hardcoding the element names and attributes).
>
>Basically, the only thing I know about the files is that they have the same
>root node.
>
>For example, with the 2 following files:
>File1.xml:
><root>
>	<elt1 att1="a" att2="b">
>		<subelt1 att1="b"/>
>		<subelt1 att1="c"/>
>	</elt1>
>	<elt2 att1="d"/>
></root>
>
>File2.xml:
><root>
>	<elt1 att1="a" att2="b">
>		<subelt1 att1="c"/>
>		<subelt1 att1="d"/>
>	</elt1>
>	<elt1 att1="a" att2="d">
>		<subelt1 att1="x"/>
>	</elt1>
>	<elt3 att1="e"/>
></root>
>
>Should give something like:
><root>
>	<elt1 att1="a" att2="b">
>		<subelt1 att1="b"/>
>		<subelt1 att1="c"/>
>		<subelt1 att1="d"/>
>	</elt1>
>	<elt1 att1="a" att2="d">
>		<subelt1 att1="x"/>
>	</elt1>
>	<elt2 att1="d"/>
>	<elt3 att1="e"/>
></root>
>
>So the following rules must be respected:
>. Each element associated with its attribute is unique (we don't have two
><elt1 att1="a" att2="b">).
>. If one element exists only in one of the file, it should  appear in the
>output.
>
>I am very new to xsl and tried to look on the web without finding exactly
>what I want.
>
>Does anyone have an idea on how to solve that question?
>
>Thank you,
>
>Patrick
>
>
>
>
>Confidentiality Notice: The information contained in this e-mail message is
>intended only for the personal and confidential use of the recipient(s)
>named above. If the reader of this message is not the intended recipient or
>an agent responsible for delivering it to the intended recipient, you are
>hereby notified that you have received this document in error and that any
>review, dissemination, distribution, or copying of this message is strictly
>prohibited. If you have received this communication in error, please notify
>us immediately by e-mail, and delete the original message.
>
>Message confidentiel : Les informations contenues dans ce message sont
>destinees a un usage personnel et confidentiel du destinataire indique
>ci-dessus. Si le lecteur de ce message n'est pas le destinataire prevu, ou
>n'est pas une personne en charge de le delivrer au destinataire voulu, vous
>etes par la presente informe que vous avez recu ce document par erreur, et
>que tout examen, transmission, distribution ou copie de ce message est
>totalement interdit. Si vous avez recu cette communication par erreur, nous
>vous remercions de bien vouloir nous avertir immediatement par e-mail et de
>detruire le message d'origine.



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



Current Thread
Keywords