You are here:   » Home » Documentation » Details » How-To » TOC-Lists » Home

Alphabetic list of all keywords of page elements

The alphabetic sorted list of all keywords references to the correspondent document objects.

Solution: The algorithm first iterates all subordinate page-like objects (PAGES). Then for each object the comma-separated keyword list is broken into single words. Each keyword is added with the correspondent page as tupel to the temporary list subjLst. The temporary list is ordered by keywords alphabetically and displayed.

<!--// Init List of Keywords //-->
<dtml-call "REQUEST.set('subjLst',[])">

<!--// Assemble intermediate List of Keywords //-->
<dtml-in "filteredChildNodes(REQUEST,PAGES)">
 <dtml-let ob="_['sequence-item']">
  <dtml-unless "isResource(REQUEST)">
   <dtml-in "_.string.split(getObjProperty('attr_dc_subject',
        REQUEST),',')">
    <dtml-let s="_.string.strip(_['sequence-item'])">
     <dtml-call "subjLst.append((s,ob))">
    </dtml-let>
   </dtml-in>
  </dtml-unless>
 </dtml-let>
</dtml-in>

<!--// Sort Keywords alphabetically //-->
<dtml-call "subjLst.sort()">

<!--// Write Keywords with references to documents //-->
<dtml-in subjLst>
 <dtml-let s="_['sequence-key']"
           ob="_['sequence-item']">
  <a href="<dtml-var "ob.getHref2IndexHtml(REQUEST)">">
   <dtml-var s>
  </a>
 </dtml-let>
</dtml-in>