Skip to Content
0
Former Member
Oct 15, 2013 at 12:52 PM

Email interface using XSLT Mapping issue

233 Views

Hi Experts,

I have a requirement to create an HTML Email using the XSLT Mapping in SAP PI 7.31 java stack.

Below is the source structure:

<Content>

<header>

<section>

<para1>

<para2>

<para3>...

<LineItem1>

<LineItem2>

<LineItem3>.....

Above structure needs to be mapped to standard mail package <content> field. How to iterate the section segment which contains

multiple <para> tags and <LineItem> tags in XSLT mapping. I have tried below XSLT mapping code -

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://sap.com/xi/XI/Mail/30">

<xsl:output method="xml" indent="yes" />

<xsl:template match="/">

<Mail xmlns="http://sap.com/xi/XI/Mail/30">

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

<Content>

<xsl:value-of select="ns0:Mail/Content/Header"/>

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

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

</xsl:for-each>

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

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

</xsl:for-each>

<xsl:value-of select="ns0:Mail/Content/Footer"/>

</Content>

</Mail>

</xsl:template>

</xsl:stylesheet>

Above code always gives me the first para value duplicated for all the other para values and first LineItem value duplicated for all the other LineItems.

Please help me correcting this XSLT mapping code. If any one already worked on such scenario, please share sample code.