on 10-23-2006 10:47 PM
Hello all,
Is everyone absolutely sure that a cdata string cannot be created in the middle of an xml file using message mapping?
I have tried doing the XSL map in other blogs I even tried writing a whole XSL map in xml spy - yet xi complains about not finding this class file and that class file. I'm having a hard time believing that this is so hard to do in XI - especially when Microsoft web service implementation seem to long for data crammed into a string ( in my experience ).
Any help is GREATLY appreciated.
Thank you!!!
Scott
Check if this weblog is of any help to you - /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Scott,
Pls follow the following steps to insert XML string into a single element:
Create a xsl file with the following data:
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <i><b>NSpace</b></i>>
<xsl:template match="/">
<namespace:name1>
<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text><xsl:copy-of select="<b>//namespace:name</b>"/><xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text><xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
</namespace:name1>
</xsl:template>
</xsl:stylesheet>
In the above code I have removed xmlns:p2="http://frik.bcc.com.pl" which is not needed.
Also you have to put '<b>//</b>' before the target element from where you want to start creating XML string over here it is <b>name</b>. And <b>name1</b> is the element you want to store the XML string in.
So anything in the element <b>name</b> will be stored in <b>name1</b>
Regarding the <b>namespace:</b> To find out the namespace test your message mapping between the source and the target without adding XSLT mapping. After testing click on <b>'SCR'</b> tab present on top of the target window. There you will see <b>ns1: or ns2:</b> attached to each element. Replace <b>namespace</b> in the above code with <b>ns1: or ns2:</b>. And replace <b>NSpace</b> in the above XSL Header with the namespace in the SCR of test map.
So the final XSL file will look like that:
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <i><b>xmlns:ns1="http://sap.com/xi/HR"</b></i>>
<xsl:template match="/">
<<b>ns1:</b>name1>
<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text><xsl:copy-of select="<b>//ns1:name</b>"/><xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text><xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
</<b>ns1:</b>name1>
</xsl:template>
</xsl:stylesheet>
Dont forget to put '//' before the target element.
This should work. Or pls put the source and target xml struct and we will assist you further.
Regards,
Ashish
Thank you Ashish. However I am trying to put this cdata node in the middle of a regular xml file so .. .message mapping to xsl map then back to message map. I have been able to do it with straight message mapping but it is very hairy. Here is a sample output ..
<?xml version="1.0" encoding="UTF-8"?>
<ns1:getSampleResponse xmlns:ns1="http://ABC/webservices/InventoryQuery/"><ns1:getSampleResponse>true</ns1:getSampleResponse><inventoryOutputString>&lt;locationCode&gt;LOCATIONCODETESTDATA&lt;/locationCode&gt;&lt;inventoryStatusCode&gt;INVENTORYCODETESTDATA&lt;/inventoryStatusCode&gt;&lt;inventoryStatus&gt;INVENTORYSTATUSTESTDATA&lt;/inventoryStatus&gt;&lt;quantity&gt;QUANTITYTESTDATA&lt;/quantity&gt;</inventoryOutputString><ns1:errorCode>ec</ns1:errorCode><ns1:errorDescription>des</ns1:errorDescription></ns1:getSampleResponse>
User | Count |
---|---|
85 | |
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.