Advertisement

03.28.2008 at 07:11AM PDT, ID: 23277200 | Points: 420
[x]
Attachment Details

Combine two XML documents

Asked by amd2002a in Extensible Markup Language (XML), Extensible Stylesheet Language Transformation (XSLT)

Tags: ,

I am trying to combine two XML strings to produce a new XML string. Both XML strings are based on the same schema but the data in the elements will be different. If both XML strings have an element that contains data in both strings, the resulting XML should have the two values concatenated into 1. See the attached code snippet for an example of what is expected.

Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
<!-- Here is the first XML document -->
<?xml version="1.0" encoding="UTF-8"?>
<message>
    <transaction>
        <foo>Document 1</foo>
    </transaction>    
</message>
 
<!-- Here is the second XML document -->
<?xml version="1.0" encoding="UTF-8"?>
<message>
    <transaction>
        <foo>Document 2</foo>
        <bar>Document 2</bar>
    </transaction>    
</message>
 
 
<!-- Here is the expected result -->
<?xml version="1.0" encoding="UTF-8"?>
<message>
    <transaction>
        <foo>Document 1 Document 2</foo>
        <bar>Document 2</bar>
    </transaction>    
</message>
[+][-]03.28.2008 at 11:17AM PDT, ID: 21232839

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.28.2008 at 12:05PM PDT, ID: 21233258

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.28.2008 at 12:09PM PDT, ID: 21233283

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.28.2008 at 12:35PM PDT, ID: 21233494

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.28.2008 at 12:37PM PDT, ID: 21233511

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628