Update tag values against other xml

11 views
Skip to first unread message

sergio

unread,
Apr 14, 2017, 6:54:14 AM4/14/17
to XSLT, John Pluchino
Hi guys,
i kindly ask you an help to find a solution to this problem. 
I've two xml like this:

base:
<person>
<name>A</name>
<surname>B</surname>
<address/>
... many other tags...
</person>

update:
<person>
<name/>
<surname>D</surname>
<address>C</address>
</person>

The result xml should have the same tags of "base" xml where their value has been updated with the value in the related not-empty tag in "update" xml, like the following:

result XML
<person>
<name>A</name>
<surname>D</surname>
<address>C</address>
... many other tags...
</person>


Could please suggest a smart way to do this with a XSLT (1.0 or 2.0 ver) transformation?

What if the base and update XML are in the same XML tree? For examle:
<root>
<base>
 see the above XML
</base>
<update>
 see the above XML
</update>
</root>

Many thanks!
Bye
Sergio

Reply all
Reply to author
Forward
0 new messages