cancel
Showing results for 
Search instead for 
Did you mean: 

help in XSLT Mapping

Former Member
0 Kudos

Hi mates,

I'm trying out the scenario in one of michal's blogs

/people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter

my source message is as follows

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

<ns0:MT_ErrorDetails xmlns:ns0="http://xyz.com/utility/errors/ReportErrors">

<Object_Error>

<Client/>

<Logical_System/>

<Object_Type/>

<Object_Key>1234</Object_Key>

<Error_Message/>

</Object_Error>

<Object_Error>

<Client/>

<Logical_System/>

<Object_Type/>

<Object_Key>1235</Object_Key>

<Error_Message/>

</Object_Error>

</ns0:MT_ErrorDetails></i>

I'm trying to generate o/p which will have 'Object_key's separated by line break i.e. new line.

I wrote teh following XSLT code in XSLT_TOOL.

<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:sap="http://www.sap.com/sapxsl"
>

<xsl:strip-space elements="*"/>

<xsl:template match="/">
<html>
<body>
</body>
<p>
<strong>The following is the list of Material Numbers with errors</strong>
</p>
<p>
<ol>
<xsl:for-each select="Object_Error">
<li value="0">
<xsl:value-of select="Object_Key"/>
</li>
</xsl:for-each>
</ol>
</p>
</html>
</xsl:template>

</xsl:transform>

I wrote this based on XSLT mapping given in the blog. But my mapping is not giving me the required result. It gives the following o/p.

<i><html><body></body><p><strong>The following is the list of Material

Numbers with errors</strong></p><p><ol></ol></p></html></i>

It doesnt select the 'Object Key's. What is wrong/missing in the XSLT mapping..XSLT gurus please help out this beginner.

I highly appreciate your inputs.

thx in adv

praveen

Accepted Solutions (0)

Answers (2)

Answers (2)

moorthy
Active Contributor
0 Kudos

Hi Praveen,

Try with this in XSLT mapping-

<xsl:value-of select="<b>./</b>Object_Key"/>

I think, the error is the parser is not able to resolve the segment name. So do as the above.

but you may need to take some considerations like context etc. For this you may need to change the logic

Regards,

Moorhy

Former Member
0 Kudos

Moorthy,

There is no change in the output for with code change you suggested

Any other suggestions?

Anyways, thanks for your prompt response.

thx

praveen

Former Member
0 Kudos

If I replace <i><ns0:MT_ErrorDetails xmlns:ns0="http://xyz.com/utility/errors/ReportErrors"> and </ns0:MT_ErrorDetails></i> with <MT_ErrorDetails> and </MT_ErrorDetails>

I get the desired result.

But at runtime, my input message will have these values.

How do I handle this 'ns0' tag?

thx in adv

praveen

moorthy
Active Contributor
0 Kudos

Hi,

In the XSLT mapping - add your namespace in the XSLT mapping header like this-

<xsl:transform version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:sap="http://www.sap.com/sapxsl" xmlns:ns0="http://xyz.com/utility/errors/ReportErrors">

BTW, what was the error ? Is it path problem right ?

Hope this helps,

regards,

moorthy

Former Member
0 Kudos

Yeah..it was the problem with the namespace..

I added the my namsapce xmlns:ns0="http://xyz.com/utility/errors/ReportErrors" in the header.

Now I get the result that I want.

Now I'm trying to use this in Iterface Mapping.

I saved the mapping program that I created in XSLT_TOOL on XI as .XSLT and created .zip file containing this.

I imported this zip file as 'imported archive'

I'm trying to specify this in the Interface mapping.

When I select Mapping type 'XSL', I'm not able to select the imported archive. Should I be using R3_XSLT as the mapping type?

I added the additional mapping types in exchange profile, but I still dont see it in Interface Mapping as one of the mapping options. Do I need to restart the system?

praveen

Former Member
0 Kudos

I saved the my mapping as .XSL and I could use this in Interface mapping with type XSL

But, I've question...what is the difference between mapping tyep XSL and R3_XSLT? Is it processed differenly?

Anyways, my problem is solved.

thank a lot Moorthy.

praveen

Former Member
0 Kudos

Hi,

XSL is the one that ou have just created and R3_XSL is the one thats created in the ABAP Stack.

http://help.sap.com/saphelp_nw04/helpdata/en/83/2200cb50d345c793336d9a1683163e/content.htm

Regards

Vijaya

Former Member
0 Kudos

I apologise for posting the message multiple times...

I had some problems with my internet speed...so hit the submit 4 times..:-(