on 02-20-2007 11:47 AM
Hi,
I'm currently working in a scenario which involves XSLT mapping.Below is the source message structure:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
<ns0:Message1>
<ns1:MT_SESSIONRESP xmlns:ns1="urn:horizon:sessionmgmt">
<SessionId/>
</ns1:MT_SESSIONRESP>
</ns0:Message1>
<Message2>
<upsert xmlns:ns2="urn:enterprise.soap.sforce.com">
<:externalIDFieldName/>
<ns2:sObjects>
<ns3:fieldsToNull xmlns:ns3="urn:sobject.enterprise.soap.sforce.com"/>
<ns3:Id xmlns:ns3="urn:sobject.enterprise.soap.sforce.com"/>
<b><ns3:Owner xmlns:ns3="urn:sobject.enterprise.soap.sforce.com">
<Horizon_user_id></Horizon_user_id>
<ns3:Owner></b>
</ns2:sObjects>
</ns2:upsert>
</ns0:Message2>
</ns0:Messages>
<u><b>Target Message Required:</b></u>
<?xml version="1.0" encoding="utf-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge" xmlns:ns1="urn:enterprise.soap.sforce.com" xmlns:ns2="urn:enterprise.soap.sforce.com">
<ns0:Message1>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<SessionHeader xmlns:ns1="urn:horizon:sessionmgmt" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
<ns1:sessionId/>
</SessionHeader>
</soapenv:Header>
<soapenv:Body>
<upsert xmlns="urn:enterprise.soap.sforce.com">
<externalIDFieldName/>
<sObjects xsi:type="ns1:Account" xmlns:ns1="urn:sobject.enterprise.soap.sforce.com">
<ns3:fieldsToNull xmlns:ns3="urn:sobject.enterprise.soap.sforce.com"/>
<ns3:Id xmlns:ns3="urn:sobject.enterprise.soap.sforce.com"/>
<b> <ns3:Owner xmlns:ns3="urn:sobject.enterprise.soap.sforce.com">
<ns3:type xmlns:ns3="urn:sobject.partner.soap.sforce.com">User</ns3:type>
<Horizon_User_Id></Horizon_User_Id>
</ns3:Owner></b>
</sObjects>
</upsert>
</soapenv:Body>
</soapenv:Envelope>
</ns0:Message1>
</ns0:Messages>
In the target structure tag <type> is hardcoded and its a substructure to owner field.Guys help me with xslt mapping to obtain the above mentioned target structure from the source structure.
Regards
Jithesh
Hi Jithesh,
i see nothing taken from source. So you just write down, what you need, nothing else. If you want to read some source element values use
<xsl:value-of select="//mySourceField"/>
Regards,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Udo,
Using
<b>xsl:copy-of select="/ns0:Messages/ns0:Message2/ns2:upsert/ns2:sObjects[.]/@*|node()"</b> statement i copied the entire fields of sObjects from the source to the target sObjects field.
But my question is how to traverse through the target structure and add a field named type(<type></type> ) below the owner tag.The structure required is
<b><sObjects>
.
.
.
.
<Owner>
<type></type>
</owner>
.
.
.
</sObjects></b>
Regards
Jithesh
Hi Jithesh,
as i told you. Just write target elements down you need. If you want to take values from source, use "value-of". "Copy-of" can only copy parts, never change. Some manuell work.
May be its easier if you use a not parsing mapping kind, like Java or ABAP, where just replace a substring.
Regards,
Udo
Hi,
Try to create target structure and export the xsd into Altova mapforce change according to your requirement..
After that In Altova mapforce you can have source and target structure import and do the mapping , click on xlst , then the xslt file will be generated later, create zip and iport under archieve , in Interface mapping select the XSLT and select imported xslt mapping program..
I hope you got it..
see for XSLT help..
XSLT Mapping
/people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping
/people/sreekanth.babu2/blog/2005/01/05/design-time-value-mappings-in-xslt
/people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
XSLT Mapping with java enhancement
/people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
Regards
Chilla..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.