cancel
Showing results for 
Search instead for 
Did you mean: 

CDATA in mapping

Former Member
0 Kudos

Hi All,

The output of the mapping that U am implementing expects CDATA part in the output

The CDATA part should be this way

<v1:Body messageType="CUSTIMPORT"><![CDATA[<.....Message xsi:schemaLocation="http://www.../Webservice/....Message/ MicCustImportMessage1.3.xsd" xmlns="http://www...../Webservice/....Message/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Means,the CDATA is applicable to only }<v1:Body messageType="CUSTIMPORT"> .

So I will have to use both graphical as well as XSLT mapping

I do not know the XSLT.

Can you please provide me the XSLT code for the requirement?

Also,how to mention those mappings in the interface mapping/operation mapping?

Thanks in advance

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

answered

Former Member
0 Kudos

chk this also:

/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping

basics of xslt:

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/000ee4d0-be91-2d10-8aaf-ff8045bdd37d

Former Member
0 Kudos

Hi Raja Sekhar and AMit,

Thanks for the quick replies.

I have gone through the blogs you mentioned

But in my mapping the CDATA is applicable to the root element of the node .

The strucutre is somewhat like this

<soapenv:Envelope

<soapenv:Header/>

<soapenv:Body>

<v1:Messages>

<v1:Message>

<v1:Envelope>

.

.

.

</v1:Envelope>

<v1:ActionCode>

<v1:code>DIC</v1:code>

</v1:ActionCode>

<<v1:Body messageType="CUSTIMPORT"><![CDATA[<.....Message xsi:schemaLocation="http://www.../Webservice/....Message/ MicCustImportMessage1.3.xsd" xmlns="http://www...../Webservice/....Message/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

It is this field/node where mapping is applicable..

<<v1:Body messageType="CUSTIMPORT">

The code in the blog is

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p2="http://frik.bcc.com.pl">

<xsl:template match="/">

<p2:inside xmlns:p2="http://frik.bcc.com.pl">

<name>

<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text>

<xsl:copy-of select="p2:outside/name"/>

<xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text>

<xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>

</name>

</p2:inside>

</xsl:template>

</xsl:stylesheet>

For my mapping requirement should the code be like this

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p2="http://frik.bcc.com.pl">

<xsl:template match="/">

<p2:inside xmlns:p2="http://frik.bcc.com.pl">

<Body>

<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[ <.....Message xsi:schemaLocation="http://www.../Webservice/....Message/ MicCustImportMessage1.3.xsd"]]></xsl:text>

<xsl:copy-of select="p2:outside/Body"/>

<xsl:text disable-output-escaping="yes"><![CDATA[xmlns="http://www...../Webservice/....Message/"]]]]></xsl:text>

<xsl:text disable-output-escaping="yes"><![CDATA[xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">>]]></xsl:text>

</name>

</p2:inside>

</xsl:template>

</xsl:stylesheet>

Should the inverted commas be also there?

If there is any improvement please paste it.

Thanks in advance

Former Member
0 Kudos

Hi,

I created the following code as per the othr blog you mentioned.

Please correct it if it is wrong

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">

<xsl:template match="ns0:Envelope">
	
</xsl:template><xsl:value-of select="ns0:Body" disable-output-escaping="yes"/>


</xsl:stylesheet>

Thanks in advance

rajasekhar_reddy14
Active Contributor
0 Kudos

genarate Zip file and execute your XSL mapping and share results.

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Your XSL code looks correct. Test and provide us updates.

Former Member
0 Kudos

Hi All,

I have implemented the XSLT map in the notepad.

How can I use it in the operation mapping?

I zippes the file and tried to import it as external definition using as WSDL and XSD in the GUI of external definition but got errors.

Please help me.

Thanks in advance

former_member200962
Active Contributor
0 Kudos

save your code as .xsl .....then zip this .... create an Imported Archive (you are trying to create an External Definition)

In Operation Mapping select the option XSL and then check.

former_member854360
Active Contributor
0 Kudos

Hi shweta,

Please refer this link for step by step approach to create imported archive for XSL

http://www.saptechnical.com/Tutorials/XI/XSLT/page1.htm

Former Member
0 Kudos

Hi Abhishek and Debashish,

Thanks for your valuable suggestions.

I put 2 mappings in the operation mappings that is message mapping and the XSLT mapping,but I am getting error ,I think it is for CDATA portion.

Do I need to test the mapping seperately for the message and CDATA portion?

If so,then how to do it?

Thanks in advance

former_member854360
Active Contributor
0 Kudos

In operation mapping test tab test only using one mapping.

there is one options where you can select no of mapping to be test. select mapping from 1 to 1

And test your first XSL mapping output

former_member200962
Active Contributor
0 Kudos

>

<?xml version='1.0'?>
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">
> 
> <xsl:template match="ns0:Envelope">
> 	
> </xsl:template><xsl:value-of select="ns0:Body" disable-output-escaping="yes"/>
> 
> 
> </xsl:stylesheet>

>

you sure above is the XSLT code? in my opinion this code is not going to work....

value-of is out of the template section....should it not be within the template (as template defines your XML structure)?

I could not see any CDATA in your code....you need to write the code similarly to what Michal has described in his blog.

I would suggest that you make use of some XSLT tool (like Stylus Studio) to write the code or you can make use of an online testing tool which will give you the result: http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog_ex1

Former Member
0 Kudos

Hi Abhishek,

I tried the xslt code form michel as well

<?xml version='1.0'?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:p2="http://www......com/Webservice/.../...">

<xsl:template match="/">

<p2:inside xmlns:p2="http://www......com/Webservice/.../...">

<Body>

<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text>

<xsl:copy-of select="p2:outside/Body"/>

<xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text>

<xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>

</Body>

</p2:inside>

</xsl:template>

</xsl:stylesheet>

Is it the correct one?

If not can you please suggest some changes?

I am confused about the xmlns:p2="http://www......com/Webservice/.../...">

part as there are 2 different urls mentioned in the source data and not getting which one to select.

Can you please help me?

Thanks in advance

rajasekhar_reddy14
Active Contributor
0 Kudos

refer below link

/people/danny.deroovere/blog/2008/11/30/how-to-map-cdata-to-a-structured-message-in-xi

Regards,

Raj