Set-type attributes can hold multi-value data, e.g. a set of tags. Some action operators can create sets, most notably the links() operator. Having created a set it can be useful to make it into an HTML list. This is easily done using the format() operator:
format($MySet(Data),"<ul>\n","\t<li>","</li>\n","</ul>\n");
This gives:
<ul>
<li>cow</li>
<li>dog</li>
<li>eel</li>
</ul>
If the above were a list of notes' $Name values it is also possible to make the list items into links. This is possible using a two-step process. First the existing set's data is copied to a new set with each value enclosed by link export code:
$MySetB = format($MySet(Data),"","^linkTo(",")^;","");
The format() operator is now called a second time to make an HTML list using a String attribute $FormattedList to hold the output:
$FormattedList = format($MySetB,"<ul>\n","\t<li>","</li>\n","</ul>\n");
On export, the ^linkTo()^ codes are expanded:
<ul>
<li><a href="Data/cow.html" >cow</a></li>
<li><a href="Data/dog.html" >dog</a></li>
<li><a href="Data/eel.html" >eel</a></li>
</ul>
The $FormattedList attribute is simply a placeholder to store the fully formatted list ready for use in an export template, thus:
^value($FormattedList)^
.
The overall process can be done without needing a second set attribute if link() can be used to make the source set of values. Note the need to use the eval() operator to capture the link() output, on the fly, in set data form to pass into format():
$MySet = format(eval(links(Data).outbound.example.$Name),"","^linkTo(",")^;","");
The second step remains the same:
$FormattedList = format($MySet,"<ul>\n","\t<li>","</li>\n","</ul>\n");