Skip to Content
author's profile photo Former Member
Former Member

Mapping Header / Item

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Feb 09, 2005 at 02:38 PM

    Hello,

    If you create your own XSLT, it could be easy to do !

    Regards,

    Chris

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 09, 2005 at 03:14 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 09, 2005 at 03:48 PM

    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
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.