gpt4 book ai didi

xml - 使用 XSLT 选择唯一元素

转载 作者:数据小太阳 更新时间:2023-10-29 02:09:38 24 4
gpt4 key购买 nike

我有以下 XML:

<option>
<title>ABC</title>
<desc>123</desc>
</option>
<option>
<title>ABC</title>
<desc>12345</desc>
</option>
<option>
<title>ABC</title>
<desc>123</desc>
</option>
<option>
<title>EFG</title>
<desc>123</desc>
</option>
<option>
<title>EFG</title>
<desc>456</desc>
</option>

使用 XSLT,我想将其转换为:

<choice>
<title>ABC</title>
<desc>123</desc>
<desc>12345</desc>
</choice>
<choice>
<title>EFG</title>
<desc>123</desc>
<desc>456</desc>
</choice>

最佳答案

我建议研究“分组”来解决这个问题。 XSLT 2.0 的内置分组功能,如 for-each-group,或者,如果您使用的是 XSLT 1,则称为“Muenchian Grouping”的技术。

关于xml - 使用 XSLT 选择唯一元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2728244/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com