I have now created a fresh document for flowing the TOC story into. I then added this file to the book file and updated the numbering of the book file. The result is that ID comes up with a TOC containing the headings of the sixth file (out of ten files). Why the other nine files are not included remains a mystery to me, especially since they share the same styles etc.
I then tried another trick and exported each of the files as an IDML file, opened each of them separately, and saved it back as an INDD file again, hoping to thus remove any file corruption. However, the TOC still covers the headings of file number six only.
I have made sure that the paragraph styles applied to the elements that should show up in the TOC are the same ones in all ten files, and that the “Include Book Documents” option is checked.
If I cannot manage to conjure up this TOC, I will have to create one manually – which is not a particularly attractive option in view of the book's 500 pages.
Any ideas?