cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT mapping - removing apostrophe

former_member183906
Active Contributor
0 Kudos

Hi,

I have PI 7.1

Sender - PI (XSLT map) - Receiver

In XSLT map , i have to remove apostrophe from the ItemNode (Element of Source message) value-

<xsl:variable name="specialCharacters" select="'&apos'"/>

<xsl:value-of select="translate(ItemNode, $specialCharacters, '') "/>

But this is failing in SAP PI.

Even when i am testing it in XSLT mapping tool - Its giving error that XSLT is not correct.

Error:XSLTProcessor::transformToXml() [<a href='xsltprocessor.transformtoxml'>xsltprocessor.transformtoxml</a>]: No stylesheet associated to this object

How to remove apostrophe using XSLT map in PI.

Rgds

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

For xslt 1.0

<xsl:value-of select='translate(ItemNode, "&apos;", " ")'/>

or

<xsl:variable name="apos">'</xsl:variable>

<xsl:value-of select="translate(ItemNode, $apos, ' ')"/>

Thanks,

Aman

former_member183906
Active Contributor
0 Kudos

Hi,

Thanks for reply.

But I think apostrophe can't be removed in PI XSLT message mapping.

TransformerConfigurationException triggered while loading XSLT mapping mapping/mesage_maping_name1a751b61-1491-11df-8f09-dfc70a424100-1

Anyother suggestion.

Regards

Former Member
0 Kudos

"But I think apostrophe can't be removed in PI XSLT message mapping."

PI XSLT message mapping??

If you are using XSLT mapping then no need to create MM.

MM is basically a Graphical Mapping editor.

For XSLT-

write your XSLT code, zip it, then import as Imported Archive

Create an OM, select that imported IA and test it.

FYI-

It is working  fine for me, below is the snapshot of successful test run in OM.

in the field KEY apostrophe value is coming, which is mapped to dummy field in the Target structure and apostrophe is removed by alphabet 'd'.

I used the same snippets what I shared with you.

Thanks,

Aman

ambrish_mishra
Active Contributor
0 Kudos

Hi,

Although XSLT is also an option, but you can do this in Graphical/Java mapping by using replaceString function.

Apostrophe should be &apos; and not just &apos

In XSLT it should work like as below:

<xsl:for-each select="ItemNode">

<xsl:value-of select=" replace(current(),'&amp;','')"/>

Hope it works.


Ambrish

former_member183906
Active Contributor
0 Kudos

Hi,

Thanks for reply.

But I think apostrophe can't be removed in PI XSLT message mapping.

Runtime exception occurred during application mapping com/sap/xi/tf/msg_mapping_name; com.sap.aii.utilxi.misc.api.BaseRuntimeException:Element type "input" must be followed by either attribute specifications, ">" or "/>"

Anyother suggestion.

Regards