[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Dirty Input
Hello, Our system is generating some very dirty XML input. I am not sure if there would be any solution to this problem at all. At first it might remind you of my similar request from last week. But this time the elements are not that conveniently grouped into one parent tag but are rather loose. The tag <Devices> contains elements <a>, <b> and <c> in that order respectively. The elements <b> and <c> incl. their sub elements are optional and may be not in the input file. But <a> is mandatory and would always be in the input file. The output shall give the exact structure as the input file but group <a>, <b> and <c> together and put a <device> tag between each group. Since <a> is mandatory we could take it as a base and say the first <a> is in the first group and the following tags until the next <a> belong to group 1 as well. The next <a> belongs to group 2 and any following tags until the next <a> shall be in group 2 as well, etc. Each group shall be separated by a <device> tag. Otherwise the same structure of the input file shall be copied. Input file: <bla>x</bla> <bla>x</bla> <Devices> <a> <a2>1</a2> </a> <b> <b2> <b3>1</b3> <b4>1</b4> </b2> <b2i> <b3i>1</b3i> <b4i>1</b4i> </b2i> ... </b> <c>1</c> <a> <a2>1</a2> </a> <b> <b2> <b3>1</b3> <b4>1</b4> </b2> <b2i> <b3i>1</b3i> <b4i>1</b4i> </b2i> ... </b> <c>1</c> ... </Devices> Output: <bla>x</bla> <bla>x</bla> <Devices> <device> <a> <a2>1</a2> </a> <b> <b2> <b3>1</b3> <b4>1</b4> </b2> <b2i> <b3i>1</b3i> <b4i>1</b4i> </b2i> ... </b> <c>1</c> </device> <device> <a> <a2>1</a2> </a> <b> <b2> <b3>1</b3> <b4>1</b4> </b2> <b2i> <b3i>1</b3i> <b4i>1</b4i> </b2i> ... </b> <c>1</c> </device> ... </Devices> Do you guys think this would be possible at all? Many Thanks, Houman
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|