fdo#83798: sw: fix generation of ToX with chapter numbers

(regression from 0a1b1511faaa3302429d93ccdad3eb41dc8f36cb
 and 26259e0cca3bc4d8f45337b0cafea2eed8eb32f9)

Change-Id: Idf9a6f5620c9efe62d2824df1688b30d13a4782e
(cherry picked from commit 9ba1f8e19efd208cb791bc3c51731d9287074b54)