I have a XML like this:
<process id="Process_1">
<exclusiveGateway id="ExclusiveGateway_03b639w" />
<startEvent id="StartEvent_0nmzsw0" />
<sendTask id="Task_13s9uob"/>
<userTask id="Task_1v0riz3" />
</process>
I need to convert it to this with xslt:
<process id="Process_1">
<Gateway type="exclusive" id="ExclusiveGateway_03b639w" />
<Event type="start" id="StartEvent_0nmzsw0" />
<Task type="send" id="Task_13s9uob"/>
<Task type="user" id="Task_1v0riz3" />
</process>
I think I can use tokenize
function for this but I do not know how to separate tokens.
It would be very helpful if someone could explain solution for this problem.
Thanks.
Assuming the use of an XSLT 2.0 processor like Saxon 9 you can use
Online at http://xsltransform.net/jz1PuNM.
To do this in XSLT 1.0, try something along the lines of:
XSLT 1.0
Note that this assumes that all (and only) children of the root
process
element need to be processed as shown.P.S. If you know the structure of the input XML, it would be more robust to transform the individual elements explicitly, e.g.: