example merging: test82 merging details only from file2

basic-control-file: cmp82.xml
<?xml version="1.0" encoding="UTF-8"?>
<delivery>
	<list_person>
		<person>
			<name          ident_text="true"   />
			<firstname     ident_text="true"   />
			<list_hobby>
				<hobby ident_att_name="true"/>
			</list_hobby>
		</person>
	</list_person>
</delivery>
explanation

Input:
Files "test82a.xml" and "test82b.xml" should be merged according the merge-rules of file "merge82.xml".
Person "Fischer Werner" exists in both files.
Person "Fischer Albert" exists only in file "test82a.xml".
Person "Bauer Willi" exists only in file "test82b.xml".
All persons have different hobbies in both files.
Merge-rules:
The merge-rules mean: Take all persons from both files, but take only hobbies from file "test82b.xml".
Merge-result:
In the result-file there are all three person, but there are only hobbies from file "test82b.xml".

merge-control-file: merge82.xml
<?xml version='1.0' encoding='UTF-8'?>
<!--
Element <identity>: Explanation of the merge-Attributes:

     merge='??'
            ||
            |If rows are equal:
            |________________________________________________________
            |0 = take no row from input1 or input2
            |3 = merge rows from input1 and input2.
            |________________________________________________________
            |
            If rows are not equal:
            _________________________________________________________
            0 = take no row from input1 or input2
            1 = take only row from input1
            2 = take only row from input2
            3 = take row from input1 and input2.

Element <value>: Explanation of the merge-Attributes:

     merge='???'
            |||
            ||If element/attribute-name are equal but contents are not equal:
            ||_______________________________________________________
            ||0 = take no attribute/element from input1 or input2
            ||1 = take attribute/element from input1
            ||2 = take attribute/element from input2
            ||3 = take attribute/element from input1 and input2 (not possible if path is an attribute)
            ||
            |If element/attribute-name and content are equal:
            |________________________________________________________
            |0 = take no element/attribute from input1 or input2
            |3 = take element/attribute from input1 or input2
            |________________________________________________________
            |
            If element/attribute-name are not equal:
            _________________________________________________________
            0 = take no element/attribute from input1 or input2
            1 = take only element/attribute from input1
            2 = take only element/attribute from input2
            3 = take element/attribute from input1 and input2.
-->
<merge>
<identity path='/delivery/list_person/person'   merge='33' >
    <identity path='/list_hobby/hobby'          merge='23' >
    </identity>
</identity>
</merge>
file: test82a.xml
<?xml version='1.0' encoding='UTF-8'?>
<delivery>
	<list_person>
		<person>
			<name>Fischer</name>
			<firstname>Werner</firstname>
			<list_hobby>
				<hobby name="hiking"/>
				<hobby name="hunting"/>
			</list_hobby>
		</person>
		<person>
			<name>Fischer</name>
			<firstname>Albert</firstname>
			<list_hobby>
				<hobby name="cooking"/>
			</list_hobby>
		</person>
	</list_person>
</delivery>
file: test82b.xml
<?xml version='1.0' encoding='UTF-8'?>
<delivery>
	<list_person>
		<person>
			<name>Fischer</name>
			<firstname>Werner</firstname>
			<list_hobby>
				<hobby name="reading"/>
			</list_hobby>
		</person>
		<person>
			<name>Bauer</name>
			<firstname>Willi</firstname>
			<list_hobby>
				<hobby name="jogging"/>
			</list_hobby>
		</person>
	</list_person>
</delivery>


merge-result on stdout
<?xml version='1.0' encoding='UTF-8'?>
<delivery>
	<list_person>
		<person>
			<name>Bauer</name><firstname>Willi</firstname>
			<list_hobby>
				<hobby name='jogging'>
				</hobby>
			</list_hobby>
		</person>
		<person>
			<name>Fischer</name><firstname>Albert</firstname>
		</person>
		<person>
			<name>Fischer</name><firstname>Werner</firstname>
			<list_hobby>
				<hobby name='reading'>
				</hobby>
			</list_hobby>
		</person>
	</list_person>
</delivery>