Skip to Content
0
Jul 05, 2012 at 12:47 PM

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

76 Views

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