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
|
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
|