我们需要根据到期日对标签进行分组

时间:2016-08-26 03:27:27

标签: xslt xslt-1.0

嗨,我们要求根据逻辑组参考对成熟日期进行分组。

            <xsl:for-each select="OutboundPayment[count(. | key('contacts-by-LogicalGroupReference', PaymentNumber/LogicalGroupReference/)[1]) = 1]">

我无法理解每个陈述的上述内容。如果我尝试将每个成熟日期与每个日期相结合。我的xml out put进入null

<?xml version="1.0" encoding="UTF-8"?>
<!--  $Header: IBY_SEPA_STR_REM.xsl 120.7.12020000.3 2012/10/23 10:03:59 asarada ship $   --> 
<!--  dbdrv: exec java oracle/apps/xdo/oa/util XDOLoader.class java &phase=dat checkfile:~PROD:patch/115/publisher/templates:IBY_SEPA_STR_REM.xsl UPLOAD -DB_USERNAME &un_apps -DB_PASSWORD &pw_apps -JDBC_CONNECTION &jdbc_db_addr -LOB_TYPE TEMPLATE -APPS_SHORT_NAME IBY -LOB_CODE IBY_SEPA_CREDIT_INIT_TEMPLATE_STR_REM -LANGUAGE en -XDO_FILE_TYPE XSL-XML -FILE_NAME &fullpath:~PROD:patch/115/publisher/templates:IBY_SEPA_STR_REM.xsl -->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="no"/>
    <xsl:output method="xml"/>
    <xsl:key name="contacts-by-LogicalGroupReference" match="OutboundPayment" use="PaymentNumber/LogicalGroupReference" />
    <xsl:template match="OutboundPaymentInstruction">
        <Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <xsl:variable name="instrid" select="PaymentInstructionInfo/InstructionReferenceNumber"/>
            <CstmrCdtTrfInitn> 

                <GrpHdr>
                        <MsgId>
                            <xsl:value-of select="$instrid"/>
                        </MsgId>
                        <CreDtTm>
                            <xsl:value-of select="PaymentInstructionInfo/InstructionCreationDate"/>
                        </CreDtTm>

                        <NbOfTxs>
                            <xsl:value-of select="InstructionTotals/PaymentCount"/>
                        </NbOfTxs>
                            <CtrlSum>
                                <xsl:value-of select="format-number(InstructionTotals/TotalPaymentAmount/Value,'0.00')"/> 
                            </CtrlSum >
                        <InitgPty>
                            <Nm>
                                <xsl:value-of select="InstructionGrouping/Payer/Name"/> 
                            </Nm>
                        </InitgPty>

                </GrpHdr>

                <xsl:for-each select="OutboundPayment[count(. | key('contacts-by-LogicalGroupReference', PaymentNumber/LogicalGroupReference/)[1]) = 1]">
                    <xsl:sort select="PaymentNumber/LogicalGroupReference" />

                    <PmtInf>
                            <PmtInfId>
                                <xsl:value-of select="PaymentNumber/LogicalGroupReference"/>
                            </PmtInfId>

                            <PmtMtd>TRF</PmtMtd>

                            <NbOfTxs>
                                <xsl:value-of select="count(key('contacts-by-LogicalGroupReference', PaymentNumber/LogicalGroupReference))"/>
                            </NbOfTxs>

                            <CtrlSum>
                                <xsl:value-of select="format-number(sum(key('contacts-by-LogicalGroupReference', PaymentNumber/LogicalGroupReference)/PaymentAmount/Value),'0.00')"/> 
                            </CtrlSum>

                            <PmtTpInf> 
                                <InstrPrty>NORM</InstrPrty>
                                <SvcLvl> 
                                    <Cd>SEPA</Cd>
                                </SvcLvl>
                                <LclInstrm>
                                    <Cd>CONF</Cd> 
                                </LclInstrm>
                                <CtgyPurp><Cd>SUPP</Cd></CtgyPurp>
                            </PmtTpInf>

                            <ReqdExctnDt>
                                <xsl:value-of select="MaturityDate"/> <!-- PaymentDate, PaymentDueDate, MaturityDate-->
                            </ReqdExctnDt>

                            <Dbtr>
                                <Nm>
                                    <xsl:value-of select="Payer/Name"/>
                                </Nm>

                                <PstlAdr>
                                    <StrtNm>
                                        <xsl:value-of select="Payer/Address/AddressLine1"/>
                                    </StrtNm> 
                                    <PstCd> 
                                        <xsl:value-of select="Payer/Address/PostalCode"/>                       
                                    </PstCd> 
                                    <TwnNm>
                                        <xsl:value-of select="Payer/Address/City"/>                 
                                    </TwnNm> 
                                    <xsl:if test="not(Payer/Address/State='')">
                                        <CtrySubDvsn>
                                            <xsl:value-of select="Payer/Address/State"/>
                                        </CtrySubDvsn> 
                                    </xsl:if>   
                                    <Ctry>
                                        <xsl:value-of select="Payer/Address/Country"/>
                                    </Ctry>
                                </PstlAdr>
                                <Id>
                                    <OrgId>
                                      <xsl:choose>
                                                <xsl:when test="not(Payer/TaxRegistrationNumber='')">
                                                    <Othr><Id><xsl:value-of select="Payer/TaxRegistrationNumber"/></Id></Othr>
                                                </xsl:when>
                                                <xsl:otherwise>
                                                    <Othr><Id><xsl:value-of select="Payer/LegalEntityRegistrationNumber"/></Id></Othr>
                                                </xsl:otherwise>
                                        </xsl:choose>
                                     </OrgId>
                                </Id>
                            </Dbtr>

                            <DbtrAcct>
                                <Id>
                                    <IBAN>
                                            <xsl:value-of select="BankAccount/IBANNumber"/>
                                    </IBAN>
                                </Id>
                                <Ccy>
                                    <xsl:value-of select="BankAccount/BankAccountCurrency/Code"/>
                                </Ccy>
                            </DbtrAcct>

                            <DbtrAgt>
                                <FinInstnId>
                                    <BIC>
                                        <xsl:value-of select="BankAccount/SwiftCode"/>
                                    </BIC>
                                    <PstlAdr>
                                        <Ctry>ES</Ctry> 
                                    </PstlAdr>
                                </FinInstnId>
                            </DbtrAgt>

                            <xsl:for-each select="key('contacts-by-LogicalGroupReference', PaymentNumber/LogicalGroupReference)">
                                <CdtTrfTxInf>
                                    <xsl:variable name="paymentdetails" select="PaymentDetails"/>
                                    <PmtId>
                                        <InstrId>
                                            <xsl:value-of select="PaymentNumber/PaymentReferenceNumber"/>
                                        </InstrId>
                                        <EndToEndId>
                                            <xsl:value-of select="PaymentNumber/PaymentReferenceNumber"/>
                                        </EndToEndId>
                                    </PmtId>
                                    <Amt>
                                        <InstdAmt>
                                            <xsl:attribute name="Ccy">
                                                <xsl:value-of select="PaymentAmount/Currency/Code"/>
                                            </xsl:attribute>

                                            <xsl:value-of select="format-number(PaymentAmount/Value,'0.00')"/>
                                        </InstdAmt>
                                    </Amt>

                                    <CdtrAgt>
                                        <FinInstnId>
                                            <BIC>
                                                <xsl:value-of select="PayeeBankAccount/SwiftCode"/>
                                            </BIC>
                                            <PstlAdr>
                                                <Ctry>ES</Ctry> 
                                            </PstlAdr>
                                        </FinInstnId>
                                    </CdtrAgt>

                                    <Cdtr>
                                        <Nm>
                                            <xsl:value-of select="Payee/Name"/>
                                        </Nm>

                                        <PstlAdr>
                                            <StrtNm>
                                                <xsl:value-of select="Payee/Address/AddressLine1"/>
                                            </StrtNm> 
                                            <PstCd>
                                                <xsl:value-of select="Payee/Address/PostalCode"/>                       
                                            </PstCd> 
                                            <TwnNm>
                                                <xsl:value-of select="Payee/Address/City"/>                 
                                            </TwnNm> 
                                            <xsl:if test="not(Payee/Address/State='')">
                                                <CtrySubDvsn>
                                                    <xsl:value-of select="Payee/Address/State"/>
                                                </CtrySubDvsn> 
                                            </xsl:if>
                                            <Ctry>
                                                <xsl:value-of select="Payee/Address/Country"/>
                                            </Ctry>
                                        </PstlAdr>
                                        <Id> 
                                            <OrgId>
                                                <xsl:if test="not(Payee/TaxRegistrationNumber='')">
                                                    <Othr><Id><xsl:value-of select="Payee/TaxRegistrationNumber"/></Id></Othr>
                                                </xsl:if>
                                                <xsl:if test="(Payee/TaxRegistrationNumber='')">
                                                    <xsl:if test="not(Payee/LegalEntityRegistrationNumber='')">
                                                        <Othr><Id><xsl:value-of select="Payee/LegalEntityRegistrationNumber"/></Id></Othr>
                                                    </xsl:if>
                                                    <xsl:if test="(Payee/LegalEntityRegistrationNumber='')">
                                                        <xsl:if test="not(Payee/SupplierNumber='')">
                                                            <Othr><Id><xsl:value-of select="Payee/SupplierNumber"/></Id></Othr>
                                                        </xsl:if>
                                                        <xsl:if test="(Payee/SupplierNumber='')">
                                                            <xsl:if test="not(Payee/PartyNumber='')">
                                                                <Othr><Id><xsl:value-of select="Payee/SupplierNumber"/></Id></Othr>
                                                            </xsl:if>
                                                            <xsl:if test="(Payee/PartyNumber='')">
                                                                <Othr><Id><xsl:value-of select="Payee/SupplierNumber"/></Id></Othr>
                                                            </xsl:if>
                                                        </xsl:if>                                              
                                                    </xsl:if>
                                                </xsl:if>
                                            </OrgId>    
                                        </Id>
                                        <xsl:if test="not(Payee/ContactInfo/ContactLocators/EmailAddress='')">
                                            <CtctDtls>
                                                <EmailAdr><xsl:value-of select="Payee/ContactInfo/ContactLocators/EmailAddress"/></EmailAdr> 
                                            </CtctDtls>
                                        </xsl:if>
                                    </Cdtr>

                                    <CdtrAcct>
                                        <Id>
                                            <IBAN>
                                                <xsl:value-of select="PayeeBankAccount/IBANNumber"/>
                                            </IBAN>
                                        </Id>
                                    </CdtrAcct>

                                    <RmtInf>
                                        <xsl:variable name="IssurName" select="Payee/Name"/>
                                        <xsl:for-each select="DocumentPayable">                         
                                            <Strd>  
                                                <RfrdDocInf> 
                                                    <Tp> 
                                                        <CdOrPrtry>
                                                            <Cd>
                                                                <xsl:choose>
                                                                    <xsl:when test="TotalDocumentAmount/Value >= 0">
                                                                        <xsl:text>CINV</xsl:text>
                                                                    </xsl:when>
                                                                    <xsl:otherwise>
                                                                        <xsl:text>CREN</xsl:text>
                                                                    </xsl:otherwise>
                                                                </xsl:choose>
                                                            </Cd>
                                                        </CdOrPrtry>
                                                    </Tp>
                                                    <Nb>
                                                        <xsl:value-of select="DocumentNumber/ReferenceNumber"/>
                                                    </Nb>
                                                    <RltdDt>
                                                        <xsl:value-of select="DocumentDate"/>
                                                    </RltdDt>
                                                </RfrdDocInf>
                                                <RfrdDocAmt>
                                                    <xsl:choose>
                                                        <xsl:when test="TotalDocumentAmount/Value >= 0">
                                                            <DuePyblAmt>
                                                                <xsl:attribute name="Ccy">
                                                                    <xsl:value-of select="TotalDocumentAmount/Currency/Code"/>
                                                                </xsl:attribute>
                                                                <xsl:value-of select="format-number(TotalDocumentAmount/Value,'0.00')"/>    
                                                            </DuePyblAmt>
                                                        </xsl:when>
                                                        <xsl:otherwise>
                                                            <CdtNoteAmt>
                                                                <xsl:attribute name="Ccy">
                                                                    <xsl:value-of select="TotalDocumentAmount/Currency/Code"/>
                                                                </xsl:attribute>
                                                                <xsl:value-of select="format-number((-1 * TotalDocumentAmount/Value),'0.00')"/>
                                                            </CdtNoteAmt>
                                                        </xsl:otherwise>
                                                    </xsl:choose>                                                   
                                                </RfrdDocAmt>
                                            </Strd>
                                        </xsl:for-each>                                          
                                    </RmtInf>
                                </CdtTrfTxInf>
                            </xsl:for-each>                         
                    </PmtInf>               
                </xsl:for-each>
            </CstmrCdtTrfInitn>
        </Document>
    </xsl:template>
</xsl:stylesheet>

0 个答案:

没有答案
相关问题