Not getting data to transform Xml

后端 未结 1 1705
遇见更好的自我
遇见更好的自我 2020-12-22 08:28

I need to transform the following xml :






        
相关标签:
1条回答
  • 2020-12-22 09:18

    You need to declare the namespace in your stylesheet, assign it a prefix, and use the prefix when addressing the document nodes - for example (including some streamlining):

    <xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:pain="urn:iso:std:iso:20022:tech:xsd:pain.002.001.03"
    exclude-result-prefixes="pain">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    
    <xsl:template match="/">
        <root>
            <xsl:for-each select="pain:Document/pain:CstmrPmtStsRpt/pain:GrpHdr">
                <tblGrpHdr1>
                    <HeaderID>
                        <xsl:value-of select="position()"/>
                    </HeaderID>
                    <MsgId>
                        <xsl:value-of select="pain:MsgId"/>
                    </MsgId>
                    <CreDtTm>
                        <xsl:value-of select="pain:CreDtTm"/>
                    </CreDtTm>
                    <BICorBEI>
                        <xsl:value-of select="pain:InitgPty/pain:Id/pain:OrgId/pain:BICorBEI"/>
                    </BICorBEI>
                </tblGrpHdr1>
            </xsl:for-each>
        </root>
    </xsl:template>
    
    </xsl:stylesheet>
    
    0 讨论(0)
提交回复
热议问题