Well it took me one transformation to get rid of formatting info, one
transformation per div level, plus one transformation for clean up at the
end but I have it working now. Anyone else interested in code can reach me
off list.
starting with
<document>
<a>xxxxxxx</a>
<b>level1 head ----------</b>
<c>level 2 head 00000</c>
<!-- no pattern in following content -->
<dfg>1111 blah</dfg>
<e>2222 blah</e>
<f>blah</f>
<c>level 2 head 33333</c>
<df>44444 blah</df>
<d>level 3 head 5555</d>
<i>66666blah</i>
<j>blah</j>
<c>level 2 head 777777</c>
<df>888888 blah</df>
<e>blah</e>
<f>blah</f>
<b>level 1 head 99999</b>
<c>level 2 head 1010101010</c>
<df>11 11 11 11 blah</df>
<e>blah</e>
<f>blah</f>
</document>
and ending up with
<?xml version="1.0" encoding="UTF-8"?>
<document>
<title>xxxxxxx</title>
<div>
<title>level1 head ----------</title>
<div>
<title>level 2 head 00000</title>
<dfg>1111 blah</dfg>
<e>2222 blah</e>
<f>blah</f>
</div>
<div>
<title>level 2 head 33333</title>
<df>44444 blah</df>
<d>level 3 head 5555</d>
<i>66666blah</i>
<j>blah</j>
</div>
<div>
<title>level 2 head 777777</title>
<df>888888 blah</df>
<e>blah</e>
<f>blah</f>
</div>
</div>
<div>
<title>level 1 head 99999</title>
<div>
<title>level 2 head 1010101010</title>
<df>11 11 11 11 blah</df>
<e>blah</e>
<f>blah</f>
</div>
</div>
</document>
Jim Albright
704 843-0582
Wycliffe Bible Translators