I need to transform the following xml :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Document>
<CstmrPmtStsRpt>
<GrpHdr>
<MsgId>DATIR0022G12345678100</MsgId>
<CreDtTm>2013-07-18T06:00:01</CreDtTm>
<InitgPty>
<Id>
<OrgId>
<BICorBEI>BICBICMMXXX</BICorBEI>
</OrgId>
</Id>
</InitgPty>
</GrpHdr>
</CstmrPmtStsRpt>
</Document>
To transform the xml file I am using the following code :
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<root>
<xsl:for-each select="//GrpHdr">
<tblGrpHdr1>
<xsl:variable name="CurrentHeaderID" select="position()"/>
<HeaderID>
<xsl:value-of select="$CurrentHeaderID"/>
</HeaderID>
<MsgId>
<xsl:value-of select="./MsgId"/>
</MsgId>
<CreDtTm>
<xsl:value-of select="./CreDtTm"/>
</CreDtTm>
<BICorBEI>
<xsl:value-of select="./InitgPty/Id/OrgId/BICorBEI"/>
</BICorBEI>
</tblGrpHdr1>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
The code works fine when the root-element is <Document>
, but it does not work when the root is <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.002.001.03">
What I can do?