You can use the TAL repeat variable that each repeat
loop creates:
<table tal:attributes="id string:table-${python:repeat['diagnoses'].index}"
class="table table-hover" style="border-style:none">
or using a path expression:
<table tal:attributes="id string:table-${path:repeat/diagnoses/index}"
class="table table-hover" style="border-style:none">
Depending on how Chameleon was configured you can omit either the path:
or the python:
prefix; whichever one is the default expression type. Pagetemplates default to path:
expressions, Chameleon to python:
but normally the Plone integration switches that to path:
to keep compatibility.
The repeat
mapping contains a special object for each loop variable; your loop uses the name myindex
so there is a repeat['diagnoses']
object that contains things like the loop index, the parity of the iteration (odd or even) and even roman numeral versions of the loop counter.