my xml input is-
<?xml version="1.0" encoding="UTF-8"?>
<foo> <bar>bar</bar>
<bar>bar</bar>
<foobar>foobar</foobar>
<foobar>foobar</foobar>
<foobar>foobar</foobar>
<bar>bar</bar>
<bar>bar</bar>
</foo>
Output using xslt should be
<?xml version="1.0" encoding="UTF-8"?>
<foo>
<s>
<s>
<bar>bar</bar>
<bar>bar</bar>
</s>
<s>
<foobar>foobar></foobar>
<foobar>foobar></foobar>
<foobar>foobar></foobar>
</s>
<s>
<bar>bar</bar>
<bar>bar</bar>
</s>
</s>
</foo>
the output should to have sequence-of elements inside a parent. Mixed sequence-of elements will be moved inside parents node “s”. Is there any xslt command that detects the sequence and process the xml accordingly.Many thanks.
Same as here, use the id of the first preceding sibling whose name is different in order to group the records:
Added:
When applied to your (cleaned up) input of:
the result is:
which to me seems to be exactly the result you have asked for:
except for the
>
characters inside the<foobar>
elements, which I have removed from the input.--
P.S. Please DO NOT delete your question after it has been answered.