Grouping every 3 items in xslt 1.0
- by Piotr Czapla
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?