Skip to content

Instantly share code, notes, and snippets.

@bestlinuxgamers
Created October 25, 2025 23:18
Show Gist options
  • Select an option

  • Save bestlinuxgamers/e794abdb85f1fcccaaaf67c8cfa29b35 to your computer and use it in GitHub Desktop.

Select an option

Save bestlinuxgamers/e794abdb85f1fcccaaaf67c8cfa29b35 to your computer and use it in GitHub Desktop.
Convert camt 052.001.08 to 053.001.08
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:c52="urn:iso:std:iso:20022:tech:xsd:camt.052.001.08"
xmlns="urn:iso:std:iso:20022:tech:xsd:camt.053.001.08"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="c52">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="c52:Document">
<Document>
<xsl:attribute name="xsi:schemaLocation">
urn:iso:std:iso:20022:tech:xsd:camt.053.001.08 camt.053.001.08.xsd
</xsl:attribute>
<xsl:apply-templates select="node()"/>
</Document>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="c52:BkToCstmrAcctRpt">
<BkToCstmrStmt>
<xsl:apply-templates select="@* | node()"/>
</BkToCstmrStmt>
</xsl:template>
<xsl:template match="c52:Rpt">
<xsl:if test="c52:Bal">
<Stmt>
<xsl:apply-templates select="@* | node()"/>
</Stmt>
</xsl:if>
</xsl:template>
<xsl:template match="c52:Ntry[c52:Sts/c52:Cd = 'PDNG']"/>
<xsl:template match="c52:RptPgntn">
<StmtPgntn>
<xsl:apply-templates select="@* | node()"/>
</StmtPgntn>
</xsl:template>
<xsl:template match="c52:AddtlRptInf">
<AddtlStmtInf>
<xsl:apply-templates select="@* | node()"/>
</AddtlStmtInf>
</xsl:template>
<xsl:template match="c52:*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
@bestlinuxgamers
Copy link
Author

How to use:

xsltproc convert_camt_052_to_053.xslt input.xml > output.xml

Should ignore transactions without a balance or with a pending status (untested)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment