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 (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hi Praveen,

your path is not complete. The root elemennt is missing. Try to use

<xsl:for-each select="//Object_Error">

what means, select all Elements Object_Error at all undependend from parent. <b></Object_Key></b>will be found in the way you did because it is a child of <b><Object_Error></b>.

Regards,

Udo

Answers (1)

Answers (1)

dirk_roeckmann
Participant
0 Kudos

Hi Praveen,

I think the reference in your loop is not correct.

Try

<xsl:for-each select="Object_Error/Object_Key">

<li value="0">

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

</li>

</xsl:for-each>

or

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

<li value="0">

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

</li>

</xsl:for-each>

both should work.

regards

Dirk