Hi,
In a mapping I want to do that:
--> Inbound (Idoc):
Segment<b>1</b>-fieldA
Segment<b>1</b>-fieldB
Segment<b>2</b>-field<b>C</b>
Segment<b>2</b>-field<b>D</b>
<i>Segment1 and Segment2 are at the same hierarchical level.</i>
--> Outbound (row for a file):
row1: Segment<b>1</b>-fieldA Segment<b>1</b>-fieldB Segment<b>2</b>-field<b>C</b>
row2: Segment<b>1</b>-fieldA Segment<b>1</b>-fieldB Segment<b>2</b>-field<b>D</b>
(it seems that I'll need only ONE Segment1)
But by using "Splitbyvalue", "removecontext", I have only this:
--> Outbound:
row1: Segment<b>1</b>-fieldA Segment<b>1</b>-fieldB Segment<b>2</b>-field<b>C</b>
row2: Segment<b>2</b>-field<b>D</b>
==> pb: Segment1 is missing for my second line.
Anybody have an idea?
Regards.
Mickael.
Message was edited by: Mickael Huchet
Message was edited by: Mickael Huchet
Hello,
If you create your own XSLT, it could be easy to do !
Regards,
Chris
Hi Mickael,
You can use a XSLT Mapping.
For Example:
Message before Mapping execute:
<?xml version="1.0" encoding="UTF-8"?> <DATA> <SEGMENT1> <FIELD_A>DataA</FIELD_A>> <FIELD_B>DataB</FIELD_B> </SEGMENT1> <SEGMENT2> <FIELD_C>DataC</FIELD_C> <FIELD_D>DataD</FIELD_D> </SEGMENT2> </DATA>
After Mapping:
<?xml version="1.0" encoding="UTF-8"?> <DATA> <row1>DataADataBDataC</row1> <row2>DataADataBDataD</row2> </DATA>
If this is the result you want, you have to use a XSLT Mapping like this:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <DATA> <row1> <xsl:value-of select="//SEGMENT1/FIELD_A"/> <xsl:value-of select="//SEGMENT1/FIELD_B"/> <xsl:value-of select="//SEGMENT2/FIELD_C"/> </row1> <row2> <xsl:value-of select="//SEGMENT1/FIELD_A"/> <xsl:value-of select="//SEGMENT1/FIELD_B"/> <xsl:value-of select="//SEGMENT2/FIELD_D"/> </row2> </DATA> </xsl:template> </xsl:stylesheet>
Regards,
Robin
Hi Mickael,
If you want unlimmited number of rows, don't number them.
You can loop over the source data using the xsl:for-each command.
<xsl:for-each select="//Segment">
<row>
<xsl:value-of select="."/>
</row>
</xsl:for-each>
You can find more information on XSLT on www.zvon.org.
Hopes this helps,
Christiaan Schaake
Add a comment