我有以下XML,我想处理它,以便我不会在结果集中得到重复项。我简化了问题,使其更容易理解。另外,如何将一个模板的结果用作另一个模板的输入?
此:
<LINES xmlns:set="http://exslt.org/sets">
<STDINSTRSEQ>0</STDINSTRSEQ>
<STDINSTRSEQ>1</STDINSTRSEQ>
<STDINSTRSEQ>2</STDINSTRSEQ>
</LINES>
是期望的结果。 <STDINSTRSEQ>
是应被视为键的字段的名称。我在这里提供了样本数据。
<PURCHASEORDER>
<POHEADER>
<BODID>infor-nid:Elevon:SCMCS::12654_0198617S12 000 000:?&verb=</BODID>
<VERB></VERB>
<TenantId>Elevon</TenantId>
<ToLogicalId>lid://default</ToLogicalId>
<FromLogicalId>lid://snipesm@mcsk12.net</FromLogicalId>
<FromPartyId>snipesm@mcsk12.net</FromPartyId>
<AccountingEntityId>SCMCS</AccountingEntityId>
<ActionCode></ActionCode>
<MessageId>lid://snipesm@mcsk12.net:1267198551845:4</MessageId>
<UserId></UserId>
<CurrentDateTime>2010-02-26T09:35:51Z</CurrentDateTime>
<CTLENTYID>MCS</CTLENTYID>
<VCKVAL>12654</VCKVAL>
<POKVAL>0198617S12 000 000</POKVAL>
<PCKVAL>000017</PCKVAL>
<PODT>2005-03-16</PODT>
<POREQDT>2005-06-30</POREQDT>
<POQTEDT>2005-03-08</POQTEDT>
<REQUISITIONNO>1103025T12 000 000</REQUISITIONNO>
<REQHDATE></REQHDATE>
<REQLDATE>2004-10-26</REQLDATE>
<MTLREQDT></MTLREQDT>
<RQSTRLONGNM></RQSTRLONGNM>
<POCLASSOFORDCD>S</POCLASSOFORDCD>
<SNGLDISTACKVAL></SNGLDISTACKVAL>
<DISTACKVAL></DISTACKVAL>
<CREATEDT>2005-03-16</CREATEDT>
<POPROMDT></POPROMDT>
<RORDDT></RORDDT>
<RQSTRID>TEL</RQSTRID>
<TAXCDREF></TAXCDREF>
<DFLTDLVYLOCCD>407-P</DFLTDLVYLOCCD>
<POGROSSAMT>1.00</POGROSSAMT>
<SHIPPOINTNM></SHIPPOINTNM>
<CRNCYCD>USD</CRNCYCD>
<ORDVNDRCTACTID></ORDVNDRCTACTID>
<LINEAMTTOT>0.00</LINEAMTTOT>
<TERMSCD>18</TERMSCD>
<FOBCD>01</FOBCD>
<BYRCD>12</BYRCD>
<INFORBUS>INFORBUS</INFORBUS>
<VNDRLONGNM>DORI FOODS, INC.</VNDRLONGNM>
<VNDRADDRLN001>P.O. BOX 11365</VNDRADDRLN001>
<VNDRADDRLN002></VNDRADDRLN002>
<VNDRADDRLN003></VNDRADDRLN003>
<VNDRCITYLN>RICHMOND</VNDRCITYLN>
<VNDRSTCD>VA</VNDRSTCD>
<VNDRZIPCD>23</VNDRZIPCD>
<VNDRZIPCDREST>2301365</VNDRZIPCDREST>
<VCKTRDPRTNRID>12654</VCKTRDPRTNRID>
<TPNAME>DORI FOODS, INC.</TPNAME>
<TPADDR1>P.O. BOX 11365</TPADDR1>
<TPADDR2></TPADDR2>
<TPADDR3></TPADDR3>
<TPCITY>RICHMOND</TPCITY>
<TPZIP>232301365</TPZIP>
<TPSTATE>VA</TPSTATE>
<TPFAX>8043551631</TPFAX>
<TPPARTNERID>12654</TPPARTNERID>
<TPEMAIL>KITCHENJEREMYT@MCSK12.NET</TPEMAIL>
<ECPOACKNHRSCNT>0</ECPOACKNHRSCNT>
<ECSUPLMACKNHRSCNT>0</ECSUPLMACKNHRSCNT>
<ECACKNPROCSTATCD>N</ECACKNPROCSTATCD>
<UPLMACKNPROCSTATCD>N</UPLMACKNPROCSTATCD>
<CORPTRDPRTNRID>MCSGENERIC</CORPTRDPRTNRID>
<BYRSHRTNM>KEN RUBY</BYRSHRTNM>
<BYRLONGNM>KEN RUBY</BYRLONGNM>
<BYRUSERID>PURKENR</BYRUSERID>
<BYRUSATELNBR></BYRUSATELNBR>
<BYRTELNBR2VAL></BYRTELNBR2VAL>
<BYRFAXXNBR></BYRFAXXNBR>
<TERMSSHRTDESC>NET 30 DAY</TERMSSHRTDESC>
<FRSTSTDINSTRCD>098</FRSTSTDINSTRCD>
<XXC004>xxC004.STDINSTRDESC</XXC004>
<INVCTONM></INVCTONM>
<INVCTOADDRLN001></INVCTOADDRLN001>
<INVCTOADDRLN002></INVCTOADDRLN002>
<INVCTOADDRLN003></INVCTOADDRLN003>
<INVCTOCITYLN></INVCTOCITYLN>
<INVCTOSTCD></INVCTOSTCD>
<INVCTOZIPCD></INVCTOZIPCD>
<INVCTOCTRYCD></INVCTOCTRYCD>
</POHEADER>
<LINES>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>23</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>23.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>NOTE: THIS PURCHASE ORDER SERVES AS CONFIRMATION</STDINSTRDESC>
<STDINSTRSEQ>0</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>AS PER BID OF MARCH 8, 2005.....</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>22</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>22.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>NOTE: THIS PURCHASE ORDER SERVES AS CONFIRMATION</STDINSTRDESC>
<STDINSTRSEQ>0</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>PRICE: $47.89/CASE - SHIP LOT: 30 CASE</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>21</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>21.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>NOTE: THIS PURCHASE ORDER SERVES AS CONFIRMATION</STDINSTRDESC>
<STDINSTRSEQ>0</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>BRAND: MCCORMICK 930839 - 25 LBS.</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>12</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>12.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>NOTE: THIS PURCHASE ORDER SERVES AS CONFIRMATION</STDINSTRDESC>
<STDINSTRSEQ>0</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>PRICE: $78.92/CASE - SHIP LOT: 25 CASE</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>11</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>11.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>NOTE: THIS PURCHASE ORDER SERVES AS CONFIRMATION</STDINSTRDESC>
<STDINSTRSEQ>0</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>BRAND: MCCORMICK 931025 - 25 LBS.</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>11</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>11.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>THAT WE ACCEPT THE TERMS AND CONDITIONS OUTLINED IN</STDINSTRDESC>
<STDINSTRSEQ>1</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>BRAND: MCCORMICK 931025 - 25 LBS.</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>12</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>12.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>THAT WE ACCEPT THE TERMS AND CONDITIONS OUTLINED IN</STDINSTRDESC>
<STDINSTRSEQ>1</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>PRICE: $78.92/CASE - SHIP LOT: 25 CASE</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>21</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>21.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>THAT WE ACCEPT THE TERMS AND CONDITIONS OUTLINED IN</STDINSTRDESC>
<STDINSTRSEQ>1</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>BRAND: MCCORMICK 930839 - 25 LBS.</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>22</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>22.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>THAT WE ACCEPT THE TERMS AND CONDITIONS OUTLINED IN</STDINSTRDESC>
<STDINSTRSEQ>1</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>PRICE: $47.89/CASE - SHIP LOT: 30 CASE</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>23</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>23.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>THAT WE ACCEPT THE TERMS AND CONDITIONS OUTLINED IN</STDINSTRDESC>
<STDINSTRSEQ>1</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>AS PER BID OF MARCH 8, 2005.....</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>23</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>23.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>YOUR CONTRACT DATED 02/16/2007 FOR THE FOLLOWING</STDINSTRDESC>
<STDINSTRSEQ>2</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>AS PER BID OF MARCH 8, 2005.....</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>22</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>22.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>YOUR CONTRACT DATED 02/16/2007 FOR THE FOLLOWING</STDINSTRDESC>
<STDINSTRSEQ>2</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>PRICE: $47.89/CASE - SHIP LOT: 30 CASE</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>21</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>21.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>YOUR CONTRACT DATED 02/16/2007 FOR THE FOLLOWING</STDINSTRDESC>
<STDINSTRSEQ>2</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>BRAND: MCCORMICK 930839 - 25 LBS.</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>12</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>12.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>YOUR CONTRACT DATED 02/16/2007 FOR THE FOLLOWING</STDINSTRDESC>
<STDINSTRSEQ>2</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>PRICE: $78.92/CASE - SHIP LOT: 25 CASE</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
<LINE>
<DLVYLOCCD></DLVYLOCCD>
<STRGLOCID></STRGLOCID>
<DLVYLOCCDLONGNM></DLVYLOCCDLONGNM>
<DLVYLOCCDADDRLN001></DLVYLOCCDADDRLN001>
<DLVYLOCCDADDRLN002></DLVYLOCCDADDRLN002>
<DLVYLOCCDADDRLN003></DLVYLOCCDADDRLN003>
<CITYLN></CITYLN>
<STCD></STCD>
<ZIPCD></ZIPCD>
<CTRYCD></CTRYCD>
<CTCTNM>KEN RUBY</CTCTNM>
<POLINENBR>11</POLINENBR>
<APPOLINECD>081</APPOLINECD>
<UNIQID>11.081</UNIQID>
<UOMCD></UOMCD>
<STDINSTRDESC>YOUR CONTRACT DATED 02/16/2007 FOR THE FOLLOWING</STDINSTRDESC>
<STDINSTRSEQ>2</STDINSTRSEQ>
<MCKVAL></MCKVAL>
<MTLDESC></MTLDESC>
<POPROMDT></POPROMDT>
<CRRNM></CRRNM>
<MFGRREF></MFGRREF>
<MFGRPARTREF></MFGRPARTREF>
<PODTLDESC>BRAND: MCCORMICK 931025 - 25 LBS.</PODTLDESC>
<XTRNVNDRUOMCD></XTRNVNDRUOMCD>
<VNDRPARTREF></VNDRPARTREF>
<VCVNDRPARTREF></VCVNDRPARTREF>
<MTLLONGDESC></MTLLONGDESC>
<XXR013>xxR013.MTLDESC</XXR013>
<XXE4E00>xxE4E00.CMNTDESC</XXE4E00>
<ORDQTY>0.0000</ORDQTY>
<UOMSHRTDESC></UOMSHRTDESC>
<UNITPRC>0.00000</UNITPRC>
<VATTAXAMT>0.00</VATTAXAMT>
<POLINEAMT>0.00</POLINEAMT>
<XXE4F00>xxE4F00.UPLDFILENM</XXE4F00>
</LINE>
</LINES>
</PURCHASEORDER>
答案 0 :(得分:3)
如果我理解你要求的是什么,那么给出你的样本XML就行了
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="/PURCHASEORDER/LINES" />
</xsl:template>
<xsl:template match="LINES">
<LINES xmlns:set="http://exslt.org/sets">
<xsl:apply-templates select="LINE/STDINSTRSEQ[not(. = preceding::STDINSTRSEQ)]"/>
</LINES>
</xsl:template>
<xsl:template match="STDINSTRSEQ">
<xsl:copy> <xsl:apply-templates/> </xsl:copy>
</xsl:template>
</xsl:stylesheet>
使用<xsl:key>
过滤并提供独特结果的优化版本:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:key name="STDIN" match="STDINSTRSEQ" use="./text()" />
<xsl:template match="/">
<xsl:apply-templates select="/PURCHASEORDER/LINES" />
</xsl:template>
<xsl:template match="LINES">
<LINES xmlns:set="http://exslt.org/sets">
<xsl:apply-templates select="LINE/STDINSTRSEQ[generate-id(.) = generate-id(key('STDIN', .))]"/>
</LINES>
</xsl:template>
<xsl:template match="STDINSTRSEQ">
<xsl:copy> <xsl:apply-templates/> </xsl:copy>
</xsl:template>
</xsl:stylesheet>
答案 1 :(得分:2)
我不确定apply-templates。我不明白他们是如何工作的。所以对于像这样的XML:
<xml>
<line>209</line>
<line>209</line>
<line>209</line>
<line>100</line>
<line>101</line>
<line>101</line>
<line>100</line>
<line>102</line>
<line>209</line>
<line>101</line>
<line>101</line>
<line>101</line>
<line>101</line>
<line>209</line>
<line>100</line>
</xml>
删除重复项,只留下唯一值:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="no" />
<xsl:template match="/">
<Output>
<xsl:for-each select="//line">
<xsl:if test="not(. = preceding::line)">
<line>
<xsl:value-of select="string(.)" disable-output-escaping="no" />
</line>
</xsl:if>
</xsl:for-each>
</Output>
</xsl:template>
</xsl:stylesheet>
结果是:
<Output>
<line>100</line>
<line>101</line>
<line>102</line>
<line>209</line>
</Output>
它比Mads Hansen提供的解决方案快得多。
答案 2 :(得分:1)
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:key name="kSTDINSTRSEQ" match="STDINSTRSEQ" use="." />
<xsl:template match="PURCHASEORDER">
<xsl:apply-templates select="LINES" />
</xsl:template>
<xsl:template match="LINES">
<LINES xmlns:set="http://exslt.org/sets">
<xsl:copy-of select="
LINE/STDINSTRSEQ[
generate-id() = generate-id(key('kSTDINSTRSEQ', .)[1])
]
" />
</LINES>
</xsl:template>
</xsl:stylesheet>
产生
<LINES xmlns:set="http://exslt.org/sets">
<STDINSTRSEQ>0</STDINSTRSEQ>
<STDINSTRSEQ>1</STDINSTRSEQ>
<STDINSTRSEQ>2</STDINSTRSEQ>
</LINES>
要从另一个XSL模板访问它,请将其写入临时文件并使用document()
函数。或者,只需在其他XSLT文件中进行分组。