Suppose you want to generate a different set of sidebar navigation links for each major section of a Web site, where each section is in a single DITA file that DITA2Go splits into named pages (see §27. Splitting and extracting files). For each page, the sidebar item that names that page should not be a link, because a live link to the current page confuses people.
You need a slightly different list of sidebar items on every HTML page, to avoid a same-page link. But the logic is always the same, as are the names of files and the titles to be displayed. What is needed is a macro that takes into account which item should not be linked.
Your configuration file could include a pair of lists, one with file names and the other with matching sidebar titles, like this:
[DITA_File]
1 = homepage
2 = descript
3 = operate
4 = testimonial
5 = demo
6 = order
[SideTitle]
1 = Widgets
2 = What a Widget Does
3 = How to Use a Widget
4 = What Users Say About Widgets
5 = Get a Demo Widget
6 = Order Widgets On Line
You could process the two lists with this macro:
[Sidebar]
<$$val=2><$$maxval=6>\
<$_while ($$val <= $$maxval)>\
<$_if ($$_currbase is $$DITA_File[$$val])>\
<p class="SidebarTxt"><$$SideTitle[$$val]></p>\
<$_else>\
<p class="SidebarTxt"><a class="SidebarLnk"\
href="<$$DITA_File[$$val]>.htm"><$$SideTitle[$$val]></a></p>\
<$_endif>
<$$val++>
<$_endwhile>