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'. The ^action()^ code run in the template ensures offered filename for saving the generated data has the necessary '.opml' extension. Copy/paste code in the monospaced font:
<?xml version="1.0" encoding="UTF-8"?>
^action($HTMLExportExtension=".opml")^
<opml version="1.0">
<head>
<title>^value(attributeEncode($Name))^</title>
<expansionState>0</expansionState>
</head>
<body>
^children("OPML-item")^
</body>
</opml>