def setIndexLink(template, indexFilename):
 indexLinks = domhelpers.findElementsWithAttribute(template, 'class', 'index-link')
 for link in indexLinks:
  if (indexFilename is None):
   link.parentNode.removeChild(link)
  else:
   link.nodeName = link.tagName = link.endTagName = 'a'
   for attrName in link.attributes.keys():
    link.removeAttribute(attrName)
   link.setAttribute('href', indexFilename)

def setIndexLink ( template , indexFilename ) : indexLinks = domhelpers . findElementsWithAttribute ( template , 'class' , 'index-link' ) for link in indexLinks : if ( indexFilename is None ) : link . parentNode . removeChild ( link ) else : link . nodeName = link . tagName = link . endTagName = 'a' for attrName in link . attributes . keys ( ) : link . removeAttribute ( attrName ) link . setAttribute ( 'href' , indexFilename )
insert a link to an index document .