cancel
Showing results for 
Search instead for 
Did you mean: 

Need to add ns0:<namespace> in the root element.

0 Kudos

Hi Experts,

I need to add ns0:namespace in the root element.

I am using a XSLT mapping for that.It is given below:

<?xml version='1.0' encoding='utf-8'?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" encoding="UTF-8"/>

<xsl:template match="/">

<ABS

xmlns="namespace name">

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

</ABC>

</xsl:template>

</xsl:stylesheet>

but the output I am getting is as below:

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

<ABC xmlns="namespace name">

<ABC NumPrograms="">

<Program XMLProgramNum="">

<ProgramID/>

<FiscalYear/>

<SAPCountryCode/>

<CustNum/>

<BudgetCode/>

<SpecializedBusinessUnit/>

<FundedBy/>

<OffInvoice/>

<TotalBudget/>

<Exposure/>

</Program>

</ABC>

</ABC>

In the output I need it as below:

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

<ABC NumPrograms="" xmlns="namespace name">

<Program XMLProgramNum="">

<ProgramID/>

<FiscalYear/>

<SAPCountryCode/>

<CustNum/>

<BudgetCode/>

<SpecializedBusinessUnit/>

<FundedBy/>

<OffInvoice/>

<TotalBudget/>

<Exposure/>

</Program>

</ABC>

In the target structure field ABC is comming twice..please note the diffence between the two structure.

Please resolve.

Regards

Joy

Accepted Solutions (1)

Accepted Solutions (1)

former_member184681
Active Contributor
0 Kudos

Hi Joy,

Use the followint XSLT (I have bolded my modifications):

<?xml version='1.0' encoding='utf-8'?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" encoding="UTF-8"/>

<xsl:template match="ABC">

<ABC NumPrograms="" xmlns="namespace name">

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

</ABC>

</xsl:template>

</xsl:stylesheet>

Regards,

Greg

Answers (0)