This requires keeping track of the current element being processed. This in turn allows the usage of count() + preceding-sibling/following-sibling.