Я хочу изменить корневой тег XML-сообщения ISO-20022, включая его пространство имен, определение и расположение, с помощью XSLT.
- корневой тег: SCLSCT: BBkICFBlkCdtTrf -> SCLSCT: BBkSCFBlkCdtTrf
- xmlns: xmlns: SCLSCT = "urn: BBkICF: xsd: $ BBkICFBlkCdtTrf" -> xns:SCLSCT = "urn: BBkSCF: xsd: $ BBkSCFBlkCdtTrf"
- схема размещения: xsi: schemaLocation = "urn: BBkICF: xsd: $ BBkICFBlkCdtTrf BBkICTT * rl8Cdt * rl8Cdtrrl_tcrtrrrtrfrrrrrrrrrrfrfrrrrrfrfrfrfrfrfrfrfrrfrrfrrrrrrrr ...1019 * xsi: schemaLocation = "urn: BBkSCF: xsd: $ BBkSCFBlkCdtTrf BBkSCFBlkCdtTrf.xsd"
Я преуспел во всех точках, но не понимаю, почему урна xmlns = "is: is: std: iso: 20022: tech: xsd: sct: pacs.008.001.02 "определение перенесено на все дочерние объекты (из SCLSCT: FIToFICstmrCdtTrf в GrpHdr и добавлено в CdtTrfTxInf).
INPUT
<?xml version="1.0" encoding="UTF-8"?>
<SCLSCT:BBkICFBlkCdtTrf xmlns:SCLSCT="urn:BBkICF:xsd:$BBkICFBlkCdtTrf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:BBkICF:xsd:$BBkICFBlkCdtTrf BBkICFBlkCdtTrf.xsd">
<SCLSCT:SndgInst>XXXXXXXX</SCLSCT:SndgInst>
<SCLSCT:RcvgInst>XXXXXXXXXXX</SCLSCT:RcvgInst>
<SCLSCT:FileRef>XXX2019021100048</SCLSCT:FileRef>
<SCLSCT:SrvcID>SCT</SCLSCT:SrvcID>
<SCLSCT:TstCode>T</SCLSCT:TstCode>
<SCLSCT:FType>ICF</SCLSCT:FType>
<SCLSCT:FDtTm>2019-02-11T15:51:10.868+01:00</SCLSCT:FDtTm>
<SCLSCT:NumCTBlk>1</SCLSCT:NumCTBlk>
<SCLSCT:NumPCRBlk>1</SCLSCT:NumPCRBlk>
<SCLSCT:NumRFRBlk>1</SCLSCT:NumRFRBlk>
<SCLSCT:NumROIBlk>1</SCLSCT:NumROIBlk>
<SCLSCT:NumSRBlk>1</SCLSCT:NumSRBlk>
<SCLSCT:FIToFICstmrCdtTrf xmlns="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.02">
<GrpHdr>
<MsgId>XXXXXXXXS110219XXXXXXXXXXX000480005</MsgId>
<CreDtTm>2019-02-11T15:51:10.176+01:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<TtlIntrBkSttlmAmt Ccy="EUR">1</TtlIntrBkSttlmAmt>
<IntrBkSttlmDt>2019-02-11</IntrBkSttlmDt>
<SttlmInf>
<SttlmMtd>CLRG</SttlmMtd>
<ClrSys>
<Prtry>SCL</Prtry>
</ClrSys>
</SttlmInf>
<InstgAgt>
<FinInstnId>
<BIC>XXXXXXXX</BIC>
</FinInstnId>
</InstgAgt>
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
<EndToEndId>XXXXXXXXXXXXXXXXXXXXX</EndToEndId>
<TxId>XXXXXXXXXXXXXXXXXXXXX</TxId>
</PmtId>
<PmtTpInf>
<SvcLvl>
<Cd>SEPA</Cd>
</SvcLvl>
</PmtTpInf>
<IntrBkSttlmAmt Ccy="EUR">1</IntrBkSttlmAmt>
<ChrgBr>SLEV</ChrgBr>
<Dbtr>
<Nm>XXXXXXXXXXXXXXXXXXXXX</Nm>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>XXXXXXXXXXXXXXXXXXXXX</IBAN>
</Id>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BIC>XXXXXXXXXXX</BIC>
</FinInstnId>
</DbtrAgt>
<CdtrAgt>
<FinInstnId>
<BIC>XXXXXXXXXXX</BIC>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>Creditor Name XXXXXXXXXXXXXXXXXXXXX</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>XXXXXXXXXXXXXXXXXXXXX</IBAN>
</Id>
</CdtrAcct>
<RmtInf>
<Ustrd>Remittance Information XXXXXXXXXXXXXXXXXXXXX</Ustrd>
</RmtInf>
</CdtTrfTxInf>
</SCLSCT:FIToFICstmrCdtTrf>
</SCLSCT:BBkICFBlkCdtTrf>
ЖЕЛАЕМЫЙ ВЫХОД
?xml version="1.0" encoding="UTF-8"?>
<SCLSCT:BBkSCFBlkCdtTrf xmlns:SCLSCT="urn:BBkSCF:xsd:$BBkSCFBlkCdtTrf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:BBkSCF:xsd:$BBkSCFBlkCdtTrf BBkSCFBlkCdtTrf.xsd">
<SCLSCT:SndgInst>XXXXXXXX</SCLSCT:SndgInst>
<SCLSCT:RcvgInst>XXXXXXXXXXX</SCLSCT:RcvgInst>
<SCLSCT:FileRef>XXX2019021100048</SCLSCT:FileRef>
<SCLSCT:SrvcID>SCT</SCLSCT:SrvcID>
<SCLSCT:TstCode>T</SCLSCT:TstCode>
<SCLSCT:FType>ICF</SCLSCT:FType>
<SCLSCT:FDtTm>2019-02-11T15:51:10.868+01:00</SCLSCT:FDtTm>
<SCLSCT:NumCTBlk>1</SCLSCT:NumCTBlk>
<SCLSCT:NumPCRBlk>1</SCLSCT:NumPCRBlk>
<SCLSCT:NumRFRBlk>1</SCLSCT:NumRFRBlk>
<SCLSCT:NumROIBlk>1</SCLSCT:NumROIBlk>
<SCLSCT:NumSRBlk>1</SCLSCT:NumSRBlk>
<SCLSCT:FIToFICstmrCdtTrf xmlns="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.02">
<GrpHdr>
<MsgId>XXXXXXXXS110219XXXXXXXXXXX000480005</MsgId>
<CreDtTm>2019-02-11T15:51:10.176+01:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<TtlIntrBkSttlmAmt Ccy="EUR">1</TtlIntrBkSttlmAmt>
<IntrBkSttlmDt>2019-02-11</IntrBkSttlmDt>
<SttlmInf>
<SttlmMtd>CLRG</SttlmMtd>
<ClrSys>
<Prtry>SCL</Prtry>
</ClrSys>
</SttlmInf>
<InstgAgt>
<FinInstnId>
<BIC>XXXXXXXX</BIC>
</FinInstnId>
</InstgAgt>
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
<EndToEndId>XXXXXXXXXXXXXXXXXXXXX</EndToEndId>
<TxId>XXXXXXXXXXXXXXXXXXXXX</TxId>
</PmtId>
<PmtTpInf>
<SvcLvl>
<Cd>SEPA</Cd>
</SvcLvl>
</PmtTpInf>
<IntrBkSttlmAmt Ccy="EUR">1</IntrBkSttlmAmt>
<ChrgBr>SLEV</ChrgBr>
<Dbtr>
<Nm>XXXXXXXXXXXXXXXXXXXXX</Nm>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>XXXXXXXXXXXXXXXXXXXXX</IBAN>
</Id>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BIC>XXXXXXXXXXX</BIC>
</FinInstnId>
</DbtrAgt>
<CdtrAgt>
<FinInstnId>
<BIC>XXXXXXXXXXX</BIC>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>Creditor Name XXXXXXXXXXXXXXXXXXXXX</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>XXXXXXXXXXXXXXXXXXXXX</IBAN>
</Id>
</CdtrAcct>
<RmtInf>
<Ustrd>Remittance Information XXXXXXXXXXXXXXXXXXXXX</Ustrd>
</RmtInf>
</CdtTrfTxInf>
</SCLSCT:FIToFICstmrCdtTrf>
XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:SCLSCT="urn:BBkICF:xsd:$BBkICFBlkCdtTrf" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="SCLSCT:*" xmlns:SCLSCT="urn:BBkICF:xsd:$BBkICFBlkCdtTrf">
<xsl:element name="{name()}" namespace="urn:BBkSCF:xsd:$BBkSCFBlkCdtTrf">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:copy copy-namespaces="no">
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="SCLSCT:BBkICFBlkCdtTrf">
<SCLSCT:BBkSCFBlkCdtTrf xmlns:SCLSCT="urn:BBkSCF:xsd:$BBkSCFBlkCdtTrf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:apply-templates select="@* | node()"/>
</SCLSCT:BBkSCFBlkCdtTrf>
</xsl:template>
<xsl:template match="@xsi:schemaLocation">
<xsl:attribute name="xsi:schemaLocation">urn:BBkSCF:xsd:$BBkSCFBlkCdtTrf BBkSCFBlkCdtTrf.xsd</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
РЕЗУЛЬТАТ
<?xml version="1.0" encoding="UTF-8"?>
<SCLSCT:BBkSCFBlkCdtTrf xmlns:SCLSCT="urn:BBkSCF:xsd:$BBkSCFBlkCdtTrf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:BBkSCF:xsd:$BBkSCFBlkCdtTrf BBkSCFBlkCdtTrf.xsd">
<SCLSCT:SndgInst>XXXXXXXX</SCLSCT:SndgInst>
<SCLSCT:RcvgInst>XXXXXXXXXXX</SCLSCT:RcvgInst>
<SCLSCT:FileRef>XXX2019021100048</SCLSCT:FileRef>
<SCLSCT:SrvcID>SCT</SCLSCT:SrvcID>
<SCLSCT:TstCode>T</SCLSCT:TstCode>
<SCLSCT:FType>ICF</SCLSCT:FType>
<SCLSCT:FDtTm>2019-02-11T15:51:10.868+01:00</SCLSCT:FDtTm>
<SCLSCT:NumCTBlk>1</SCLSCT:NumCTBlk>
<SCLSCT:NumPCRBlk>1</SCLSCT:NumPCRBlk>
<SCLSCT:NumRFRBlk>1</SCLSCT:NumRFRBlk>
<SCLSCT:NumROIBlk>1</SCLSCT:NumROIBlk>
<SCLSCT:NumSRBlk>1</SCLSCT:NumSRBlk>
<SCLSCT:FIToFICstmrCdtTrf >
<GrpHdr xmlns="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.02">
<MsgId>XXXXXXXXS110219XXXXXXXXXXX000480005</MsgId>
<CreDtTm>2019-02-11T15:51:10.176+01:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<TtlIntrBkSttlmAmt Ccy="EUR">1</TtlIntrBkSttlmAmt>
<IntrBkSttlmDt>2019-02-11</IntrBkSttlmDt>
<SttlmInf>
<SttlmMtd>CLRG</SttlmMtd>
<ClrSys>
<Prtry>SCL</Prtry>
</ClrSys>
</SttlmInf>
<InstgAgt>
<FinInstnId>
<BIC>XXXXXXXX</BIC>
</FinInstnId>
</InstgAgt>
</GrpHdr>
<CdtTrfTxInf xmlns="urn:iso:std:iso:20022:tech:xsd:sct:pacs.008.001.02">
<PmtId>
<EndToEndId>XXXXXXXXXXXXXXXXXXXXX</EndToEndId>
<TxId>XXXXXXXXXXXXXXXXXXXXX</TxId>
</PmtId>
<PmtTpInf>
<SvcLvl>
<Cd>SEPA</Cd>
</SvcLvl>
</PmtTpInf>
<IntrBkSttlmAmt Ccy="EUR">1</IntrBkSttlmAmt>
<ChrgBr>SLEV</ChrgBr>
<Dbtr>
<Nm>XXXXXXXXXXXXXXXXXXXXX</Nm>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>XXXXXXXXXXXXXXXXXXXXX</IBAN>
</Id>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BIC>XXXXXXXXXXX</BIC>
</FinInstnId>
</DbtrAgt>
<CdtrAgt>
<FinInstnId>
<BIC>XXXXXXXXXXX</BIC>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>Creditor Name XXXXXXXXXXXXXXXXXXXXX</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>XXXXXXXXXXXXXXXXXXXXX</IBAN>
</Id>
</CdtrAcct>
<RmtInf>
<Ustrd>Remittance Information XXXXXXXXXXXXXXXXXXXXX</Ustrd>
</RmtInf>
</CdtTrfTxInf>
</SCLSCT:FIToFICstmrCdtTrf>
</SCLSCT:BBkICFBlkCdtTrf>
Любая помощь высоко ценится!THX