cancel
Showing results for 
Search instead for 
Did you mean: 

Complete XML to a field

Former Member
0 Kudos

Hi,

Is there a way you can map a complete XML to a string field including <?xml version="1.0" encoding="UTF-8"?>?

The below is the XSL code I'm using:

<?xml version="1.0" encoding="UTF-8"?>

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

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

<xsl:template match="/">

<Import>

<importXML>

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

</importXML>

</Import>

</xsl:template>

</xsl:stylesheet>

I also have tried the below:

<?xml version="1.0" encoding="UTF-8"?>

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

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

<xsl:template match="/">

<Import xmlns="http://my.url/">

<importXML>

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

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

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

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

</importXML>

</Import>

</xsl:template>

</xsl:stylesheet>

The above code basically moves all the XML except for <?xml version="1.0" encoding="UTF-8"?>.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Check this

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

Regards

Seshagiri

Former Member
0 Kudos

My code is the same. The issue I have is actually moving, <?xml version="1.0" encoding="UTF-8"?>, into the string field along with the rest of the xml.

Thanks.

Former Member
0 Kudos

Hi, Duke:

Can you try manually add the line before your line <xsl:copy-of select="." />

make it like:

<?xml version="1.0" encoding="UTF-8" ?>

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

Or try to put the line inside <xsl:text> tab.

Liang

Former Member
0 Kudos

Hi,

Unfortanelty that causes errors in the XSL program, and in the mapping step in XI.

Thanks.

Former Member
0 Kudos

How about:


.....
<xsl:text disable-output-escaping="yes">
<![CDATA[<?xml version="1.0" encoding="UTF-8" ?>


......
]]>

If it does not work, Please refer to the "How to Handle Unstructured Source Contents for Adapters"

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/482aae19-0301-0010-3485-8efd6188...

Liang

Edited by: Liang Ji on Mar 20, 2008 8:28 PM

Former Member
0 Kudos

Thanks Liang.

This solved the issue.

Best Regards.

Answers (0)