Template code. Line layout is to create correct OPML source layout. Note that you may need to adjust the name/location of the OPML-item template where it is referred to in the code; the default assumes a root/level container called 'TEMPLATES'. Copy/paste code in monospaced font:
[code starts]
^if($ChildCount)^^indent("\t",$OutlineDepth(parent)-1)^<outline^if($Text)^ text="^value(attributeEncode($Name))^" _note="^value(attributeEncode($Text))^"^else^ text="^value(attributeEncode($Name))^"^endIf^^if($Checked)^ _status="^value(attributeEncode($Checked))^"^endIf^>
^children("OPML-item")^^indent("\t",$OutlineDepth(parent)-1)^
^else^^indent("\t",$OutlineDepth(parent)-1)^<outline^if($Text)^ text="^value(attributeEncode($Name))^" _note="^value(attributeEncode($Text))^"^else^ text="^value(attributeEncode($Name))^"^endIf^^if($Checked)^ _status="^value(attributeEncode($Checked))^"^endIf^ />
^endIf^
[code ends: ensure to copy the line return after the last ^endIf^].
This version does not export $Checked:
^if($ChildCount)^^indent("\t",$OutlineDepth(parent)-1)^<outline^if($Text)^ text="^value(attributeEncode($Name))^" _note="^value(attributeEncode($Text))^"^else^ text="^value(attributeEncode($Name))^"^endIf^>
^children("OPML-item")^^indent("\t",$OutlineDepth(parent)-1)^
^else^^indent("\t",$OutlineDepth(parent)-1)^<outline^if($Text)^ text="^value(attributeEncode($Name))^" _note="^value(attributeEncode($Text))^"^else^ text="^value(attributeEncode($Name))^"^endIf^ />
^endIf^