我在 xslt 中分组的 MUENCHIAN 方法是否遗漏了什么?

Is my MUENCHIAN METHOD of grouping in xslt missing something?

抱歉,我对 XSLT 分组很陌生。我一直在为我的其他界面使用 XSLT,我不确定为什么它在映射后没有生成目标输出。

XSL 映射

<?xml version='1.0'?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="items" match="Line_Items" use="Orders" />
<xsl:template match="Orders">
    <XmlInterchange xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.edi.com.au/EnterpriseService/">
        <InterchangeInfo>
            <Source>
                <EnterpriseCode>AWH</EnterpriseCode>
                <CompanyCode>ADL</CompanyCode>
                <OriginServer>ADL</OriginServer>
            </Source>
            <Target />
            <EDIOrganisation EDICode="AWHLOG_AU" OwnerCode="AWHLOG_AU">
                <OrganisationDetails>
                    <Name>AWH LOGISTICS</Name>
                    <Location Country="Australia" City="Adelaide">AUADL</Location>
                    <Addresses>
                        <Address AddressType="MAIN">
                            <AddressLine1>Gillman Wool Complex</AddressLine1>
                            <AddressLine2>GRAND TRUNKWAY,</AddressLine2>
                            <AddressCode>Gillman Wool Complex</AddressCode>
                            <CityOrSuburb>GILLMAN</CityOrSuburb>
                            <StateOrProvince>SA</StateOrProvince>
                            <PostCode>5013</PostCode>
                            <TelephoneNumbers>
                                <TelephoneNumber NumberType="Business">+618 8240 8400</TelephoneNumber>
                                <TelephoneNumber NumberType="Fax">+618 8240 0080</TelephoneNumber>
                            </TelephoneNumbers>
                            <Email>containers@awh.com.au</Email>
                            <Language>ENG</Language>
                            <Location>AUADL</Location>
                            <Sequence>1</Sequence>
                            <AddressCapabilities>
                                <AddressCapability AddressType="MAIN" />
                                <AddressCapability IsMainAddress="true" AddressType="OFC" />
                                <AddressCapability IsMainAddress="true" AddressType="PAD" />
                            </AddressCapabilities>
                        </Address>
                    </Addresses>
                </OrganisationDetails>
            </EDIOrganisation>
        </InterchangeInfo>
        <Payload>
            <WhsDockets>
                <xsl:for-each select="Line_Items[generate-id() = generate-id(key('items',Order)[1])]">
                    <WhsDocket>
                        <Identifier>
                            <Client EDICode="COCCOLBNE" OwnerCode="COCCOLBNE">
                                <OrganisationDetails>
                                    <Name>COCA-COLA AMATIL (AUST) PTY LTD</Name>
                                    <Location Country="Australia" City="Brisbane">AUBNE</Location>
                                    <Addresses>
                                        <Address AddressType="MAIN">
                                            <AddressLine1>260 ORCHARD ROAD</AddressLine1>
                                            <AddressCode>MANUFACTURING - ATO 12175</AddressCode>
                                            <CityOrSuburb>RICHLANDS</CityOrSuburb>
                                            <StateOrProvince>QLD</StateOrProvince>
                                            <PostCode>4077</PostCode>
                                            <TelephoneNumbers>
                                                <TelephoneNumber NumberType="Business">+61 (7) 3248-2686</TelephoneNumber>
                                            </TelephoneNumbers>
                                            <Language>ENG</Language>
                                            <Location>AUBNE</Location>
                                            <Sequence>1</Sequence>
                                            <AddressCapabilities>
                                                <AddressCapability AddressType="MAIN" />
                                                <AddressCapability IsMainAddress="true" AddressType="OFC" />
                                                <AddressCapability IsMainAddress="false" AddressType="PAD" />
                                            </AddressCapabilities>
                                        </Address>
                                    </Addresses>
                                    <Contacts>
                                        <Contact>
                                            <Name>Abbas Ansari</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-11-19T13:13:00+11:00</WebContractSignDate>
                                            <EmailAddress>abbas.ansari@ccamatil.com</EmailAddress>
                                            <Sequence>1</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Abel Amiga</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <JobTitle>ULink Account</JobTitle>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2015-03-03T09:23:00+11:00</WebContractSignDate>
                                            <EmailAddress>abel.amiga@ccamatil.com</EmailAddress>
                                            <Sequence>2</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Accounts / Hazel Turton</Name>
                                            <Salutation>Hazel Turton</Salutation>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>cca.au.supplierinvoices@decipha.com.au</EmailAddress>
                                            <Sequence>3</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Anneka Crebbin</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <JobTitle>ULink Account</JobTitle>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-08-11T10:07:00+10:00</WebContractSignDate>
                                            <EmailAddress>annekacrebbin@awh.com.au</EmailAddress>
                                            <Sequence>4</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Beau Dymond</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-12-12T15:32:00+11:00</WebContractSignDate>
                                            <EmailAddress>beau.dymond@ccamatil.com</EmailAddress>
                                            <Sequence>5</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Catherine Orchard</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>catherine.orchard@ccamatil.com</EmailAddress>
                                            <Sequence>6</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Drew Wilson</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>drew.wilson@ccamatil.com</EmailAddress>
                                            <Sequence>7</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Eddie Foote</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>eddie.foote@ccamatil.com</EmailAddress>
                                            <Sequence>8</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Fiona Peterson</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>fiona.peterson@ccamatil.com</EmailAddress>
                                            <Sequence>9</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Gordon Mills</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-12-11T10:33:00+11:00</WebContractSignDate>
                                            <EmailAddress>gordon.mills@ccamatil.com</EmailAddress>
                                            <Sequence>10</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Graeme Wood</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <JobTitle>ULink Account</JobTitle>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>graemewood@awh.com.au</EmailAddress>
                                            <Sequence>11</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Grant Bourke</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2015-06-09T12:50:00+10:00</WebContractSignDate>
                                            <EmailAddress>grant.bourke@ccamatil.com</EmailAddress>
                                            <Sequence>12</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Hazel Turton</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>hazel.turton@ccamatil.com</EmailAddress>
                                            <Sequence>13</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Jodi Poyser</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <JobTitle>ULink Account</JobTitle>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-04-23T12:20:00+10:00</WebContractSignDate>
                                            <EmailAddress>jodi@awh.com.au</EmailAddress>
                                            <Sequence>14</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>John Payne</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <JobTitle>ULink Account</JobTitle>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-09-18T14:26:00+10:00</WebContractSignDate>
                                            <EmailAddress>johnpayne@awh.com.au</EmailAddress>
                                            <Sequence>15</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Julie Llewellyn</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>julie.llewellyn@ccamatil.com</EmailAddress>
                                            <Sequence>16</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Kathleen King</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>kathleen.king@ccamatil.com</EmailAddress>
                                            <Sequence>17</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Malka Caballero</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>malka.caballero@ccamatil.com</EmailAddress>
                                            <Sequence>18</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Matthew Davies</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>matthew.davies@ccamatil.com</EmailAddress>
                                            <Sequence>19</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Matthew Hall</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>mat.hall@ccamatil.com</EmailAddress>
                                            <Sequence>20</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Paul Aleixo</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <JobTitle>ULink Account</JobTitle>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>paul.aleixo@ccamatil.com</EmailAddress>
                                            <Sequence>21</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Rhyss Foote</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-11-20T13:12:00+11:00</WebContractSignDate>
                                            <EmailAddress>rhyss.foote@ccamatil.com</EmailAddress>
                                            <Sequence>22</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Ryan Clarke</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <JobTitle>ULink Account</JobTitle>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-11-20T10:56:00+11:00</WebContractSignDate>
                                            <EmailAddress>ryanclarke@awh.com.au</EmailAddress>
                                            <Sequence>23</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Sean Bradley</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>sean.bradley@ccamatil.com</EmailAddress>
                                            <Sequence>24</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Sean Dalton</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>sean.dalton@ccamatil.com</EmailAddress>
                                            <Sequence>25</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Steven Sheather</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>steven.sheather@ccamatil.com</EmailAddress>
                                            <Sequence>26</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Stuart Jordin</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-11-21T07:48:00+11:00</WebContractSignDate>
                                            <EmailAddress>stuart.jordin@ccamatil.com</EmailAddress>
                                            <Sequence>27</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Tayla Bush</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <JobTitle>ULink Account</JobTitle>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-11-26T15:28:00+11:00</WebContractSignDate>
                                            <EmailAddress>taylabush@awh.com.au</EmailAddress>
                                            <Sequence>28</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Tim Schenk</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <JobTitle>IT</JobTitle>
                                            <Mobile>+61 (400) 065-650</Mobile>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-10-22T13:24:00+11:00</WebContractSignDate>
                                            <EmailAddress>tim.schenk@ccamatil.com</EmailAddress>
                                            <Sequence>29</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Timothy Ballard</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <WebContractSignDate>2014-12-16T16:20:00+11:00</WebContractSignDate>
                                            <EmailAddress>timothy.ballard@ccamatil.com</EmailAddress>
                                            <Sequence>30</Sequence>
                                        </Contact>
                                        <Contact>
                                            <Name>Trevor Horrigan</Name>
                                            <Language>ENG</Language>
                                            <NotifyMode>EML</NotifyMode>
                                            <AttachmentType>PDF</AttachmentType>
                                            <EmailAddress>trevor.horrigan@ccamatil.com</EmailAddress>
                                            <Sequence>31</Sequence>
                                        </Contact>
                                    </Contacts>
                                    <RegistrationNumbers>
                                        <RegistrationNumber>
                                            <CountryOfRegistration>AU</CountryOfRegistration>
                                            <NumberType>ABN</NumberType>
                                            <Number>26 004 139 397</Number>
                                        </RegistrationNumber>
                                        <RegistrationNumber>
                                            <CountryOfRegistration>AU</CountryOfRegistration>
                                            <NumberType>LSC</NumberType>
                                            <Number>20787</Number>
                                        </RegistrationNumber>
                                        <RegistrationNumber>
                                            <CountryOfRegistration>AU</CountryOfRegistration>
                                            <NumberType>GST</NumberType>
                                            <Number>26 004 139 397</Number>
                                        </RegistrationNumber>
                                    </RegistrationNumbers>
                                </OrganisationDetails>
                            </Client>
                            <Reference>
                                <xsl:value-of select="Order" />
                            </Reference>
                            <DocketType>WOH</DocketType>
                            <ActionType>CON</ActionType>
                        </Identifier>
                        <DocketDetail>
                            <WarehouseCode>ROC</WarehouseCode>
                            <CustomerReference>
                                <xsl:value-of select="Order"/>
                            </CustomerReference>
                            <CustomerOrderDetail>
                                <OrderType>ORD</OrderType>
                                <DateRequired>
                                    <xsl:value-of select="DateRequired"/>
                                </DateRequired>
                                <xsl:choose>
                                    <xsl:when test="substring(External_ID, 3,2) = 'BC'">
                                        <Consignee AddressType="CEA">
                                            <AddressReference>
                                                <AddressSequenceRef>1</AddressSequenceRef>
                                                <Organisation EDICode="GHPLHEA" OwnerCode="GHPLHEA">
                                                    <OrganisationDetails>
                                                        <Name>GHPL</Name>
                                                        <Location Country="Australia" City="Heathwood">AUHEA</Location>
                                                        <Addresses>
                                                            <Address AddressType="MAIN">
                                                                <AddressLine1>STAPYLTON RD</AddressLine1>
                                                                <AddressCode>STAPYLTON RD</AddressCode>
                                                                <CityOrSuburb>HEATHWOOD</CityOrSuburb>
                                                                <StateOrProvince>QLD</StateOrProvince>
                                                                <PostCode>4110</PostCode>
                                                                <Language>ENG</Language>
                                                                <Location>AUHEA</Location>
                                                                <Sequence>1</Sequence>
                                                                <AddressCapabilities>
                                                                    <AddressCapability AddressType="MAIN" />
                                                                    <AddressCapability IsMainAddress="true" AddressType="OFC" />
                                                                </AddressCapabilities>
                                                            </Address>
                                                        </Addresses>
                                                    </OrganisationDetails>
                                                </Organisation>
                                            </AddressReference>
                                        </Consignee>
                                    </xsl:when>
                                    <xsl:when test="substring(External_ID, 3,2) = 'BW'">
                                        <Consignee AddressType="CEA">
                                            <AddressReference>
                                                <AddressSequenceRef>1</AddressSequenceRef>
                                                <Organisation EDICode="WOOLARBNE" OwnerCode="WOOLARBNE">
                                                    <OrganisationDetails>
                                                        <Name>WOOLWORTHS LARAPINTA WAREHOUSE</Name>
                                                        <Location Country="Australia" City="Larapinta">AUBNE</Location>
                                                        <Addresses>
                                                            <Address AddressType="MAIN">
                                                                <AddressLine1>DISTRIBUTION ST</AddressLine1>
                                                                <AddressCode>DISTRIBUTION ST</AddressCode>
                                                                <CityOrSuburb>LARAPINTA</CityOrSuburb>
                                                                <StateOrProvince>QLD</StateOrProvince>
                                                                <PostCode>4110</PostCode>
                                                                <Language>ENG</Language>
                                                                <Location>AUBNE</Location>
                                                                <Sequence>1</Sequence>
                                                                <AddressCapabilities>
                                                                    <AddressCapability AddressType="MAIN" />
                                                                    <AddressCapability IsMainAddress="true" AddressType="OFC" />
                                                                </AddressCapabilities>
                                                            </Address>
                                                        </Addresses>
                                                    </OrganisationDetails>
                                                </Organisation>
                                            </AddressReference>
                                        </Consignee>
                                    </xsl:when>
                                    <xsl:when test="substring(External_ID, 3,2) = 'RI'">
                                        <Consignee AddressType="CEA">
                                            <AddressReference>
                                                <AddressSequenceRef>1</AddressSequenceRef>
                                                <Organisation EDICode="SPARBNE" OwnerCode="SPARBNE">
                                                    <OrganisationDetails>
                                                        <Name>SPAR</Name>
                                                        <Location Country="Australia" City="Brisbane">AUBNE</Location>
                                                        <Addresses>
                                                            <Address AddressType="MAIN">
                                                                <AddressLine1>FOX RD</AddressLine1>
                                                                <AddressCode>FOX RD</AddressCode>
                                                                <CityOrSuburb>ACACIA RIDGE</CityOrSuburb>
                                                                <StateOrProvince>QLD</StateOrProvince>
                                                                <PostCode>4110</PostCode>
                                                                <Language>ENG</Language>
                                                                <Location>AUBNE</Location>
                                                                <Sequence>1</Sequence>
                                                                <AddressCapabilities>
                                                                    <AddressCapability AddressType="MAIN" />
                                                                    <AddressCapability IsMainAddress="true" AddressType="OFC" />
                                                                </AddressCapabilities>
                                                            </Address>
                                                        </Addresses>
                                                    </OrganisationDetails>
                                                </Organisation>
                                            </AddressReference>
                                        </Consignee>
                                    </xsl:when>
                                    <xsl:when test="substring(External_ID, 3,2) = 'BD'">
                                        <Consignee AddressType="CEA">
                                            <AddressReference>
                                                <AddressSequenceRef>1</AddressSequenceRef>
                                                <Organisation EDICode="METCASLOG" OwnerCode="METCASLOG">
                                                    <OrganisationDetails>
                                                        <Name>METCASH</Name>
                                                        <Location Country="Australia" City="Brisbane">AULOG</Location>
                                                        <Addresses>
                                                            <Address AddressType="MAIN">
                                                                <AddressLine1>MAGNESIUM DRIVE</AddressLine1>
                                                                <AddressCode>MAGNESIUM DRIVE</AddressCode>
                                                                <CityOrSuburb>CRESTMEAD</CityOrSuburb>
                                                                <StateOrProvince>QLD</StateOrProvince>
                                                                <PostCode>4132</PostCode>
                                                                <Language>ENG</Language>
                                                                <Location>AUBNE</Location>
                                                                <Sequence>1</Sequence>
                                                                <AddressCapabilities>
                                                                    <AddressCapability AddressType="MAIN" />
                                                                    <AddressCapability IsMainAddress="true" AddressType="OFC" />
                                                                </AddressCapabilities>
                                                            </Address>
                                                        </Addresses>
                                                    </OrganisationDetails>
                                                </Organisation>
                                            </AddressReference>
                                        </Consignee>
                                    </xsl:when>
                                    <xsl:when test="substring(External_ID, 3,2) = 'BC'">
                                        <Consignee AddressType="CEA">
                                            <AddressReference>
                                                <AddressSequenceRef>1</AddressSequenceRef>
                                                <Organisation EDICode="GHPLHEA" OwnerCode="GHPLHEA">
                                                    <OrganisationDetails>
                                                        <Name>GHPL</Name>
                                                        <Location Country="Australia" City="Heathwood">AUHEA</Location>
                                                        <Addresses>
                                                            <Address AddressType="MAIN">
                                                                <AddressLine1>STAPYLTON RD</AddressLine1>
                                                                <AddressCode>STAPYLTON RD</AddressCode>
                                                                <CityOrSuburb>HEATHWOOD</CityOrSuburb>
                                                                <StateOrProvince>QLD</StateOrProvince>
                                                                <PostCode>4110</PostCode>
                                                                <Language>ENG</Language>
                                                                <Location>AUHEA</Location>
                                                                <Sequence>1</Sequence>
                                                                <AddressCapabilities>
                                                                    <AddressCapability AddressType="MAIN" />
                                                                    <AddressCapability IsMainAddress="true" AddressType="OFC" />
                                                                </AddressCapabilities>
                                                            </Address>
                                                        </Addresses>
                                                    </OrganisationDetails>
                                                </Organisation>
                                            </AddressReference>
                                        </Consignee>
                                    </xsl:when>
                                    <xsl:when test="substring(External_ID, 3,2) = 'LD'">
                                        <Consignee AddressType="CEA">
                                            <AddressReference>
                                                <AddressSequenceRef>1</AddressSequenceRef>
                                                <Organisation EDICode="ALDIBNE" OwnerCode="ALDIBNE">
                                                    <OrganisationDetails>
                                                        <Name>ALDI</Name>
                                                        <Location Country="Australia" City="Stapylton">AUBNE</Location>
                                                        <Addresses>
                                                            <Address AddressType="MAIN">
                                                                <AddressLine1>55 BURNSIDE RD</AddressLine1>
                                                                <AddressCode>55 BURNSIDE RD</AddressCode>
                                                                <CityOrSuburb>STAPYLTON</CityOrSuburb>
                                                                <StateOrProvince>QLD</StateOrProvince>
                                                                <PostCode>4207</PostCode>
                                                                <Language>ENG</Language>
                                                                <Location>AUBNE</Location>
                                                                <Sequence>1</Sequence>
                                                                <AddressCapabilities>
                                                                    <AddressCapability AddressType="MAIN" />
                                                                    <AddressCapability IsMainAddress="true" AddressType="OFC" />
                                                                </AddressCapabilities>
                                                            </Address>
                                                        </Addresses>
                                                    </OrganisationDetails>
                                                </Organisation>
                                            </AddressReference>
                                        </Consignee>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <Consignee AddressType="CEA">
                                            <AddressReference>
                                                <AddressSequenceRef>1</AddressSequenceRef>
                                                <Organisation EDICode="COCCOLBNE" OwnerCode="COCCOLBNE">
                                                    <OrganisationDetails>
                                                        <Name>COCA-COLA AMATIL (AUST) PTY LTD</Name>
                                                        <Location Country="Australia" City="Richlands">AUBNE</Location>
                                                        <Addresses>
                                                            <Address AddressType="MAIN">
                                                                <AddressLine1>260 ORCHARD ROAD</AddressLine1>
                                                                <AddressCode>260 ORCHARD ROAD</AddressCode>
                                                                <CityOrSuburb>RICHLANDS</CityOrSuburb>
                                                                <StateOrProvince>QLD</StateOrProvince>
                                                                <PostCode>4077</PostCode>
                                                                <Language>ENG</Language>
                                                                <Location>AUBNE</Location>
                                                                <Sequence>1</Sequence>
                                                                <AddressCapabilities>
                                                                    <AddressCapability AddressType="MAIN" />
                                                                    <AddressCapability IsMainAddress="true" AddressType="OFC" />
                                                                </AddressCapabilities>
                                                            </Address>
                                                        </Addresses>
                                                    </OrganisationDetails>
                                                </Organisation>
                                            </AddressReference>
                                        </Consignee>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </CustomerOrderDetail>
                        </DocketDetail>
                        <DocketLines>
                            <xsl:apply-templates select="key('items',Order)" />
                        </DocketLines>
                    </WhsDocket>
                </xsl:for-each>
            </WhsDockets>
        </Payload>
    </XmlInterchange>
</xsl:template>
<xsl:template match="Line_Items">
    <DocketLine>
        <Product>
            <xsl:value-of select="Product" />
        </Product>  
        <Description>
            <xsl:value-of select="Description"/>
        </Description>
        <QuantityFromClientOrder>
            <xsl:value-of select="Quantity"/>
        </QuantityFromClientOrder>
        <ProductUQ>MST</ProductUQ>  
        <LineNumber>
            <xsl:value-of select="position()" />
        </LineNumber>                                   
    </DocketLine>
</xsl:template>

我的输入是平的XML

<?xml version="1.0" encoding="UTF-8"?><Orders>
    <Line_Items>
        <DateRequired>2015-09-02T00:00:00</DateRequired>
        <Order>2370519</Order>
        <Warebouse>ROC</Warebouse>
        <Client>Bunnings Maroochydore OLD Warehouse</Client>
        <AddressLine1>Cnr Maroochydore and BroadmeadowRds</AddressLine1>
        <CityOrSuburb>MAROOCHYDORE</CityOrSuburb>
        <StateOrProvince>QLD</StateOrProvince>
        <PostCode>4558</PostCode>
        <Product>E2281</Product>
        <Description>R 3 5 175mm x 580mm x 1160mm</Description>
        <Quantity>4</Quantity>
        <UOM>MST</UOM>
        <LineQuantity>16</LineQuantity>
        <LineQuantityUQ>PAC</LineQuantityUQ>
        <Line_Number>1</Line_Number>
    </Line_Items>
    <Line_Items>
        <DateRequired>2015-09-02T00:00:00</DateRequired>
        <Order>2370519</Order>
        <Warebouse>ROC</Warebouse>
        <Client>Bunnings Maroochydore OLD Warehouse</Client>
        <AddressLine1>Cnr Maroochydore and BroadmeadowRds</AddressLine1>
        <CityOrSuburb>MAROOCHYDORE</CityOrSuburb>
        <StateOrProvince>QLD</StateOrProvince>
        <PostCode>4558</PostCode>
        <Product>E3592</Product>
        <Description>R 2 0 ACOUSTIC 75 X 580 X 1160 15 1 KG</Description>
        <Quantity>4</Quantity>
        <UOM>MST</UOM>
        <LineQuantity>48</LineQuantity>
        <LineQuantityUQ>PAC</LineQuantityUQ>
        <Line_Number>2</Line_Number>
    </Line_Items></Orders>

但是我的输出没有生成条件

输出

<?xml version="1.0"?><XmlInterchange xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.edi.com.au/EnterpriseService/">
<InterchangeInfo>
    <Source>
        <EnterpriseCode>AWH</EnterpriseCode>
        <CompanyCode>ADL</CompanyCode>
        <OriginServer>ADL</OriginServer>
    </Source>
    <Target/>
    <EDIOrganisation EDICode="AWHLOG_AU" OwnerCode="AWHLOG_AU">
        <OrganisationDetails>
            <Name>AWH LOGISTICS</Name>
            <Location Country="Australia" City="Adelaide">AUADL</Location>
            <Addresses>
                <Address AddressType="MAIN">
                    <AddressLine1>Gillman Wool Complex</AddressLine1>
                    <AddressLine2>GRAND TRUNKWAY,</AddressLine2>
                    <AddressCode>Gillman Wool Complex</AddressCode>
                    <CityOrSuburb>GILLMAN</CityOrSuburb>
                    <StateOrProvince>SA</StateOrProvince>
                    <PostCode>5013</PostCode>
                    <TelephoneNumbers>
                        <TelephoneNumber NumberType="Business">+618 8240 8400</TelephoneNumber>
                        <TelephoneNumber NumberType="Fax">+618 8240 0080</TelephoneNumber>
                    </TelephoneNumbers>
                    <Email>containers@awh.com.au</Email>
                    <Language>ENG</Language>
                    <Location>AUADL</Location>
                    <Sequence>1</Sequence>
                    <AddressCapabilities>
                        <AddressCapability AddressType="MAIN"/>
                        <AddressCapability IsMainAddress="true" AddressType="OFC"/>
                        <AddressCapability IsMainAddress="true" AddressType="PAD"/>
                    </AddressCapabilities>
                </Address>
            </Addresses>
        </OrganisationDetails>
    </EDIOrganisation>
</InterchangeInfo>
<Payload>
    <WhsDockets/>
</Payload>

我可能需要一双新眼睛,因为我看不出任何错误。非常感谢任何帮助

密钥应该是 <xsl:key name="items" match="Line_Items" use="Order" />,而不是 <xsl:key name="items" match="Line_Items" use="Orders" />