cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT code for addition of namespace

Former Member
0 Kudos


Hi All,

Please provide me XSLT code for adding namespace.

Input xml:

<?xml version="1.0" encoding="UTF-8" ?>
<ns0:Document xmlns:ns0="http://abcd.com">
<ns0:CstmrCdtTrfInitn>

Output xml:

<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     
        
xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
        
xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">  
<CstmrCdtTrfInitn>

____________________________________________________________________________

I treid below code but no success.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes"/>
    <xsl:strip-space elements="*"/>
    <xsl:template match="@*|text()|comment()|processing-instruction()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="Document">
        <Request xmlns="http://abcd.com"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <xsl:apply-templates select="@*|node()"/>          
        </Request>
    </xsl:template>

    <xsl:template match="*">
        <xsl:element name="{local-name()}" namespace="http://abcd.com">
            <xsl:apply-templates select="@*|node()"/>
        </xsl:element>
    </xsl:template>

</xsl:stylesheet>

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Thanks & Regards,

Nida

Accepted Solutions (0)

Answers (1)

Answers (1)

iaki_vila
Active Contributor
0 Kudos

Hi Nida,

I haven't so clear your result if you don't share a entire input XML and the desired one.

For example with this XML:


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

<ns0:Document xmlns:ns0="http://abcd.com">

<ns0:CstmrCdtTrfInitn>

<ns0:request>hello world</ns0:request>

</ns0:CstmrCdtTrfInitn>

</ns0:Document>

And this XSLT:


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://abcd.com" exclude-result-prefixes="ns0">

<xsl:output method="xml" encoding="utf-8" indent="no"/>

                       

<xsl:template match="/">

<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    

         xmlns:xsd="http://www.w3.org/2001/XMLSchema

         xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03"> 

<CstmrCdtTrfInitn>

                   

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

</CstmrCdtTrfInitn>

</Document>

</xsl:template>   

I can get:


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

<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03"><CstmrCdtTrfInitn><ns0:request xmlns:ns0="http://abcd.com">hello world</ns0:request></CstmrCdtTrfInitn></Document>

If you share an example more complete, we could help you better.

Regards.

Former Member
0 Kudos

Hi Iñaki,

PFB  the input and output complete xml.

I only need to add extra namespace remaining xml dont need nay change.

Please suggest.

Input:

<?xml version="1.0" encoding="UTF8" ?>

<ns0:Document xmlns:ns0="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">

<ns0:CstmrCdtTrfInitn>

<ns0:GrpHdr>

  <ns0:MsgId>014601MRDH2015060203410029</ns0:MsgId>

  <ns0:CreDtTm>20150602T03:41:29</ns0:CreDtTm>

  <ns0:BtchBookg>Constant</ns0:BtchBookg>

  <ns0:NbOfTxs>000000000000002</ns0:NbOfTxs>

  </ns0:GrpHdr>

<ns0:PmtInf>

  <ns0:ReqdExctnDt>20150602</ns0:ReqdExctnDt>

  <ns0:PmtTpInf />

  <ns0:Dbtr>Constant</ns0:Dbtr>

<ns0:DbtrAcct>

<ns0:Id>

<ns0:Othr>

  <ns0:Id>10740028822H</ns0:Id>

  </ns0:Othr>

  </ns0:Id>

  </ns0:DbtrAcct>

<ns0:DbtrAgt>

  <ns0:FinInstnId />

  </ns0:DbtrAgt>

  <ns0:ChrgBr>OUR</ns0:ChrgBr>

<ns0:ChrgsAcct>

<ns0:Id>

<ns0:Othr>

  <ns0:Id>10740028822H</ns0:Id>

  </ns0:Othr>

  </ns0:Id>

  </ns0:ChrgsAcct>

<ns0:CdtTrfTxInf>

<ns0:PmtId>

  <ns0:InstrId>MBW1</ns0:InstrId>

  </ns0:PmtId>

<ns0:Amt>

  <ns0:InstdAmt Ccy="USD">100.00</ns0:InstdAmt>

  </ns0:Amt>

<ns0:EqvtAmt>

  <ns0:Amt>0</ns0:Amt>

  <ns0:CcyOfTrf>USD</ns0:CcyOfTrf>

  </ns0:EqvtAmt>

<ns0:IntrmyAgt1>

<ns0:FinInstnId>

  <ns0:ClrSysMmbId />

  </ns0:FinInstnId>

  </ns0:IntrmyAgt1>

<ns0:CdtrAgt>

<ns0:FinInstnId>

  <ns0:PstlAdr />

<ns0:ClrSysMmbId>

  <ns0:ClrSysId />

  </ns0:ClrSysMmbId>

  </ns0:FinInstnId>

  </ns0:CdtrAgt>

<ns0:Cdtr>

  <ns0:Nm>FREEPORT LNG DEVELOPMENT, L.P.</ns0:Nm>

<ns0:PstlAdr>

  <ns0:Ctry>US</ns0:Ctry>

  <ns0:AdrLine>333 CLAY STREET, SUITE 5050,HOUSTON,77002,TX</ns0:AdrLine>

  </ns0:PstlAdr>

  </ns0:Cdtr>

<ns0:CdtrAcct>

<ns0:Id>

<ns0:Othr>

  <ns0:Id />

  </ns0:Othr>

  </ns0:Id>

  </ns0:CdtrAcct>

<ns0:CdtrAgtAcct>

<ns0:Id>

<ns0:Othr>

  <ns0:Id>0</ns0:Id>

  </ns0:Othr>

  </ns0:Id>

  </ns0:CdtrAgtAcct>

  <ns0:RmtInf />

  </ns0:CdtTrfTxInf>

  </ns0:PmtInf>

<ns0:PmtInf>

  <ns0:ReqdExctnDt>20150602</ns0:ReqdExctnDt>

  <ns0:PmtTpInf />

  <ns0:Dbtr>Constant</ns0:Dbtr>

<ns0:DbtrAcct>

<ns0:Id>

<ns0:Othr>

  <ns0:Id>0</ns0:Id>

  </ns0:Othr>

  </ns0:Id>

  </ns0:DbtrAcct>

<ns0:DbtrAgt>

  <ns0:FinInstnId />

  </ns0:DbtrAgt>

  <ns0:ChrgBr>OUR</ns0:ChrgBr>

<ns0:ChrgsAcct>

<ns0:Id>

  <ns0:Othr />

  </ns0:Id>

  </ns0:ChrgsAcct>

<ns0:CdtTrfTxInf>

<ns0:PmtId>

  <ns0:InstrId>MBW1</ns0:InstrId>

  </ns0:PmtId>

<ns0:Amt>

  <ns0:InstdAmt>0</ns0:InstdAmt>

  </ns0:Amt>

<ns0:EqvtAmt>

  <ns0:Amt>200.00</ns0:Amt>

  <ns0:CcyOfTrf>USD</ns0:CcyOfTrf>

  </ns0:EqvtAmt>

<ns0:IntrmyAgt1>

<ns0:FinInstnId>

  <ns0:ClrSysMmbId />

  </ns0:FinInstnId>

  </ns0:IntrmyAgt1>

<ns0:CdtrAgt>

<ns0:FinInstnId>

  <ns0:PstlAdr />

<ns0:ClrSysMmbId>

  <ns0:ClrSysId />

  </ns0:ClrSysMmbId>

  </ns0:FinInstnId>

  </ns0:CdtrAgt>

<ns0:Cdtr>

  <ns0:Nm>100 CLUB OF BRAZORIA COUNTY</ns0:Nm>

<ns0:PstlAdr>

  <ns0:Ctry>US</ns0:Ctry>

  <ns0:AdrLine>P.O. BOX 1596,HOUSTAN,77566,TX</ns0:AdrLine>

  </ns0:PstlAdr>

  </ns0:Cdtr>

<ns0:CdtrAcct>

<ns0:Id>

+ <ns0:Othr>

  <ns0:Id />

  </ns0:Othr>

  </ns0:Id>

  </ns0:CdtrAcct>

<ns0:CdtrAgtAcct>

<ns0:Id>

  <ns0:Othr />

  </ns0:Id>

  </ns0:CdtrAgtAcct>

  <ns0:RmtInf />

  </ns0:CdtTrfTxInf>

  </ns0:PmtInf>

  </ns0:CstmrCdtTrfInitn>

  </ns0:Document>

Output:

<Document xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">

<CstmrCdtTrfInitn>

<GrpHdr>

  <CreDtTm>20121211T14:00:00</CreDtTm>

  <BtchBookg>false</BtchBookg>

  <NbOfTxs>4</NbOfTxs>

  <InitgPty />

  </GrpHdr>

<PmtInf>

  <ReqdExctnDt>20121221</ReqdExctnDt>

<PmtTpInf>

  <SvcLvl />

  </PmtTpInf>

<Dbtr>

  <PstlAdr />

  </Dbtr>

<DbtrAcct>

<Id>

<Othr>

  <Id>H10740000001</Id>

  </Othr>

  </Id>

  </DbtrAcct>

<DbtrAgt>

  <FinInstnId />

  </DbtrAgt>

  <ChrgBr>DEBT</ChrgBr>

<ChrgsAcct>

<Id>

<Othr>

  <Id>H10740000002</Id>

  </Othr>

  </Id>

  </ChrgsAcct>

<CdtTrfTxInf>

<PmtId>

  <EndToEndId>0</EndToEndId>

  <InstrId>1000478849</InstrId>

  </PmtId>

<Amt>

  <InstdAmt Ccy="USD">10000</InstdAmt>

  </Amt>

<IntrmyAgt1>

<FinInstnId>

<ClrSysMmbId>

  <ClrSysId />

  </ClrSysMmbId>

  </FinInstnId>

  </IntrmyAgt1>

<CdtrAgt>

<FinInstnId>

  <PstlAdr />

<ClrSysMmbId>

<ClrSysId>

  <Cd>USABA</Cd>

  </ClrSysId>

  <MmbId>026008905</MmbId>

  </ClrSysMmbId>

  </FinInstnId>

  </CdtrAgt>

<Cdtr>

  <Nm>THE BENEFICIARY</Nm>

<PstlAdr>

  <AdrLine>1 MAIN ST, NEW YORK NY 10023</AdrLine>

  </PstlAdr>

  </Cdtr>

<CdtrAcct>

<Id>

<Othr>

  <Id>BENEACCT001</Id>

  </Othr>

  </Id>

  </CdtrAcct>

<CdtrAgtAcct>

<Id>

  <Othr />

  </Id>

  </CdtrAgtAcct>

<RmtInf>

  <Ustrd>Single credit bank example</Ustrd>

  </RmtInf>

  </CdtTrfTxInf>

  </PmtInf>

<PmtInf>

  <ReqdExctnDt>20121221</ReqdExctnDt>

<PmtTpInf>

  <SvcLvl />

  </PmtTpInf>

<Dbtr>

  <PstlAdr />

  </Dbtr>

<DbtrAcct>

<Id>

<Othr>

  <Id>H10740000001</Id>

  </Othr>

  </Id>

  </DbtrAcct>

<DbtrAgt>

<FinInstnId>

  <BIC>MHCBUS33</BIC>

  </FinInstnId>

  </DbtrAgt>

  <ChrgBr>SHAR</ChrgBr>

<ChrgsAcct>

<Id>

  <Othr />

  </Id>

  </ChrgsAcct>

<CdtTrfTxInf>

<PmtId>

  <EndToEndId>0</EndToEndId>

  <InstrId>2000478849</InstrId>

  </PmtId>

<Amt>

  <InstdAmt Ccy="JPY">20000</InstdAmt>

  </Amt>

<IntrmyAgt1>

<FinInstnId>

  <BIC>MHCBUS33</BIC>

<ClrSysMmbId>

  <ClrSysId />

  </ClrSysMmbId>

  </FinInstnId>

  </IntrmyAgt1>

<CdtrAgt>

<FinInstnId>

<PstlAdr>

  <AdrLine>2 BENE ST, NEW YORK NY 10023</AdrLine>

  </PstlAdr>

  <Nm>THE BENEFICIARY BANK</Nm>

<ClrSysMmbId>

  <ClrSysId />

  </ClrSysMmbId>

  </FinInstnId>

  </CdtrAgt>

<Cdtr>

  <Nm>STILL THE BENEFICIARY</Nm>

<PstlAdr>

  <AdrLine>2 MAIN ST NEW YORK, NY 10023</AdrLine>

  </PstlAdr>

  </Cdtr>

<CdtrAcct>

<Id>

<Othr>

  <Id>BENEACCT002</Id>

  </Othr>

  </Id>

  </CdtrAcct>

<CdtrAgtAcct>

<Id>

<Othr>

  <Id>BENEBANKACCT02</Id>

  </Othr>

  </Id>

  </CdtrAgtAcct>

<RmtInf>

  <Ustrd>Intermediary Bank (2 credit banks) example</Ustrd>

  </RmtInf>

  </CdtTrfTxInf>

  </PmtInf>

<PmtInf>

  <ReqdExctnDt>20121221</ReqdExctnDt>

<PmtTpInf>

  <SvcLvl />

  </PmtTpInf>

<Dbtr>

  <PstlAdr />

  </Dbtr>

<DbtrAcct>

<Id>

<Othr>

  <Id>H10740000001</Id>

  </Othr>

  </Id>

  </DbtrAcct>

<DbtrAgt>

  <FinInstnId />

  </DbtrAgt>

  <ChrgBr>SHAR</ChrgBr>

<ChrgsAcct>

<Id>

<Othr>

  <Id>H10740000002</Id>

  </Othr>

  </Id>

  </ChrgsAcct>

<CdtTrfTxInf>

<PmtId>

  <EndToEndId>0</EndToEndId>

  <InstrId>3000478849</InstrId>

  </PmtId>

<Amt>

  <InstdAmt Ccy="USD">30000</InstdAmt>

  </Amt>

<IntrmyAgt1>

<FinInstnId>

<ClrSysMmbId>

  <ClrSysId />

  </ClrSysMmbId>

  </FinInstnId>

  </IntrmyAgt1>

<CdtrAgt>

<FinInstnId>

  <PstlAdr />

<ClrSysMmbId>

<ClrSysId>

  <Cd>USABA</Cd>

  </ClrSysId>

  <MmbId>026008905</MmbId>

  </ClrSysMmbId>

  </FinInstnId>

  </CdtrAgt>

<Cdtr>

  <Nm>THE BENEFICIARY</Nm>

<PstlAdr>

  <AdrLine>3 CHAMPSELYSEES,PARIS FR</AdrLine>

  </PstlAdr>

  </Cdtr>

<CdtrAcct>

<Id>

<Othr>

  <Id>BENEACCT003</Id>

  </Othr>

  </Id>

  </CdtrAcct>

<CdtrAgtAcct>

<Id>

  <Othr />

  </Id>

  </CdtrAgtAcct>

  <RmtInf />

  </CdtTrfTxInf>

  </PmtInf>

<PmtInf>

  <ReqdExctnDt>20121221</ReqdExctnDt>

<PmtTpInf>

  <SvcLvl />

  </PmtTpInf>

<Dbtr>

  <PstlAdr />

  </Dbtr>

<DbtrAcct>

<Id>

<Othr>

  <Id>H10740000001</Id>

  </Othr>

  </Id>

  </DbtrAcct>

<DbtrAgt>

<FinInstnId>

  <BIC>MHCBUS33</BIC>

  </FinInstnId>

  </DbtrAgt>

  <ChrgBr>SHAR</ChrgBr>

<ChrgsAcct>

<Id>

  <Othr />

  </Id>

  </ChrgsAcct>

<CdtTrfTxInf>

<PmtId>

  <EndToEndId>0</EndToEndId>

  <InstrId>4000478849</InstrId>

  </PmtId>

<Amt>

  <InstdAmt Ccy="JPY">40000</InstdAmt>

  </Amt>

<IntrmyAgt1>

<FinInstnId>

  <BIC>MHCBUS33</BIC>

<ClrSysMmbId>

  <ClrSysId />

  </ClrSysMmbId>

  </FinInstnId>

  </IntrmyAgt1>

<CdtrAgt>

<FinInstnId>

  <PstlAdr />

  <Nm>LAST BENEFICIARY BANK</Nm>

<ClrSysMmbId>

  <ClrSysId />

  </ClrSysMmbId>

  </FinInstnId>

  </CdtrAgt>

<Cdtr>

  <Nm>ANOTHER BENEFICIARY</Nm>

<PstlAdr>

  <AdrLine>4 MAIN ST NEW YORK, NY 10023</AdrLine>

  </PstlAdr>

  </Cdtr>

<CdtrAcct>

<Id>

<Othr>

  <Id>BENEACCT004</Id>

  </Othr>

  </Id>

  </CdtrAcct>

<CdtrAgtAcct>

<Id>

  <Othr />

  </Id>

  </CdtrAgtAcct>

<RmtInf>

  <Ustrd>Intermediary Bank and Bene Bank address not available</Ustrd>

  </RmtInf>

  </CdtTrfTxInf>

  </PmtInf>

  </CstmrCdtTrfInitn>

  </Document>

I tried below xsl code, partially succeeded got the namespaces  but it has removed all xml tags.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" exclude-result-prefixes="ns0">

<xsl:output method="xml" encoding="utf-8" indent="no"/>

                  
<xsl:template match="/">


<Document xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    

         xmlns:xsd="http://www.w3.org/2001/XMLSchema

         xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03"> 
 
</Document>

</xsl:template>

</xsl:stylesheet>

Thanks & Regards,

Nida Fatima

rcsegovia
Active Participant
0 Kudos

Hi Fatima,

Please check below links about anonymizerBean module:

Adding XMLAnonymizerBean in the Module Processor - SAP NetWeaver Process Integration - SAP Library

Cheers,

Roberto.

iaki_vila
Active Contributor
0 Kudos

Hi Nida,

Right now is clear your requeriment.

I think you could do easily concatenating two XSL, the first one remove all namespaces, the second one you set manually

<Document xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">

</Document>

And you do inside that tags the copy-of-select without problems.

I think it could be possible in one shoot, let me think.

Regards.

Former Member
0 Kudos

Hi Inaki,

I am bad in XSLT. Could you please provide me the complete code.

Thanks,

Nida

iaki_vila
Active Contributor
0 Kudos

Hi Nida,

I have it in one XSL:


<?xml version="1.0" encoding="UTF8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" exclude-result-prefixes="ns0">

    <xsl:output method="xml" encoding="utf-8" indent="no"/>

    <xsl:template match="/">

        <Document xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">

            <xsl:apply-templates select="//ns0:CstmrCdtTrfInitn"/>

        </Document>

    </xsl:template>

    <xsl:template match="*">

        <xsl:element name="{local-name()}">

            <xsl:apply-templates select="@* | node()"/>

        </xsl:element>

    </xsl:template>

    <!-- template to copy attributes -->

    <xsl:template match="@*">

        <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>

    </xsl:template>

    <!-- template to copy the rest of the nodes -->

    <xsl:template match="comment() | text() | processing-instruction()">

        <xsl:copy/>

    </xsl:template>

</xsl:stylesheet>

I get this output:


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

<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance">

    <CstmrCdtTrfInitn xmlns="">

        <GrpHdr>

            <MsgId>014601MRDH2015060203410029</MsgId>

            <CreDtTm>20150602T03:41:29</CreDtTm>

            <BtchBookg>Constant</BtchBookg>

            <NbOfTxs>000000000000002</NbOfTxs>

        </GrpHdr>

        <PmtInf>

            <ReqdExctnDt>20150602</ReqdExctnDt>

            <PmtTpInf/>

            <Dbtr>Constant</Dbtr>

            <DbtrAcct>

                <Id>

                    <Othr>

                        <Id>10740028822H</Id>

                    </Othr>

                </Id>

            </DbtrAcct>

            <DbtrAgt>

                <FinInstnId/>

            </DbtrAgt>

            <ChrgBr>OUR</ChrgBr>

            <ChrgsAcct>

                <Id>

                    <Othr>

                        <Id>10740028822H</Id>

                    </Othr>

                </Id>

            </ChrgsAcct>

            <CdtTrfTxInf>

                <PmtId>

                    <InstrId>MBW1</InstrId>

                </PmtId>

                <Amt>

                    <InstdAmt Ccy="USD">100.00</InstdAmt>

                </Amt>

                <EqvtAmt>

                    <Amt>0</Amt>

                    <CcyOfTrf>USD</CcyOfTrf>

                </EqvtAmt>

                <IntrmyAgt1>

                    <FinInstnId>

                        <ClrSysMmbId/>

                    </FinInstnId>

                </IntrmyAgt1>

                <CdtrAgt>

                    <FinInstnId>

                        <PstlAdr/>

                        <ClrSysMmbId>

                            <ClrSysId/>

                        </ClrSysMmbId>

                    </FinInstnId>

                </CdtrAgt>

                <Cdtr>

                    <Nm>FREEPORT LNG DEVELOPMENT, L.P.</Nm>

                    <PstlAdr>

                        <Ctry>US</Ctry>

                        <AdrLine>333 CLAY STREET, SUITE 5050,HOUSTON,77002,TX</AdrLine>

                    </PstlAdr>

                </Cdtr>

                <CdtrAcct>

                    <Id>

                        <Othr>

                            <Id/>

                        </Othr>

                    </Id>

                </CdtrAcct>

                <CdtrAgtAcct>

                    <Id>

                        <Othr>

                            <Id>0</Id>

                        </Othr>

                    </Id>

                </CdtrAgtAcct>

                <RmtInf/>

            </CdtTrfTxInf>

        </PmtInf>

        <PmtInf>

            <ReqdExctnDt>20150602</ReqdExctnDt>

            <PmtTpInf/>

            <Dbtr>Constant</Dbtr>

            <DbtrAcct>

                <Id>

                    <Othr>

                        <Id>0</Id>

                    </Othr>

                </Id>

            </DbtrAcct>

            <DbtrAgt>

                <FinInstnId/>

            </DbtrAgt>

            <ChrgBr>OUR</ChrgBr>

            <ChrgsAcct>

                <Id>

                    <Othr/>

                </Id>

            </ChrgsAcct>

            <CdtTrfTxInf>

                <PmtId>

                    <InstrId>MBW1</InstrId>

                </PmtId>

                <Amt>

                    <InstdAmt>0</InstdAmt>

                </Amt>

                <EqvtAmt>

                    <Amt>200.00</Amt>

                    <CcyOfTrf>USD</CcyOfTrf>

                </EqvtAmt>

                <IntrmyAgt1>

                    <FinInstnId>

                        <ClrSysMmbId/>

                    </FinInstnId>

                </IntrmyAgt1>

                <CdtrAgt>

                    <FinInstnId>

                        <PstlAdr/>

                        <ClrSysMmbId>

                            <ClrSysId/>

                        </ClrSysMmbId>

                    </FinInstnId>

                </CdtrAgt>

                <Cdtr>

                    <Nm>100 CLUB OF BRAZORIA COUNTY</Nm>

                    <PstlAdr>

                        <Ctry>US</Ctry>

                        <AdrLine>P.O. BOX 1596,HOUSTAN,77566,TX</AdrLine>

                    </PstlAdr>

                </Cdtr>

                <CdtrAcct>

                    <Id>

+ <Othr>

                            <Id/>

                        </Othr>

                    </Id>

                </CdtrAcct>

                <CdtrAgtAcct>

                    <Id>

                        <Othr/>

                    </Id>

                </CdtrAgtAcct>

                <RmtInf/>

            </CdtTrfTxInf>

        </PmtInf>

    </CstmrCdtTrfInitn>

</Document>

Regards.

iaki_vila
Active Contributor
0 Kudos

Hi again,

I've just noticed this tag could be not desired <CstmrCdtTrfInitn xmlns="">

If you apply two xsl in this order in operation mapping the result will be succesful:

To remove all namespaces:


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

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

    <xsl:output method="xml" encoding="utf-8" indent="yes"/>

    <xsl:template match="*">

        <xsl:element name="{local-name()}">

            <xsl:apply-templates select="@* | node()"/>

        </xsl:element>

    </xsl:template>

    <!-- template to copy attributes -->

    <xsl:template match="@*">

        <xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>

    </xsl:template>

    <!-- template to copy the rest of the nodes -->

    <xsl:template match="comment() | text() | processing-instruction()">

        <xsl:copy/>

    </xsl:template>

</xsl:stylesheet>

To add you namespace on the root tag:


<?xml version="1.0" encoding="UTF8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">

    <xsl:output method="xml" encoding="utf-8" indent="yes"/>

    <xsl:template match="/">

        <Document xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">

            <xsl:copy-of select="//Document/child::*"/>

        </Document>

    </xsl:template>

</xsl:stylesheet>

Regards.

RaghuVamseedhar
Active Contributor
0 Kudos

Nida,

Please check this blog (on removing namespace)