on 09-18-2013 9:26 AM
Hi Gurus,
My requirement is to do Multimapping using XSLT only. All the configuration is working fine with Graphical mapping.
Input Payload :
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_BO_S xmlns:ns0="namespace0">
<Source>
<Header>
<Recipent>asd</Recipent>
</Header>
<Item>
<Value>1</Value>
</Item>
<Item>
<Value>2</Value>
</Item>
</Source>
</ns0:MT_BO_S>
I need to generate same number of files as the occurrence of ‘item’ field in source. For ex, 3 items in the above payload, so 3 files will get generated.
Steps I did for Graphical:
Changed the occurrence of Target MT in MM to 0..Unbounded
Changed the occurrence of Target SI in OM to 0..Unbounded
Got the perfect output and getting 2 files generated E2E.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<ns1:MT_BO_R xmlns:ns1="namespace">
<Target>
<Header>
<Recipent>asd</Recipent>
</Header>
<Item>
<Value>1</Value>
</Item>
</Target>
</ns1:MT_BO_R>
<ns1:MT_BO_R xmlns:ns1="namespace">
<Target>
<Header>
<Recipent>asd</Recipent>
</Header>
<Item>
<Value>2</Value>
</Item>
</Target>
</ns1:MT_BO_R>
</ns0:Message1>
</ns0:Messages>
For Xslt, I did
Changed the occurrence of Target SI in OM to 0..Unbounded
Please help me with the mapping in XSLT, I want the same output as it is coming for Graphical.
Source :
Appreciate early reply.
Regards,
Prashanthi
Hi Prashanthi,
check the links below:
http://wiki.scn.sap.com/wiki/display/Java/Multi+Mapping+with+Java+and+XSLT+mappings
http://scn.sap.com/thread/1974939
http://scn.sap.com/thread/1819841
cheers,
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ambrish,
Thanks for your reply.
I already seen these threads.
/people/aleksey.popov2/blog/2010/09/23/xslt-multi-mapping-example
Exact requirement is to generate the same output as coming in the graphical mapping output.
As far as I know, we need to add manually below structure in the xslt
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
please correct me if I am wrong.
Regards,
Prashanthi
okay, so I wrote this xsl code
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge" xmlns:a="namespace">
<xsl:template match="/">
<ns0:Messages>
<ns0:Message1>
<xsl:for-each select="a:MT_BO_S/Source/Item">
<a:MT_BO_R>
<Target>
<Header>
<Recipent>
<xsl:value-of select="../Header/Recipent"/>
</Recipent>
</Header>
<xsl:for-each select=".">
<Item>
<Value>
<xsl:value-of select="Value"/>
</Value>
</Item>
</xsl:for-each>
</Target>
</a:MT_BO_R>
</xsl:for-each>
</ns0:Message1>
</ns0:Messages>
</xsl:template>
</xsl:stylesheet>
this is what I am getting in external editor from the above xsl.
<?xml version="1.0"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge" xmlns:a="namespace">
<ns0:Message1>
<a:MT_BO_R>
<Target>
<Header>
<Recipent>asd</Recipent>
</Header>
<Item>
<Value>1</Value>
</Item>
</Target>
</a:MT_BO_R>
<a:MT_BO_R>
<Target>
<Header>
<Recipent>asd</Recipent>
</Header>
<Item>
<Value>2</Value>
</Item>
</Target>
</a:MT_BO_R>
</ns0:Message1>
</ns0:Messages>
but when I am executing it in OM, only Message fields are coming.
I guess we need to include the namespace in the root node, as marked in the image. please help 🙂
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.