Мой сценарий - xml-idoc, где в idoc у меня E1EDP01-POSEX, который повторяется со значением 000001. Я узнаю, как удалить дубликат узла, но перед этим мне нужно добавить значения в E1EDP01-MENGE (ex posex = 000001.и menge = 2500, posex = 000001 и menge3000), поэтому я хочу posex = 000001 и menge = 5500.
Поскольку я использовал этот код
<xsl:template match="E1EDP01[not(generate-id() = generate-id(key('kPOSEX', POSEX)[000001]))]"/>
Он принимает только значение первого узла.Ниже приведен один и тот же код
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Invoice>
<InvoiceDetail>
<ListOfInvoiceItemDetail>
<InvoiceItemDetail>
<InvoiceBaseItemDetail>
<LineItemNum>
<BuyerLineItemNum>000002</BuyerLineItemNum>
<SellerLineItemNum>000001</SellerLineItemNum>
</LineItemNum>
<LineItemType>
<LineItemTypeCoded>Item</LineItemTypeCoded>
</LineItemType>
<ItemIdentifiers>
<PartNumbers>
<SellerPartNumber>
<PartNum>
<PartID>100356381</PartID>
</PartNum>
</SellerPartNumber>
<BuyerPartNumber>
<PartNum>
<PartID>517801</PartID>
</PartNum>
</BuyerPartNumber>
</PartNumbers>
</ItemIdentifiers>
<TotalQuantity>
<Quantity>
<QuantityValue>40320.0</QuantityValue>
<UnitOfMeasurement>
<UOMCoded>EA</UOMCoded>
</UnitOfMeasurement>
</Quantity>
</TotalQuantity>
<LineItemReferences>
<InvoiceReferences>
<PurchaseOrderReference>
<PurchaseOrderNumber>
<Reference>
<RefNum>0045486186</RefNum>
</Reference>
</PurchaseOrderNumber>
<PurchaseOrderDate>20110825T040000.000Z</PurchaseOrderDate>
<PurchaseOrderLineItemNumber>000002</PurchaseOrderLineItemNumber>
</PurchaseOrderReference>
<ASNNumber>
<Reference>
<RefNum>0805548867</RefNum>
</Reference>
</ASNNumber>
<OtherInvoiceReferences>
<ListOfReferenceCoded>
<ReferenceCoded>
<ReferenceTypeCoded>Other</ReferenceTypeCoded>
<ReferenceTypeCodedOther>SalesOrderNumber</ReferenceTypeCodedOther>
<PrimaryReference>
<Reference>
<RefNum>0006543680</RefNum>
</Reference>
</PrimaryReference>
<SupportingReference>
<Reference>
<RefNum>000002</RefNum>
</Reference>
</SupportingReference>
</ReferenceCoded>
</ListOfReferenceCoded>
</OtherInvoiceReferences>
</InvoiceReferences>
</LineItemReferences>
</InvoiceBaseItemDetail>
<InvoicePricingDetail>
<ListOfPrice>
<Price>
<UnitPrice>
<UnitPriceValue>115.11</UnitPriceValue>
</UnitPrice>
</Price>
</ListOfPrice>
<Tax>
<TaxFunctionQualifierCoded>Tax</TaxFunctionQualifierCoded>
<TaxCategoryCoded>StandardRate</TaxCategoryCoded>
<TaxTypeCoded>Other</TaxTypeCoded>
<TaxTypeCodedOther>
<Identifier>
<Agency>
<AgencyCoded>Other</AgencyCoded>
<AgencyCodedOther>Not Specified</AgencyCodedOther>
</Agency>
<Ident>National Tax</Ident>
</Identifier>
</TaxTypeCodedOther>
<TaxPercent>10.000</TaxPercent>
<TaxAmount>464.12</TaxAmount>
</Tax>
<InvoiceCurrencyTotalValue>
<MonetaryValue>
<MonetaryAmount>4641.24</MonetaryAmount>
</MonetaryValue>
</InvoiceCurrencyTotalValue>
</InvoicePricingDetail>
</InvoiceItemDetail>
<InvoiceItemDetail>
<InvoiceBaseItemDetail>
<LineItemNum>
<BuyerLineItemNum>000001</BuyerLineItemNum>
<SellerLineItemNum>000002</SellerLineItemNum>
</LineItemNum>
<LineItemType>
<LineItemTypeCoded>Item</LineItemTypeCoded>
</LineItemType>
<ItemIdentifiers>
<PartNumbers>
<SellerPartNumber>
<PartNum>
<PartID>100351756</PartID>
</PartNum>
</SellerPartNumber>
<BuyerPartNumber>
<PartNum>
<PartID>462088</PartID>
</PartNum>
</BuyerPartNumber>
</PartNumbers>
</ItemIdentifiers>
<TotalQuantity>
<Quantity>
<QuantityValue>37632.0</QuantityValue>
<UnitOfMeasurement>
<UOMCoded>EA</UOMCoded>
</UnitOfMeasurement>
</Quantity>
</TotalQuantity>
<LineItemReferences>
<InvoiceReferences>
<PurchaseOrderReference>
<PurchaseOrderNumber>
<Reference>
<RefNum>0045486186</RefNum>
</Reference>
</PurchaseOrderNumber>
<PurchaseOrderDate>20110825T040000.000Z</PurchaseOrderDate>
<PurchaseOrderLineItemNumber>000001</PurchaseOrderLineItemNumber>
</PurchaseOrderReference>
<ASNNumber>
<Reference>
<RefNum>0805548867</RefNum>
</Reference>
</ASNNumber>
<OtherInvoiceReferences>
<ListOfReferenceCoded>
<ReferenceCoded>
<ReferenceTypeCoded/>
<PrimaryReference>
<Reference>
<RefNum>0006543680</RefNum>
</Reference>
</PrimaryReference>
<SupportingReference>
<Reference>
<RefNum>000003</RefNum>
</Reference>
</SupportingReference>
</ReferenceCoded>
</ListOfReferenceCoded>
</OtherInvoiceReferences>
</InvoiceReferences>
</LineItemReferences>
</InvoiceBaseItemDetail>
<InvoicePricingDetail>
<ListOfPrice>
<Price>
<UnitPrice>
<UnitPriceValue>119.79</UnitPriceValue>
</UnitPrice>
</Price>
</ListOfPrice>
<Tax>
<TaxFunctionQualifierCoded>Tax</TaxFunctionQualifierCoded>
<TaxCategoryCoded>StandardRate</TaxCategoryCoded>
<TaxTypeCoded>Other</TaxTypeCoded>
<TaxTypeCodedOther>
<Identifier>
<Agency>
<AgencyCoded>Other</AgencyCoded>
<AgencyCodedOther>Not Specified</AgencyCodedOther>
</Agency>
<Ident>National Tax</Ident>
</Identifier>
</TaxTypeCodedOther>
<TaxPercent>10.000</TaxPercent>
<TaxAmount>450.79</TaxAmount>
</Tax>
<InvoiceCurrencyTotalValue>
<MonetaryValue>
<MonetaryAmount>4507.94</MonetaryAmount>
</MonetaryValue>
</InvoiceCurrencyTotalValue>
</InvoicePricingDetail>
</InvoiceItemDetail>
<InvoiceItemDetail>
<InvoiceBaseItemDetail>
<LineItemNum>
<BuyerLineItemNum>000003</BuyerLineItemNum>
<SellerLineItemNum>000003</SellerLineItemNum>
</LineItemNum>
<LineItemType>
<LineItemTypeCoded>Item</LineItemTypeCoded>
</LineItemType>
<ItemIdentifiers>
<PartNumbers>
<SellerPartNumber>
<PartNum>
<PartID>100356381</PartID>
</PartNum>
</SellerPartNumber>
<BuyerPartNumber>
<PartNum>
<PartID>517801</PartID>
</PartNum>
</BuyerPartNumber>
</PartNumbers>
</ItemIdentifiers>
<TotalQuantity>
<Quantity>
<QuantityValue>60480.0</QuantityValue>
<UnitOfMeasurement>
<UOMCoded>EA</UOMCoded>
</UnitOfMeasurement>
</Quantity>
</TotalQuantity>
<LineItemReferences>
<InvoiceReferences>
<PurchaseOrderReference>
<PurchaseOrderNumber>
<Reference>
<RefNum>0045486186</RefNum>
</Reference>
</PurchaseOrderNumber>
<PurchaseOrderDate>20110825T040000.000Z</PurchaseOrderDate>
<PurchaseOrderLineItemNumber>000003</PurchaseOrderLineItemNumber>
</PurchaseOrderReference>
<ASNNumber>
<Reference>
<RefNum>0805548867</RefNum>
</Reference>
</ASNNumber>
<OtherInvoiceReferences>
<ListOfReferenceCoded>
<ReferenceCoded>
<ReferenceTypeCoded/>
<PrimaryReference>
<Reference>
<RefNum>0006543680</RefNum>
</Reference>
</PrimaryReference>
<SupportingReference>
<Reference>
<RefNum>000004</RefNum>
</Reference>
</SupportingReference>
</ReferenceCoded>
</ListOfReferenceCoded>
</OtherInvoiceReferences>
</InvoiceReferences>
</LineItemReferences>
</InvoiceBaseItemDetail>
<InvoicePricingDetail>
<ListOfPrice>
<Price>
<UnitPrice>
<UnitPriceValue>115.11</UnitPriceValue>
</UnitPrice>
</Price>
</ListOfPrice>
<Tax>
<TaxFunctionQualifierCoded>Tax</TaxFunctionQualifierCoded>
<TaxCategoryCoded>StandardRate</TaxCategoryCoded>
<TaxTypeCoded>Other</TaxTypeCoded>
<TaxTypeCodedOther>
<Identifier>
<Agency>
<AgencyCoded>Other</AgencyCoded>
<AgencyCodedOther>Not Specified</AgencyCodedOther>
</Agency>
<Ident>National Tax</Ident>
</Identifier>
</TaxTypeCodedOther>
<TaxPercent>10.000</TaxPercent>
<TaxAmount>696.19</TaxAmount>
</Tax>
<InvoiceCurrencyTotalValue>
<MonetaryValue>
<MonetaryAmount>6961.85</MonetaryAmount>
</MonetaryValue>
</InvoiceCurrencyTotalValue>
</InvoicePricingDetail>
</InvoiceItemDetail>
<InvoiceItemDetail>
<InvoiceBaseItemDetail>
<LineItemNum>
<BuyerLineItemNum>000001</BuyerLineItemNum>
<SellerLineItemNum>000004</SellerLineItemNum>
</LineItemNum>
<LineItemType>
<LineItemTypeCoded>Item</LineItemTypeCoded>
</LineItemType>
<ItemIdentifiers>
<PartNumbers>
<SellerPartNumber>
<PartNum>
<PartID>100351756</PartID>
</PartNum>
</SellerPartNumber>
<BuyerPartNumber>
<PartNum>
<PartID>462088</PartID>
</PartNum>
</BuyerPartNumber>
</PartNumbers>
</ItemIdentifiers>
<TotalQuantity>
<Quantity>
<QuantityValue>56448.0</QuantityValue>
<UnitOfMeasurement>
<UOMCoded>EA</UOMCoded>
</UnitOfMeasurement>
</Quantity>
</TotalQuantity>
<LineItemReferences>
<InvoiceReferences>
<PurchaseOrderReference>
<PurchaseOrderNumber>
<Reference>
<RefNum>0045486186</RefNum>
</Reference>
</PurchaseOrderNumber>
<PurchaseOrderDate>20110825T040000.000Z</PurchaseOrderDate>
<PurchaseOrderLineItemNumber>000001</PurchaseOrderLineItemNumber>
</PurchaseOrderReference>
<ASNNumber>
<Reference>
<RefNum>0805548867</RefNum>
</Reference>
</ASNNumber>
<OtherInvoiceReferences>
<ListOfReferenceCoded>
<ReferenceCoded>
<ReferenceTypeCoded/>
<PrimaryReference>
<Reference>
<RefNum>0006543680</RefNum>
</Reference>
</PrimaryReference>
<SupportingReference>
<Reference>
<RefNum>000005</RefNum>
</Reference>
</SupportingReference>
</ReferenceCoded>
</ListOfReferenceCoded>
</OtherInvoiceReferences>
</InvoiceReferences>
</LineItemReferences>
</InvoiceBaseItemDetail>
<InvoicePricingDetail>
<ListOfPrice>
<Price>
<UnitPrice>
<UnitPriceValue>119.79</UnitPriceValue>
</UnitPrice>
</Price>
</ListOfPrice>
<Tax>
<TaxFunctionQualifierCoded>Tax</TaxFunctionQualifierCoded>
<TaxCategoryCoded>StandardRate</TaxCategoryCoded>
<TaxTypeCoded>Other</TaxTypeCoded>
<TaxTypeCodedOther>
<Identifier>
<Agency>
<AgencyCoded>Other</AgencyCoded>
<AgencyCodedOther>Not Specified</AgencyCodedOther>
</Agency>
<Ident>National Tax</Ident>
</Identifier>
</TaxTypeCodedOther>
<TaxPercent>10.000</TaxPercent>
<TaxAmount>676.19</TaxAmount>
</Tax>
<InvoiceCurrencyTotalValue>
<MonetaryValue>
<MonetaryAmount>6761.91</MonetaryAmount>
</MonetaryValue>
</InvoiceCurrencyTotalValue>
</InvoicePricingDetail>
</InvoiceItemDetail>
</ListOfInvoiceItemDetail>
</InvoiceDetail>
<InvoiceSummary>
<NumberOfLines>4.0</NumberOfLines>
<InvoiceTotals>
<NetValue>
<MonetaryValue>
<MonetaryAmount>22872.94</MonetaryAmount>
</MonetaryValue>
</NetValue>
<GrossValue>
<MonetaryValue>
<MonetaryAmount>25160.23</MonetaryAmount>
</MonetaryValue>
</GrossValue>
<TaxValue>
<MonetaryValue>
<MonetaryAmount>2287.29</MonetaryAmount>
</MonetaryValue>
</TaxValue>
<TotalAmountPayable>
<MonetaryValue>
<MonetaryAmount>25160.23</MonetaryAmount>
</MonetaryValue>
</TotalAmountPayable>
</InvoiceTotals>
<ListOfTaxSummary>
<TaxSummary>
<Tax>
<TaxFunctionQualifierCoded>Tax</TaxFunctionQualifierCoded>
<TaxCategoryCoded>StandardRate</TaxCategoryCoded>
<TaxTypeCoded>Other</TaxTypeCoded>
<TaxTypeCodedOther>
<Identifier>
<Agency>
<AgencyCoded>Other</AgencyCoded>
<AgencyCodedOther>Not specified</AgencyCodedOther>
</Agency>
<Ident>NationalTax</Ident>
</Identifier>
</TaxTypeCodedOther>
<TaxPercent>10.000</TaxPercent>
<TaxAmount>2287.29</TaxAmount>
</Tax>
</TaxSummary>
</ListOfTaxSummary>
</InvoiceSummary>
</Invoice>
, а выходное значение равно
<?xml version="1.0" encoding="UTF-8"?>
<INVOIC01>
<IDOC BEGIN="1">
<EDI_DC40 SEGMENT="1">
<E1EDP01 SEGMENT="1">
<POSEX>000002</POSEX>
<MENGE>40320.0</MENGE>
<MENEE>EA</MENEE>
<VPREI>115.11</VPREI>
</E1EDP01>
<E1EDP01 SEGMENT="1">
<POSEX>000001</POSEX>
<MENGE>37632.0</MENGE>
<MENEE>EA</MENEE>
<VPREI>119.79</VPREI>
</E1EDP01>
<E1EDP01 SEGMENT="1">
<POSEX>000003</POSEX>
<MENGE>60480.0</MENGE>
<MENEE>EA</MENEE>
<VPREI>115.11</VPREI>
</E1EDP01>
<E1EDP01 SEGMENT="1">
<POSEX>000001</POSEX>
<MENGE>56448.0</MENGE>
<MENEE>EA</MENEE>
</E1EDP01>
</IDOC>
</INVOIC01>
Извините, если файл выглядит странно ... это первый раз, когда я отправляю в выходной файл, вы можете увидеть E1EDP01в этом POSEX и MENGE.Мне нужно удалить повторяющиеся значения в POSEX (EX это должно быть 000001, и значения MENGE должны быть добавлены)
Надеюсь, это имеет смысл.