OK, the OPML version builds from the doc root and as $OutlineDepth as root is 1 and we generally don’t indent the first level, we want to use
$OutlineDepth - 1. Then we march on down using
But you are starting from a note at an arbitrary $OutlineDepth which will vary by where the top level exported document lives. So you need to cache the current indent level as you go, e.g. in a Number attribute at $MyIndent in a note at
/config, i.e. at
At the top of the starting template (holding the top level list opening <ul> or <ol>) you add:
Now, in your recursing template, you use and increment
$MyIndent("config") remembering to de-increment at the end of the template, so as the each branch completes the next discrete branches starts with the right increment.
Lastly, in the starting template, at the end, clear up the counter:
Essentially you’ll use a common counter setting/incrementing/de-incrementing it as you go and setting the result to default when done.
Tip: _Don’t be tempted to do this in your working file but make a test doc with minimal $Text/content so you can concentrate on getting the indenting right. Only then port it to your working file.
V. busy to day or I’d try and post a demo file (sorry!)