xml - XSLT:如何删除具有相同属性值的重复元素,并且元素具有相同的名称和值
问题描述
我们在这个输入 XML 中得到了重复的标签。我们想使用 XSLT 模板指令删除这个重复。但我是 XSLT 的新手,请帮助我。
输入 XML:
<?xml version="1.0" encoding="UTF-8"?>
<Document>
<TRU_SALESFORCECATALOGIMPORTENTITY>
<ITEMID>239917</ITEMID>
<BRAND/>
<custom-attributes attribute-id="Manufacturer Min Age">No</custom-attributes>
<custom-attributes attribute-id="Manufacturer Min Age">No</custom-attributes>
<custom-attributes attribute-id="Age Range">3 Years</custom-attributes>
<DESCRIPTION>Hasbro Gaming - Jenga - styles may vary</DESCRIPTION>
<DESCRIPTION>tieng fr CA - Hasbro Gaming - Jenga - styles may vary</DESCRIPTION>
<DESCRIPTION>tieng fr CA - Hasbro Gaming - Jenga - styles may vary</DESCRIPTION>
</TRU_SALESFORCECATALOGIMPORTENTITY>
</Document>
在那个带有标签的 XML 中,如果具有相同的属性 ID 值,我想删除重复项。使用标签说明,如果具有相同的值,我想删除重复项:
预期的xml:
<?xml version="1.0" encoding="UTF-8"?>
<Document>
<TRU_SALESFORCECATALOGIMPORTENTITY>
<ITEMID>239917</ITEMID>
<BRAND/>
<custom-attributes attribute-id="Manufacturer Min Age">No</custom-attributes>
<custom-attributes attribute-id="Age Range">3 Years</custom-attributes>
<DESCRIPTION>Hasbro Gaming - Jenga - styles may vary</DESCRIPTION>
<DESCRIPTION>tieng fr CA - Hasbro Gaming - Jenga - styles may vary</DESCRIPTION>
</TRU_SALESFORCECATALOGIMPORTENTITY>
</Document>
任何帮助将不胜感激!谢谢你们!
解决方案
推荐阅读
- docker - 将容器内的文件指定为 Fluent 位的输入
- javascript - HotKey 触发 Ant Design Select 开始搜索
- core-data - 使用公共数据库更改快速本地更新 CoreData+CloudKit
- c# - 变量值未更新
- google-analytics - Google Analytics(分析)显示实时目标命中,但超过 72 小时后它们不会反映在转化报告中
- c# - OracleCommand TimeOut 在 C# 代码中不起作用
- ruby - is_a 之间的性能差异?/ 有点儿?vs class.name 用于 ruby 中的类比较
- python - 'NoneType' 对象在 kivy 上没有属性 'root'
- vue.js - 如何在 401 错误时将 Vue 应用程序重定向到登录页面?
- react-native - 我们可以下载 react native 和 react navigation