cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy to convert linear structure to Header and lineitem

0 Kudos
248

Hi All,

could you please provide me either groovy or XSLT to convert the input file to output format.

<Output>
	<Row>
		<H1>H1</H1>
		<H2>H2</H2>
		<I1>I11</I1>
		<I2>I12</I2>
	</Row>
	<Row>
		<H1>H3</H1>
		<H2>H4</H2>
		<I1>I21</I1>
		<I2>I22</I2>
	</Row>
	<Row>
		<H1>H1</H1>
		<H2>H2</H2>
		<I1>I31</I1>
		<I2>I32</I2>
	</Row>
	<Row>
		<H1>H3</H1>
		<H2>H4</H2>
		<I1>I41</I1>
		<I2>I42</I2>
	</Row>
</Output>
<Output>
	<Row>
		<Header>
			<H1>H1</H1>
			<H2>H2</H2>
		</Header>
		<Item>
			<I1>I11</I1>
			<I2>I12</I2>
		</Item>
		<Item>
			<I1>I31</I1>
			<I2>I32</I2>
		</Item>
	</Row>
	<Row>
		<Header>
			<H1>H3</H1>
			<H2>H4</H2>
		</Header>
		<Item>
			<I1>I21</I1>
			<I2>I22</I2>
		</Item>
		<Item>
			<I1>I41</I1>
			<I2>I42</I2>
		</Item>
	</Row>
</Output>

Regards,

Accepted Solutions (0)

Answers (1)

Answers (1)

daviddasilva
Active Contributor
0 Kudos

Hi,

You can achieve this easily by using message mapping. Create the target xsd as you need and then map accordingly.

Alternatively, as Morten suggested, please post the XSLT you are currently using.

Kind regards,

David