xslt 1.0 中每 3 项进行分组
我无法找到一种对 xslt 1.0 项目进行分组的方法。 我有一个类似于下面的源 xml:
<client name="client A">
<project name = "project A1"/>
<project name = "project A2"/>
<project name = "project A3"/>
<project name = "project A4"/>
</client>
<client name="client B">
<project name = "project B1"/>
<project name = "project B2"/>
</client>
<client name="client C">
<project name = "project C1"/>
<project name = "project C2"/>
<project name = "project C3"/>
</client>
我想选择所有项目,对它们进行排序,然后将每 3 个项目分组到一个边界中,如下例所示:
<boundle>
<project name="project A1">
<project name="project A2">
<project name="project A3">
</boundle>
<boundle>
<project name="project A4">
<project name="project B1">
<project name="project B2">
</boundle>
<boundle>
<project name="project C1">
<project name="project C2">
<project name="project C3">
</boundle>
目前,为了这样做,我正在使用打开一个边界标签并稍后关闭它。 你能想出更好的解决办法吗?
I'm having troubles to figure out a way to group items xslt 1.0.
I have a source xml similar to the one below:
<client name="client A">
<project name = "project A1"/>
<project name = "project A2"/>
<project name = "project A3"/>
<project name = "project A4"/>
</client>
<client name="client B">
<project name = "project B1"/>
<project name = "project B2"/>
</client>
<client name="client C">
<project name = "project C1"/>
<project name = "project C2"/>
<project name = "project C3"/>
</client>
I'd like to select all projects, sort them and then group every 3 project in one boundle as in the example below:
<boundle>
<project name="project A1">
<project name="project A2">
<project name="project A3">
</boundle>
<boundle>
<project name="project A4">
<project name="project B1">
<project name="project B2">
</boundle>
<boundle>
<project name="project C1">
<project name="project C2">
<project name="project C3">
</boundle>
Currently to do so I'm using to open a boundle tag and close it later.
Can you think about any better solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
无需分组。
No grouping necessary.
我可以推荐以下链接 http://www.jenitennison.com/xslt/grouping/这帮助我弄清楚如何根据 XML 文档中的内容将不同数量的元素分组为某些类别。
I can recommend the following link http://www.jenitennison.com/xslt/grouping/ which helped me figuring out how to group various number of elements into some categories based on the contents in the XML document.