按 xslt 中的属性分组
嗨,我有点陷入这个问题,我的 xml 是因为
<album>
<title>album name</title>
<tracks>
<track tracksequence="1" disksequence="1">track 1 - disc 1</track>
<track tracksequence="2" disksequence="1">track 2 - disc 1</track>
<track tracksequence="3" disksequence="1">track 3 - disc 1</track>
<track tracksequence="1" disksequence="2">track 1 - disc 2</track>
<track tracksequence="2" disksequence="2">track 2 - disc 2</track>
<track tracksequence="3" disksequence="2">track 3 - disc 2</track>
<track tracksequence="4" disksequence="2">track 4 - disc 2</track>
<track tracksequence="1" disksequence="3">track 1 - disc 3</track>
<track tracksequence="2" disksequence="3">track 2 - disc 3</track>
</tracks>
</album>
我希望能够输出,因为
<div>
<span>album name disc 1</span>
track 1 disc 1
track 2 disc 1
track 3 disc 1
</div>
<div>
<span>album name disc 2</span>
track 1 disc 2
track 2 disc 2
track 3 disc 2
track 4 disc 2
</div>
ect...
我确信我需要使用某种 Muenchian 分组,但我很难理解它以适应我的特定用途。
Hi i am a little stuck with this problem my xml is as
<album>
<title>album name</title>
<tracks>
<track tracksequence="1" disksequence="1">track 1 - disc 1</track>
<track tracksequence="2" disksequence="1">track 2 - disc 1</track>
<track tracksequence="3" disksequence="1">track 3 - disc 1</track>
<track tracksequence="1" disksequence="2">track 1 - disc 2</track>
<track tracksequence="2" disksequence="2">track 2 - disc 2</track>
<track tracksequence="3" disksequence="2">track 3 - disc 2</track>
<track tracksequence="4" disksequence="2">track 4 - disc 2</track>
<track tracksequence="1" disksequence="3">track 1 - disc 3</track>
<track tracksequence="2" disksequence="3">track 2 - disc 3</track>
</tracks>
</album>
i would like to be able to output as
<div>
<span>album name disc 1</span>
track 1 disc 1
track 2 disc 1
track 3 disc 1
</div>
<div>
<span>album name disc 2</span>
track 1 disc 2
track 2 disc 2
track 3 disc 2
track 4 disc 2
</div>
ect...
im sure that i need to use some sort of Muenchian grouping but im having difficulty getting my head around it for my particular usage.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
输出(使用您的示例):
Output (using your sample):