cancel
Showing results for 
Search instead for 
Did you mean: 

String to XML using XSLT

swatantra_vijay3
Participant
0 Kudos
665

Hi

I am trying to extract XML from XML string which is inside a XML tag

My message looks like this

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

<ns0:InsertData xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">

<ns0:Data>

Here actual xml message resides

</ns0:Data>

I am using XSLT mapping as

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

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

<xsl:template match="/">

<xsl:for-each select="Data">

<xsl:value-of select="." disable-output-escaping="yes"/>

</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

When Iu2019m trying to execute this mapping in Interface mapping test

I am getting below error

Problem when building the tree , XML not well formed

Any clues???

Regards

SV

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">
  <xsl:output method="xml" omit-xml-declaration="yes"/>
  <xsl:template match="/">
    <xsl:for-each select="//ns0:Data">
      <xsl:value-of select="." disable-output-escaping="yes"/>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

As Satish mentioned, it would be helpful if you provide a better sample input message and an example of the output you are expecting.

Former Member
0 Kudos

Hi Vijay,

It seems something wrong in your input. Can you exact input payload so that somebody can help you out with the xslt. If you are getting the same payload, I feel you can directly do a graphical mapping. I will let you know only when i see the exact payload.

Regards,

---Satish

jyothi_anagani
Active Contributor
0 Kudos

Hi swatantra,

I think Namespace is missing...Check the XSLT one more time..

Thanks.

swatantra_vijay3
Participant
0 Kudos

Hi Jyothi ,

I tried with namespace as well , still the same problem persisting

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

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

<xsl:output method="xml" omit-xml-declaration="yes" />

<xsl:template match="/">

<xsl:for-each select="//ns0:Data">

<xsl:value-of select="." disable-output-escaping="yes"/>

</xsl:for-each>

</xsl:template>

</xsl:stylesheet>

Any more ideas

Thanks

Edited by: Swatantra Vijay on Aug 20, 2009 1:36 PM

Edited by: Swatantra Vijay on Aug 20, 2009 1:38 PM

swatantra_vijay3
Participant
0 Kudos

Guys any ideas ???

Regards

Swatantra

Former Member
0 Kudos

Hi Vijay,

Have you tested your XSLT on an external tool? It can be a problem with your incoming data or with your mapping program.

Also, share the mapping so that anyone can help you out with that.

Regards,

Neetesh

Former Member
0 Kudos

Please check if this blog helps

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