Skip to Content
avatar image
Former Member

XML to string in XSL mapping

Hi All,
Im trying to achieve the following transformation by using XSL mapping:

Input
<ROOTNODE>
<NODEPARAMETERS>
<USER>ABC</USER>
<PASSWORD>DEF</PASSWORD>
<REQUESTID>12321</REQUESTID>
</NODEPARAMETERS>
<NODEMESSAGE>
<DESTINATION>453453453</DESTINATION>
<TEXT>TESTING</TEXT>
<SOURCE>31232</SOURCE>
</NODEMESSAGE>
</ROOTNODE>

Output
USER=ABC&PASSWORD=DEF&REQUESTID=12321
<NODEMESSAGE>
<DESTINATION>453453453</DESTINATION>
<TEXT>TESTING</TEXT>
<SOURCE>31232</SOURCE>
</NODEMESSAGE>

Basically, im trying to output the node parameters as string and node message as XML in a single output.
Is this possible via XSL mapping?
If so, how is it done?

Regards,
J

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Jun 09, 2015 at 02:02 PM

    Hi Janan,

    Yes it's possible, Check the point 4 in this document Useful XSLT mapping functions in SAP XI/PI

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 11, 2015 at 10:53 AM

    Hi all,
    In my source XML, i have 2 nodes as follows:
    <ROOTNODE>
    <NODEPARAMETERS>
    <USER>ABC</USER>
    <PASSWORD>DEF</PASSWORD>
    <REQUESTID>12321</REQUESTID>
    </NODEPARAMETERS>
    <NODEMESSAGE>
    <DESTINATION>453453453</DESTINATION>
    <TEXT>TESTING</TEXT>
    <SOURCE>31232</SOURCE>
    </NODEMESSAGE>
    </ROOTNODE>

    For the target, im expecting that the Nodeparameters should appear as text/string without <> tags, and concatenated by & character; followed by the node message to appear as xml
    so ideally the output should be somewhat like this:

    USER=ABC&PASSWORD=DEF&REQUESTID=12321
    <NODEMESSAGE>
    <DESTINATION>453453453</DESTINATION>
    <TEXT>TESTING</TEXT>
    <SOURCE>31232</SOURCE>
    </NODEMESSAGE>

    Is this possible through XSL mapping/ Java mapping? or a combination of both?
    Any pointers to the java code?
    I assume i can have both XSL and java mapping in the operation mapping....
    Regards,
    J

    Add comment
    10|10000 characters needed characters exceeded