cancel
Showing results for 
Search instead for 
Did you mean: 

Special Characters - XSLT Mapping

helmut_skolaut3
Active Participant
0 Kudos

Hi all,

I have out of a sales order situations, where my business people enter some wired stuff into texts.

The information will be viewable also in the source message properly:

The Source message is UTF-8:

<?xml version="1.0" encoding="UTF-8" ?>

In my XSLT I have configured, that this field should be encapsultated in CDATA section:

<xsl:output method="xml" omit-xml-declaration="yes" cdata-section-elements="proc3:P_INTCOMMENTLB-VARCHAR2-IN" indent="yes"/>

<!-- some other code -->

<xsl:variable name="tdid0002"><xsl:apply-templates select="E1EDKT1[TDID='0002']/E1EDKT2"/></xsl:variable>

<proc3:P_INTCOMMENTLB-VARCHAR2-IN><xsl:value-of select="substring($tdid0002,1,500)"/></proc3:P_INTCOMMENTLB-VARCHAR2-IN>

<!-- some other code -->

<xsl:template match="E1EDKT2">

  <xsl:if test="position() &gt; 1"><xsl:value-of select="'&#xD;'" /></xsl:if>  

  <xsl:value-of select="TDLINE"/>

</xsl:template>

<!-- some other code -->

If I look at the result message, it became invalid:

I want to send the information to the receiver using Web Service and their server proxy (not SAP) is refusing it.

Any ideas who to fix it?

Regards

   Helmut

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Helmut,

Have you tried with disable-output-escaping="yes" ?

Also if you have the PI with the SP necessary you can try the instruction xsl:character-map, check this link Disable-output-escaping and xsl:character-map

Regards,

helmut_skolaut3
Active Participant
0 Kudos

Thanks Inaki for your very fast help.

I have played with the "disable-output-escaping" function but unfortunately the result is the same ;-(.

In order to play with the xsl:character-map option, I am a bit lost what to specify in the character attribute. See here they hex-code of the "bad character" from the source message:

But even if I now would know exactly the byte-code to enter in the character attribute, every new "bad character" will crash the interface again. Is there a way to specify that only out of a list of allowed characters (e.g. ABCD....XYZabcd...xyz012...9+-:.. ) and ignore all others?

Regards

   Helmut

iaki_vila
Active Contributor
0 Kudos

Hi Helmut,

You have an example to skip characters in this link (not very elegant) xml - Remove characters not in specified XSLT encoding - Stack Overflow

You would need to set all the charset, may be other SCN member had a better way to do it

Regards.

Answers (1)

Answers (1)

helmut_skolaut3
Active Participant
0 Kudos

Hi all,

the problem is, that xsl:character-map is not available in XSLT 1.0 😞

disable-escaping does not work for some reason ...

The "positive list" is also not good as we want to see regular Chinees and Japanese characters.

But I have solved it now like this:

<xsl:template match="E1EDKT2">

  <xsl:if test="position() &gt; 1"><xsl:value-of select="'&#xD;'" /></xsl:if>  

  <xsl:value-of select="translate(TDLINE,'&#x1F603;','')" />

  

</xsl:template>

Whenever I have another "bad guy" I need to add is as well... But since one your it was the 2nd time ... So I assume it's an acceptable approach.

Regards

   Helmut

iaki_vila
Active Contributor
0 Kudos

Hi Helmut,

XSLT 2.0 is supported from the PI versions 7.31 SP10 & 11 / 7.4 SP05&06 ()

Regards.