XSLT 1.0 grouping to reformat element defined by date into element defined by task
- by Daniel
Hi folks,
I have a tricky XSLT transformation and I'd like your advise
My xml is formatted as below:
<Person>
<name>John</name>
<date>June12</date>
<workTime taskID=1>34</workTime>
<workTime taskID=2>12</workTime>
</Person>
<Person>
<name>John</name>
<date>June12</date>
<workTime taskID=1>21</workTime>
<workTime taskID=2>11</workTime>
</Person>
The output xml should be:
<Person>
<name>John</name>
<taskID>1</taskID>
<workTime>
<date>June12</date>
<time>34</time>
</worTime>
<workTime>
<date>June13</date>
<time>21</time>
</worTime>
</Person>
<Person>
<name>John</name>
<taskID>2</taskID>
<workTime>
<date>June12</date>
<time>12</time>
</worTime>
<workTime>
<date>June13</date>
<time>11</time>
</worTime>
</Person>
Essentially, as an input, a "Person" object gathers all the task/workTime for a specific date. As an output, I want the "Person" object to gather the date/workTime for a specific task.
I need to use XLST 1.0.
I've been trying to use grouping with key but get very puzzled.
Appreciate your help.
Daniel