tags:

views:

13

answers:

0

I'm trying to convert an outline control to HTML with the end result to look like this:

           <ol>
              <li>Level 1A</li>
              <li>Level 1B
                 <ol>
                    <li>Level 2A</li>
                    <li>Level 2B</li>
                 </ol>
              </li>
              <li>Level 1C</li>
           </ol>

I know there is a way to do this recursively, but I can't get my head around it. Any help much appreciated.

The input would be a hierarchical tree control like MSOutl32.ocx populated as follows:

Level 1A
Level 1B
    Level 2A
    Level 2B
Level 1C