global counter nrofcities initial {0} ; a variable with name "nrofcities" and value "0" element cities ;rule output "%c" ; continue parsing element city increment nrofcities ; the variable "profcities" is incremented (+1) output "

" output "City %d(nrofcities) of " ; the value of variable "nrofcities" is sent to the output output referent "totalofcities" ; the referent is the placeholder for the not known yet value of the total of cities ; the content of the placeholder is sent to the output output "
" output "%c" output "

" set referent "totalofcities" to "%d(nrofcities)" ; the value of "nrofcities" is placed in the placeholder ; after the first its 1, then 2, and finally for our example 5