cancel
Showing results for 
Search instead for 
Did you mean: 

XSL mapping of ARTMAS IDoc - carriage returns and white space

Former Member
0 Kudos

Hi all. I have tried all sorts here and am completely stuck. I am mapping an article master ARTMAS IDoc using XSL mapping and an extra carriage return and white space characters are being added to the FIELD1 and FIELD2 fields of the E1BPE1MARAEXTRT segment and I don't know why! These fields contain all our bespoke field values joined together so they are 229 and 250 characters long respectively, which I think is related to the problem. The mapping program looks like this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/>

<xsl:template match="/">

<ARTMAS04>

<IDOC>

<xsl:copy-of select="//ARTMAS04/IDOC/EDI_DC40"/>

<xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MATHEAD"/>

<xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MARART"/>

<xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MARAEXTRT"/>

<xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MAKTRT"/>

<xsl:for-each select="//ARTMAS04/IDOC/E1BPE1MARCRT">

<xsl:if test="(PLANT='D100') or (PLANT='D200') or (PLANT='D300')">

<xsl:copy-of select="."/>

</xsl:if>

</xsl:for-each>

<xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MARMRT"/>

<xsl:copy-of select="//ARTMAS04/IDOC/E1BPE1MEANRT"/>

</IDOC>

</ARTMAS04>

</xsl:template>

</xsl:stylesheet>

I have a test IDoc going through this and the first 3 characters of the FIELD1 are "BIK". If I look at the source of the XML file, the problem area looks like this:

<E1BPE1MARAEXTRT SEGMENT="1">

<FUNCTION>004</FUNCTION>

<MATERIAL>000000000000895649</MATERIAL>

<b><FIELD1>

BIK</b> 0 0.00 T 000000001CARRERA FURY 04 20" CARRERA FURY 04 20" 2005092420040622 X 00000000 20031104 00200406140000000000 0.00 0000000

</FIELD1>

You can't really see it above, but there is a carriage return and 8 white spaces before the BIK. Where does this carriage return and white space come from?! Any help would be really appreciated - this is driving me crazy!

Many thanks,

Stuart Richards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Stuart,

I think I know the cause to your problem. I am not an XSLT programmer but based on searching this forum I found how I can acheive the carriage return at the end of my document. Your xsl statement is as follows:

<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/>

Change the indent value from yes to no. This should remove the carraige return. Hope this works for you.

I actually need a carriage return and line feed on my document so I am still stuck. All I have acheived is the carraige return.

Thanks,

Jim

Former Member
0 Kudos

Jim,

Excellent!! Many thanks - this seemed to do the job although it does remove <b>all</b> carriage returns from the file. However, the system receiving the file seems happy with it so for now, all is well.

Thanks again

Stuart

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Stuart

Just use the normalize-space option and your problem will be solved.

Try this,

<xsl:copy-of select="normalize-space(//ARTMAS04/IDOC/E1BPE1MARAEXTRT)"/>

cheers

Sameer

Former Member
0 Kudos

Sameer,

Thanks for your help too - I tried this earlier and it didn't seem to make any difference with my example. Jim's answer seems to have helped anyway.

Thanks,

Stuart