0

I have below XML and XSLT. Need to extract values of certain XML tags. I have tried with below XSLT but not able to retrieve any values. Kindly help to achieve this.

XML:

<?xml version="1.0" encoding="UTF-8"?>
<FinMessage
    xmlns="urn:swift:xsd:mtmsg.2021">
    <!--line=0-->
    <Block1>
        <ApplicationIdentifier>F</ApplicationIdentifier>
        <ServiceIdentifier>01</ServiceIdentifier>
        <LogicalTerminalAddress>F0AXXX</LogicalTerminalAddress>
        <SessionNumber>0000</SessionNumber>
        <SequenceNumber>000000</SequenceNumber>
    </Block1>
    <!--line=0-->
    <Block2>
        <InputIdentifier>I</InputIdentifier>
        <MessageType>103</MessageType>
        <DestinationAddress>0X760</DestinationAddress>
        <MessagePriority>N</MessagePriority>
    </Block2>
    <Block4>
        <Document
            xmlns="urn:swift:xsd:fin.103.2021">
            <MT103>
                <F20a>
                    <!--line=1-->
                    <F20>136548878</F20>
                </F20a>
                <F23a_1>
                    <!--line=2-->
                    <F23B>CRED</F23B>
                </F23a_1>
            </MT103>
        </Document>
    </Block4>
</FinMessage>

XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" />
    <xsl:template match="/">
        <xsl:value-of select="/FinMessage/Block1/ApplicationIdentifier"/>,
        <xsl:value-of select="/FinMessage/Block4/Document/MT103/F20a/F20"/>
    </xsl:template>
</xsl:stylesheet>

Expected output:

F,136548878

Actual output:

,
Sebastien
  • 2,672
  • 1
  • 8
  • 13
Nijith
  • 69
  • 6

0 Answers0