关于XML和XSLT解析中的Distinct问题

windlike 2002-05-10 04:51:10
在做东西的时候遇到的难题。

xml文件
<root>
<row date="4-10" time="5:00" name="jane" />
<row date="4-10" time="5:00" name="jane" />
<row date="4-11" time="5:00" name="peter" />
<row date="4-11" time="5:30" name="jane" />
<row date="4-12" time="5:30" name="tom" />
</root>

想显示为:

4-10 4-10 4-11 4-11 4-12
jane jane peter jane tom
5:00
5:30

如何解决?
...全文
92 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangwenyou 2002-05-10
  • 打赏
  • 举报
回复
客气了,这实现起来确实很麻烦:)
windlike 2002-05-10
  • 打赏
  • 举报
回复
谢谢,虽然没有完全解决,但是给我很大的启发。
wangwenyou 2002-05-10
  • 打赏
  • 举报
回复
http://www.dpawson.co.uk/xsl/sect2/N6191.html#d190e588
http://www.dpawson.co.uk/xsl/sect2/N6280.html#d195e102
wangwenyou 2002-05-10
  • 打赏
  • 举报
回复
一点参考
<!-- the key declaration must be global ! -->
<xsl:key name="keyname" match="@att" use="."/>

<!--
substitute xpath with xpath to your xpath to the node to iterate
substitute @att with the name of the attribute or . for txt node.
-->
<xsl:for-each select="xpath[count(@att | key('keyname', @att)[1]) = 1]">

<xsl:value-of select="@att" />

</xsl:for-each>

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧