Search code examples
xmlepub

epub - How to divide chapter into multiple xhtml files?


Can I divide a chapter in epub to multiple files? In the ncx file, i have seen like this:

<navPoint class="chapter" id="chapter1" playOrder="1">
      <navLabel><text>Chapter 1</text></navLabel>
      <content src="file1.xhtml"/>
</navPoint>

Is it allowed to add one more tag like <content src="file2.xhtml"/> ? If yes, how is the order of the files in the chapter identified? If no, how is it supposed to be done?


Solution

  • It isn't allowed such a thing, but you can edit your ncx file to have subsections according to ncx epub3 documentation:

    <nav epub:type="toc" id="toc">
    <ol>
      …
      <li>
        <a href="s03.xhtml">A linked heading</a>
        <ol>
          <li><a href="s03-01.xhtml">Subsection</a>
          …
        </ol>
      </li>
      <li>
        <span class="navhd">An unlinked heading</span>
        <ol>
          <li>
            <a href="s04-01.xhtml">Subsection</a>
          </li>
          …
        </ol>
      </li>
      …
    </nav>
    

    But you'll have to change the entire file schema if you want to use this particular way to store the index.