How to add a parent element when read in text file using XSLT 2.0?



I have to use XSLT 2.0 to read in a text file and output an XML. The input text file is like:


Start:000,A:123,B:234,C:33,End:99,Start:03,A:123d,B:234s,End:992,Start:a00,B:234,C:33,End:99


And the desired XML output is like:



<File>
<Rec>
<Start>000</Start>
<A>123</A>
<B>234</B>
<C>33</C>
<End>99</End>
</Rec>
<Rec>
<Start>03</Start>
<A>123d</A>
<B>234s</B>
<End>992</End>
</Rec>
<Rec>
<Start>a00</Start>
<B>234</B>
<C>33</C>
<End>99</End>
</Rec>


I have difficulty grouping elements from "Start" to "End" and adding a parent element "Rec" to it. Any suggestion? Thanks a lot!


No comments:

Post a Comment