Have couple of element with same Parent and child node.
So need to remove the duplicates.
Ожидаемый вывод должен использовать XSLT.
заранее спасибо
Во входном XML есть элемент с тем же дочерним узлом, который мне нужно удалить, основываясь на значении атрибута тега. Если в обоих тегах одинаковое значение атрибута (атрибут «identity»), то весь дублирующий тег должен быть удален и отображен только один раз.
Input XML file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MainDeclaration xmlns="http://webstds.ipc.org/175x/2.0" version="2.0">
<Product comment="1. This is a generic description of the substances as the actual compostion of the substances are either considered proprietary or no official CAS number is available. If a CAS number is given, it is the closest match available." unitType="Each">
<MaterialInfo>
<ExemptionList>
<ExemptionListID authority="IPC" identity="EL2011/534/EU"/>
<Exemption description="Lead in high melting temperature type solders (i.e., lead based solder alloys containing 85% by weight or more lead)" identity="7(a)"/>
</ExemptionList>
<ExemptionList>
<ExemptionListID authority="IPC" identity="EL2011/534/EU"/>
<Exemption description="Lead in high melting temperature type solders (i.e., lead based solder alloys containing 85% by weight or more lead)" identity="7(a)"/>
</ExemptionList>
<HomogeneousMaterialList>
<HomogeneousMaterial materialGroupName="Other Non-ferrous Metals and Alloys" name="Solder Paste 1">
<Amount UOM="mg" value="7.02"/>
<SubstanceCategoryList>
<SubstanceCategoryListID authority="IPC" identity="EUROHS-0508"/>
<SubstanceCategory name="Lead/lead compounds">
<Substance name="Lead">
<SubstanceID authority="CAS" identity="7439-92-1"/>
<Amount UOM="mg" value="6.4935"/>
<SubstanceExemption description="Lead in high melting temperature type solders (i.e., lead based solder alloys containing 85% by weight or more lead)" identity="7(a)"/>
</Substance>
<SubstanceCatExemptionList>
<ExemptionListID authority="IPC" identity="EL2011/534/EU"/>
<Exemption description="Lead in high melting temperature type solders (i.e., lead based solder alloys containing 85% by weight or more lead)" identity="7(a)"/>
</SubstanceCatExemptionList>
</SubstanceCategory>
</SubstanceCategoryList>
<SubstanceCategoryList>
<SubstanceCategoryListID authority="Supplier" identity="Supplier"/>
<SubstanceCategory name="Lead alloy">
<Substance name="Silver (Ag)">
<SubstanceID authority="CAS" identity="7440-22-4"/>
<Amount UOM="mg" value="0.1755"/>
</Substance>
</SubstanceCategory>
</SubstanceCategoryList>
<SubstanceCategoryList>
<SubstanceCategoryListID authority="Supplier" identity="Supplier"/>
<SubstanceCategory name="Lead alloy">
<Substance name="Tin (Sn)">
<SubstanceID authority="CAS" identity="7440-31-5"/>
<Amount UOM="mg" value="0.351"/>
</Substance>
</SubstanceCategory>
</SubstanceCategoryList>
</HomogeneousMaterial>
<HomogeneousMaterial materialGroupName="Other Non-ferrous Metals and Alloys" name="Post-plating">
<Amount UOM="mg" value="3.85"/>
<SubstanceCategoryList>
<SubstanceCategoryListID authority="Supplier" identity="Supplier"/>
<SubstanceCategory name="Pure metal">
<Substance name="Tin (Sn)">
<SubstanceID authority="CAS" identity="7440-31-5"/>
<Amount UOM="mg" value="3.85"/>
</Substance>
</SubstanceCategory>
</SubstanceCategoryList>
</HomogeneousMaterial>
</HomogeneousMaterialList>
</MaterialInfo>
</Product>
</MainDeclaration>
Expected Output file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MainDeclaration xmlns="http://webstds.ipc.org/175x/2.0" version="2.0">
<Product comment="1. This is a generic description of the substances as the actual compostion of the substances are either considered proprietary or no official CAS number is available. If a CAS number is given, it is the closest match available." unitType="Each">
<MaterialInfo>
<ExemptionList>
<ExemptionListID authority="IPC" identity="EL2011/534/EU"/>
<Exemption description="Lead in high melting temperature type solders (i.e., lead based solder alloys containing 85% by weight or more lead)" identity="7(a)"/>
</ExemptionList>
<HomogeneousMaterialList>
<HomogeneousMaterial materialGroupName="Other Non-ferrous Metals and Alloys" name="Solder Paste 1">
<Amount UOM="mg" value="7.02"/>
<SubstanceCategoryList>
<SubstanceCategoryListID authority="IPC" identity="EUROHS-0508"/>
<SubstanceCategory name="Lead/lead compounds">
<Substance name="Lead">
<SubstanceID authority="CAS" identity="7439-92-1"/>
<Amount UOM="mg" value="6.4935"/>
<SubstanceExemption description="Lead in high melting temperature type solders (i.e., lead based solder alloys containing 85% by weight or more lead)" identity="7(a)"/>
</Substance>
<SubstanceCatExemptionList>
<ExemptionListID authority="IPC" identity="EL2011/534/EU"/>
<Exemption description="Lead in high melting temperature type solders (i.e., lead based solder alloys containing 85% by weight or more lead)" identity="7(a)"/>
</SubstanceCatExemptionList>
</SubstanceCategory>
</SubstanceCategoryList>
<SubstanceCategoryList>
<SubstanceCategoryListID authority="Supplier" identity="Supplier"/>
<SubstanceCategory name="Lead alloy">
<Substance name="Silver (Ag)">
<SubstanceID authority="CAS" identity="7440-22-4"/>
<Amount UOM="mg" value="0.1755"/>
</Substance>
</SubstanceCategory>
</SubstanceCategoryList>
<SubstanceCategoryList>
<SubstanceCategoryListID authority="Supplier" identity="Supplier"/>
<SubstanceCategory name="Lead alloy">
<Substance name="Tin (Sn)">
<SubstanceID authority="CAS" identity="7440-31-5"/>
<Amount UOM="mg" value="0.351"/>
</Substance>
</SubstanceCategory>
</SubstanceCategoryList>
</HomogeneousMaterial>
<HomogeneousMaterial materialGroupName="Other Non-ferrous Metals and Alloys" name="Post-plating">
<Amount UOM="mg" value="3.85"/>
<SubstanceCategoryList>
<SubstanceCategoryListID authority="Supplier" identity="Supplier"/>
<SubstanceCategory name="Pure metal">
<Substance name="Tin (Sn)">
<SubstanceID authority="CAS" identity="7440-31-5"/>
<Amount UOM="mg" value="3.85"/>
</Substance>
</SubstanceCategory>
</SubstanceCategoryList>
</HomogeneousMaterial>
</HomogeneousMaterialList>
</MaterialInfo>
</Product>
</MainDeclaration>