What you are asking is done by docx4j's HTML and PDF output.
Have a look at org.docx4j.model.listnumbering.Emulator, specifically its getNumber method
The emulator maintains internal counters for each list; if you invoke it for each paragraph in document order, then at any point in the document, the counters will reflect the current number of each list.