在JD Edwards报告中,XSL转换失败,XML输出格式不正确

时间:2016-04-29 22:11:28

标签: xml xslt jdedwards enterpriseone

我需要在JD Edwards for EDI中转换自定义发票程序的输出。报告中出现的XML数据形成不良,我正在努力重组数据以满足EDI要求。我是XSL的新手,所以我一直在通过反复试验来得出结果。

我面临的挑战之一是报告没有正确构建数据。发票行不是发票标题的正确后代,如下面的XML输入中所示。我让开发人员在每个部分添加发票号,希望我能够根据该发票号重组数据。

我的问题是,如何更改XSL样式表代码以使输出与我想要的结果匹配,从而创建正确的父/子/兄弟结构?

这是XML输入:

<R5942015>
    <Main___F4211_F42119_S1>
        <Header_S2>
            <ShipDate_ID11>2016-04-06</ShipDate_ID11>
            <CustomerNumber_ID92>10779</CustomerNumber_ID92>
            <InvoiceDate_ID107>2016-04-07</InvoiceDate_ID107>
            <DealerNumber_ID6>44014104</DealerNumber_ID6>
            <ShipmentNumber_ID70>169638</ShipmentNumber_ID70>
            <InvoiceNumber_ID62>8729266</InvoiceNumber_ID62>
        </Header_S2>
    </Main___F4211_F42119_S1>
    <Main___F4211_F42119_S1>
        <Line_Info_S4>
            <AckLineNumber_D_ID1>13</AckLineNumber_D_ID1>
            <LineExtendedPrice_D_ID8>1230.00</LineExtendedPrice_D_ID8>
            <_nd_Item_Number_D_ID3>010799</_nd_Item_Number_D_ID3>
            <DisplayInvoiceNumber_ID42>8729266</DisplayInvoiceNumber_ID42>
            <LineQuantityShipped_D_ID35>2</LineQuantityShipped_D_ID35>
            <AckLine_Freight_ID21>54.78</AckLine_Freight_ID21>
        </Line_Info_S4>
        <Summary_Info_S8>
            <AckExtendedPrice_T_ID2>1230.00</AckExtendedPrice_T_ID2>
            <Freight_T_ID6>54.78</Freight_T_ID6>
            <GrandTotal_T_ID17>1284.78</GrandTotal_T_ID17>
            <DisplayInvoiceNumber_ID39>8729266</DisplayInvoiceNumber_ID39>
        </Summary_Info_S8>
        <Remit_To_S11>
            <Invoice_No__ID19>Invoice No:</Invoice_No__ID19>
            <DisplayInvoiceNumber_ID18>8729266</DisplayInvoiceNumber_ID18>
            <Service_Charge_Message_ID14>Service charge message...</Service_Charge_Message_ID14>
        </Remit_To_S11>
        <Header_S2>
            <ShipDate_ID11>2016-04-06</ShipDate_ID11>
            <CustomerNumber_ID92>11005</CustomerNumber_ID92>
            <InvoiceDate_ID107>2016-04-07</InvoiceDate_ID107>
            <DealerNumber_ID6>50857355</DealerNumber_ID6>
            <ShipmentNumber_ID70>169638</ShipmentNumber_ID70>
            <InvoiceNumber_ID62>8729267</InvoiceNumber_ID62>
        </Header_S2>
    </Main___F4211_F42119_S1>
    <Main___F4211_F42119_S1>
        <Line_Info_S4>
            <AckLineNumber_D_ID1>3</AckLineNumber_D_ID1>
            <LineExtendedPrice_D_ID8>665.00</LineExtendedPrice_D_ID8>
            <_nd_Item_Number_D_ID3>010512</_nd_Item_Number_D_ID3>
            <DisplayInvoiceNumber_ID42>8729267</DisplayInvoiceNumber_ID42>
            <LineQuantityShipped_D_ID35>1</LineQuantityShipped_D_ID35>
            <AckLine_Freight_ID21>22.64</AckLine_Freight_ID21>
        </Line_Info_S4>
    </Main___F4211_F42119_S1>
    <Main___F4211_F42119_S1>
        <Line_Info_S4>
            <AckLineNumber_D_ID1>4</AckLineNumber_D_ID1>
            <LineExtendedPrice_D_ID8>665.00</LineExtendedPrice_D_ID8>
            <_nd_Item_Number_D_ID3>010512</_nd_Item_Number_D_ID3>
            <DisplayInvoiceNumber_ID42>8729267</DisplayInvoiceNumber_ID42>
            <LineQuantityShipped_D_ID35>1</LineQuantityShipped_D_ID35>
            <AckLine_Freight_ID21>22.64</AckLine_Freight_ID21>
        </Line_Info_S4>
    </Main___F4211_F42119_S1>
    <Main___F4211_F42119_S1>
        <Line_Info_S4>
            <AckLineNumber_D_ID1>5</AckLineNumber_D_ID1>
            <LineExtendedPrice_D_ID8>715.00</LineExtendedPrice_D_ID8>
            <_nd_Item_Number_D_ID3>010512</_nd_Item_Number_D_ID3>
            <DisplayInvoiceNumber_ID42>8729267</DisplayInvoiceNumber_ID42>
            <LineQuantityShipped_D_ID35>1</LineQuantityShipped_D_ID35>
            <AckLine_Freight_ID21>22.64</AckLine_Freight_ID21>
        </Line_Info_S4>
    </Main___F4211_F42119_S1>
    <Main___F4211_F42119_S1>
        <Line_Info_S4>
            <AckLineNumber_D_ID1>11</AckLineNumber_D_ID1>
            <LineExtendedPrice_D_ID8>665.00</LineExtendedPrice_D_ID8>
            <_nd_Item_Number_D_ID3>010512</_nd_Item_Number_D_ID3>
            <DisplayInvoiceNumber_ID42>8729267</DisplayInvoiceNumber_ID42>
            <LineQuantityShipped_D_ID35>1</LineQuantityShipped_D_ID35>
            <AckLine_Freight_ID21>22.64</AckLine_Freight_ID21>
        </Line_Info_S4>
    </Main___F4211_F42119_S1>
    <Main___F4211_F42119_S1>
        <Line_Info_S4>
            <AckLineNumber_D_ID1>21</AckLineNumber_D_ID1>
            <LineExtendedPrice_D_ID8>630.00</LineExtendedPrice_D_ID8>
            <_nd_Item_Number_D_ID3>016799</_nd_Item_Number_D_ID3>
            <DisplayInvoiceNumber_ID42>8729267</DisplayInvoiceNumber_ID42>
            <LineQuantityShipped_D_ID35>1</LineQuantityShipped_D_ID35>
            <AckLine_Freight_ID21>22.64</AckLine_Freight_ID21>
        </Line_Info_S4>
    </Main___F4211_F42119_S1>
    <Main___F4211_F42119_S1>
        <Line_Info_S4>
            <AckLineNumber_D_ID1>23</AckLineNumber_D_ID1>
            <LineExtendedPrice_D_ID8>600.00</LineExtendedPrice_D_ID8>
            <_nd_Item_Number_D_ID3>010765</_nd_Item_Number_D_ID3>
            <DisplayInvoiceNumber_ID42>8729267</DisplayInvoiceNumber_ID42>
            <LineQuantityShipped_D_ID35>1</LineQuantityShipped_D_ID35>
            <AckLine_Freight_ID21>22.64</AckLine_Freight_ID21>
        </Line_Info_S4>
    </Main___F4211_F42119_S1>
    <Main___F4211_F42119_S1>
        <Line_Info_S4>
            <AckLineNumber_D_ID1>24</AckLineNumber_D_ID1>
            <LineExtendedPrice_D_ID8>715.00</LineExtendedPrice_D_ID8>
            <_nd_Item_Number_D_ID3>P10512</_nd_Item_Number_D_ID3>
            <DisplayInvoiceNumber_ID42>8729267</DisplayInvoiceNumber_ID42>
            <LineQuantityShipped_D_ID35>1</LineQuantityShipped_D_ID35>
            <AckLine_Freight_ID21>22.64</AckLine_Freight_ID21>
        </Line_Info_S4>
    </Main___F4211_F42119_S1>
    <Main___F4211_F42119_S1>
        <Line_Info_S4>
            <AckLineNumber_D_ID1>62</AckLineNumber_D_ID1>
            <LineExtendedPrice_D_ID8>630.00</LineExtendedPrice_D_ID8>
            <_nd_Item_Number_D_ID3>016799</_nd_Item_Number_D_ID3>
            <DisplayInvoiceNumber_ID42>8729267</DisplayInvoiceNumber_ID42>
            <LineQuantityShipped_D_ID35>1</LineQuantityShipped_D_ID35>
            <AckLine_Freight_ID21>22.64</AckLine_Freight_ID21>
        </Line_Info_S4>
        <Summary_Info_S8>
            <AckExtendedPrice_T_ID2>5285.00</AckExtendedPrice_T_ID2>
            <Freight_T_ID6>181.12</Freight_T_ID6>
            <GrandTotal_T_ID17>5466.12</GrandTotal_T_ID17>
            <DisplayInvoiceNumber_ID39>8729267</DisplayInvoiceNumber_ID39>
        </Summary_Info_S8>
        <Remit_To_S11>
            <Invoice_No__ID19>Invoice No:</Invoice_No__ID19>
            <DisplayInvoiceNumber_ID18>8729267</DisplayInvoiceNumber_ID18>
            <Service_Charge_Message_ID14>Service charge message...</Service_Charge_Message_ID14>
        </Remit_To_S11>
    </Main___F4211_F42119_S1>
</R5942015>

这是EDI的理想输出:

<R5942015>
    <Invoices>
        <InvNumber>8729266</InvNumber>
        <InvoiceDate>2016-04-07</InvoiceDate>
        <ShipmentNumber>169638</ShipmentNumber>
        <ShipDate>2016-04-06</ShipDate>
        <CustomerNumber>10779</CustomerNumber>
        <DealerNumber>44014104</DealerNumber>
        <line>
            <ITEMLineNumber>13</ITEMLineNumber>
            <ITEM2ndItemNumber>010799</ITEM2ndItemNumber>
            <QTYShipped>2</QTYShipped>
            <AMTLineExtendedPrice>1230.00</AMTLineExtendedPrice>
            <AMTLandedFreight>54.78</AMTLandedFreight>
        </line>
        <summary>
            <QTYOrdered>2</QTYOrdered>
            <QTYShipped>2</QTYShipped>
            <AMTLandedFreight>54.78</AMTLandedFreight>
            <AMTExtendedPrice>1230.00</AMTExtendedPrice>
            <AMTGrandTotal>1284.78</AMTGrandTotal>
        </summary>
        <messages>
            <MSGServiceCharge>Service charge message...</MSGServiceCharge>
        </messages>
    </Invoices>
    <Invoices>
        <InvNumber>8729267</InvNumber>
        <InvoiceDate>2016-04-07</InvoiceDate>
        <ShipmentNumber>169638</ShipmentNumber>
        <ShipDate>2016-04-06</ShipDate>
        <CustomerNumber>11005</CustomerNumber>
        <DealerNumber>50857355</DealerNumber>
        <line>
            <ITEMLineNumber>3</ITEMLineNumber>
            <ITEM2ndItemNumber>010512</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>665.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>4</ITEMLineNumber>
            <ITEM2ndItemNumber>010512</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>665.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>5</ITEMLineNumber>
            <ITEM2ndItemNumber>010512</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>715.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>11</ITEMLineNumber>
            <ITEM2ndItemNumber>010512</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>665.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>21</ITEMLineNumber>
            <ITEM2ndItemNumber>016799</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>630.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>23</ITEMLineNumber>
            <ITEM2ndItemNumber>010765</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>600.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>24</ITEMLineNumber>
            <ITEM2ndItemNumber>P10512</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>715.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>62</ITEMLineNumber>
            <ITEM2ndItemNumber>016799</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>630.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <summary>
            <QTYOrdered>8</QTYOrdered>
            <QTYShipped>8</QTYShipped>
            <AMTLandedFreight>181.12</AMTLandedFreight>
            <AMTExtendedPrice>5285.00</AMTExtendedPrice>
            <AMTGrandTotal>5466.12</AMTGrandTotal>
        </summary>
        <messages>
            <MSGServiceCharge>Service charge message...</MSGServiceCharge>
        </messages>
    </Invoices>
</R5942015>

这是我在XSL样式表运行时实际获得的内容。第一张发票的详细信息行,摘要和消息实际显示在第二张发票的标题之后。

<R5942015>
    <Invoices>
        <InvNumber>8729266</InvNumber>
        <InvoiceDate>2016-04-07</InvoiceDate>
        <ShipmentNumber>169638</ShipmentNumber>
        <ShipDate>2016-04-06</ShipDate>
        <CustomerNumber>10779</CustomerNumber>
        <DealerNumber>44014104</DealerNumber>
    </Invoices>
    <Invoices>
        <InvNumber>8729267</InvNumber>
        <InvoiceDate>2016-04-07</InvoiceDate>
        <ShipmentNumber>169638</ShipmentNumber>
        <ShipDate>2016-04-06</ShipDate>
        <CustomerNumber>11005</CustomerNumber>
        <DealerNumber>50857355</DealerNumber>
        <line>
            <ITEMLineNumber>13</ITEMLineNumber>
            <ITEM2ndItemNumber>010799</ITEM2ndItemNumber>
            <QTYShipped>2</QTYShipped>
            <AMTLineExtendedPrice>1230.00</AMTLineExtendedPrice>
        </line>
        <summary>
            <QTYOrdered>2</QTYOrdered>
            <QTYShipped>2</QTYShipped>
            <AMTExtendedPrice>1230.00</AMTExtendedPrice>
            <AMTGrandTotal>1284.78</AMTGrandTotal>
        </summary>
        <messages>
            <MSGServiceCharge>Service charge message...</MSGServiceCharge>
        </messages>
        <line>
            <ITEMLineNumber>3</ITEMLineNumber>
            <ITEM2ndItemNumber>010512</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>665.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>4</ITEMLineNumber>
            <ITEM2ndItemNumber>010512</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>665.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>5</ITEMLineNumber>
            <ITEM2ndItemNumber>010512</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>715.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>11</ITEMLineNumber>
            <ITEM2ndItemNumber>010512</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>665.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>21</ITEMLineNumber>
            <ITEM2ndItemNumber>016799</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>630.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>23</ITEMLineNumber>
            <ITEM2ndItemNumber>010765</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>600.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
        <line>
            <ITEMLineNumber>24</ITEMLineNumber>
            <ITEM2ndItemNumber>P10512</ITEM2ndItemNumber>
            <QTYShipped>1</QTYShipped>
            <AMTLineExtendedPrice>715.00</AMTLineExtendedPrice>
            <AMTLandedFreight>22.64</AMTLandedFreight>
        </line>
    </Invoices>
    <Invoices>
        <summary>
            <QTYOrdered>8</QTYOrdered>
            <QTYShipped>8</QTYShipped>
            <AMTExtendedPrice>5285.00</AMTExtendedPrice>
            <AMTGrandTotal>5466.12</AMTGrandTotal>
        </summary>
        <messages>
            <MSGServiceCharge>Service charge message...</MSGServiceCharge>
        </messages>
     </Invoices>  
</R5942015>    

这就是我为样式表提出的,试图绕过格式不佳的XML。再次,XSL的新手,所以请放轻松:

<xsl:stylesheet version="2.0"
                xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
                xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
                xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ora="http://schemas.oracle.com/xpath/extension"
                xmlns:ehdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
                xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
                xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
                xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
                exclude-result-prefixes="xsl xs msdata xref xp20 bpws ora ehdr orcl ids hwf">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

    <xsl:template match="/R5942015"> 
        <xsl:copy>
            <xsl:for-each-group select="Main___F4211_F42119_S1" group-starting-with="Main___F4211_F42119_S1[Header_S2]">
            <Invoices>
                    <xsl:apply-templates select="current-group()"/>
            </Invoices>
            </xsl:for-each-group>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="Main___F4211_F42119_S1[Header_S2]">
            <xsl:if test="Header_S2/InvoiceNumber_ID62"><InvNumber><xsl:value-of select="Header_S2/InvoiceNumber_ID62"/></InvNumber></xsl:if>
            <xsl:if test="Header_S2/InvoiceDate_ID107"><InvoiceDate><xsl:value-of select="Header_S2/InvoiceDate_ID107"/></InvoiceDate></xsl:if>
            <xsl:if test="Header_S2/ShipmentNumber_ID70"><ShipmentNumber><xsl:value-of select="Header_S2/ShipmentNumber_ID70"/></ShipmentNumber></xsl:if>
            <xsl:if test="Header_S2/ShipDate_ID11"><ShipDate><xsl:value-of select="Header_S2/ShipDate_ID11"/></ShipDate></xsl:if>
            <xsl:if test="Header_S2/CustomerNumber_ID92"><CustomerNumber><xsl:value-of select="Header_S2/CustomerNumber_ID92"/></CustomerNumber></xsl:if>
            <xsl:if test="Header_S2/DealerNumber_ID6"><DealerNumber><xsl:value-of select="Header_S2/DealerNumber_ID6"/></DealerNumber></xsl:if>
            <xsl:if test="Line_Info_S4"><line>
                <xsl:if test="Line_Info_S4/AckLineNumber_D_ID1"><ITEMLineNumber><xsl:value-of select="Line_Info_S4/AckLineNumber_D_ID1"/></ITEMLineNumber></xsl:if>
                <xsl:if test="Line_Info_S4/_nd_Item_Number_D_ID3"><ITEM2ndItemNumber><xsl:value-of select="Line_Info_S4/_nd_Item_Number_D_ID3"/></ITEM2ndItemNumber></xsl:if>
                <xsl:if test="Line_Info_S4/LineQuantityShipped_D_ID35"><QTYShipped><xsl:value-of select="Line_Info_S4/LineQuantityShipped_D_ID35"/></QTYShipped></xsl:if>
                <xsl:if test="Line_Info_S4/LineExtendedPrice_D_ID8"><AMTLineExtendedPrice><xsl:value-of select="Line_Info_S4/LineExtendedPrice_D_ID8"/></AMTLineExtendedPrice></xsl:if>
                <xsl:if test="Line_Info_S4/AckLine_Freight_ID21"><AMTLandedFreight><xsl:value-of select="Line_Info_S4/AckLine_Freight_ID21"/></AMTLandedFreight></xsl:if>
            </line></xsl:if>
            <xsl:if test="Summary_Info_S8"><summary>
                <xsl:if test="Summary_Info_S8/AckQuantity_T_ID10"><QTYOrdered><xsl:value-of select="Summary_Info_S8/AckQuantity_T_ID10"/></QTYOrdered></xsl:if>
                <xsl:if test="Summary_Info_S8/QuantityShipped_T_ID13"><QTYShipped><xsl:value-of select="Summary_Info_S8/QuantityShipped_T_ID13"/></QTYShipped></xsl:if>
                <xsl:if test="Summary_Info_S8/LandedFreight_T_ID6"><AMTLandedFreight><xsl:value-of select="Summary_Info_S8/LandedFreight_T_ID6"/></AMTLandedFreight></xsl:if>
                <xsl:if test="Summary_Info_S8/AckExtendedPrice_T_ID2"><AMTExtendedPrice><xsl:value-of select="Summary_Info_S8/AckExtendedPrice_T_ID2"/></AMTExtendedPrice></xsl:if>
                <xsl:if test="Summary_Info_S8/GrandTotal_T_ID17"><AMTGrandTotal><xsl:value-of select="Summary_Info_S8/GrandTotal_T_ID17"/></AMTGrandTotal></xsl:if>
            </summary></xsl:if>
            <xsl:if test="Remit_To_S11"><messages>
                <xsl:if test="Remit_To_S11/Service_Charge_Message_ID14"><MSGServiceCharge><xsl:value-of select="Remit_To_S11/Service_Charge_Message_ID14"/></MSGServiceCharge></xsl:if>
            </messages></xsl:if>
    </xsl:template>

    <xsl:template match="Main___F4211_F42119_S1">
            <xsl:if test="Line_Info_S4"><line>
                <xsl:if test="Line_Info_S4/AckLineNumber_D_ID1"><ITEMLineNumber><xsl:value-of select="Line_Info_S4/AckLineNumber_D_ID1"/></ITEMLineNumber></xsl:if>
                <xsl:if test="Line_Info_S4/_nd_Item_Number_D_ID3"><ITEM2ndItemNumber><xsl:value-of select="Line_Info_S4/_nd_Item_Number_D_ID3"/></ITEM2ndItemNumber></xsl:if>
                <xsl:if test="Line_Info_S4/LineQuantityOrdered_D_ID10"><QTYOrdered><xsl:value-of select="Line_Info_S4/LineQuantityOrdered_D_ID10"/></QTYOrdered></xsl:if>
                <xsl:if test="Line_Info_S4/LineQuantityShipped_D_ID35"><QTYShipped><xsl:value-of select="Line_Info_S4/LineQuantityShipped_D_ID35"/></QTYShipped></xsl:if>
                <xsl:if test="Line_Info_S4/LineExtendedPrice_D_ID8"><AMTLineExtendedPrice><xsl:value-of select="Line_Info_S4/LineExtendedPrice_D_ID8"/></AMTLineExtendedPrice></xsl:if>
                <xsl:if test="Line_Info_S4/AckLine_Freight_ID21"><AMTLandedFreight><xsl:value-of select="Line_Info_S4/AckLine_Freight_ID21"/></AMTLandedFreight></xsl:if>
            </line></xsl:if>
            <xsl:if test="Summary_Info_S8"><summary>
                <xsl:if test="Summary_Info_S8/AckQuantity_T_ID10"><QTYOrdered><xsl:value-of select="Summary_Info_S8/AckQuantity_T_ID10"/></QTYOrdered></xsl:if>
                <xsl:if test="Summary_Info_S8/QuantityShipped_T_ID13"><QTYShipped><xsl:value-of select="Summary_Info_S8/QuantityShipped_T_ID13"/></QTYShipped></xsl:if>
                <xsl:if test="Summary_Info_S8/LandedFreight_T_ID6"><AMTLandedFreight><xsl:value-of select="Summary_Info_S8/LandedFreight_T_ID6"/></AMTLandedFreight></xsl:if>
                <xsl:if test="Summary_Info_S8/AckExtendedPrice_T_ID2"><AMTExtendedPrice><xsl:value-of select="Summary_Info_S8/AckExtendedPrice_T_ID2"/></AMTExtendedPrice></xsl:if>
                <xsl:if test="Summary_Info_S8/GrandTotal_T_ID17"><AMTGrandTotal><xsl:value-of select="Summary_Info_S8/GrandTotal_T_ID17"/></AMTGrandTotal></xsl:if>
            </summary></xsl:if>
            <xsl:if test="Header_S2">
            <xsl:if test="Header_S2/InvoiceNumber_ID62"><InvNumber><xsl:value-of select="Header_S2/InvoiceNumber_ID62"/></InvNumber></xsl:if>
            <xsl:if test="Header_S2/InvoiceDate_ID107"><InvoiceDate><xsl:value-of select="Header_S2/InvoiceDate_ID107"/></InvoiceDate></xsl:if>
            <xsl:if test="Header_S2/ShipmentNumber_ID70"><ShipmentNumber><xsl:value-of select="Header_S2/ShipmentNumber_ID70"/></ShipmentNumber></xsl:if>
            <xsl:if test="Header_S2/ShipDate_ID11"><ShipDate><xsl:value-of select="Header_S2/ShipDate_ID11"/></ShipDate></xsl:if>
            <xsl:if test="Header_S2/CustomerNumber_ID92"><CustomerNumber><xsl:value-of select="Header_S2/CustomerNumber_ID92"/></CustomerNumber></xsl:if>
            <xsl:if test="Header_S2/DealerNumber_ID6"><DealerNumber><xsl:value-of select="Header_S2/DealerNumber_ID6"/></DealerNumber></xsl:if>
            <xsl:if test="Remit_To_S11"><messages>
                <xsl:if test="Remit_To_S11/Service_Charge_Message_ID14"><MSGServiceCharge><xsl:value-of select="Remit_To_S11/Service_Charge_Message_ID14"/></MSGServiceCharge></xsl:if>
            </messages></xsl:if>
    </xsl:template>
</xsl:stylesheet>

感谢您阅读此问题。如果你看到我之前关于同一主题的问题,我为这个问题的不良结构道歉。

1 个答案:

答案 0 :(得分:1)

我无法遵循您尝试的XSLT的逻辑。我建议你尝试一种不同的方法 - 这是一个骨架的例子:

my_object.wait.connection()
  .then(() => done(1))
  .catch(() => done());

我在这里假设元素的名称是一致的,并且不会随意地从一个输入改变到另一个输入。