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

xml to xml mapping - how to combine two groups

Subject: xml to xml mapping - how to combine two groups
From: <Andy.Lewis@xxxxxxxxxxx>
Date: Tue, 8 Jan 2008 10:12:50 -0500
 xml to xml mapping - how to combine two groups
I'm not sure how to add to a thread so I'm listing my original question
to be sure. I've added a note at the bottom.

I'm receiving XML data with two different groups of elements. Let's call
them GROUP-A and GROUP-B.

I need to merge the two into single groups of elements. I may have more
of one group than the other.

For example:  I may receive 3 occurrences of GROUP-A and 2 occurrence of
GROUP-B. I want my resulting XML to have 3 occurrences of a new group.
The first two occurrences would contain the elements from both GROUP-A
and GROUP-B. The third occurrence would only contain the elements from
GROUP-A because GROUP-A had one more occurrence than GROUP-B.

Example 2:    2 occurrences of GROUP-A and 6 occurrences of GROUP-B. My
resulting xml should have 6 occurrences of a new group. The first two
would contain elements from both GROUP-A and GROUP-B. The remaining 4
occurrences would contain the elements from the last 4 occurrences of
GROUP-B.

Below is an example of some date.

<LIST_GROUP_A>
<GROUP_A>
<COLOR>red</COLOR>
</GROUP_A>
</LIST_GROUP_A>
<LIST_GROUP_B>
<GROUP_B>
<SHAPE>round</SHAPE>
</GROUP_B>
<GROUP_B>
<SHAPE>square</SHAPE>
</GROUP_B>
</LIST_GROUP_B>

I need to map these into one grouping.
I would like the result to be something like:

<LIST_COMBINED>
<COMBINED>
<COLOR>red</COLOR>
<SHAPE>round</SHAPE>
</COMBINED>
<COMBINED>
<SHAPE>square</SHAPE>
</COMBINED>
</LIST_COMBINED>

The result needs to have two occurrences of COMBINED. The first contains
the first occurrences of GROUP_A and GROUP_B. The second contains the
second occurrence of GROUP_B.

I sure do hope I've explained this.

Thanks! Andy


This message may contain confidential and/or privileged information. This
information is intended to be read only by the individual or entity to whom it
is addressed. If you are not the intended recipient, you are on notice that
any review, disclosure, copying, distribution or use of the contents of this
message is strictly prohibited. If  you have received this message in error,
please notify the sender immediately and delete or destroy any copy of this
message.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.