for-each-ref: fix %(numparent) and %(parent)