cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT question

Former Member
0 Kudos

Hi folks,

I need to write an XSLT that will extract the CDATA Segment into XML structure.

input.xml
<parent_messages>
<result> 
<code>OK</code>
  <details>
<Body messageType="CUSTIMPORT"><![CDATA[
<Shipment>
     <company>DE</company>
     <plant>01</plant>
     <shipmentId>DE20120210</shipmentId>
</Shipment>
]]>
</Body>
  </details>
</result>
< /parent_messages>

Needed Output.xml
<
parent_messages>
<result> 
<code>OK</code>
<details>
<Shipment>
     <company>DE</company>
     <plant>01</plant>
     <shipmentId>DE20120210</shipmentId>
</Shipment>

</Body>
  </details>
</result>
< /parent_messages>

XSLT Mapping???

Can some one please guide or suggest me?

Kind Regards,

Peter

K

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member184681
Active Contributor
0 Kudos

Hi Peter,

Definitely agreed with Baskar Gopalakrishnan, doing it with Java mapping is the easiest (if not the only) possibility here. Have a look at this blog by Shabarish: http://scn.sap.com/people/shabarish.vijayakumar/blog/2010/01/14/file-conversion-using-nodeception.

It is aimed at somehow similar problem (deleting a node, not CDATA section, but the rule is identical there). Just start reading from "NODECEPTION aka Node Deception" to find your solution. There is even a link in this blog, to an example source code that you could use.

Hope this helps,
Greg

Former Member
0 Kudos

Hi all,

isn't possible to solve this without java?

baskar_gopalakrishnan2
Active Contributor
0 Kudos

You can do using java mapping too. Basically you need to remove the CDATA  prefix from the XML. You can use replace or substring methods to eliminate the unwanted portion of the input xml.