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

Re: xml to xml mapping - how to combine two groups

Subject: Re: xml to xml mapping - how to combine two groups
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Sun, 6 Jan 2008 19:16:29 +0530
Re:  xml to xml mapping - how to combine two groups
I was trying to write the transformation for you, but was stuck due to
incomplete specification of the problem. I guess, others would agree
to this ...

Here's something to start with:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                        version="1.0">

 <xsl:output method="xml" />

 <xsl:template match="LIST_CREATION">
   <LIST_COMBINED>
     <xsl:for-each select="LIST_NOTE/NOTE">
       <COMBINED>
          <!-- some more instructions -->
       </COMBINED>
     </xsl:for-each>
   </LIST_COMBINED>
 </xsl:template>

</xsl:stylesheet>

If you could specify more clearly about the problem, we could try to
help further ...

On Jan 4, 2008 11:41 PM,  <Andy.Lewis@xxxxxxxxxxx> wrote:
>
>
> 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 have the following xml data:
>
> <LIST_CREATION>
> <CREATION>
> <CREATION_DATE>03-OCT-07</CREATION_DATE>
> </CREATION>
> </LIST_CREATION>
> <LIST_NOTE>
> <NOTE>
> <OUT_NOTE>Blue Box</OUT_NOTE>
> </NOTE>
> <NOTE>
> <OUT_NOTE>Red Box</OUT_NOTE>
> </NOTE>
> </LIST_NOTE>
>
> I need to map these into one grouping.
> I would like the result to be something like:
> <LIST_COMBINED>
> <COMBINED>
> <CREATION_DATE>03-OCT-07</CREATION_DATE>
> <OUT_NOTE>Blue Box</OUT_NOTE>
> </COMBINED>
> <COMBINED>
> <OUT_NOTE>Red Box</OUT_NOTE>
> </COMBINED>
> </LIST_COMBINED>
>
> I have no idea how many occurrences of <CREATION> or <NOTE> that I may
> have. In the above example, there were two occurrences of <NOTE> and one
> of <CREATION>. Thus I needed two occurrences of <COMBINED>.  I could
> have any number of either. I hope this clarifies!!
>
>
> Thanks! Andy


-- 
Regards,
Mukul Gandhi

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.