Eliminar elementos duplicados con XSLT

Necesito eliminar elementos duplicados de mi XML usando un nodo específico (ItemID)

Mi XML se ve de la siguiente manera;

  Waltons CAP600795SI 20100506 723073 02 Pentel LR7 Energel Metal Tip Refill 0.7mm WRITING INSTRUMENTS Refill  1.0000000  6.0000000  10.0200000  8.4200000  60.1200000 Black EA  0.0000000  CAP5637542_060   Waltons CAP600795SI 20100506 903420  STEPHENS JUNIOR Stapler Half Strip KW586 OFFICE SUNDRIES Staplers  2.0000000  3.0000000  32.2500000  13.5400000  96.7500000  Ea  0.0000000  CAP5637547_060   Waltons CAP600795SI 20100506 867241  TRODAT PRINTY S/Inking Stamp Copy 4911 STAMPS DATERS NUMBERERS Self Inking Stamps  3.0000000  1.0000000  42.1500000  5.9000000  42.1500000  Ea  1.0000000  CAP5637548_060   Waltons CAP600795SI 20100506 941151  PENTEL Correction Tape 5mx5mm ZT35 OFFICE SUNDRIES Correction Fluid/Pens/Tape  4.0000000  2.0000000  25.1500000  7.0400000  50.3000000  Ea  0.0000000  CAP5637549_060   Waltons CAP600795SI 20100506 801215  MONDI ROTATRIM Copy Paper A4 80Gsm White A4 Paper White Bond Paper  5.0000000  100.0000000  29.0100000  406.1400000  2901.0000000  Pkt 500  0.0000000  CAP5637552_060    CAP716197SO  CAP600795SI 2010/05/06   2.0000000 805236  CAP0000594_061 Ruled Paper A4 Fnt/Marg JD76 2010/05/06  CAP5637543_060  4.0000000  4.0000000  4.0000000  4.0000000 EA  CAP716197SO wal 622392608 1    CAP716197SO  CAP600795SI 2010/05/06   3.0000000 941150  CAP0000594_061 PENGUIN Correction Fluid 20ml White 2010/05/06  CAP5637546_060  6.0000000  6.0000000  6.0000000  6.0000000 EA  CAP716197SO wal 622392609 1    CAP716197SO  CAP600795SI 2010/05/06   5.0000000 867241  CAP0000594_061 TRODAT PRINTY S/Inking Stamp Copy 4911 2010/05/06  CAP5637548_060  2.0000000  2.0000000  1.0000000  1.0000000 EA  CAP716197SO wal 622392610 1   

Verá que el XML no es idéntico, pero la etiqueta siempre está en el mismo lugar, y actualmente hay 1 duplicado 867241

No quiero que la orden cambie, solo el elemento eliminado.

La salida deseada sería;

   Waltons CAP600795SI 20100506 723073 02 Pentel LR7 Energel Metal Tip Refill 0.7mm WRITING INSTRUMENTS Refill  1.0000000  6.0000000  10.0200000  8.4200000  60.1200000 Black EA  0.0000000  CAP5637542_060   Waltons CAP600795SI 20100506 903420  STEPHENS JUNIOR Stapler Half Strip KW586 OFFICE SUNDRIES Staplers  2.0000000  3.0000000  32.2500000  13.5400000  96.7500000  Ea  0.0000000  CAP5637547_060   Waltons CAP600795SI 20100506 867241  TRODAT PRINTY S/Inking Stamp Copy 4911 STAMPS DATERS NUMBERERS Self Inking Stamps  3.0000000  1.0000000  42.1500000  5.9000000  42.1500000  Ea  1.0000000  CAP5637548_060   Waltons CAP600795SI 20100506 941151  PENTEL Correction Tape 5mx5mm ZT35 OFFICE SUNDRIES Correction Fluid/Pens/Tape  4.0000000  2.0000000  25.1500000  7.0400000  50.3000000  Ea  0.0000000  CAP5637549_060   Waltons CAP600795SI 20100506 801215  MONDI ROTATRIM Copy Paper A4 80Gsm White A4 Paper White Bond Paper  5.0000000  100.0000000  29.0100000  406.1400000  2901.0000000  Pkt 500  0.0000000  CAP5637552_060    CAP716197SO  CAP600795SI 2010/05/06   2.0000000 805236  CAP0000594_061 Ruled Paper A4 Fnt/Marg JD76 2010/05/06  CAP5637543_060  4.0000000  4.0000000  4.0000000  4.0000000 EA  CAP716197SO wal 622392608 1    CAP716197SO  CAP600795SI 2010/05/06   3.0000000 941150  CAP0000594_061 PENGUIN Correction Fluid 20ml White 2010/05/06  CAP5637546_060  6.0000000  6.0000000  6.0000000  6.0000000 EA  CAP716197SO wal 622392609 1   

Puedo usar XSLT 1 o 2

Saludos,

I. Solución XSLT 1.0:

Aquí hay una solución usando la agrupación Muenchian :

            

Nota :

  1. La agrupación Muenchian es el método de agrupación general conocido más eficiente para XSLT 1.0.

  2. Estilo puro de “empuje” utilizado.


II. Solución XSLT 2.0:

           

Ambas soluciones, cuando se aplican en el documento XML proporcionado:

   Waltons CAP600795SI 20100506 723073 02 Pentel LR7 Energel Metal Tip Refill 0.7mm WRITING INSTRUMENTS Refill  1.0000000  6.0000000  10.0200000  8.4200000  60.1200000 Black EA  0.0000000  CAP5637542_060   Waltons CAP600795SI 20100506 903420  STEPHENS JUNIOR Stapler Half Strip KW586 OFFICE SUNDRIES Staplers  2.0000000  3.0000000  32.2500000  13.5400000  96.7500000  Ea  0.0000000  CAP5637547_060   Waltons CAP600795SI 20100506 867241  TRODAT PRINTY S/Inking Stamp Copy 4911 STAMPS DATERS NUMBERERS Self Inking Stamps  3.0000000  1.0000000  42.1500000  5.9000000  42.1500000  Ea  1.0000000  CAP5637548_060   Waltons CAP600795SI 20100506 941151  PENTEL Correction Tape 5mx5mm ZT35 OFFICE SUNDRIES Correction Fluid/Pens/Tape  4.0000000  2.0000000  25.1500000  7.0400000  50.3000000  Ea  0.0000000  CAP5637549_060   Waltons CAP600795SI 20100506 801215  MONDI ROTATRIM Copy Paper A4 80Gsm White A4 Paper White Bond Paper  5.0000000  100.0000000  29.0100000  406.1400000  2901.0000000  Pkt 500  0.0000000  CAP5637552_060    CAP716197SO  CAP600795SI 2010/05/06   2.0000000 805236  CAP0000594_061 Ruled Paper A4 Fnt/Marg JD76 2010/05/06  CAP5637543_060  4.0000000  4.0000000  4.0000000  4.0000000 EA  CAP716197SO wal 622392608 1    CAP716197SO  CAP600795SI 2010/05/06   3.0000000 941150  CAP0000594_061 PENGUIN Correction Fluid 20ml White 2010/05/06  CAP5637546_060  6.0000000  6.0000000  6.0000000  6.0000000 EA  CAP716197SO wal 622392609 1    CAP716197SO  CAP600795SI 2010/05/06   5.0000000 867241  CAP0000594_061 TRODAT PRINTY S/Inking Stamp Copy 4911 2010/05/06  CAP5637548_060  2.0000000  2.0000000  1.0000000  1.0000000 EA  CAP716197SO wal 622392610 1   

producir el resultado deseado y correcto :

   Waltons CAP600795SI 20100506 723073 02 Pentel LR7 Energel Metal Tip Refill 0.7mm WRITING INSTRUMENTS Refill  1.0000000  6.0000000  10.0200000  8.4200000  60.1200000 Black EA  0.0000000  CAP5637542_060   Waltons CAP600795SI 20100506 903420  STEPHENS JUNIOR Stapler Half Strip KW586 OFFICE SUNDRIES Staplers  2.0000000  3.0000000  32.2500000  13.5400000  96.7500000  Ea  0.0000000  CAP5637547_060   Waltons CAP600795SI 20100506 867241  TRODAT PRINTY S/Inking Stamp Copy 4911 STAMPS DATERS NUMBERERS Self Inking Stamps  3.0000000  1.0000000  42.1500000  5.9000000  42.1500000  Ea  1.0000000  CAP5637548_060   Waltons CAP600795SI 20100506 941151  PENTEL Correction Tape 5mx5mm ZT35 OFFICE SUNDRIES Correction Fluid/Pens/Tape  4.0000000  2.0000000  25.1500000  7.0400000  50.3000000  Ea  0.0000000  CAP5637549_060   Waltons CAP600795SI 20100506 801215  MONDI ROTATRIM Copy Paper A4 80Gsm White A4 Paper White Bond Paper  5.0000000  100.0000000  29.0100000  406.1400000  2901.0000000  Pkt 500  0.0000000  CAP5637552_060    CAP716197SO  CAP600795SI 2010/05/06   2.0000000 805236  CAP0000594_061 Ruled Paper A4 Fnt/Marg JD76 2010/05/06  CAP5637543_060  4.0000000  4.0000000  4.0000000  4.0000000 EA  CAP716197SO wal 622392608 1    CAP716197SO  CAP600795SI 2010/05/06   3.0000000 941150  CAP0000594_061 PENGUIN Correction Fluid 20ml White 2010/05/06  CAP5637546_060  6.0000000  6.0000000  6.0000000  6.0000000 EA  CAP716197SO wal 622392609 1   

La siguiente transformación funcionó para mí:

            

La expresión se puede simplificar, si ItemID / ITEMID se deletreó consistentemente en mayúsculas o camel-case.