View Full Version : Table of contents problems

03-18-2010, 01:34 AM
I'm trying to link to files with anchors in my table of contents. I have something like this somewhere in a book2.xhtml file: <a name="chap12">Chapter 12</a>

In my TOC.ncx file I have something like this:

<navPoint id="toc22" playOrder="22">
<text>Chapter 12</text>
<content src="book2.xhtml#chap12"/>

My Sony reader and library do not work with this, they just open the next xhtml file instead. Calibre seems to accept it though. Am I doing something wrong?

03-18-2010, 06:06 AM
The "name" attribute is not valid in XHTML, use "id" instead, and not in an anchor element (<a>), i.e.:

<h1 id="chap12">Chapter 12</h1>

for instance. But apparently the Sony has problems with fragments (the "#" part in the href) in the NCX file, so it's better to avoid them if you can.

03-18-2010, 08:51 AM
Thank you, that did the trick. It seems to work well on my Sony.

The reason I need anchors is that I don't want to split my chapters into different xhtml files. I don't want the chapters to appear on a new page each time. Is there a way to do this with split chapters? That way I could avoid using anchors.