cancel
Showing results for 
Search instead for 
Did you mean: 

XML not well formed in - XSLT mapping

Former Member
0 Kudos

Hi,

I am doing a simple xslt mapping wherein my Source data structure is

MT

|__ details

|__ Records

|_emp_no

|_ emp_name

|_emp_dno

In XSL file i hv specified <xsl:template match="MT">

and I am using <for-each select="details/Records">

when I m testing it in Interface mapping, it is giving me error "XML not well formed"

can anybody please suggest whats the problem in the code??

Thank you,

Anu Singhal

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Am facing the same problem i tried the solution but in my case it didn't worked , please suggest me some solution.

prasanthi_chavala
Active Contributor
0 Kudos

Hi Anu,

I think in the select query in xslt mapping u have to mention the expression "//" so that for each iteration it can go according the path.

< for-each select = " //details/records">

I have some sample code of same type...just check it..

<xsl:template match="/">

<MT_EMP_TARGET>

<xsl:for-each select="//EMP_DATA">

<EMP_DATA>

<xsl:variable name="fname" select="//EMP_DATA/First_Name"/>

<xsl:variable name="lname" select="//EMP_DATA/Last_Name"/>

<Emp_Code><xsl:value-of select="//EMP_DATA/Emp_Code"/></Emp_Code>

<Name><xsl:value-of select="concat($fname,' ',$lname)"/></Name>

<Join_Dt><xsl:value-of select="//EMP_DATA/Join_Dt"/></Join_Dt>

<Designation><xsl:value-of select="//EMP_DATA/Level"/></Designation>

<Dept><xsl:value-of select="//EMP_DATA/Dept"/></Dept>

</EMP_DATA>

</xsl:for-each>

</MT_EMP_TARGET>

</xsl:template>

For more info:

http://www.w3schools.com/xsl/el_for-each.asp

Cheers,

Prasanthi.

      • Reward marks if helpful.

Former Member
0 Kudos

Hi Prasanthi,

Thanks for replyin,

I have tried yr solution in my earlier mapping.. it definetly works.

i just wanted to know..do we have to maintain any hierarchy of source sructure

i.e only immediate parent name have to be given of the desired node in template match element

Former Member
0 Kudos

Hi,

You could specify the Template match as MT/details too.

The value specified against parameter "match" depends on what you want in the target.

If you want all or some of the values starting after MT/details in your target, you need to specify match as MT/details

Else, if you want detail values too, you need to specify match as MT

Regards,

Smitha.

Message was edited by:

Smitha Rao

Former Member
0 Kudos

Hi Anu,

either your xml input document or your XSLT stylesheet is not well-formed. Here is an explanation of what 'well-formed' means:

http://en.wikipedia.org/wiki/XML#Well-formed_documents

If you still cannot solve it by yourself, just post your entire xml input document as well as your entire XSLT stylesheet and we can have a look.

Regards,

Matthias

Shabarish_Nair
Active Contributor
0 Kudos

open the test xml in IE and check if it is well formed.

In case of a well fomed XML the explorer will not throw an error.