The elements in your input XML have a default namespace. You need to declare this namespace in your XSLT stylesheet, too and prefix any input elements you want to match.
You do not need to match the GrpHdr
elements if you'd like to output the NbOfTxs
element and its content anyway.
Input
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CstmrCdtTrfInitn>
<GrpHdr>
<NbOfTxs>3</NbOfTxs>
</GrpHdr>
</CstmrCdtTrfInitn>
</Document>
Stylesheet
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:nsa="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">
<xsl:output encoding="UTF-8" indent="yes" method="xml" standalone="no" omit-xml-declaration="yes"/>
<xsl:template match='nsa:NbOfTxs'>
<xsl:copy>
<xsl:value-of select="."/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Output
Note that the NbOfTxs
element still has its namespace in the output (you did not say whether you want to keep it or not).
<NbOfTxs xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">3</NbOfTxs>