cancel
Showing results for 
Search instead for 
Did you mean: 

Convert XML Node to String using XSLT

Former Member
0 Kudos

Hi,

Perhaps this has been discussed before. But i am looking at creating a XSLT mapping to take the entire inbound message and put it into a single node of the target.

Is there a way?

Thanks in advance

Regards

Venkat

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Shankar,

I have a input XML <root><a></a></root>

I have a target <tgt><b></b></tgt>

I need to have the target xml as

<tgt><b>&lessthansign;root&greaterthansign;&lessthansign;a&greaterthansign;&lessthansign;/a&greaterthansign;&lessthansign;/root&greaterthansign;</b></tgt>

Using the XSLT that you mentioned

I am getting the format

<tgt><b><root><a></a></root></b></tgt>

Now the consumer of this message expects the data in the first type of format

That is where i am getting stuck

Thanks and Regards

Venkat

Former Member
0 Kudos

Hi,

Is your requirement is only XSLT mapping?

This can be done easily using Java Mapping. You can easilt get the input XML as a string, replace the characters that u want and then set it as a text in the target node.

Otherwise you might try this Java enhancement in XSLT mapping.

Got thro the following blog for the same:

/people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners

Regards,

P.Venkat

Message was edited by:

Venkataramanan

Former Member
0 Kudos

Hi

The "<" and ">" have to be replaced with "&lt;" and "&gt;"

Regards

Venkat

Former Member
0 Kudos

Hi Shankar,

I have already done this. But the issue is that the receiving system is failing when trying to accept the message as they is an XML within XML. In this case i want to convert "<" and ">" with &lt; and &gt;

How do i do this?

Thanks and Regards

Venkat

Former Member
0 Kudos

Venkat,

Am not clear with your requirement. Can you give an example? After using this mapping, you would end up with an XML like this <field> whole content </field>.

Right? What am I missing here??

Regards,

Jai Shankar

Former Member
0 Kudos

Am not that good in XSLT..

Try using this mapping given by Prakash in another thread...

<b><?xml version='1.0'?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">

<Root>

<Field>

<xsl:copy-of select="." />

</Field>

</Root>

</xsl:template>

</xsl:stylesheet></b>

Regards,

Jai Shankar