View Single Post
Old 09-09-2021, 07:57 AM   #9
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
I know this thread is 3 years old. But it's one of the very few hits anywhere for this epubcheck error "Exactly one 'toc' nav element must be present"
So I thought I'd add this anecdote.

The error was indicated at the end of the "<body>" line of the nav file.

Eventually I worked out the problem was the epub namespace, but in the html line at the top, which was:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2011/epub" lang="en" xml:lang="en">


Changing this to
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" lang="en" xml:lang="en">

and all was good.


I previously tried rebuilding the nav file, by using Sigil's "Edit TOC" and "Generate TOC" functions.

While these made new file, they preserved the original headers. That's usually a good thing, if like me you paste in CSS styles to make the nav look nice and use it as the visible Contents page. But doesn't fix any errors in the header.

Sigil won't let you delete the nav and make a completely new one. But if you open the epub as a zip and delete the nav file Sigil will create a new clean one from scratch on opening (interestingly, without any message that it is doing so). So that might be easier than trying to work out exactly where the syntax is wrong in the old one and quicker than extracting all the HTML, etc and importing all to a new epub.

Last edited by AlanHK; 09-09-2021 at 08:05 AM.
AlanHK is offline   Reply With Quote