
On 12/11/2011 5:51 AM, Keith J. Schultz wrote:
Now, I can see the elegance of the approach, but isn't this going to cause a big mess when authoring an ebook and cause older EPUB not to function properly.
That is where do I put use tag (that is does it go into ncx or just in a file). [Yes, I could look it up! ;-)) ]
The ePub group took sort of an odd approach this time. Their goal was to produce a specification that was not only backward compatible, but was forward compatible as well. In other words, not only should an ePub 3 User Agent be able to display an ePub 2 document, but an ePub 2 User Agent should be able to display an ePub 3 document. Overall, I'm not real impressed with just how well they have managed that goal. But in order to try and meet the goal they changed the way the Table of Contents is identified in the publication definition file (.opf). For ePub 2, the NCX file is identified by adding the "toc" attribute to the <spine> element having as a value the id of the item in the manifest which points to the NCX file. In ePub 3, a User Agent finds the document file containing the HTML5 <nav> element by scanning the manifest for an <item> element which has a property of "nav" (e.g. <item property="nav">...). It then becomes an issue of opening that file to find the <nav> element.
How should I deveolp a new ebook.
1) still use a NCX 2) just use theHTML5<nav>-tag 3) use both methods
This may seem as a trivial question, yet is important if expect an ebook to work with different ereaders or develop a tool.
You should be able to use both methods. In my mind, the most reliable method of building a Table of Contents is by using a list element (<ol> or <ul>) at or near the beginning of the document as a whole. I tend to like placing the Table in its own file, but it's really up to you. As I have been working on ePubEditor, I discovered that it was fairly easy to create a Daisy NCX file from a nested list, so I built that functionality into my program. Thus, my approach is to build a Table of Contents using HTML lists and list items. I identify the TOC with a <div> element with a "toc" class. When encapsulating my HTML files into an ePub I identify the TOC file in the guide as being the "toc" type, and then just generate the NCX file just before I build the ePub. You could add the HTML5 <nav> element as the first (and only) child of the <div> tag for ePub 3 compatibility, but as of right now there is not a single User Agent in the world that can actually read a version 3 ePub, so it seems like that adding the element is unnecessary at the moment. So long as the <div> element identifies the TOC, the <nav> tag can be added back in later if and when necessary. One of my major design goals in developing ePubEditor was to build a tool that could be used to fix the truly horrendous markup that commercial publisher use to create ePub files (even BowerBird has more of a clue about how to create an ePub than Penguin books). As part of that process I have been checking out hundreds of books from my public library, even ones I have no personal interest in, and examining their structures. As part of this process I have discovered that despite Mr. Adcock's claim to the contrary, almost every commercial book I have looked at has an HTML Table of Contents in addition to the Daisy NCX file. Usually they are not implemented as lists (in some instances each TOC entry is marked as a paragraph with a class of "list-item"!), but usually they exist, so even commercial publishers have learned that while an NCX file is good, an HTML Table of Contents is even better.