I am facing trouble when try to replace the namespace after copy the fpml.
I need to replace
<nonpublicExecutionReport xmlns="http://www.fpml.org/FpML-5/transparency" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.fpml.org/FpML-5/transparency file:///C:/APPS/Resources/xmls/SDR/transparency/fpml-main-5-5.xsd" fpmlVersion="5-5">
<A/>
<B/>
</nonpublicExecutionReport>
for
<nonpublicExecutionReport fpmlVersion="5-5" xsi:schemaLocation="http://www.fpml.org/FpML-5/recordkeeping /../xmls/SDR/recordkeeping/fpml-main-5-5.xsd" xmlns="http://www.fpml.org/FpML-5/recordkeeping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<A/>
<B/>
</nonpublicExecutionReport>
Basically is replace 'transparency' by 'recordkeeping'
I have tried follow the previous question like XML replacement with XSL but without success for my case.
What I do is:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" mlns:fpml="http://www.fpml.org/FpML-5/transparency">
<!-- Copy XML source -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<!-- Remove transparency from the layout-->
<xsl:template match="fpml:*">
<!-- Update this tag -->
<xsl:element name="{local-name()}">
<nonpublicExecutionReport xmlns="http://www.fpml.org/FpML-5/reportkeeping" fpmlVersion="5-5" xsi:schemaLocation="http://www.fpml.org/FpML-5/recordkeeping/../xmls/SDR/recordkeeping/fpml-main-5-5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:apply-templates select="node()"/>
</nonpublicExecutionReport>
</xsl:element>
</xsl:template>
<xsl:template match="fpml:*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
The namespace isn't being replaced.
question from:
https://stackoverflow.com/questions/65917561/fpml-how-to-replace-a-text-in-the-namespace-after-copy-the-whole-fpml 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…