[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Merge based on shared element value

Subject: Merge based on shared element value
From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 7 Apr 2015 14:43:25 -0000
 Merge based on shared element value
Hi Srinivas,

I have started a new thread with a new subject line. In future, please
don't "Reply To" with new messages as it prevents messages from being
sorted usefully in the archives.

In response to your question - why do (you think) you want a solution
"based on Operation Using Nested For loop with IF Condition"?

To solve the problem you have presented is straightforward, even
trivial, with xsl:for-each-group (in XSLT 2.0). You only need to
collect all your Source1 elements (from both documents) in a sequence,
then group them by the values of 'Operation'.

Then perhaps you need a policy for detecting and avoiding unwanted
"duplication" of Source2 elements in your groups - a part of the
problem you have not presented. (This could be done by grouping inside
the group.)

Cheers, Wendell

=================

Your message:

Hi all,

I have a requirement as below.

i have one source xml, which as below.

<Source>
    <Source1>
           <Operation>XXXXXX</Operation>
           <Source2>
                 <Name>XXXX</Name>
                 <Address>XXXX</Address>
            </Source2>
            <Source2>
                 <Name>XXXX</Name>
                 <Address>XXXX</Address>
            </Source2>
     </Source1>
</Source>.

I have one Config XML, which as below.

<Source>
    <Source1>
          <Operation>XXXXXX</Operation>
           <Source3>
                 <City>XXXX</City>
                 <State>XXXX</State>
            </Source3>
     </Source1>
</Source>.

I want to merge the second xml with my source xml based on the
Operation Name, my desired output xml should be.

<Source>
    <Source1>
           <Operation>XXXXXX</Operation>
           <Source2>
                 <Name>XXXX</Name>
                 <Address>XXXX</Address>
            </Source2>
           <Source3>
                 <City>XXXX</City>
                 <State>XXXX</State>
            </Source3>
    </Source1>
</Source>.

like wise i have couple of config xml's, i need to merge them into
source file based on Operation Using Nested For loop with IF
Condition.

I am new to XSLT, please help me to understand this.

Thanks for advance.

[signed]

-- 
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.