cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT Mapping Question

Former Member
0 Kudos

Source:

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

<ns0:MT_Org_In xmlns:ns0="http://source.google.com">

<Org_recs>

<Sales_Org>1234</Sales_Org>

<Sales_Org_Desc>chicago Brew</Sales_Org_Desc>

<Dist_Channel>10</Dist_Channel>

</Org_recs>

</ns0:MT_Org_In>

Target:

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

<ns1:SubmitXML xmlns:ns1="http://target.google.com">

<ns1:sLabel>MT_Vel_Org_In</ns1:sLabel>

<ns1:sXML><![CDATA[

<ns0:MT_Org_In xmlns:ns0="http://source.google.com">

<Org_recs>

<Sales_Org>1234</Sales_Org>

<Sales_Org_Desc>chicago Brew</Sales_Org_Desc>

<Dist_Channel>10</Dist_Channel>

</Org_recs>

</ns0:MT_Org_In>

]]>

</ns1:sXML>

</ns1:SubmitXML>

Please Note: 1. Namespace Changes btween Source and Target

2. <sLabel> in target contains the name of the root in source

3. Whole source XML goes into <sXML> of target with <![CDATA[ ....]]>

Experts please help me with XSL Source. Appreciate all your help and suggestions.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Try following code,

There is possibility of one line not executed because of CDATA. Try it first to see what happens.

Regards

Liang


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns0="http://source.google.com" 
xmlns:ns1="http://target.google.com">
<xsl:output method="xml" encoding="UTF-8" />
<xsl:template match="/">
<ns1:SubmitXML>
<ns1:sLabel>MT_Vel_Org_In</ns1:sLabel>
<ns1:sXML>
<xsl:text><![CDATA[</xsl:text>
  <xsl:copy-of select="." /> 
<xsl:text>

 


]]>