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:
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>^value(attributeEncode($Name))^</title>
<expansionState>0</expansionState>
</head>
<body>
^children(OPML-item)^
</body>
</opml>